/* Sound It First — toddler-safe, tablet-first styles.
   Big targets, high contrast, no scrolling during play. */

:root {
  --bg: #1b2a4a;
  --bg-2: #24386180;
  --ink: #ffffff;
  --ink-soft: #c9d4ee;
  --card: #2d406e;
  --accent: #ffd23f;
  --good: #38d39f;
  --bad: #ff6b6b;

  /* CS2-style 5-player palette (high contrast, distinct) */
  --p1: #f2c94c; /* yellow */
  --p2: #b45ce6; /* purple */
  --p3: #5bd06b; /* green  */
  --p4: #4b8ff0; /* blue   */
  --p5: #ff8a3d; /* orange */

  --glyph-font: "Baloo 2", "Arial Rounded MT Bold", "Comic Sans MS", system-ui, -apple-system, sans-serif;
  --ui-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui-font);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
}

/* ---------- Generic kid buttons ---------- */
.btn {
  font-family: var(--ui-font);
  font-weight: 800;
  border: none;
  border-radius: 28px;
  padding: 26px 40px;
  font-size: clamp(20px, 3.4vw, 34px);
  color: #1b2a4a;
  background: var(--accent);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 14px 24px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  min-height: 88px;
  min-width: 88px;
  touch-action: manipulation;
}
.btn:active { transform: translateY(6px); box-shadow: 0 2px 0 rgba(0,0,0,0.25), 0 6px 12px rgba(0,0,0,0.3); }
.btn.secondary { background: var(--card); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink-soft); box-shadow: none; border: 3px solid #ffffff33; }
.btn.big { font-size: clamp(28px, 6vw, 64px); padding: 34px 64px; border-radius: 36px; }

