/* ═══════════════════════════════════════════════
   POPCULTURE LINKS — styles.css
   Shared by every page. Three independent color systems:
   1) --accent/--accent-light/--accent-dark — the per-category theme, set
      by a [data-category="..."] block below, applied to <html> (same
      element as [data-theme], so the two can reference each other — see
      --accent-on-chrome).
   2) Tile/keyboard status colors (green/gold/gray/magenta) — fixed
      globally, same on every category page and either light/dark theme.
   3) [data-theme="light"|"dark"] — page-chrome light/dark mode, toggled
      by the header button (see shared/game.js). Light is the default.
      Only the page CHROME (header, keyboard bar, mode toggle, etc. — the
      things that sit directly on --bg) actually changes between themes.
      Cards (word-row, result-card, modal) stay their fixed light "paper"
      color in BOTH themes — --surface/--ink never change with theme.
   ═══════════════════════════════════════════════ */

:root {
  /* Wordle-standard tile/keyboard status colors — identical on every
     category page, regardless of --accent or light/dark theme. */
  --correct:       #2e9e4c;
  --correct-dark:  #1c6b32;
  --partial:       #d8a316;
  --partial-dark:  #96700c;
  --wrong:         #6b6f76;
  --wrong-dark:    #4a4d52;
  /* "elsewhere" (Canon Mode only): wrong here, but present in one of the
     other two answers. Magenta specifically to stay visually distinct
     from every one of the 6 category accent colors below. */
  --elsewhere:       #d6247e;
  --elsewhere-dark:  #931658;

  /* Card background (word-row, result-card, modal) — a fixed light
     "paper" tone in BOTH themes. Only --bg (page chrome) changes below. */
  --surface:      #f6f6f8;
  --surface-dark: #e7e8ec;
  --ink:          #1b1e24;
  --ink-faded:    #52565f;

  --kb-height: 200px;

  /* Neutral fallback accent — only actually used on the home page, which
     has no [data-category]. Same specificity as the [data-category="..."]
     rules below (both single attribute-ish selectors on <html>), so
     source order decides: this loses to any category rule that also
     matches, and only applies when none does. */
  --accent: #8a8f99; --accent-light: #c4c8d0; --accent-dark: #5b5f68;
}

/* ═══ PER-CATEGORY ACCENT THEME ═══
   Set on <html data-category="..."> by each subpage (see game.js reading
   document.documentElement.dataset.category). Brighter/more saturated
   pass over the original palette — every dark variant is >= 4.6:1
   contrast against --surface (#f6f6f8, what it's used as text color on),
   and every light variant is >= 4.6:1 against dark-theme's --bg
   (#14161b, what IT'S used as text color on there) — verified with a
   WCAG relative-luminance contrast script, not eyeballed. Movies
   (silver) is the one exception that stays low-saturation on purpose:
   silver is desaturated by definition, so "brighter" there means
   cooler/lighter steel, not turning it into pale blue. */
/* --title-font: a distinct display face per category for .app-title/
   .result-title only (see those rules below) — every other label/button/
   body text stays on the Poppins/Inter pairing for readability. Each
   page's own <link> only loads the ONE Google Font it actually needs. */
