/* ==========================================================================
   Kids: word cards, the little-kid hub, and everything that speaks
   ========================================================================== */

/* --- the speaker button ------------------------------------------------ */
.say-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap);
  padding: 10px 18px;
  border: 0; border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-size: .95rem; font-weight: 800; letter-spacing: .01em;
  box-shadow: 0 4px 0 var(--accent-2), var(--sh-2);
  transition: transform .12s var(--ease-bounce), box-shadow .12s var(--ease);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.say-btn svg { width: 1.35em; height: 1.35em; flex: none; }
.say-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--accent-2), var(--sh-3); }
.say-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--accent-2); }
.say-sm { min-height: 38px; padding: 6px 12px; font-size: .82rem; }
.say-sm svg { width: 1.1em; height: 1.1em; }
.say-lg { min-height: 60px; padding: 14px 30px; font-size: 1.15rem; }
.say-icon { padding: 0; width: var(--tap); height: var(--tap); border-radius: 50%; }

.say-btn.saying { animation: sayPulse .7s var(--ease) infinite; }
@keyframes sayPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.09); }
}

/* Tappable words in the reader's recognised-text layer. Nothing else marks
   them, so they need a hint that a word can be heard. */
.tl-page .say-word { cursor: pointer; border-radius: 4px; }
.tl-page .say-word:hover,
.tl-page .say-word:focus-visible,
.tl-page .say-word.saying { background: var(--accent-soft); }
/* No recording AND no device voice: say so rather than looking broken. */
.say-btn.no-voice { background: var(--warn); box-shadow: 0 4px 0 #8a6100; }

/* a big round speaker that floats over a word card */
.say-float {
  position: absolute; right: 14px; top: 14px;
  width: 52px; height: 52px; border-radius: 50%;
  border: 0; background: var(--accent); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 4px 0 var(--accent-2), var(--sh-2);
  cursor: pointer;
  transition: transform .12s var(--ease-bounce);
}
.say-float svg { width: 24px; height: 24px; }
.say-float:hover { transform: scale(1.08); }
.say-float:active { transform: scale(.94); }

/* A game option that carries its own speaker: the "right answer" highlight
   still lands on the row, so the option inside it must show it too. */
.choice-hold.correct .choice { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.choice-hold.correct .choice .ck { background: var(--ok); border-color: var(--ok); color: #fff; }

/* --- the word card ------------------------------------------------------ */
.word-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
}
.word-card {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 10px;
  min-height: 148px;
  padding: 18px 18px 14px;
  border-radius: var(--r-lg);
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: var(--sh-1);
  cursor: pointer; text-align: left;
  transition: transform .16s var(--ease-bounce), box-shadow .18s var(--ease),
              border-color .18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.word-card:hover {
  transform: translateY(-4px) rotate(-.6deg);
  box-shadow: var(--sh-3);
  border-color: var(--brand-tint);
}
.word-card:active { transform: translateY(0) scale(.99); }
.word-card .wc-tr {
  font-family: var(--display);
  font-size: clamp(1.25rem, 1rem + 1.4vw, 1.7rem);
  font-weight: 800; line-height: 1.15;
  letter-spacing: -.015em; color: var(--ink);
  /* Room for the floating speaker, expressed in em so it grows with the text
     size. As a fixed 46px it stayed put while the type got bigger, and at
     "Biggest" the button landed on top of longer words. */
  padding-right: 3.2em;
  overflow-wrap: break-word;
  text-wrap: balance;      /* avoid a lone letter wrapping onto its own line */
}
.word-card .wc-en {
  font-size: .9rem; color: var(--ink-3); font-weight: 600;
  padding-right: 52px;     /* clears the 52px floating speaker at every size */
  overflow-wrap: break-word;
  text-wrap: pretty;
}
.word-card .wc-foot {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.word-card .wc-lv {
  font-size: .68rem; font-weight: 800; letter-spacing: .04em;
  padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--ink-3);
  border: 1px solid var(--border);
}
.word-card.heard { border-color: var(--ok); }
.word-card.heard::after {
  content: "✓"; position: absolute; left: 14px; top: 12px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ok); color: #fff;
  display: grid; place-items: center; font-size: .78rem; font-weight: 900;
}

/* filter row */
.kid-filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 20px;
}
.kid-chip {
  min-height: 44px; padding: 9px 20px;
  border-radius: var(--r-pill);
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: .95rem; font-weight: 800; color: var(--ink-2);
  cursor: pointer;
  transition: transform .14s var(--ease-bounce), background .16s var(--ease),
              border-color .16s var(--ease), color .16s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.kid-chip:hover { transform: translateY(-2px); }
.kid-chip[aria-pressed="true"] {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 3px 0 var(--brand-2);
}

/* --- the big word stage (used by the cards game + modal) ---------------- */
.word-stage {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; text-align: center;
  min-height: min(58vh, 460px);
  padding: 40px 26px;
  border-radius: var(--r-xl);
  border: 3px solid var(--border);
  background:
    radial-gradient(120% 90% at 50% 0%, var(--brand-soft), transparent 62%),
    var(--surface);
  box-shadow: var(--sh-3);
  overflow: hidden;
}
.word-stage .ws-word {
  font-family: var(--display);
  font-size: clamp(2.4rem, 1.4rem + 6vw, 5.4rem);
  font-weight: 900; line-height: 1.02; letter-spacing: -.03em;
  color: var(--ink); word-break: break-word;
}
.word-stage .ws-en {
  font-size: clamp(1.05rem, .9rem + 1vw, 1.5rem);
  color: var(--ink-2); font-weight: 700;
}
.word-stage .ws-meta {
  font-size: .82rem; color: var(--ink-4); font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
}
.word-stage.reveal .ws-en { animation: popIn .3s var(--ease-bounce) both; }

/* --- big buttons for small hands --------------------------------------- */
.big-actions {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}
.big-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 24px 24px 22px;
  border-radius: var(--r-lg);
  border: 3px solid var(--border);
  background: var(--surface);
  box-shadow: var(--sh-2);
  cursor: pointer; text-align: left;
  transition: transform .16s var(--ease-bounce), box-shadow .18s var(--ease),
              border-color .18s var(--ease);
  -webkit-tap-highlight-color: transparent;
  text-decoration: none; color: inherit;
}
.big-btn:hover {
  transform: translateY(-5px);
  box-shadow: var(--sh-4);
  border-color: var(--bb, var(--brand));
  text-decoration: none; color: inherit;
}
.big-btn:active { transform: translateY(-1px); }
.big-btn .bb-emoji { font-size: 2.6rem; line-height: 1; }
.big-btn .bb-name {
  font-family: var(--display);
  font-size: 1.35rem; font-weight: 800; letter-spacing: -.015em;
}
.big-btn .bb-sub { font-size: .9rem; color: var(--ink-3); font-weight: 600; }
.big-btn .bb-badge {
  position: absolute; right: 18px; top: 18px;
  min-width: 34px; height: 34px; padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--bb, var(--brand)); color: #fff;
  display: grid; place-items: center;
  font-size: .86rem; font-weight: 900;
  box-shadow: var(--sh-1);
}
.big-btn.tone-brand { --bb: var(--brand); background: linear-gradient(160deg, var(--brand-soft), var(--surface) 70%); }
.big-btn.tone-accent { --bb: var(--accent); background: linear-gradient(160deg, var(--accent-soft), var(--surface) 70%); }
.big-btn.tone-gold { --bb: var(--gold); background: linear-gradient(160deg, var(--gold-soft), var(--surface) 70%); }
.big-btn.tone-sky { --bb: var(--sky); background: linear-gradient(160deg, var(--sky-soft), var(--surface) 70%); }
.big-btn.tone-grape { --bb: var(--grape); background: linear-gradient(160deg, var(--grape-soft), var(--surface) 70%); }
.big-btn.tone-pink { --bb: var(--pink); background: linear-gradient(160deg, var(--pink-soft), var(--surface) 70%); }

