/* ---------- Tokens ---------- */
:root {
  --bg: #fff7e0;
  --bg-glow-1: rgb(255 194 26 / 0.28);
  --bg-glow-2: rgb(255 77 141 / 0.14);
  --surface: #ffffff;
  --surface-2: #fff0c2;
  --text: #1b1433;
  --muted: #554c70;
  --border: #f0dca0;
  --accent: #ffc21a;
  --accent-ink: #1b1433;
  --accent-soft: #ffe9a3;
  --link: #6d28d9;
  --focus: #6d28d9;
  --good: #16a34a;
  --warn: #f59e0b;
  --hero: linear-gradient(135deg, #ffc21a 0%, #ff9f1c 45%, #ff5c8a 100%);
  --hero-ink: #1b1433;
  --stripe: linear-gradient(90deg, #ffb703, #ff5c8a, #8b5cf6, #2563eb, #16a34a);
  --shadow: 0 1px 2px rgb(27 20 51 / 0.06), 0 6px 20px rgb(27 20 51 / 0.08);
  --shadow-lift: 0 2px 4px rgb(27 20 51 / 0.08), 0 14px 32px rgb(27 20 51 / 0.14);
  --radius: 16px;
  --max: 1080px;
  --header-h: 64px;
  --anchor-h: 72px; /* 50px ad + label + padding */
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (min-width: 768px) { :root { --anchor-h: 114px; } } /* 90px ad */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14102a;
    --bg-glow-1: rgb(255 194 26 / 0.12);
    --bg-glow-2: rgb(139 92 246 / 0.22);
    --surface: #1f1940;
    --surface-2: #2c2457;
    --text: #f6f2ff;
    --muted: #bdb3de;
    --border: #3b3270;
    --accent: #ffcc33;
    --accent-soft: #3d3166;
    --link: #c4b5fd;
    --focus: #ffcc33;
    --hero: linear-gradient(135deg, #ffc21a 0%, #ff8a3d 50%, #ff4d8d 100%);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 6px 20px rgb(0 0 0 / 0.35);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.45), 0 14px 32px rgb(0 0 0 / 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14102a;
  --bg-glow-1: rgb(255 194 26 / 0.12);
  --bg-glow-2: rgb(139 92 246 / 0.22);
  --surface: #1f1940;
  --surface-2: #2c2457;
  --text: #f6f2ff;
  --muted: #bdb3de;
  --border: #3b3270;
  --accent: #ffcc33;
  --accent-soft: #3d3166;
  --link: #c4b5fd;
  --focus: #ffcc33;
  --hero: linear-gradient(135deg, #ffc21a 0%, #ff8a3d 50%, #ff4d8d 100%);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 6px 20px rgb(0 0 0 / 0.35);
  --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.45), 0 14px 32px rgb(0 0 0 / 0.5);
  color-scheme: dark;
}

/* One color per game, used by its card (and later by the game page). */
[data-game-card="hive"], [data-game="hive"] { --game: #ffb703; --game-ink: #1b1433; --game-soft: rgb(255 183 3 / 0.2); }
[data-game-card="guess"], [data-game="guess"] { --game: #16a34a; --game-ink: #ffffff; --game-soft: rgb(22 163 74 / 0.16); }
[data-game-card="scramble"], [data-game="scramble"] { --game: #e11d74; --game-ink: #ffffff; --game-soft: rgb(225 29 116 / 0.15); }
[data-game-card="search"], [data-game="search"] { --game: #2563eb; --game-ink: #ffffff; --game-soft: rgb(37 99 235 / 0.15); }
[data-game-card="ladder"], [data-game="ladder"] { --game: #7c3aed; --game-ink: #ffffff; --game-soft: rgb(124 58 237 / 0.16); }
[data-game-card="hangman"], [data-game="hangman"] { --game: #f97316; --game-ink: #1b1433; --game-soft: rgb(249 115 22 / 0.16); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgb(109 40 217 / 0.15);
  scroll-padding-top: calc(var(--header-h) + 12px);
}
body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 0% -10%, var(--bg-glow-1), transparent 70%),
    radial-gradient(800px 500px at 100% 0%, var(--bg-glow-2), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
a, button { touch-action: manipulation; }
img, svg { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; text-wrap: balance; overflow-wrap: break-word; }
p, li { text-wrap: pretty; }
h1 { font-size: clamp(1.8rem, 4.5vw, 2.7rem); letter-spacing: -0.015em; font-weight: 900; }
h2 { font-size: 1.4rem; margin-top: 1.6em; font-weight: 800; }
[id] { scroll-margin-top: calc(var(--header-h) + 12px); }
.wrap {
  width: 100%; max-width: var(--max); margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Focus ---------- */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
main:focus { outline: none; } /* skip-link target only; not interactive */
.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 100;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-weight: 700; text-decoration: none;
}
.skip-link:focus-visible { top: 12px; }

/* ---------- Header ---------- */
.site-header {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.site-header::after { content: ""; display: block; height: 4px; background: var(--stripe); }
.site-header .wrap {
  display: flex; align-items: center; gap: 12px; height: calc(var(--header-h) - 4px);
}
.brand {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  font-weight: 900; font-size: 1.2rem; color: var(--text); text-decoration: none;
  margin-right: auto; letter-spacing: -0.01em;
}
.brand__mark {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #ffc21a, #ff8a3d);
  color: #1b1433; box-shadow: 0 2px 0 #c97a00;
  display: grid; place-items: center; font-size: 1.15rem; font-weight: 900;
  transform: rotate(-6deg);
}
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .icon-btn {
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 0.95rem;
  padding: 8px 12px; border-radius: 10px; border: 0; background: none; cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nav a:hover, .icon-btn:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.lang-switch { font-size: 0.85rem; letter-spacing: 0.04em; box-shadow: inset 0 0 0 2px var(--border); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; }
.icon-btn svg { width: 20px; height: 20px; }
@media (max-width: 560px) {
  .nav .nav__text { display: none; }
}

/* ---------- Main ---------- */
main { flex: 1; padding: 24px 0 48px; }

/* ---------- Fixed bottom ad (the only ad on each page) ---------- */
.ad-anchor {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--anchor-h) + env(safe-area-inset-bottom));
  padding: 4px 0 calc(6px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgb(27 20 51 / 0.12);
  overflow: hidden;
}
.ad-anchor__label {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); line-height: 1; margin-bottom: 4px;
}
/* Fixed sizes reserved before the ad loads (AdSense reads these). */
.ad-anchor__unit { display: inline-block; width: 320px; height: 50px; max-width: 100%; }
@media (min-width: 768px) { .ad-anchor__unit { width: 728px; height: 90px; } }
/* No ad unit configured yet: no banner, so no space reserved for it. */
html.ads-off { --anchor-h: 0px; }

/* ---------- Home ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 92% 18%, rgb(255 255 255 / 0.35) 0 34px, transparent 35px),
    radial-gradient(circle at 84% 78%, rgb(255 255 255 / 0.22) 0 60px, transparent 61px),
    radial-gradient(circle at 70% 30%, rgb(255 255 255 / 0.18) 0 18px, transparent 19px),
    var(--hero);
  color: var(--hero-ink);
  border-radius: calc(var(--radius) + 8px);
  padding: clamp(24px, 5vw, 48px);
  box-shadow: var(--shadow-lift);
}
.hero h1 { max-width: 16em; margin-bottom: 0.4em; }
.hero p { max-width: 38em; font-size: 1.08rem; margin: 0; font-weight: 600; }

.games {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  margin: 18px 0 8px;
}
.card {
  position: relative;
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 0 0 18px; color: var(--text); text-decoration: none; box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--game); box-shadow: var(--shadow-lift); }
.card:active { transform: translateY(-1px); }
.card > :not(.card__art) { margin-left: 18px; margin-right: 18px; }
.card h3 { margin-top: 4px; margin-bottom: 0; font-size: 1.2rem; font-weight: 800; }
.card p { margin-top: 0; margin-bottom: 0; color: var(--muted); font-size: 0.95rem; flex: 1; }
.card__art {
  display: flex; gap: 6px; align-items: center; justify-content: center;
  height: 92px; background: var(--game); color: var(--game-ink);
  font-weight: 900; font-size: 1.2rem;
}
.tile {
  width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center;
  font-weight: 900; font-size: 1.1rem;
  background: #ffffff; color: #1b1433;
  box-shadow: 0 3px 0 rgb(0 0 0 / 0.18);
}
.tile--accent { background: #1b1433; color: #ffcc33; }
.tile--good { background: #16a34a; color: #fff; box-shadow: 0 3px 0 #0e6b31, 0 0 0 2px #fff; }
.tile--warn { background: #f59e0b; color: #1b1433; box-shadow: 0 3px 0 #a86a00, 0 0 0 2px #fff; }
.card__cta {
  align-self: flex-start; font-weight: 800; font-size: 0.9rem;
  padding: 7px 16px; border-radius: 999px; background: var(--game); color: var(--game-ink);
}
.card__cta--soon { background: var(--game-soft); color: var(--text); }

.stats-box {
  display: none; gap: 24px; flex-wrap: wrap;
  background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius);
  padding: 16px 20px; margin: 16px 0 0;
}
.stats-box.has-stats { display: flex; }
.stats-box strong { display: block; font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats-box span { color: var(--muted); font-size: 0.85rem; }

.features {
  list-style: none; padding: 0; margin: 12px 0 0;
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
}
.features li {
  background: var(--surface); border-radius: 14px; padding: 14px 16px 14px 46px; position: relative;
  border: 1px solid var(--border); font-weight: 600;
}
.features li::before {
  content: "✓"; position: absolute; left: 14px; top: 15px;
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--good); color: #fff; font-size: 0.8rem; font-weight: 900;
}

/* ---------- Content pages ---------- */
.prose { max-width: 46em; overflow-wrap: break-word; }
.prose h2 { font-size: 1.2rem; }
.prose p, .prose li { color: var(--text); }
.panel {
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.panel[data-game] { border-color: var(--game); border-top-width: 8px; }

/* ---------- Buttons ---------- */
.btn {
  font-family: inherit; font-weight: 800; font-size: 0.95rem; cursor: pointer;
  padding: 10px 20px; border-radius: 999px; border: 2px solid transparent;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; display: inline-block;
  box-shadow: 0 3px 0 #c97a00;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}
.btn:hover { background: #ffd447; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #c97a00; }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); box-shadow: none; }
.btn--ghost:hover { background: var(--surface-2); }
.btn--ghost:active { box-shadow: none; }

/* ---------- Consent banner (sits above the bottom ad) ---------- */
.consent {
  position: fixed; left: 16px; right: 16px; z-index: 50;
  bottom: calc(var(--anchor-h) + env(safe-area-inset-bottom) + 12px);
  max-width: 640px; margin: 0 auto;
  max-height: calc(100dvh - var(--anchor-h) - var(--header-h) - 24px); overflow: auto;
  overscroll-behavior: contain;
  background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 8px 40px rgb(0 0 0 / 0.25); padding: 16px 18px;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.consent p { margin: 0; flex: 1 1 280px; font-size: 0.92rem; }
.consent__actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--surface);
  /* Extra bottom room so the fixed ad never covers the footer. */
  padding: 0 0 calc(24px + var(--anchor-h) + env(safe-area-inset-bottom)); font-size: 0.9rem; color: var(--muted);
}
.site-footer::before { content: ""; display: block; height: 4px; background: var(--stripe); margin-bottom: 20px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.site-footer .copy { margin-left: auto; }
@media (max-width: 640px) { .site-footer .copy { margin-left: 0; width: 100%; } }

/* ---------- Language chooser ---------- */
.chooser { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.chooser__options { display: flex; gap: 12px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

/* ---------- Home long-form copy + FAQ ---------- */
.seo-copy { max-width: 46em; margin-top: 8px; }
.seo-copy h3 { font-size: 1.08rem; margin: 1.4em 0 0.4em; }
.seo-copy p { margin: 0 0 1em; }
.faq { display: grid; gap: 10px; margin-top: 8px; }
.faq details {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px;
  transition: border-color 0.15s ease;
}
.faq details[open] { border-color: var(--accent); }
.faq summary { cursor: pointer; font-weight: 700; }
.faq summary:hover { color: var(--link); }
.faq details p { margin: 10px 0 0; color: var(--muted); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .card:hover, .card:active, .btn:active { transform: none; }
}

/* Game illustrations on cards (added with the games). */
.card__art:has(img) { height: auto; aspect-ratio: 5 / 3; padding: 0; overflow: hidden; }
.card__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