[data-category="movies"]       { --accent: #aeb4bd; --accent-light: #ecedef; --accent-dark: #66707e; --title-font: 'Bebas Neue'; }
[data-category="tv"]           { --accent: #2f8cff; --accent-light: #9fcaff; --accent-dark: #0055be; --title-font: 'Righteous'; }
[data-category="anime-manga"]  { --accent: #ff2440; --accent-light: #ff94a2; --accent-dark: #b30017; --title-font: 'Rampart One'; }
[data-category="comics"]       { --accent: #ff8800; --accent-light: #ffbc70; --accent-dark: #8f4c00; --title-font: 'Bangers'; }
[data-category="books"]        { --accent: #17a457; --accent-light: #46e58e; --accent-dark: #094223; --title-font: 'Playfair Display'; }
[data-category="video-games"]  { --accent: #9b30ff; --accent-light: #d1a0ff; --accent-dark: #6300bf; --title-font: 'Orbitron'; }

/* ═══ LIGHT / DARK THEME ═══
   :root (light) is the default; [data-theme="dark"] overrides. Both are
   set on <html>, the same element [data-category] uses above, so
   --accent-on-chrome can reference --accent-dark/--accent-light and get
   the CURRENT category's actual values (custom-property resolution is
   per-element, across all rules that match it — not per-selector). */
:root, [data-theme="light"] {
  --bg: #eef0f3;
  --bg-highlight-2: rgba(0,0,0,0.03);
  /* Text/icon color for anything sitting directly on --bg (header,
     keyboard bar, mode toggle, feedback bar, home page, etc.) — NOT the
     cards, which stay --ink always. */
  --chrome-text: #1b1e24;
  /* Whichever of the category's own two calibrated shades is legible on
     the CURRENT --bg — swaps direction per theme. --accent-dark was
     calibrated for a light background, which is exactly --bg in light
     theme, so chrome text reuses it here instead of --accent-light
     (which stays calibrated for dark-theme's --bg instead). */
  --accent-on-chrome: var(--accent-dark);
  --kb-bg: rgba(255,255,255,0.92);
  --kb-key-wrong-text: #f6f6f8;
  --home-card-bg: rgba(0,0,0,0.035);
  --home-card-border: rgba(0,0,0,0.15);
}
[data-theme="dark"] {
  --bg: #14161b;
  --bg-highlight-2: rgba(255,255,255,0.05);
  --chrome-text: #f0f1f4;
  --accent-on-chrome: var(--accent-light);
  --kb-bg: rgba(10,11,14,0.96);
  --kb-key-wrong-text: rgba(240,241,244,0.85);
  --home-card-bg: rgba(255,255,255,0.04);
  --home-card-border: rgba(255,255,255,0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 15%, color-mix(in srgb, var(--accent) 16%, transparent) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 85%, var(--bg-highlight-2) 0%, transparent 55%);
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--chrome-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Subtle full-page category watermark — a giant, barely-there version of
   the section's own icon sitting behind all real content. Reinforces
   "you're in Movies/TV/etc." ambiently instead of through more UI. Only
   on category subpages — the home page has no single icon to represent
   all 6 categories, so it gets none (no [data-category] there to match).
   position:fixed puts this in its own stacking context painted AFTER
   ordinary static-positioned content, not before — despite coming first
   in the DOM, it would otherwise render ON TOP of the header/main/etc.
   That's why those get an explicit position:relative + low z-index below:
   putting them in the SAME "positioned" paint group with a higher index
   is what actually guarantees this stays behind them. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: min(70vw, 460px);
  line-height: 1;
  opacity: 0.1;
  pointer-events: none;
  user-select: none;
}
[data-category="movies"]      body::before { content: '🎬'; }
[data-category="tv"]          body::before { content: '📺'; }
[data-category="anime-manga"] body::before { content: '🎌'; }
[data-category="comics"]      body::before { content: '💥'; }
[data-category="books"]       body::before { content: '📖'; }
[data-category="video-games"] body::before { content: '🎮'; }

/* ═══ CATEGORY LOTTIE BACKGROUND ═══
   A per-category ambient animation (see shared/lottie-bg.js), layered
   directly above the giant emoji watermark and directly below every real
   UI element. Same fixed/inset:0/pointer-events:none treatment as
   body::before above, and deliberately the same z-index (0) — painted
   after the watermark in DOM order, which is what puts it visually on
   top of that emoji without needing a higher z-index (see the watermark
   comment above for why DOM order, not z-index, decides that here). The
   opaque header/keyboard bars (z-index 1 / 50) already sit above both,
   so this never needs its own clipping to avoid them. */
/* This IS the <canvas> DotLottie renders into (see shared/lottie-bg.js) —
   not a wrapping container around one, since DotLottie draws straight to
   a canvas element rather than injecting SVG/DOM content. */
.category-lottie-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
  /* Most of these animations lean on very low per-shape opacity (a handful
     of percent, for a "barely-there" ambient look) which reads as
     invisible once it's sitting behind the app's own themed gradient —
     a soft dark halo behind every shape gives pale/thin content (motes,
     scanlines, petals, streaks) a contrast edge against ANY background
     color, independent of how close that background's hue is to the
     shape's own (a real problem here: e.g. anime's pale pink petals over
     this page's own pink-tinted background). */
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.35)) drop-shadow(0 0 7px rgba(0,0,0,0.25));
}

/* Comics' burst shapes/text read as too bold at full opacity behind the
   row cards. */
[data-category="comics"] .category-lottie-bg {
  opacity: 0.7;
}

[data-category="video-games"] .category-lottie-bg {
  opacity: 0.6;
}

[data-category="anime-manga"] .category-lottie-bg,
[data-category="books"] .category-lottie-bg {
  opacity: 0.6;
}

/* ═══ THEME TOGGLE BUTTON ═══ */
.theme-toggle-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 35%, var(--chrome-text) 65%);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-on-chrome);
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

/* Icon glyphs for the settings gear + the two toggles it reveals (see
   shared/icons/). Plain colorless SVGs used as a CSS mask rather than
   <img>s specifically so background-color can tint them — that's what
   makes them pick up var(--accent-on-chrome) and come out in the current
   page's category color (and stay correct through a theme switch, since
   --accent-on-chrome itself already flips between --accent-dark/-light
   for light/dark theme). */
.icon-mask {
  display: inline-block;
  width: 16px;
  height: 16px;
  background-color: var(--accent-on-chrome);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  transition: background-color 0.2s;
}
.icon-settings   { -webkit-mask-image: url('icons/settings_24dp.svg');   mask-image: url('icons/settings_24dp.svg'); }
.icon-light-mode { -webkit-mask-image: url('icons/light_mode_24dp.svg'); mask-image: url('icons/light_mode_24dp.svg'); }
.icon-dark-mode  { -webkit-mask-image: url('icons/dark_mode_24dp.svg');  mask-image: url('icons/dark_mode_24dp.svg'); }
.icon-sparkle    { -webkit-mask-image: url('icons/sparkle_24dp.svg');    mask-image: url('icons/sparkle_24dp.svg'); }
.icon-stop       { -webkit-mask-image: url('icons/stop_24dp.svg');       mask-image: url('icons/stop_24dp.svg'); }
.icon-question   { -webkit-mask-image: url('icons/question_mark_24dp.svg'); mask-image: url('icons/question_mark_24dp.svg'); }
.icon-fire       { -webkit-mask-image: url('icons/fire_24dp.svg');       mask-image: url('icons/fire_24dp.svg'); }

/* ═══ SETTINGS MENU (gear button + the light/dark and animation toggles
   it reveals) ═══
   The gear sits in the header at all times; the two toggles beneath it
   share its exact 30x30 spot until opened, so opening reads as them
   sliding out from under the gear rather than just fading in somewhere
   new. Both toggles reuse .theme-toggle-btn itself for the same look. */
.settings-menu {
  position: relative;
  width: 30px;
  height: 30px;
}
.settings-gear-btn {
  position: relative;
  z-index: 2;
  transition: all 0.2s, transform 0.35s ease;
}
.settings-gear-btn.open {
  transform: rotate(180deg);
}
.settings-dropdown-toggle {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s, transform 0.35s ease, opacity 0.35s ease;
}
/* The animation toggle sits under the theme toggle, so it's staggered
   slightly behind it in both directions. */
.settings-anim-toggle {
  transition-delay: 0.05s;
}
.settings-menu.open .settings-theme-toggle {
  transform: translateY(36px);
  opacity: 1;
  pointer-events: auto;
}
.settings-menu.open .settings-anim-toggle {
  transform: translateY(72px);
  opacity: 1;
  pointer-events: auto;
}
/* ═══ COOKIE NOTICE ═══ */
.cookie-banner {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 14px;
  background: rgba(0,0,0,0.4);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.cookie-banner.show { display: flex; }
.cookie-banner p {
  font-size: 0.72rem;
  line-height: 1.4;
  color: color-mix(in srgb, var(--chrome-text) 80%, transparent);
  max-width: 520px;
  margin: 0;
}
.cookie-banner a { color: var(--accent-on-chrome); }
.cookie-banner button {
  font-family: 'Poppins', sans-serif;
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-on-chrome);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ═══ HEADER ═══ */
.app-header {
  position: relative;
  /* Above .game-main (also z-index 1, but later in DOM order and so
     otherwise painted on top of it) — needed so the settings dropdown,
     which visually extends below the header's own box, isn't covered by
     the game content underneath it. */
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  background: rgba(0,0,0,0.25);
}
.header-left, .header-right { width: 90px; display: flex; align-items: center; gap: 6px; }
.header-right { justify-content: flex-end; }
.header-center { text-align: center; }
.app-title {
  font-family: var(--title-font, 'Poppins'), 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent-on-chrome);
  letter-spacing: 0.02em;
  text-shadow: 0 0 14px color-mix(in srgb, var(--accent) 40%, transparent);
  white-space: nowrap;
}
.app-title a { color: inherit; text-decoration: none; }
.app-subtitle {
  font-family: 'Poppins', sans-serif;
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent-on-chrome) 85%, var(--chrome-text) 15%);
  opacity: 0.85;
}
.header-streak {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.8rem;
  color: var(--accent-on-chrome);
}
.icon-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 35%, var(--chrome-text) 65%);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-on-chrome);
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.header-mode-icon {
  width: 0;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 35%, var(--chrome-text) 65%);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  margin-left: 0;
  cursor: default;
  opacity: 0;
  overflow: hidden;
  flex-shrink: 0;
  transform: scale(0.5);
  transition: width 0.35s ease, opacity 0.35s ease, transform 0.35s ease, margin-left 0.35s ease;
}
.header-mode-icon.show {
  width: 30px;
  margin-left: 6px;
  opacity: 1;
  transform: scale(1);
}
.header-mode-icon.no-anim { transition: none; }

