:root {
  --primary: #1a365d;
  --primary-light: #2c5282;
  --accent: #c9a227;
  --accent-soft: #e8d5a3;
  --bg-warm: #faf8f3;
  --bg-cream: #f5f1e8;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --surface-elevated: rgba(255, 255, 255, 0.78);
  --surface-border: rgba(255, 255, 255, 0.5);
  --interactive-shadow: 0 16px 38px rgba(18, 36, 74, 0.16);
}

[data-theme="dark"] {
  --primary: #63b3ed;
  --primary-light: #4299e1;
  --accent: #ecc94b;
  --accent-soft: #d69e2e;
  --bg-warm: #0d1117;
  --bg-cream: #161b22;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --surface-elevated: rgba(17, 28, 46, 0.72);
  --surface-border: rgba(159, 196, 255, 0.2);
  --interactive-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-primary);
  background: var(--bg-warm);
}

.top h1,
h1,
h2,
h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  letter-spacing: 0.01em;
  color: var(--primary);
}

[data-theme="dark"] .top h1,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3 {
  color: var(--primary);
}

.top p,
.instructions,
.hint,
p {
  color: var(--text-secondary);
}

.quick-links a,
.quick-links .theme-toggle-link {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid color-mix(in oklab, var(--accent) 25%, transparent);
  font-weight: 600;
}

[data-theme="dark"] .quick-links a,
[data-theme="dark"] .quick-links .theme-toggle-link {
  background: rgba(28, 33, 40, 0.92);
  color: var(--text-primary);
}

button,
.controls button,
.answer,
.tile {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
  color: #2d1e08;
}

[data-theme="dark"] button,
[data-theme="dark"] .controls button,
[data-theme="dark"] .answer,
[data-theme="dark"] .tile {
  color: #1a202c;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 42vmax;
  height: 42vmax;
  border-radius: 999px;
  z-index: -1;
  filter: blur(2px);
  opacity: 0.44;
  pointer-events: none;
}

body::before {
  top: -18vmax;
  left: -12vmax;
  background: radial-gradient(circle, rgba(70, 128, 226, 0.42) 0%, rgba(70, 128, 226, 0) 68%);
  animation: driftBlobA 20s ease-in-out infinite alternate;
}

body::after {
  right: -18vmax;
  bottom: -22vmax;
  background: radial-gradient(circle, rgba(242, 184, 75, 0.4) 0%, rgba(242, 184, 75, 0) 70%);
  animation: driftBlobB 24s ease-in-out infinite alternate;
}

.page {
  animation: fadeSlideIn 460ms ease-out;
}

.card,
.hud-item,
.shop,
.leaderboard,
.start-screen,
.result {
  backdrop-filter: blur(10px);
  background: var(--surface-elevated);
  border: 1px solid var(--surface-border);
}

.quick-links a,
.quick-links .theme-toggle-link {
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.quick-links a:hover,
.quick-links .theme-toggle-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(16, 34, 62, 0.18);
}

button,
.answer,
.tile,
.controls button {
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

button:hover,
.answer:hover,
.tile:hover,
.controls button:hover {
  transform: translateY(-1px);
  box-shadow: var(--interactive-shadow);
}

button:focus-visible,
.quick-links a:focus-visible,
.answer:focus-visible,
.tile:focus-visible,
.controls button:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--accent) 78%, white);
  outline-offset: 2px;
}

.top h1,
h1 {
  text-wrap: balance;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes driftBlobA {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4vmax, 3vmax, 0) scale(1.08); }
}

@keyframes driftBlobB {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-5vmax, -3vmax, 0) scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}


.game-site-nav {
  background: rgba(26, 54, 93, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(201, 162, 39, 0.2);
  margin-bottom: 20px;
}

[data-theme="dark"] .game-site-nav {
  background: rgba(13, 17, 23, 0.95);
  border-bottom-color: rgba(236, 201, 75, 0.2);
}

.game-site-nav .nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 24px;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.game-site-nav .nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: #fff;
  flex: 1;
  min-width: 0;
}

.game-site-nav .brand-icon {
  font-size: 1.6rem;
  color: var(--accent);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: rgba(201, 162, 39, 0.15);
  border-radius: 8px;
}

.game-site-nav .brand-title-group { display:flex; flex-direction:column; min-height:44px; justify-content:center; }
.game-site-nav .brand-title { font-family:'Cormorant Garamond', serif; font-size:1.35rem; font-weight:600; line-height:1.2; }
.game-site-nav .brand-subtitle { font-size:0.8rem; opacity:.75; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.game-site-nav .nav-actions { display:flex; align-items:center; gap:8px; margin-left:auto; flex-shrink:0; }
.game-site-nav .theme-toggle,
.game-site-nav .hamburger {
  background:none; border:none; color:rgba(255,255,255,.85); width:40px; height:40px; border-radius:8px; cursor:pointer;
}
.game-site-nav .theme-toggle:hover,
.game-site-nav .hamburger:hover { background: rgba(255,255,255,0.1); color:var(--accent); }

.game-site-nav .hamburger { display:none; font-size:1.4rem; }
.game-site-nav .nav-menu { display:flex; list-style:none; gap:8px; align-items:center; margin:0; padding-left:0; }
.game-site-nav .nav-link { color:rgba(255,255,255,.85); text-decoration:none; padding:.55rem .85rem; border-radius:8px; font-size:.9rem; font-weight:500; white-space:nowrap; }
.game-site-nav .nav-link:hover { background: rgba(255,255,255,0.1); color:#fff; }
.game-site-nav .nav-link.active { background: var(--accent); color: #1a202c; font-weight:600; }

@media (max-width: 1200px) {
  body {
    display: block;
    padding-top: 0 !important;
  }

  .game-site-nav + .page {
    margin-inline: auto;
  }

  .game-site-nav .hamburger { display:block; }
  .game-site-nav {
    margin-top: 0;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }

  .game-site-nav .nav-menu {
    display:flex; position:absolute; top:100%; left:0; width:100%;
    background:#1a365d; flex-direction:column; align-items:stretch; text-align:left;
    padding:14px 16px; gap:12px; box-shadow:0 12px 32px rgba(0,0,0,.35);
    opacity:0; transform: translateY(-8px) scaleY(.98); transform-origin: top center;
    max-height:0; overflow:hidden; pointer-events:none;
    transition: opacity .24s ease, transform .28s cubic-bezier(.22,1,.36,1), max-height .28s ease;
  }
  [data-theme="dark"] .game-site-nav .nav-menu { background:#0d1117; }
  .game-site-nav .nav-menu.active {
    opacity:1; transform: translateY(0) scaleY(1); max-height:75vh; pointer-events:auto;
  }
  .game-site-nav .nav-link {
    width:100%; font-size:1.02rem; line-height:1.9; padding:16px 14px;
  }
}