/* ---------- Home ---------- */
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.home {
  align-items: center;
  /* `safe center` centres when there's room but never clips the top when the
     menu is taller than the viewport (small phones); overflow-y lets it scroll. */
  justify-content: safe center;
  overflow-y: auto;
  gap: 20px;
  text-align: center;
  /* Top padding clears the fixed "‹ morphabet" back-link + the notch/URL bar. */
  padding: max(64px, calc(env(safe-area-inset-top) + 56px)) 20px 28px;
  background:
    radial-gradient(900px 500px at 50% -10%, #34508c 0%, transparent 60%),
    var(--bg);
}
.home .logo {
  font-family: var(--glyph-font);
  font-weight: 800;
  line-height: 0.95;
  font-size: clamp(48px, 10vw, 110px);
  letter-spacing: -1px;
  text-shadow: 0 6px 0 rgba(0,0,0,0.25);
}
.home .logo .sound { color: var(--accent); }
.home .logo .first { color: var(--p2); }
.home .tagline { color: var(--ink-soft); font-size: clamp(15px, 2.4vw, 22px); max-width: 30ch; }
.home .menu { display: flex; flex-direction: column; gap: 14px; width: min(520px, 92vw); }
.home .row { display: flex; gap: 18px; }
.home .row .btn { flex: 1; }

/* Settings — top-right corner icon (mirrors the in-game cog / close button). */
.home-cog { position: fixed; top: 14px; right: 14px; z-index: 60; width: 52px; height: 52px; border-radius: 50%; background: #0007; color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.home-cog:active { transform: translateY(2px); }
.home-cog .cog-ico { width: 28px; height: 28px; }

/* Mode cards (Race / Find it / Practice): short, full-width, icon + title + a
   one-line explanation so the page reads clearly and fits a phone. */
.mode-card {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  border: none; border-radius: 22px; padding: 14px 18px; cursor: pointer; min-height: 74px;
  color: #1b2a4a; font-family: var(--ui-font);
  box-shadow: 0 6px 0 rgba(0,0,0,0.22), 0 12px 20px rgba(0,0,0,0.28);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.mode-card:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,0.22), 0 6px 12px rgba(0,0,0,0.28); }
.mode-card.race { background: var(--accent); }
.mode-card.find { background: var(--good); }
.mode-card.practice { background: var(--card); color: var(--ink); }
/* Fixed icon column so every card's text starts at the SAME x — min-width:0
   defeats the flex auto-min-content floor that let wider emoji push the text. */
.mode-ico { font-size: clamp(26px, 6vw, 36px); line-height: 1; flex: 0 0 1.6em; width: 1.6em; min-width: 0; text-align: center; }
.mode-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mode-title { font-family: var(--glyph-font); font-weight: 800; font-size: clamp(22px, 5vw, 30px); line-height: 1; }
.mode-desc { font-weight: 700; font-size: clamp(12px, 2.5vw, 15px); line-height: 1.25; opacity: 0.82; }
.mode-card.practice .mode-desc { color: var(--ink-soft); opacity: 1; }

/* ---------- Topic picker (Letters / Numbers / Shapes / Colours / Animals) ----------
   A wrapping row of chips at the top of the home menu — scales to any number of
   packs. Sets settings.topic, which Race / Find it / Practice then use. Premium
   packs carry a small ★ badge (non-blocking; see config.hasPremiumAccess). */
.topic-toggle { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; background: #0b1430; border: 3px solid #ffffff22; border-radius: 22px; padding: 8px; }
.topic-btn {
  position: relative; min-height: 52px; border: none; border-radius: 999px;
  background: #ffffff10; color: var(--ink); font-family: var(--ui-font); font-weight: 800;
  font-size: clamp(14px, 2.2vw, 19px); cursor: pointer; padding: 9px 16px;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background 0.12s ease, color 0.12s ease;
}
.topic-btn[aria-pressed="true"] { background: var(--accent); color: #1b2a4a; }
.topic-ico { font-size: 1.15em; line-height: 1; }
.topic-premium {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border-radius: 50%; background: var(--p2); color: #fff; font-size: 12px; font-weight: 800;
}
.topic-btn[aria-pressed="true"] .topic-premium { background: #1b2a4a; color: var(--accent); }

/* Find-it card face for picture packs (shapes/animals): one big emoji. */
.find-emoji { font-size: clamp(48px, 14vmin, 110px); line-height: 1; font-family: var(--ui-font); }
/* Find-it colour swatch card (the Colours pack): exact colour, faint border. */
.find-swatch { width: 78%; aspect-ratio: 1; border-radius: 20px; border: 3px solid #ffffff77; }
/* Find-it "listen" cue (picture packs): a big tappable speaker — find by ear. */
.find-listen { font-size: clamp(64px, 20vmin, 150px); line-height: 1; filter: drop-shadow(0 10px 18px rgba(0,0,0,0.35)); }
/* Setup grid cell for picture packs: emoji big, word label beneath. */
.letter-cell.picture-cell { font-family: var(--ui-font); font-size: clamp(22px, 4vw, 36px); }
.letter-cell.picture-cell small { font-size: 0.4em; }

/* Small "back to the marketing site" link (only when served under /play/) */
.site-link { position: fixed; top: 14px; left: 14px; z-index: 50; color: var(--ink-soft); font-weight: 800; font-size: 15px; text-decoration: none; background: #0006; padding: 9px 15px; border-radius: 999px; }
.site-link:active { transform: translateY(1px); }

/* ---------- Setup ---------- */
.setup { padding: clamp(16px, 3vw, 40px); gap: 18px; overflow-y: auto; }
.setup h1 { font-family: var(--glyph-font); margin: 0; font-size: clamp(28px, 5vw, 48px); }
.setup section { background: var(--bg-2); border-radius: 24px; padding: 18px 20px; }
.setup section h2 { margin: 0 0 12px; font-size: clamp(18px, 3vw, 26px); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 12px; }
.chip {
  border: 3px solid #ffffff33; background: transparent; color: var(--ink);
  border-radius: 999px; padding: 14px 22px; font-size: clamp(16px, 2.6vw, 22px);
  font-weight: 800; cursor: pointer; min-height: 60px;
}
.chip[aria-pressed="true"] { background: var(--accent); color: #1b2a4a; border-color: var(--accent); }

.letter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.letter-cell {
  aspect-ratio: 1; border-radius: 18px; border: 3px solid #ffffff22;
  background: var(--card); color: var(--ink); font-family: var(--glyph-font);
  font-weight: 800; font-size: clamp(24px, 4vw, 40px); cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-direction: column; line-height: 1;
}
.letter-cell small { font-size: 0.66em; color: var(--ink-soft); margin-top: 2px; font-family: var(--ui-font); line-height: 1; }
.letter-cell[aria-pressed="true"] { background: var(--good); color: #0c2a20; border-color: #ffffff; }
/* Accessibility: the word label under a selected cell must read on green too. */
.letter-cell[aria-pressed="true"] small { color: #0c2a20; }
/* Colour swatch shown as a setup-cell face (the Colours pack). */
.cell-swatch { width: 58%; aspect-ratio: 1; border-radius: 9px; border: 2px solid #ffffff77; }
.preset-row { display: flex; gap: 10px; flex-wrap: wrap; }

.setup-footer { display: flex; gap: 16px; padding-top: 8px; }
.setup-footer .btn { flex: 1; }

/* Close ✕ on settings-style pages (top-right; matches Done/Back) */
.close-x { position: fixed; top: 14px; right: 14px; z-index: 70; width: 56px; height: 56px; border-radius: 50%; background: #0007; color: #fff; border: none; font-size: 26px; line-height: 1; cursor: pointer; }
.close-x:active { transform: translateY(2px); }
/* Keep the page heading clear of the close button */
.setup > h1 { padding-right: 64px; }

/* Per-player name inputs (race setup) */
.player-names { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.player-name-row { display: flex; align-items: center; gap: 12px; }
.player-name-row .score-dot { width: 20px; height: 20px; border-radius: 50%; flex: none; }
.player-name {
  flex: 1; border-radius: 12px; border: 3px solid #ffffff33; background: #0b1430;
  color: var(--ink); padding: 12px 14px; font-size: clamp(16px, 2.6vw, 22px);
  font-weight: 800; font-family: var(--ui-font); min-height: 52px;
}

/* ---------- Game ---------- */
.game { position: relative; background: radial-gradient(1200px 800px at 50% 42%, #2c477f 0%, transparent 62%), var(--bg); }

.stage-wrap {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 12vmin; /* leave room for edge buzzers */
}
.stage {
  width: min(60vmin, 560px); height: min(60vmin, 560px);
  filter: drop-shadow(0 18px 30px rgba(0,0,0,0.35));
}
.stage svg { width: 100%; height: 100%; display: block; }

.glyph-text {
  font-family: var(--glyph-font);
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
}

/* The picture (crisp Twemoji SVG) that fades in. Soft shadow lifts it off the bg. */
.emoji-img {
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
}

/* Numbers picture: the grid of native emoji <text> the numeral morphs into. The
   same soft shadow lifts the cluster off the background as the letter image. */
.count-group { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35)); }
.count-emoji { font-family: var(--ui-font); }

/* Round HUD lives in the shared .topwrap (defined with the controls below): a
   controls row (clock left · cog+exit right) with a centred score band beneath,
   so the pieces reflow cleanly on a phone instead of overlapping. */
.scoreband { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.scoreboard { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; min-width: 0; }
.score-pill { display: flex; align-items: center; gap: 7px; background: #0009; border-radius: 999px; padding: 0 14px; min-height: 48px; font-weight: 800; font-size: clamp(14px, 2vw, 19px); }
.score-dot { width: 15px; height: 15px; border-radius: 50%; flex: none; }
.score-name { font-weight: 800; max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-num { background: #ffffff26; border-radius: 999px; padding: 1px 9px; min-width: 22px; text-align: center; color: #fff; }
.round-meta { display: flex; align-items: center; min-height: 48px; background: #0008; border-radius: 999px; padding: 0 16px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; }

/* Morph progress ring / bar (subtle — points value shown) */
.points-now { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-family: var(--glyph-font); font-weight: 800; font-size: clamp(40px, 9vmin, 120px); color: #ffffff14; pointer-events: none; }

/* Edge buzzers — each shows the player's name + live score, stacked + centred. */
.buzzer {
  position: absolute; border: none; cursor: pointer; color: #00000099;
  font-family: var(--glyph-font); font-weight: 800; font-size: clamp(22px, 4vmin, 44px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; line-height: 1; text-align: center; padding: 4px;
  box-shadow: inset 0 0 0 6px #ffffff33; transition: filter 0.08s, transform 0.08s;
}
.bz-name { font-size: 0.5em; opacity: 0.82; max-width: 96%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bz-score { font-size: 1.05em; }
.buzzer:active { filter: brightness(1.15); }
.buzzer:disabled { opacity: 0.28; filter: grayscale(0.6); }
.buzzer.locked { opacity: 0.4; }
.buzzer.bottom { left: 8%; right: 8%; bottom: 0; height: 16vmin; border-radius: 28px 28px 0 0; }
.buzzer.bottomleft  { left: 8%;  width: 39%; bottom: 0; height: 15vmin; border-radius: 28px 28px 0 0; }
.buzzer.bottomright { right: 8%; width: 39%; bottom: 0; height: 15vmin; border-radius: 28px 28px 0 0; }
.buzzer.top    { left: 8%; right: 8%; top: 72px; height: 14vmin; border-radius: 0 0 28px 28px; }
.buzzer.left   { top: 22%; bottom: 22%; left: 0; width: 15vmin; border-radius: 0 28px 28px 0; }
.buzzer.right  { top: 22%; bottom: 22%; right: 0; width: 15vmin; border-radius: 28px 0 0 28px; }

.buzzer.p1 { background: var(--p1); }
.buzzer.p2 { background: var(--p2); }
.buzzer.p3 { background: var(--p3); }
.buzzer.p4 { background: var(--p4); }
.buzzer.p5 { background: var(--p5); }

/* Referee single tap-area */
.referee-hint { position: absolute; bottom: 18vmin; left: 50%; transform: translateX(-50%); color: var(--ink-soft); font-weight: 700; background: #0007; padding: 8px 18px; border-radius: 999px; }

/* Judge overlay */
.overlay {
  position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px; text-align: center;
  background: #0b1430ee; backdrop-filter: blur(3px); padding: 24px;
}
.overlay .who { font-size: clamp(22px, 4vw, 36px); font-weight: 800; }
.overlay .answer { font-family: var(--glyph-font); font-weight: 800; font-size: clamp(40px, 9vw, 96px); }
.overlay .answer .ipa { color: var(--accent); }
.overlay .judge-row { display: flex; gap: 24px; }
.judge-btn { width: clamp(120px, 22vw, 200px); height: clamp(120px, 22vw, 200px); border-radius: 36px; font-size: clamp(48px, 10vw, 96px); border: none; cursor: pointer; box-shadow: 0 10px 0 #0004; }
.judge-btn.yes { background: var(--good); }
.judge-btn.no { background: var(--bad); }
.overlay .pts { font-weight: 800; color: var(--accent); font-size: clamp(20px, 3.4vw, 30px); }

/* During the reveal/answer, hide the edge buzzers so the picture, word and Next
   button own the screen — no more stacking at the bottom. */
.game.revealing .buzzer { display: none; }

/* Reveal / reward — a bottom-anchored column so the spoken-line caption stacks
   cleanly ABOVE the Next button instead of overlapping it (deterministic on any
   phone height, unlike the old fixed-vmin offsets). */
.reveal-bar { position: absolute; left: 12px; right: 12px; bottom: 5vmin; z-index: 35; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; pointer-events: none; }
.reveal-bar > button { pointer-events: auto; }
.reveal-bar .word { font-family: var(--glyph-font); font-weight: 800; font-size: clamp(36px, 8vw, 90px); }
.reveal-bar .phon { color: var(--accent); font-weight: 800; font-size: clamp(22px, 4vw, 40px); }
.reveal-bar .cap-line { color: var(--ink); font-family: var(--glyph-font); font-weight: 800; font-size: clamp(26px, 6vw, 60px); line-height: 1.05; text-shadow: 0 2px 8px rgba(0,0,0,0.55); }

/* Privacy page — plain text, no links */
.privacy-text { color: var(--ink-soft); font-size: clamp(15px, 2.4vw, 18px); line-height: 1.55; margin: 4px 2px; }

/* Practice / Next button (centred via translateX; keep it centred when pressed) */
.practice-cta { position: absolute; left: 50%; bottom: 5vmin; transform: translateX(-50%); }
.practice-cta:active { transform: translateX(-50%) translateY(6px); }

/* ---------- Shared in-game top area (Race · Practice · Find it) ----------
   .topwrap stacks a controls row over a centred score band. Flex + wrap means
   everything reflows cleanly on a phone instead of overlapping. Captions are a
   Settings toggle now, so there's no CC button up here. */
.topwrap { position: absolute; top: 0; left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; gap: 8px; padding: 12px; pointer-events: none; }
.topwrap button, .topwrap .scoreband { pointer-events: auto; }
.toprow { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; }
.topctrls { display: flex; align-items: center; gap: 10px; }

.exit-btn { position: relative; width: 52px; height: 52px; border-radius: 50%; background: #0007; color: #fff; border: none; font-size: 24px; cursor: pointer; overflow: hidden; flex: none; }
.exit-btn .ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 4px var(--accent); clip-path: inset(0 0 100% 0); transition: clip-path 0.05s linear; }
.cog-btn { position: relative; width: 52px; height: 52px; border-radius: 50%; background: #0007; color: #fff; border: none; font-size: 26px; cursor: pointer; flex: none; display: flex; align-items: center; justify-content: center; }
.cog-btn:active { transform: translateY(2px); }

/* White settings gear (line icon, inherits currentColor). */
.cog-ico { width: 1.1em; height: 1.1em; vertical-align: -0.16em; display: inline-block; }
.btn.secondary .cog-ico { margin-right: 0.45em; }
.cog-btn .cog-ico { width: 28px; height: 28px; }

/* Countdown clock (top-left, optional — toggle in Settings). A pie that empties
   as the round's time runs out. --p = fraction of time REMAINING (1 → 0). */
.clock { position: relative; width: 52px; height: 52px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 2px #ffffff33; background: conic-gradient(var(--accent) calc(var(--p, 1) * 360deg), #ffffff1f 0deg); display: flex; align-items: center; justify-content: center; }
.clock.low { background: conic-gradient(var(--bad) calc(var(--p, 1) * 360deg), #ffffff1f 0deg); }
.clock-num { font-weight: 800; font-size: 19px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.85); font-variant-numeric: tabular-nums; }

/* Ready countdown */
.ready { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 40; }
.ready .num { font-family: var(--glyph-font); font-weight: 800; font-size: clamp(80px, 28vmin, 320px); color: var(--accent); animation: pop 0.5s ease; }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Results */
.results { align-items: center; justify-content: center; gap: 24px; text-align: center; padding: 24px; }
.results h1 { font-family: var(--glyph-font); font-size: clamp(36px, 8vw, 80px); margin: 0; }
.podium { display: flex; gap: 16px; align-items: flex-end; }
.podium .bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; border-radius: 18px 18px 0 0; padding: 14px; min-width: 90px; color: #0b1430; font-weight: 800; }
.podium .bar .num { font-size: clamp(28px, 6vw, 56px); font-family: var(--glyph-font); }
.podium .bar .medal { font-size: clamp(28px, 6vw, 48px); line-height: 1; min-height: 1px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Find it (pick-of-three) ---------- */
/* "Find it" home button gets the green accent so it reads as a learning mode,
   distinct from the yellow Race button. */
.find-cta { background: var(--good); color: #0c2a20; }

.find {
  position: relative; align-items: center; justify-content: center; gap: clamp(16px, 4vmin, 48px);
  padding: 16px;
  background: radial-gradient(1200px 800px at 50% 36%, #2c477f 0%, transparent 62%), var(--bg);
}

/* HUD: streak + score pills, top-centre, clear of the exit/cog buttons. */
.find-pill { display: flex; align-items: center; gap: 6px; min-height: 48px; background: #0009; border-radius: 999px; padding: 0 20px; font-weight: 800; font-size: clamp(18px, 2.8vw, 24px); color: var(--ink); }

/* The target prompt: bare glyph (a small frozen MorphStage) + "Find it!" caption.
   Tapping it replays the spoken line. */
.find-prompt { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; }
.find-prompt-stage { width: min(34vmin, 280px); height: min(34vmin, 280px); filter: drop-shadow(0 12px 22px rgba(0,0,0,0.35)); }
.find-prompt-stage svg { width: 100%; height: 100%; display: block; }
.find-say { font-family: var(--glyph-font); font-weight: 800; font-size: clamp(22px, 4vw, 40px); color: var(--ink-soft); }
.find-prompt:active { transform: translateY(2px); }

/* Option cards — big, tappable picture tiles in a wrapping row. */
.find-options { display: flex; flex-wrap: wrap; gap: clamp(12px, 3vmin, 28px); justify-content: center; align-items: center; max-width: 96vw; }
.find-card {
  width: clamp(96px, 22vmin, 200px); height: clamp(96px, 22vmin, 200px);
  border-radius: 28px; border: 4px solid #ffffff22; background: var(--card);
  cursor: pointer; padding: 10px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 0 rgba(0,0,0,0.25), 0 14px 24px rgba(0,0,0,0.3);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease, opacity 0.2s ease;
}
.find-card:active { transform: translateY(6px); box-shadow: 0 2px 0 rgba(0,0,0,0.25), 0 6px 12px rgba(0,0,0,0.3); }
.find-card-img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.35)); }

/* Numbers option card: a tidy grid of `count` emoji the child counts to match
   the target numeral. Columns come from --n (≈ √count) set inline per card. */
.find-count {
  width: 100%; height: 100%; display: grid; gap: 4%;
  grid-template-columns: repeat(var(--n, 3), 1fr);
  align-content: center; justify-items: center; align-items: center;
  pointer-events: none;
}
/* Emoji shrink as the count (columns) grows so even 10 fit inside the card. */
.find-count-emoji { font-size: clamp(11px, calc(15vmin / var(--n, 3)), 46px); line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35)); }

.find-card.correct { border-color: var(--good); background: var(--good); transform: translateY(0) scale(1.04); box-shadow: 0 0 0 6px #5bd06b66, 0 10px 24px rgba(0,0,0,0.35); }
.find-card.faded { opacity: 0.32; filter: grayscale(0.5); }
.find-card.wrong { border-color: var(--bad); animation: find-wobble 0.4s ease; opacity: 0.45; }

@keyframes find-wobble {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px) rotate(-4deg); }
  40% { transform: translateX(10px) rotate(4deg); }
  60% { transform: translateX(-7px) rotate(-2deg); }
  80% { transform: translateX(7px) rotate(2deg); }
}

/* Next button — centred at the bottom, like the game's practice/Next CTA. */
.find-next { position: absolute; left: 50%; bottom: 5vmin; transform: translateX(-50%); }
.find-next:active { transform: translateX(-50%) translateY(6px); }

/* ---------- Developer audio debug ---------- */
.debug-screen .chip.small { min-height: 44px; padding: 8px 14px; font-size: 16px; }
.debug-ep { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.debug-input {
  flex: 1; min-width: 220px; border-radius: 12px; border: 2px solid #ffffff33;
  background: #0b1430; color: var(--ink); padding: 12px 14px; font-size: 16px; font-family: var(--ui-font);
}
.debug-pill { background: #0b1430; border-radius: 999px; padding: 8px 14px; font-weight: 800; color: var(--ink-soft); }
.debug-list { display: flex; flex-direction: column; gap: 8px; }
.debug-row { display: flex; align-items: center; gap: 10px; background: #ffffff10; border-radius: 12px; padding: 8px 12px; }
.debug-letter { font-family: var(--glyph-font); font-weight: 800; font-size: 22px; min-width: 56px; }
.debug-word { flex: 1; color: var(--ink-soft); }
.debug-status {
  position: sticky; bottom: 0; margin-top: 14px; background: #0b1430ee; border-radius: 12px;
  padding: 12px 14px; color: var(--ink-soft); font-size: 14px; line-height: 1.4; word-break: break-word;
}