/* ═══ MAIN SCROLL AREA ═══ */
.game-main {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px calc(var(--kb-height) + 20px);
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

/* ═══ MODE TOGGLE ═══ */
.mode-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  max-height: 60px;
  overflow: hidden;
  transition: opacity 0.35s ease, max-height 0.35s ease, margin-bottom 0.35s ease, transform 0.35s ease;
}
.mode-toggle.collapsing {
  opacity: 0;
  max-height: 0;
  margin-bottom: 0;
  transform: translateY(-6px);
  pointer-events: none;
}
.mode-toggle.no-anim { transition: none; }
.mode-btn {
  flex: 1;
  font-family: 'Poppins', sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 30%, transparent);
  background: color-mix(in srgb, var(--chrome-text) 6%, transparent);
  color: color-mix(in srgb, var(--chrome-text) 55%, transparent);
  cursor: pointer;
  transition: all 0.2s;
}
.mode-btn.active {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border-color: var(--accent);
  color: var(--accent-on-chrome);
}
.mode-btn.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ═══ STATUS STRIP ═══ */
.status-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.attempts-row { display: flex; flex-wrap: wrap; gap: 6px; row-gap: 4px; max-width: 70px; flex-shrink: 0; }
.attempt-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--chrome-text) 12%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--accent) 40%, transparent);
  transition: all 0.3s;
  flex-shrink: 0;
}
.attempt-dot.used   { background: var(--accent); border-color: var(--accent-dark); }
.attempt-dot.failed { background: #b3273f; border-color: #6e1526; }
.hint-btn {
  font-family: 'Poppins', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent-on-chrome);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.hint-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.hint-btn.locked { opacity: 0.4; cursor: not-allowed; }

/* ═══ SHARED PANEL ═══ */
.shared-panel {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 8px;
  padding: 5px 9px;
  height: 30px;
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.shared-panel.complete {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent) inset;
}
.shared-panel-badges {
  display: flex;
  gap: 5px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.shared-panel-badges::-webkit-scrollbar { display: none; }
.shared-badge {
  width: 21px; height: 21px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-light), var(--accent-dark));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 0.64rem;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  animation: popIn 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
  flex-shrink: 0;
}
.shared-panel-empty {
  font-style: italic;
  font-size: 0.66rem;
  color: color-mix(in srgb, var(--chrome-text) 70%, transparent);
  white-space: nowrap;
}