/* --- level picker cards ------------------------------------------------- */
.level-cards {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
}
.level-card2 {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 22px 16px 18px;
  border-radius: var(--r-lg);
  border: 3px solid var(--lc, var(--brand));
  background: var(--surface);
  box-shadow: var(--sh-2);
  cursor: pointer; text-align: center;
  transition: transform .16s var(--ease-bounce), box-shadow .18s var(--ease);
  text-decoration: none; color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.level-card2:hover { transform: translateY(-5px) rotate(1deg); box-shadow: var(--sh-4); text-decoration: none; color: inherit; }
.level-card2 .lc-num {
  width: 62px; height: 62px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--lc, var(--brand)); color: #fff;
  font-family: var(--display); font-size: 1.9rem; font-weight: 900;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.15);
}
.level-card2 .lc-name { font-family: var(--display); font-weight: 800; font-size: 1.05rem; }
.level-card2 .lc-sub { font-size: .8rem; color: var(--ink-3); font-weight: 700; }

/* --- stars / stickers --------------------------------------------------- */
.stars-row { display: flex; gap: 4px; }
.stars-row i {
  width: 20px; height: 20px; display: block;
  background: var(--gold);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  opacity: .25;
}
.stars-row i.on { opacity: 1; animation: popIn .3s var(--ease-bounce) both; }

.sticker {
  display: inline-grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--gold-soft);
  font-size: 1.4rem;
  border: 2px solid var(--gold);
}
.sticker.locked { filter: grayscale(1); opacity: .35; border-color: var(--border); background: var(--surface-2); }

/* --- celebration -------------------------------------------------------- */
.cheer {
  position: fixed; inset: 0; z-index: 600;
  pointer-events: none; overflow: hidden;
}
.cheer i {
  position: absolute; top: -8vh;
  width: 12px; height: 12px; border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(112vh) rotate(720deg); opacity: .9; }
}

.big-score {
  font-family: var(--display);
  font-size: clamp(3rem, 2rem + 6vw, 5.5rem);
  font-weight: 900; line-height: 1;
  letter-spacing: -.04em;
  background: linear-gradient(135deg, var(--brand), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* --- kid header --------------------------------------------------------- */
.kid-hero {
  text-align: center;
  padding: 30px 20px 26px;
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 100% at 50% 0%, var(--brand-soft), transparent 65%),
    linear-gradient(180deg, var(--surface), var(--paper));
  border: 3px solid var(--border);
  margin-bottom: 26px;
}
.kid-hero h1 {
  font-family: var(--display);
  font-size: clamp(1.9rem, 1.3rem + 3.4vw, 3.2rem);
  font-weight: 900; letter-spacing: -.03em; margin: 0 0 8px;
}
.kid-hero p { font-size: 1.05rem; color: var(--ink-2); max-width: 54ch; margin: 0 auto; font-weight: 600; }

@media (max-width: 560px) {
  .word-card { min-height: 130px; padding: 15px 15px 12px; }
  .say-float { width: 46px; height: 46px; right: 10px; top: 10px; }
  .word-card .wc-tr, .word-card .wc-en { padding-right: 42px; }
  .word-stage { padding: 28px 16px; border-radius: var(--r-lg); }
}

/* Respect a child who finds motion distracting */
@media (prefers-reduced-motion: reduce) {
  .word-card, .big-btn, .level-card2, .say-btn { transition: none; }
  .word-card:hover, .big-btn:hover, .level-card2:hover { transform: none; }
  .cheer { display: none; }
}