/* ═══ PREVIOUS GUESSES DROPDOWN ═══ */
.prev-guesses-details {
  margin-bottom: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
  overflow: hidden;
}
.prev-guesses-details summary {
  font-family: 'Poppins', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent-on-chrome) 80%, var(--chrome-text) 20%);
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.prev-guesses-details summary::-webkit-details-marker { display: none; }
.prev-guesses-details summary::before {
  content: '▸';
  transition: transform 0.2s;
  font-size: 0.7rem;
}
.prev-guesses-details[open] summary::before { transform: rotate(90deg); }
.prev-guesses-body {
  padding: 6px 12px 12px;
  max-height: 220px;
  overflow-y: auto;
  border-top: 1px dashed color-mix(in srgb, var(--accent) 15%, transparent);
}
.prev-attempt-block { margin-bottom: 10px; }
.prev-attempt-block:last-child { margin-bottom: 0; }
.prev-attempt-label {
  font-family: 'Poppins', sans-serif;
  font-size: 0.52rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--chrome-text) 40%, transparent);
  margin-bottom: 4px;
}
.prev-word-row {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}
.prev-category-icon { font-size: 10px; width: 16px; flex-shrink: 0; opacity: 0.6; }
.prev-letter-tile {
  width: 20px; height: 22px;
  flex-shrink: 0;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif;
  font-size: 0.52rem;
  font-weight: 700;
  color: #fff;
}
.prev-letter-tile.correct   { background: var(--correct);   border: 1px solid var(--correct-dark); }
.prev-letter-tile.partial   { background: var(--partial);   border: 1px solid var(--partial-dark); }
.prev-letter-tile.wrong     { background: var(--wrong);     border: 1px solid var(--wrong-dark); }
.prev-letter-tile.elsewhere { background: var(--elsewhere); border: 1px solid var(--elsewhere-dark); }
.prev-letter-tile.sep {
  background: transparent;
  border: none;
  color: color-mix(in srgb, var(--chrome-text) 35%, transparent);
  width: 8px;
}
/* Spacer inserted between word-groups in a past multi-word guess — see
   renderHistory() in shared/game.js, which computes group boundaries from
   wordShapes. Clearly wider than the row's own 2px inter-letter gap. */
.prev-word-row .group-gap { width: 10px; flex-shrink: 0; }

/* ═══ WORD ROWS ═══ */
.words-area { position: relative; display: flex; flex-direction: column; gap: 8px; }

.submit-loading {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(10,11,14,0.55);
  backdrop-filter: blur(2px);
  border-radius: 10px;
  z-index: 20;
}
.submit-loading.show { display: flex; }
.submit-loading p {
  font-family: 'Poppins', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  /* This overlay is a fixed dark scrim in BOTH themes (dimming the tile
     grid while a guess submits, same convention as the modal backdrop
     below) — so its text stays the dark-background-calibrated shade
     regardless of the page's own theme. */
  color: var(--accent-light);
}
.spinner {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent-light);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.word-row {
  /* Slightly translucent (not fully opaque --surface) so the page
     watermark peeks through the card itself, not just the gaps around
     it — the letter tiles inside still have their own solid/near-solid
     backgrounds, so this doesn't cost any text legibility. */
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 2px solid color-mix(in srgb, var(--accent-dark) 40%, transparent);
  border-radius: 10px;
  padding: 8px 10px 10px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}
.word-row.active {
  border-width: 3px;
  border-color: var(--accent-on-chrome);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 9px 2px color-mix(in srgb, var(--accent-on-chrome) 55%, transparent), 0 4px 16px rgba(0,0,0,0.35);
}
.word-row.locked {
  border-color: var(--accent-dark);
  cursor: default;
  opacity: 0.95;
}
.word-row.locked::after {
  content: '✓';
  position: absolute;
  top: 6px; right: 10px;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  color: var(--accent-dark);
  font-size: 0.85rem;
}
.word-row-label {
  font-family: 'Poppins', sans-serif;
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.word-row-icon { font-size: 12px; }

/* Each space-separated word is its own ".tile-word-group" (built in
   shared/game.js's buildTileRows) — a real flex item, not just a wider
   margin on one tile. flex-wrap here wraps whole GROUPS onto a new row
   when they don't fit; a group's own tiles never split across rows, so a
   long multi-word answer stacks into stacked word-rows on a small phone
   instead of shrinking into illegibility or needing horizontal scroll. */
.tile-grid {
  display: flex;
  flex-wrap: wrap;
  /* row-gap column-gap — column-gap (between groups) is deliberately much
     larger than the 4px gap within a group. Both scale with --tile-scale
     (see below) so the row's total width is truly proportional to the
     scale factor, making shared/game.js's fitTileRow able to compute the
     exact scale a row needs in one shot instead of under-shrinking. */
  gap: calc(10px * var(--tile-scale, 1)) calc(16px * var(--tile-scale, 1));
  /* Belt-and-suspenders only — fitTileRow always computes a scale that
     fits, so this should never actually clip anything. Kept in case of
     sub-pixel rounding. Never overflow-x:auto/scroll: row cards must
     never be able to scroll. */
  max-width: 100%;
  overflow-x: hidden;
}
.tile-word-group {
  display: flex;
  gap: calc(4px * var(--tile-scale, 1));
  flex: 0 0 auto;
}

/* --tile-scale is 1 (full size) unless shared/game.js's fitTileRow finds
   this row's content actually overflows its card, in which case it sets
   this custom property (scoped to the single overflowing #tiles-N grid)
   to whatever factor makes it fit exactly. Plain CSS flex-shrink was
   tried here first and rejected — shrinking a flex item that's itself a
   flex container (a tile-word-group) inside a wrapping flex container
   (tile-grid) compounds into shrinking far past what's actually needed
   to fit (confirmed by measurement, not just visually) — a real
   nested-flex quirk, not a threshold-tuning issue. A JS-measured,
   explicitly-computed scale is deterministic instead. */
.letter-tile {
  flex: 0 0 auto;
  width: calc(40px * var(--tile-scale, 1));
  aspect-ratio: 10 / 11;
  border: 1.5px solid color-mix(in srgb, var(--accent-dark) 35%, transparent);
  background: rgba(255,255,255,0.7);
  border-radius: 8px;
  box-shadow: 0 2px 0 rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Poppins', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  user-select: none;
  transition: all 0.2s;
}
.letter-tile.filled {
  border-color: var(--accent-dark);
  background: rgba(255,255,255,0.95);
  animation: tilePop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.letter-tile.correct   { background: var(--correct);   border-color: var(--correct-dark);   color: #fff; box-shadow: 0 2px 0 rgba(0,0,0,0.18); }
.letter-tile.partial   { background: var(--partial);   border-color: var(--partial-dark);   color: #fff; box-shadow: 0 2px 0 rgba(0,0,0,0.18); }
.letter-tile.wrong     { background: var(--wrong);     border-color: var(--wrong-dark);     color: #fff; box-shadow: 0 2px 0 rgba(0,0,0,0.18); }
.letter-tile.elsewhere { background: var(--elsewhere); border-color: var(--elsewhere-dark); color: #fff; box-shadow: 0 2px 0 rgba(0,0,0,0.18); }
.letter-tile.reveal    { animation: flipTile 0.5s ease both; }
.letter-tile.ghost     { color: #9096a3; }

/* Separator tile — a period, apostrophe, or hyphen that's part of a
   Person/Place/Thing answer. Pre-filled and non-interactive: the player
   never types it and it's never scored. Kept visually muted (no border/
   background, unlike a real letter tile) so it still reads as
   punctuation rather than a 5th tile state, but sized up and bolded —
   at 1rem/35% opacity a period in particular was reading as nothing at
   all rather than as a period. */
.letter-tile.tile-sep {
  flex: 0 0 auto;
  width: calc(16px * var(--tile-scale, 1));
  aspect-ratio: auto;
  background: transparent;
  border: none;
  color: rgba(27,30,36,0.65);
  font-size: 1.4rem;
  font-weight: 700;
  cursor: default;
}

/* ═══ FEEDBACK ═══ */
.feedback-bar {
  min-height: 26px;
  text-align: center;
  font-style: italic;
  font-size: 0.85rem;
  color: color-mix(in srgb, var(--chrome-text) 70%, transparent);
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 8px;
  transition: all 0.25s;
}
/* error/hint use a fixed (non-accent) red/blue regardless of category —
   these two need their OWN light/dark pair (pale wash + dark text in
   light theme, dark wash + pale text in dark theme), since unlike
   .success they don't route through chrome-text/accent-on-chrome. */
.feedback-bar.error   { background: rgba(179,39,63,0.12);  color: #8b1a1a; }
.feedback-bar.success { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-on-chrome); }
.feedback-bar.hint    { background: rgba(43,90,138,0.12);  color: #1a3d6b; }
[data-theme="dark"] .feedback-bar.error { background: rgba(179,39,63,0.25); color: #f5c3cc; }
[data-theme="dark"] .feedback-bar.hint  { background: rgba(43,90,138,0.25); color: #bcd0f0; }

/* ═══ KEYBOARD ═══ */
.kb-container {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--kb-bg);
  backdrop-filter: blur(6px);
  border-top: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
  z-index: 50;
}
.kb-hint {
  text-align: center;
  font-family: 'Poppins', sans-serif;
  font-size: 0.52rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent-on-chrome) 80%, var(--chrome-text) 20%);
  margin-bottom: 5px;
}
.kb-row {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 5px;
  padding: 0 2px;
}
.kb-row:last-child { margin-bottom: 0; }
.kb-key {
  flex: 1 1 0;
  max-width: 42px;
  height: 46px;
  border-radius: 8px;
  box-shadow: 0 2px 0 rgba(0,0,0,0.12);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  background: color-mix(in srgb, var(--chrome-text) 12%, transparent);
  font-family: 'Poppins', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--chrome-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, transform 0.06s;
  user-select: none;
  touch-action: manipulation;
}
.kb-key:active { transform: translateY(1px) scale(0.96); background: color-mix(in srgb, var(--accent) 30%, transparent); box-shadow: none; }
.kb-key.kb-wide {
  flex: 1.6 1 0;
  max-width: 70px;
  font-size: 0.56rem;
  letter-spacing: 0.04em;
}
.kb-key.correct { background: var(--correct); border-color: var(--correct-dark); color: #fff; }
.kb-key.partial { background: var(--partial); border-color: var(--partial-dark); color: #fff; }
.kb-key.wrong   { background: rgba(107,111,118,0.55); border-color: var(--wrong-dark); color: var(--kb-key-wrong-text); }
.kb-key.shared  { box-shadow: 0 2px 0 rgba(0,0,0,0.12), inset 0 0 0 2px var(--accent-on-chrome); }

/* ═══ RESULT VIEW ═══ */
.result-view { display: none; }
.result-view.show { display: block; animation: fadeUp 0.5s ease both; }
.result-card {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 2px solid var(--accent-dark);
  border-radius: 12px;
  padding: 20px 16px;
  color: var(--ink);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 10%, transparent), 0 16px 48px rgba(0,0,0,0.6);
}
.result-header { position: relative; text-align: center; margin-bottom: 12px; }
.result-icon { font-size: 2rem; display: block; margin-bottom: 4px; }
.result-icon.win-icon {
  animation: iconPulse 0.7s ease-out both;
}

/* ═══ WIN CELEBRATION — renders on the always-light --surface result-card,
   so these stay the dark-background-calibrated accent-light regardless of
   overall page theme, same reasoning as .submit-loading above. ═══ */
.win-fx {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}
.win-spark {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-light) 0%, var(--accent) 60%, transparent 100%);
  opacity: 0;
  animation: sparkBurst 1.1s ease-out var(--delay) both;
}
/* Category-flavored confetti particle (the section's own icon, e.g. 🎬)
   mixed in among the plain color-dot sparks above — see buildWinSparks()
   in shared/game.js. Reuses the same --x/--y/--tx/--ty/--delay custom
   properties, just a different visual (an emoji, tumbling and rotating
   as it flies) and animation. */
.win-spark-icon {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: auto;
  height: auto;
  background: none;
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  animation: sparkBurstIcon 1.15s ease-out var(--delay) both;
}
@keyframes sparkBurstIcon {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.3) rotate(0deg); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(1) rotate(var(--rot)); }
}
@keyframes sparkBurst {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.4); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(1); }
}
@keyframes iconPulse {
  0%   { transform: scale(0.3) rotate(-12deg); opacity: 0; text-shadow: 0 0 0 transparent; }
  55%  { transform: scale(1.35) rotate(6deg); opacity: 1; text-shadow: 0 0 22px color-mix(in srgb, var(--accent-light) 90%, transparent); }
  80%  { transform: scale(0.95) rotate(-2deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; text-shadow: 0 0 10px color-mix(in srgb, var(--accent-light) 55%, transparent); }
}
.result-title {
  font-family: var(--title-font, 'Poppins'), 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  color: var(--accent-dark);
}
.result-score-big {
  font-family: 'Poppins', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent-dark);
  text-align: center;
}
.result-score-label {
  text-align: center;
  font-family: 'Poppins', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 14px;
}
.result-time-badge {
  text-align: center;
  font-family: 'Poppins', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--accent-dark);
  margin-bottom: 14px;
}
.result-streak-row { display: flex; justify-content: center; margin-bottom: 14px; }
.result-streak-badge {
  padding: 4px 14px;
  border-radius: 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-dark);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.answer-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.answer-chip {
  padding: 4px 12px;
  border-radius: 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-dark);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.result-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, color-mix(in srgb, var(--accent) 40%, transparent), transparent);
  margin: 14px 0;
}
.result-section-title {
  font-family: 'Poppins', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 10px;
}
/* One highlight card per puzzle (quote or fact) — same visual slot
   scripture-links used for its 3 verse-cards, singular instead of tripled. */
.highlight-card {
  background: rgba(0,0,0,0.04);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
  opacity: 0;
  animation: highlightIn 0.5s ease 0.15s both;
}
@keyframes highlightIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.highlight-kicker {
  font-family: 'Poppins', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 3px;
}
.highlight-text { font-style: italic; font-size: 0.9rem; line-height: 1.5; margin-bottom: 3px; }
.highlight-source { font-family: 'Poppins', sans-serif; font-size: 0.6rem; color: var(--ink-faded); letter-spacing: 0.04em; }

.result-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.share-icon {
  width: 0.9em;
  height: 0.9em;
  vertical-align: -0.08em;
  margin-right: 5px;
  fill: currentColor;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,0.4);
}
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--accent-dark);
  border: 1.5px solid color-mix(in srgb, var(--accent) 45%, transparent);
}

.share-toast {
  text-align: center;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--accent-dark);
  margin-top: 8px;
  min-height: 18px;
}

.countdown-display {
  text-align: center;
  font-family: 'Poppins', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--accent-dark);
  margin-top: 10px;
}

/* ═══ MODAL ═══ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6,7,9,0.75);
  backdrop-filter: blur(3px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
  /* Stops the iOS Safari rubber-band/bounce gesture on the page behind
     this overlay from chaining into it — part of the fix for the help
     modal's close button becoming unreachable (see .modal-header below). */
  overscroll-behavior: contain;
}
.modal-overlay.open { display: flex; animation: fadeUp 0.25s ease both; }
.modal {
  background: var(--surface);
  border: 2px solid var(--accent-dark);
  border-radius: 12px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 10%, transparent), 0 24px 60px rgba(0,0,0,0.7);
  width: 100%;
  max-width: 440px;
  max-height: 86vh;
  max-height: 86dvh; /* dvh reflects the CURRENT visible viewport on iOS Safari (vh uses the largest possible one, address bar hidden) — falls back to the vh line above on browsers that don't support dvh */
  display: flex;
  flex-direction: column;
  position: relative;
  color: var(--ink);
  overflow: hidden;
}
.modal-scroll-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px 22px 20px;
}
/* .modal-header is a SIBLING of .modal-scroll-body (both direct children
   of .modal), not nested inside it — position:absolute here is relative
   to .modal itself, so it stays fixed over the top-right corner of the
   whole card regardless of the scroll body's own scroll position,
   without needing any sticky/zero-height tricks (which turned out to
   render a stray artifact on at least one real mobile browser). Content
   in .modal-scroll-body still starts right at its own top padding, since
   this reserves no layout space of its own. */
.modal-header {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 5;
  padding: 10px 10px 0 0;
  pointer-events: none;
}
.modal-close {
  pointer-events: auto;
  background: var(--surface);
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  font-size: 1.1rem;
  color: var(--accent-dark);
  cursor: pointer;
  padding: 5px 9px;
}
.modal-confirm {
  max-width: 300px;
  padding: 24px 22px 20px;
  text-align: center;
}
.hint-confirm-cost {
  font-family: 'Poppins', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-dark);
  margin: 8px 0 2px;
}
.modal-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent-dark);
  text-align: center;
  margin-bottom: 3px;
}
.modal-subtitle {
  font-family: 'Poppins', sans-serif;
  font-size: 0.56rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-dark);
  text-align: center;
  margin-bottom: 16px;
}
.modal-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, color-mix(in srgb, var(--accent) 40%, transparent), transparent);
  margin: 12px 0;
}
.modal-section-title {
  font-family: 'Poppins', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 8px;
}
.modal p {
  font-size: 0.84rem;
  color: var(--ink-faded);
  line-height: 1.6;
  margin-bottom: 8px;
}
.modal strong { color: var(--ink); font-weight: 600; }
.legend { display: flex; flex-direction: column; gap: 7px; }
.legend-row { display: flex; align-items: center; gap: 10px; }
.legend-tiles { display: flex; gap: 3px; flex-shrink: 0; }
.legend-tile {
  width: 26px; height: 28px;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif;
  font-size: 0.66rem;
  font-weight: 700;
  color: #fff;
}
.legend-tile.c-correct   { background: var(--correct);   border: 1px solid var(--correct-dark); }
.legend-tile.c-partial   { background: var(--partial);   border: 1px solid var(--partial-dark); }
.legend-tile.c-wrong     { background: var(--wrong);     border: 1px solid var(--wrong-dark); }
.legend-tile.c-elsewhere { background: var(--elsewhere); border: 1px solid var(--elsewhere-dark); }
.legend-desc { font-size: 0.8rem; color: var(--ink-faded); line-height: 1.35; }
.legend-desc strong { color: var(--ink); }
.legend-note { font-size: 0.76rem !important; font-style: italic; margin-top: 8px; }

/* ═══ ANIMATIONS ═══ */
@keyframes fadeUp   { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes tilePop  { 0% { transform: scale(0.75); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes flipTile { 0% { transform: rotateX(0) scale(1); } 45% { transform: rotateX(90deg) scale(1); } 75% { transform: rotateX(0) scale(1.08); } 100% { transform: rotateX(0) scale(1); } }
@keyframes popIn    { 0% { transform: scale(0); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake    { 0%,100% { transform: translateX(0) rotate(0); } 15%,55% { transform: translateX(-8px) rotate(-1.5deg); } 35%,75% { transform: translateX(8px) rotate(1.5deg); } 90% { transform: translateX(-3px); } }
.shake { animation: shake 0.45s ease; }

@media (prefers-reduced-motion: reduce) {
  .win-spark, .result-icon.win-icon, .highlight-card {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    text-shadow: none !important;
  }
}

@media (hover: hover) {
  .icon-btn:hover, .theme-toggle-btn:hover { background: color-mix(in srgb, var(--accent) 25%, transparent); transform: scale(1.06); }
  .settings-gear-btn.open:hover { transform: rotate(180deg) scale(1.06); }
  .mode-btn:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
  .mode-btn.locked:hover { background: color-mix(in srgb, var(--chrome-text) 6%, transparent); }
  .hint-btn:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
  .hint-btn.locked:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
  .btn-primary:hover:not(:disabled) { transform: translateY(-1px); background: linear-gradient(135deg, var(--accent-light), var(--accent)); }
  .btn-ghost:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
  .modal-close:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
  .cookie-banner button:hover { background: color-mix(in srgb, var(--accent) 28%, transparent); }
}

/* ═══ HOME PAGE ═══ */
.home-header {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding: 10px 14px 0;
}
.home-main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px 40px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}
.home-hero { text-align: center; margin-bottom: 28px; }
.home-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 2rem;
  color: var(--chrome-text);
  margin-bottom: 6px;
}
.home-tagline {
  font-family: 'Poppins', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: color-mix(in srgb, var(--chrome-text) 65%, transparent);
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (min-width: 560px) {
  .category-grid { grid-template-columns: repeat(3, 1fr); }
}
.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 22px 12px;
  border-radius: 14px;
  background: var(--card-surface, var(--home-card-bg));
  border: 2px solid var(--card-accent, var(--home-card-border));
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08) inset;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.category-card .category-icon { font-size: 2.2rem; }
.category-card .category-label {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--chrome-text);
  text-align: center;
}
.category-card .category-tagline {
  font-size: 0.66rem;
  color: color-mix(in srgb, var(--chrome-text) 60%, transparent);
  text-align: center;
  line-height: 1.3;
}
@media (hover: hover) {
  .category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.08) inset;
  }
}

/* ═══ DESKTOP / LARGER SCREENS ═══ */
@media (min-width: 640px) {
  :root { --kb-height: 220px; }
  .app-title { font-size: 1.55rem; }
  .app-subtitle { font-size: 0.64rem; }
  .game-main { max-width: 620px; padding-top: 18px; }
  .letter-tile { width: calc(48px * var(--tile-scale, 1)); font-size: 1.7rem; }
  .kb-key { max-width: 46px; height: 52px; font-size: 0.9rem; }
  .kb-key.kb-wide { max-width: 80px; font-size: 0.6rem; }
  .kb-container { padding-bottom: 12px; }
  #keyboard { max-width: 560px; margin: 0 auto; }
  .word-row { padding: 10px 14px 12px; }
  .result-card { padding: 26px 24px; }
}

/* very small phones — shrink the tile itself and the WITHIN-word gap, but
   keep the between-word gap clearly larger than that shrunk value (this is
   the breakpoint that used to collapse both gaps to the same 2px, making
   multi-word answers unreadable as separate words — see tile-word-group). */
@media (max-width: 360px) {
  .letter-tile { width: calc(32px * var(--tile-scale, 1)); font-size: 1.2rem; }
  .tile-word-group { gap: calc(2px * var(--tile-scale, 1)); }
  .tile-grid { gap: calc(8px * var(--tile-scale, 1)) calc(10px * var(--tile-scale, 1)); }
  .kb-key { height: 42px; font-size: 0.72rem; }
}
