/* ==========================================================================
   English Adventure — child-friendly, large, touch-first, responsive UI.
   ========================================================================== */
/* Buddy mascot artwork + all its animations live in one place. */
@import url('../animation/buddy.css');

:root {
  --yellow: #ffb703;
  --orange: #fb8500;
  --blue: #219ebc;
  --deep-blue: #023047;
  --sky: #8ecae6;
  --green: #43aa8b;
  --red: #ef476f;
  --purple: #8338ec;
  --bg: #fff8ec;
  --card: #ffffff;
  --shadow: 0 8px 0 rgba(0, 0, 0, 0.08), 0 12px 24px rgba(0, 0, 0, 0.12);
  --radius: 26px;
  --tap: 64px;
  --buddy-safe-area: 0px;
  font-size: clamp(16px, 2.6vw, 22px);
}

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

/* Safety net: every button/clickable element shows the hand cursor, even if a
   specific component class forgets to set one. */
button, [role="button"], a, label, select { cursor: pointer; }
button:disabled, [disabled] { cursor: not-allowed; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--deep-blue);
  font-family: 'Baloo 2', 'Comic Sans MS', 'Trebuchet MS', system-ui, sans-serif,
    'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  overscroll-behavior: none;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  /* reserves a top strip for the fixed HUD + speaker so topbars never underlap them */
  padding: calc(64px + env(safe-area-inset-top)) 16px
    calc(16px + env(safe-area-inset-bottom) + var(--buddy-safe-area));
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fade 0.25s ease;
}
.screen--home { padding-top: 26px; }
.reduce-motion .screen,
.reduce-motion * { animation: none !important; transition: none !important; }

@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(0.8); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes fox-float { 0%, 100% { transform: translateX(-38%) translateY(0); } 50% { transform: translateX(-38%) translateY(-8px); } }
@keyframes fox-floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes fox-bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-5px) rotate(4deg); } }

/* ---------- Buttons ------------------------------------------------------- */
.big-btn {
  width: 100%;
  min-height: var(--tap);
  border: none;
  border-radius: var(--radius);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  background: var(--blue);
  box-shadow: var(--shadow);
  cursor: pointer;
  padding: 16px 20px;
  margin: 6px 0;
  transition: transform 0.08s ease, filter 0.15s ease;
  touch-action: manipulation;
}
.big-btn:active { transform: translateY(3px); filter: brightness(0.97); }
.big-btn--primary { background: linear-gradient(180deg, var(--orange), #f4712e); }
.big-btn--ghost { background: #fff; color: var(--deep-blue); border: 3px solid #ffd79a; box-shadow: 0 6px 0 #ffe4b8; }
.big-btn--listen { background: linear-gradient(180deg, var(--blue), #1b87a3); }
.big-btn--speak { background: linear-gradient(180deg, var(--purple), #6f2bd6); }
.big-btn--danger { background: linear-gradient(180deg, var(--red), #d63a5f); }
.big-btn:disabled { opacity: 0.5; }

.icon-btn {
  min-width: 52px; min-height: 52px;
  border: none; border-radius: 18px;
  background: #fff; box-shadow: var(--shadow);
  font-size: 1.5rem; cursor: pointer;
}
.icon-btn:active { transform: translateY(2px); }

.link-btn {
  background: none; border: none; color: var(--blue);
  font-weight: 800; font-size: 1rem; cursor: pointer;
  padding: 10px 12px; min-height: 44px;
}
.link-btn.danger { color: var(--red); }

/* ---------- Welcome ------------------------------------------------------- */
.screen--welcome { justify-content: center; }
.welcome-card {
  background: var(--card);
  border-radius: 32px;
  box-shadow: var(--shadow);
  padding: 28px 22px;
  text-align: center;
}
.welcome-emoji { font-size: 4.5rem; animation: pop 0.5s ease; }
.welcome-title { margin: 6px 0 2px; font-size: 2rem; color: var(--orange); }
.welcome-sub { margin: 0 0 18px; color: var(--blue); font-weight: 700; }
.field-label { display: block; text-align: left; font-weight: 800; margin: 10px 4px 4px; }
.field {
  width: 100%; min-height: 58px;
  border: 3px solid var(--sky); border-radius: 18px;
  padding: 12px 16px; font-size: 1.2rem; font-family: inherit;
  background: #fbffff;
}
.field:focus { outline: none; border-color: var(--blue); }
.form-error { color: var(--red); font-weight: 800; min-height: 1.2em; margin: 8px 0 0; }

/* ---------- Splash -------------------------------------------------------- */
.screen--splash { justify-content: center; align-items: center; }
.splash-card {
  background: var(--card);
  border-radius: 32px;
  box-shadow: var(--shadow);
  padding: 18px 18px 24px;
  text-align: center;
  width: 100%;
}
.splash-scene { position: relative; width: 100%; max-width: 420px; margin: 0 auto 12px; }
.splash-art {
  width: 100%;
  border-radius: 24px;
  display: block;
  animation: pop 0.5s ease;
}
/* Animated fox overlaid on the splash scene (blinks + wags automatically) */
/* translateX is -38% (not -50%) to offset the fox's tail so the body looks centred. */
.splash-fox {
  position: absolute; left: 50%; bottom: 4%;
  width: 63%; transform: translateX(-38%); cursor: pointer;
  animation: fox-float 3.2s ease-in-out infinite;
  filter: drop-shadow(0 8px 8px rgba(0,0,0,0.18));
}
.splash-fox svg { width: 100%; height: auto; display: block; }
.splash-title { margin: 4px 0 2px; font-size: clamp(1.7rem, 7vw, 2.3rem); color: var(--orange); }
.splash-sub { margin: 0 0 16px; color: var(--blue); font-weight: 800; font-size: 1.1rem; }

/* ---------- Onboarding (name / age / class) ------------------------------- */
.screen--onboard { align-items: center; text-align: center; }
.onboard-top { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.icon-spacer { min-width: 52px; display: inline-block; }
.onboard-dots { display: flex; gap: 10px; }
/* Big animated fox in the top section */
.onboard-hero {
  position: relative;
  width: 200px; height: 200px; margin: 6px auto 2px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #fff6e6, #ffe3a3);
  box-shadow: inset 0 -8px 0 rgba(0,0,0,0.04);
  display: flex; align-items: flex-end; justify-content: center;
  animation: pop 0.45s ease;
}
.onboard-fox {
  width: 78%; margin-bottom: -6px; cursor: pointer;
  position: relative; left: 19px; /* offset the tail so the body looks centred */
  animation: fox-floaty 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 8px rgba(0,0,0,0.18));
}
.onboard-fox svg { width: 100%; height: auto; display: block; }
.onboard-badge {
  position: absolute; top: 6px; right: 6px;
  width: 48px; height: 48px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
  animation: fox-bob 2.4s ease-in-out infinite;
}
.onboard-q { font-size: clamp(1.6rem, 7vw, 2.2rem); margin: 4px 0 10px; color: var(--deep-blue); }
.onboard-body { width: 100%; max-width: 420px; }
.onboard-hint { font-weight: 800; color: var(--blue); margin: 4px 0 12px; font-size: 1.15rem; }
.onboard-note { color: #8a7a5a; font-weight: 700; font-size: 0.95rem; margin: 12px 0 0; }
.field--big { text-align: center; font-size: 1.5rem; min-height: 66px; }
.greet {
  font-size: 1.8rem; font-weight: 900; color: var(--green);
  background: #e6ffef; border-radius: 18px; padding: 16px; margin-bottom: 8px;
  animation: pop 0.4s ease;
}
.pick-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.pick-grid--age { grid-template-columns: repeat(4, 1fr); }
.pick-grid--age .pick-btn { font-size: 1.15rem; }
.pick-grid--wide { grid-template-columns: repeat(2, 1fr); }
.pick-grid--list { grid-template-columns: 1fr; gap: 12px; }
.pick-btn {
  border: none; cursor: pointer;
  background: #fff; color: var(--deep-blue);
  border-radius: 18px; box-shadow: var(--shadow);
  min-height: 66px; font-size: 1.6rem; font-weight: 900;
}
.pick-btn--wide { font-size: 1.3rem; min-height: 64px; }
.pick-btn--row { font-size: 1.25rem; min-height: 66px; padding: 12px 18px; white-space: normal; line-height: 1.2; }
.pick-btn:active { transform: translateY(2px); }
.pick-btn.is-selected { background: #d7ffe7; box-shadow: 0 0 0 4px var(--green), var(--shadow); }

/* ---------- Home ---------------------------------------------------------- */
.home-top { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.hello { font-size: 1.5rem; font-weight: 900; line-height: 1.1; }
.sub-hello { color: var(--blue); font-weight: 800; font-size: 1rem; margin-top: 2px; }

.home-launcher {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.home-launcher__btn {
  border: none;
  border-radius: 24px;
  padding: 10px 12px;
  min-height: 96px;
  background: #fff7e8;
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.12), 0 18px 28px rgba(0, 0, 0, 0.13);
  font-weight: 900;
  color: var(--deep-blue);
  display: grid;
  grid-template-columns: 48px 1fr;
  grid-template-rows: 1fr 1fr;
  column-gap: 10px;
  align-items: center;
  justify-items: start;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.home-launcher__btn::after {
  content: '';
  position: absolute;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  right: -26px;
  top: -34px;
  background: rgba(255, 255, 255, 0.35);
}
.home-launcher__icon {
  font-size: 1.7rem;
  line-height: 1;
  z-index: 1;
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
}
.home-launcher__title {
  font-size: 1.05rem;
  line-height: 1.1;
  z-index: 1;
  grid-column: 2;
  grid-row: 1;
  align-self: end;
}
.home-launcher__hint {
  font-size: 0.82rem;
  color: rgba(2, 48, 71, 0.75);
  z-index: 1;
  grid-column: 2;
  grid-row: 2;
  align-self: start;
}

.home-launcher__btn:nth-child(1) {
  background: linear-gradient(145deg, #fff8d8, #ffe8a6);
}
.home-launcher__btn:nth-child(2) {
  background: linear-gradient(145deg, #e5f6ff, #c8ebff);
}
.home-launcher__btn:nth-child(3) {
  background: linear-gradient(145deg, #eaffef, #cdf8da);
}
.home-launcher__btn:nth-child(4) {
  background: linear-gradient(145deg, #f8edff, #ead4ff);
}
.home-launcher__btn:nth-child(5) {
  background: linear-gradient(145deg, #ffeede, #ffd9b8);
}
.home-launcher__btn.is-active {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 0 0 4px #fff, 0 0 0 7px #ffbf43, 0 14px 0 rgba(0, 0, 0, 0.14), 0 22px 34px rgba(0, 0, 0, 0.15);
  filter: saturate(1.06);
}
.home-launcher__btn:active { transform: translateY(1px) scale(0.995); }

.home-pane { display: none; }
.home-pane.is-active { display: flex; flex-direction: column; gap: 14px; }

/* Keep a clean gap between the fixed reward HUD and section-page back button. */
.screen--home-section .topbar { margin-top: 14px; }

.category-note {
  margin: 0 4px 4px;
  color: #6f5d3b;
  font-weight: 700;
}
.category-empty {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
  font-weight: 800;
}
.category-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.category-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 14px;
}
.category-card--visual {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.category-art {
  position: relative;
  border-radius: 16px;
  min-height: 138px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.category-art::before,
.category-art::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  opacity: 0.32;
}
.category-art::before {
  width: 110px;
  height: 110px;
  top: -24px;
  left: -20px;
  background: #fff;
}
.category-art::after {
  width: 130px;
  height: 130px;
  right: -28px;
  bottom: -44px;
  background: #fff7d4;
}
.category-art__emoji {
  font-size: 3.8rem;
  z-index: 1;
  filter: drop-shadow(0 8px 6px rgba(0, 0, 0, 0.18));
}
.category-art.tone-1 { background: linear-gradient(135deg, #8ad7ff, #60a5fa); }
.category-art.tone-2 { background: linear-gradient(135deg, #ffb86b, #ff7b7b); }
.category-art.tone-3 { background: linear-gradient(135deg, #86efac, #22c55e); }
.category-art.tone-4 { background: linear-gradient(135deg, #f9a8d4, #c084fc); }
.category-art.tone-5 { background: linear-gradient(135deg, #fcd34d, #fb923c); }
.category-art.tone-6 { background: linear-gradient(135deg, #a5f3fc, #2dd4bf); }
.category-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.category-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.category-emoji { font-size: 1.5rem; }
.category-title {
  margin: 0;
  font-size: 1.05rem;
  text-align: center;
}
.category-desc {
  margin: 8px 0 0;
  color: #355070;
  font-weight: 700;
}
.category-plan {
  margin: 7px 0 0;
  color: var(--orange);
  font-weight: 900;
  font-size: 0.95rem;
}
.category-chips {
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.category-chip {
  display: inline-flex;
  align-items: center;
  background: #f0f7ff;
  color: #16426b;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.9rem;
  font-weight: 800;
}

.mini-playground {
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 14px;
}
.games-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  margin-bottom: 8px;
}
.games-actions .big-btn {
  margin: 0;
  min-height: 52px;
  font-size: 0.95rem;
  padding: 10px 8px;
}
.mini-card { display: flex; flex-direction: column; gap: 10px; }
.mini-question {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--deep-blue);
}
.mini-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.mini-options--words {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mini-word-btn {
  min-height: 62px;
  font-size: 1rem;
  padding: 8px;
  line-height: 1.15;
  word-break: break-word;
}
.mini-odd-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.odd-card {
  border: 2px solid #d9e6f2;
  border-radius: 16px;
  min-height: 90px;
  background: linear-gradient(180deg, #ffffff, #f3f8ff);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: var(--deep-blue);
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(10, 36, 66, 0.08);
}
.odd-card:active { transform: translateY(2px); }
.odd-card__emoji { font-size: 1.8rem; line-height: 1; }
.odd-card__image {
  width: min(100%, 88px); height: 68px; object-fit: contain; border-radius: 10px;
}
.odd-card__word { font-size: 0.98rem; }
/* Single-style options: bigger emoji when picture-only, bigger word when text-only. */
.odd-card--emoji .odd-card__emoji { font-size: 2.6rem; }
.odd-card__word--solo { font-size: 1.25rem; }
/* Guide / learn phase — picture + word shown together before the quiz. */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 480px) { .guide-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.guide-card {
  border: 2px solid #d9e6f2;
  border-radius: 16px;
  min-height: 96px;
  background: linear-gradient(180deg, #ffffff, #eef6ff);
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: var(--deep-blue);
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(10, 36, 66, 0.08);
}
.guide-card:active { transform: translateY(2px); }
.guide-card__emoji { font-size: 2.8rem; line-height: 1; }
.guide-card__image {
  width: min(100%, 96px); height: 64px; object-fit: contain; border-radius: 10px;
}
.guide-card__word { font-size: 1.05rem; }
.mini-memory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.mini-memory-card { min-height: 68px; font-size: 0.95rem; }
.mini-good { background: #d9ffe7; color: #127445; }
.mini-bad { background: #ffe0e8; color: #a31a45; }

.mini-lanes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.mini-lane {
  border-radius: 12px;
  padding: 10px 12px;
  background: #eef5ff;
  font-weight: 800;
}
.mini-lane--car { outline: 3px solid #5bb2ff; }
.mini-lane--obs { background: #fff2e0; }

.mini-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mini-controls .big-btn {
  min-height: 52px;
  font-size: 0.95rem;
  padding: 10px 8px;
  margin: 0;
}
.home-categories .category-desc,
.home-categories .category-plan,
.home-categories .category-chips,
.home-categories .category-head,
.home-categories .category-note {
  display: none;
}
.home-categories .big-btn {
  margin: 0;
  min-height: 52px;
  font-size: 1rem;
  padding: 12px 14px;
}

.future-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 18px;
  text-align: center;
}
.future-card__emoji {
  font-size: 3rem;
  line-height: 1;
}
.future-card__title {
  margin-top: 8px;
  font-weight: 900;
  font-size: 1.1rem;
}
.future-card__sub {
  margin-top: 6px;
  color: #5a6c82;
  font-weight: 700;
  font-size: 0.95rem;
}

/* Home settings gear — sits in the fixed top-right cluster, left of the speaker */
.home-settings {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  right: 58px;
  z-index: 60;
  width: 42px; height: 42px;
  border: none; border-radius: 13px;
  background: #fff; box-shadow: var(--shadow);
  font-size: 1.2rem; cursor: pointer; line-height: 1;
}
.home-settings:active { transform: translateY(2px); }
.stars-pill {
  display: inline-block; margin-top: 6px;
  background: #fff3d1; color: var(--orange);
  border-radius: 999px; padding: 4px 14px; font-weight: 900;
}
.hero-card {
  background: linear-gradient(160deg, #fff, #fff4dc);
  border-radius: 32px; box-shadow: var(--shadow);
  padding: 22px; text-align: center;
}
.hero-emoji { font-size: 4rem; animation: pop 0.5s ease; }
.hero-level { font-weight: 900; font-size: 1.2rem; color: var(--blue); }
.hero-lesson { font-size: 1.5rem; font-weight: 900; margin: 2px 0 14px; }

.section-title { font-size: 1.2rem; margin: 6px 4px; }
.level-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.level-tile {
  position: relative; border: none; cursor: pointer;
  background: #fff; border-radius: 22px; box-shadow: var(--shadow);
  padding: 16px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 110px;
}
.level-tile:active { transform: translateY(2px); }
.level-tile__emoji { font-size: 2.4rem; }
.level-tile__no { font-weight: 900; }
.level-tile__badge { position: absolute; top: 8px; right: 10px; font-size: 1.2rem; }
.level-tile--locked { filter: grayscale(0.7); opacity: 0.65; cursor: not-allowed; }
.level-tile--completed { background: #eafff4; }

/* ---------- Topbar / level & lesson lists --------------------------------- */
.topbar { display: flex; align-items: center; gap: 10px; }
.topbar__title { flex: 1; text-align: center; font-weight: 900; font-size: 1.3rem; }
.topbar__right { min-width: 52px; text-align: right; font-weight: 900; color: var(--blue); }

.lesson-list { display: flex; flex-direction: column; gap: 12px; }
.lesson-row {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: none; border-radius: 20px; box-shadow: var(--shadow);
  padding: 18px 18px; cursor: pointer; text-align: left;
}
.lesson-row:active { transform: translateY(2px); }
.lesson-row__badge { font-size: 1.5rem; }
.lesson-row__title { flex: 1; font-weight: 900; font-size: 1.15rem; }
.lesson-row__go { font-size: 1.6rem; color: var(--blue); }
.lesson-row--locked { filter: grayscale(0.7); opacity: 0.6; cursor: not-allowed; }
.lesson-row--completed { background: #eafff4; }

@media (max-width: 479px) {
  .lesson-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 4px;
    padding: 14px 16px;
  }
  .lesson-row__badge { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
  .lesson-row__title {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }
  .lesson-row__go {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    min-width: 0;
    font-size: 1.15rem;
    line-height: 1.2;
  }
}

/* ---------- Lesson stage -------------------------------------------------- */
.screen--lesson { gap: 12px; }
.stage {
  flex: 1;
  background: var(--card);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 20px 18px;
  display: flex; flex-direction: column; justify-content: center;
}

.dots { display: flex; gap: 8px; justify-content: center; padding: 4px; flex-wrap: wrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #e6d4b3; }
.dot--now { background: var(--orange); transform: scale(1.25); }
.dot--done { background: var(--green); }

/* Teaching card */
.teach { text-align: center; display: flex; flex-direction: column; align-items: center; }
.teach-pic {
  width: 100%; max-width: 320px; aspect-ratio: 1 / 1;
  background: radial-gradient(circle at 50% 40%, #fff7e6, #ffe9c2);
  border-radius: 28px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px; box-shadow: inset 0 -6px 0 rgba(0,0,0,0.05);
}
.teach-emoji { font-size: clamp(5rem, 26vw, 9rem); animation: pop 0.4s ease; line-height: 1; }
.teach-scene { width: 100%; height: 100%; display: block; animation: pop 0.4s ease; }
.teach-scene svg { width: 100%; height: 100%; display: block; border-radius: 24px; }
.teach-img { width: 100%; height: 100%; object-fit: cover; border-radius: 24px; }
.teach-pic--tap { cursor: pointer; position: relative; }
.teach-pic--tap::after {
  content: '🔊'; position: absolute; right: 10px; bottom: 10px;
  background: #fff; border-radius: 50%; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; box-shadow: var(--shadow);
}
.teach-pic--tap:active { transform: scale(0.98); }
.teach-text { font-size: clamp(1.5rem, 6vw, 2.2rem); font-weight: 900; margin: 6px 0 14px; }

/* Small sound-waves on the card while the sentence is spoken (replaces fox). */
.talk-wave { display: flex; align-items: center; justify-content: center; gap: 5px; height: 26px; margin: 0 0 10px; opacity: 0; transition: opacity 0.2s ease; }
.talk-wave.is-on { opacity: 1; }
.talk-wave span { width: 6px; height: 8px; border-radius: 999px; background: var(--blue); }
.talk-wave.is-on span { animation: talkbar 0.7s ease-in-out infinite; }
.talk-wave span:nth-child(2) { animation-delay: 0.1s; background: var(--purple); }
.talk-wave span:nth-child(3) { animation-delay: 0.2s; background: var(--orange); }
.talk-wave span:nth-child(4) { animation-delay: 0.3s; background: var(--purple); }
.talk-wave span:nth-child(5) { animation-delay: 0.4s; background: var(--blue); }
@keyframes talkbar { 0%, 100% { height: 8px; } 50% { height: 24px; } }
.teach .big-btn { max-width: 340px; }

.speak-area { width: 100%; max-width: 340px; }
.listening {
  background: #f0e6ff; color: var(--purple); font-weight: 800;
  border-radius: 16px; padding: 12px; margin: 8px 0; animation: pulse 1s infinite;
}
@keyframes pulse { 50% { opacity: 0.55; } }
.score-bar { height: 16px; background: #eee; border-radius: 999px; overflow: hidden; margin: 8px 0; }
.score-fill { height: 100%; background: linear-gradient(90deg, var(--green), var(--yellow)); transition: width 0.4s ease; }
.retry-row { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }

/* Feedback banners */
.feedback { border-radius: 16px; padding: 12px 14px; font-weight: 900; margin: 10px 0; font-size: 1.15rem; animation: pop 0.3s ease; }
.feedback--good { background: #e6ffef; color: var(--green); }
.feedback--nudge { background: #fff2e0; color: var(--orange); }

/* ---------- Games --------------------------------------------------------- */
.game { text-align: center; width: 100%; }
.quiz-head { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 6px; }
.quiz-icon {
  font-size: 2.6rem; line-height: 1;
  width: 66px; height: 66px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; box-shadow: var(--shadow);
  animation: fox-bob 1.6s ease-in-out infinite;
}
.quiz-count { font-weight: 900; color: var(--purple); font-size: 1rem; }
.game-q { font-size: 1.4rem; margin: 0 0 6px; }
.game-target { font-size: 1.6rem; font-weight: 900; color: var(--blue); margin: 0 0 12px; }
.game-hint-emoji { font-size: 3.5rem; }
.game-hint-visual {
  width: min(100%, 220px); height: 150px; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
}
.curriculum-illustration {
  width: 100%; height: 100%; object-fit: contain; border-radius: 14px;
}
.curriculum-illustration__emoji { font-size: 3.5rem; line-height: 1; }

.pic-grid, .find-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.pic-card, .find-card {
  border: none; background: #fff; border-radius: 22px; box-shadow: var(--shadow);
  min-height: 120px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.pic-card .emoji, .find-card .emoji { font-size: clamp(3rem, 16vw, 5rem); }
.pic-card:active, .find-card:active { transform: translateY(2px); }
.is-correct { background: #d7ffe7 !important; box-shadow: 0 0 0 4px var(--green), var(--shadow); animation: pop 0.4s ease; }
.is-wrong { background: #ffe0e8 !important; animation: shake 0.4s ease; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Word order */
.word-answer {
  min-height: 64px; border: 3px dashed var(--sky); border-radius: 18px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  padding: 10px; margin-bottom: 14px; background: #fbffff;
}
.word-bank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.word-chip {
  background: var(--yellow); color: var(--deep-blue); border: none;
  border-radius: 14px; padding: 12px 16px; font-size: 1.25rem; font-weight: 900;
  box-shadow: 0 4px 0 rgba(0,0,0,0.12);
}
.word-chip--bank { cursor: pointer; }
.word-chip--bank:active { transform: translateY(2px); }
.word-chip--bank:disabled { opacity: 0.25; }

/* Memory */
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.memory-card {
  border: none; border-radius: 16px; background: var(--blue);
  min-height: 78px; cursor: pointer; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
}
.memory-card .emoji { font-size: clamp(1.8rem, 9vw, 2.8rem); }
.memory-card.is-up { background: #fff; }
.memory-card.is-done { background: #d7ffe7; }

/* Counting */
.count-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0 18px; }
.count-emoji { font-size: clamp(2.6rem, 13vw, 4rem); }
.count-choices { display: flex; gap: 14px; justify-content: center; }
.count-btn {
  min-width: 74px; min-height: 74px; border: none; border-radius: 20px;
  background: #fff; box-shadow: var(--shadow); font-size: 2rem; font-weight: 900;
  color: var(--deep-blue); cursor: pointer;
}
.count-btn:active { transform: translateY(2px); }

/* Category multiple-choice cards need sentence-friendly type instead of the
   large numeric treatment inherited from .count-btn. Keep this scoped so
   counting, Games-hub controls, and other activity families stay unchanged. */
.screen--level .mini-card--multiple-choice { gap: 8px; }
.screen--level .mini-card--multiple-choice .game-hint-visual {
  width: min(100%, 180px); height: 120px; margin-bottom: 2px;
}
.screen--level .mini-card--multiple-choice .game-hint-emoji,
.screen--level .mini-card--multiple-choice .curriculum-illustration__emoji {
  font-size: 48px;
}
.screen--level .mini-card--multiple-choice .multiple-choice-question {
  font-size: 18px; line-height: 1.3;
}
.screen--level .multiple-choice-options { gap: 8px; }
.screen--level .multiple-choice-option--word {
  min-width: 0; min-height: 58px;
  padding: 10px 12px;
  font-size: 18px; line-height: 1.25;
  word-break: normal; overflow-wrap: anywhere;
}
.screen--level .mini-card--multiple-choice .feedback {
  margin: 2px 0 0; padding: 9px 12px;
  font-size: 16px; line-height: 1.3;
}

/* The buddy remains visible, but activity cards and their Continue action
   paint above the fixed decorative mascot so it cannot cover controls. */
.screen--level .mini-playground,
.screen--level .mini-continue {
  position: relative;
  z-index: 56;
}
.activity-page .buddy { width: 140px; }

/* ---------- Completion ---------------------------------------------------- */
/* Top-align the completion card so it doesn't sit centred with big empty space. */
.stage:has(.complete) { justify-content: flex-start; }
.complete { text-align: center; }
.complete-emoji { font-size: 3.4rem; animation: pop 0.5s ease; }
.complete-title { color: var(--orange); margin: 2px 0; }
.stars-row { font-size: 1.6rem; letter-spacing: 4px; margin: 2px 0; }
.complete-sub { font-weight: 900; font-size: 1.1rem; margin: 4px 0 8px; }
.complete-learned { margin: 12px 0 6px; font-weight: 800; }
.vocab-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 10px; }
.vocab-chip { background: #eaf6ff; color: var(--blue); border-radius: 999px; padding: 5px 12px; font-weight: 900; }
.earned { color: var(--green); font-weight: 900; font-size: 1.3rem; margin-bottom: 10px; }

/* ---------- Activity timer / score / navigation (Task K) ------------------ */
.topbar__right--actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.topbar__counter { font-weight: 900; color: var(--blue); font-size: 0.95rem; white-space: nowrap; }
.icon-btn--home { min-width: 44px; min-height: 44px; font-size: 1.3rem; }

.activity-timer {
  align-self: center;
  margin: 8px auto 2px;
  min-width: 96px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  background: #eaf6ff;
  color: var(--blue);
  font-weight: 900;
  font-size: 1.05rem;
  border-radius: 999px;
  padding: 6px 18px;
  box-shadow: var(--shadow);
  transition: background 0.2s ease, color 0.2s ease;
}
.activity-timer--low { background: #ffe1e6; color: var(--red); animation: pop 0.4s ease; }

/* Activity screen polish (M.1) — scoped to .screen--level so games are unaffected.
   Larger, centred prompt so the task reads first; clear separation for Continue. */
.screen--level .mini-question { font-size: 1.3rem; line-height: 1.3; text-align: center; }
.screen--level .game-hint-emoji { text-align: center; }
.screen--level .feedback { text-align: center; }
.mini-continue { margin-top: 6px; }

/* Replay button for listening activities (Hear the Letter, etc.) */
.replay-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px auto 12px;
  background: linear-gradient(180deg, var(--blue), #1b87a3);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--shadow);
  touch-action: manipulation;
}
.replay-btn:active { transform: translateY(2px); }

/* Score readout on the completion card */
.complete-score { margin: 6px 0 4px; }
.complete-score__num { font-weight: 900; font-size: 1.15rem; color: var(--deep-blue); }
.complete-score__pct { font-weight: 900; font-size: 1.8rem; color: var(--orange); }
.complete-tier-sub { font-weight: 800; color: var(--deep-blue); margin: 2px 0 4px; }
.complete-breakdown { display: flex; gap: 8px; justify-content: center; margin: 4px 0 2px; }
.complete-breakdown__item { font-weight: 900; border-radius: 999px; padding: 3px 10px; font-size: 0.95rem; }
.complete-breakdown__item.is-correct-tag { background: #d9ffe7; color: #127445; }
.complete-breakdown__item.is-wrong-tag { background: #ffe0e8; color: #a31a45; }
.complete-breakdown__item.is-skip-tag { background: #fff2e0; color: #a8641a; }

/* Emphasized primary action (Next Level / Explore Categories) */
.complete-primary { margin: 14px 0 6px; }
.next-level__label { margin-top: 6px; font-weight: 700; color: var(--blue); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
.next-level__title {
  margin-top: 2px;
  font-weight: 900;
  color: var(--deep-blue);
  font-size: 1.05rem;
}

/* De-emphasized secondary actions row */
.complete-secondary { display: flex; gap: 8px; margin-top: 8px; }
.complete-secondary .big-btn {
  margin: 0;
  flex: 1;
  font-size: 0.95rem;
  padding: 11px 12px;
  min-height: 48px;
}

/* Category completion banner (final level of a category) */
.category-complete {
  margin: 14px 0 4px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, #fff7e6, #fff);
  border: 3px solid #ffe4b8;
}
.category-complete__emoji { font-size: 2.4rem; }
.category-complete__title { font-weight: 900; font-size: 1.3rem; color: var(--orange); margin: 2px 0; }
.category-complete__sub { font-weight: 900; color: var(--deep-blue); }
.category-complete__hint { margin-top: 4px; color: var(--deep-blue); font-weight: 700; }

/* ---------- Settings ------------------------------------------------------ */
.settings-card { background: #fff; border-radius: 28px; box-shadow: var(--shadow); padding: 24px; }
.settings-section { margin: 18px 0 4px; font-weight: 900; color: var(--deep-blue); border-top: 2px solid #f1e6cf; padding-top: 14px; }

/* Difficulty selector */
.diff-row { display: flex; gap: 10px; }
.diff-btn {
  flex: 1; border: none; cursor: pointer;
  background: #fff; box-shadow: var(--shadow); border-radius: 16px;
  padding: 14px 6px; font-size: 1rem; font-weight: 900; color: var(--deep-blue);
}
.diff-btn:active { transform: translateY(2px); }
.diff-btn.is-selected { background: #d7ffe7; box-shadow: 0 0 0 3px var(--green), var(--shadow); }

/* Manage children */
.form-note { color: var(--green); font-weight: 900; min-height: 1.2em; margin: 6px 0 0; text-align: center; }
.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-row { display: flex; align-items: stretch; gap: 8px; }
.user-pick {
  flex: 1; display: flex; align-items: center; gap: 12px;
  border: none; cursor: pointer; text-align: left;
  background: #fff; box-shadow: var(--shadow); border-radius: 16px; padding: 12px 14px;
}
.user-row.is-current .user-pick { background: #eafff4; box-shadow: 0 0 0 3px var(--green), var(--shadow); }
.user-pick:active { transform: translateY(2px); }
.user-ava { font-size: 1.8rem; }
.user-name { flex: 1; font-weight: 900; font-size: 1.1rem; color: var(--deep-blue); }
.user-flag { font-weight: 800; font-size: 0.85rem; color: var(--blue); }
.user-del {
  border: none; cursor: pointer; background: #ffe0e8; color: var(--red);
  border-radius: 14px; width: 48px; font-size: 1.2rem; font-weight: 900; box-shadow: var(--shadow);
}
.user-del:active { transform: translateY(2px); }

/* Consent (splash) */
.consent-row {
  display: flex; gap: 10px; align-items: center; text-align: left;
  background: #fbf3df; border-radius: 16px; padding: 12px 14px; margin: 4px 0 6px;
  font-weight: 700; font-size: 0.95rem; color: var(--deep-blue);
}
.consent-row input { width: 22px; height: 22px; flex: 0 0 auto; }
.consent-link {
  background: none; border: none; padding: 0; font: inherit;
  color: var(--purple); font-weight: 900;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
/* keep "Privacy Policy." together so the period never wraps onto its own line */
.consent-policy { white-space: nowrap; }

/* Level intro — dancing buddy says "Let's start Level N!" */
.level-intro {
  position: fixed; inset: 0; z-index: 120;
  background: radial-gradient(circle at 50% 38%, #fff6e6, #ffd88a);
  display: flex; align-items: center; justify-content: center;
  animation: fade 0.3s ease;
}
.level-intro__card { text-align: center; padding: 20px; width: 100%; max-width: 420px; }
.level-intro__bubble {
  display: inline-block; background: #fff; color: var(--deep-blue);
  font-weight: 900; font-size: 1.4rem; padding: 14px 20px; border-radius: 20px;
  box-shadow: var(--shadow); margin-bottom: 6px; animation: pop 0.4s ease;
}
.level-intro__fox {
  width: 220px; margin: 0 auto;
  position: relative; left: 27px; /* offset the tail so the body looks centred */
  animation: b-dance 0.62s ease-in-out infinite;
  filter: drop-shadow(0 8px 8px rgba(0,0,0,0.18));
}
.level-intro__fox svg { width: 100%; height: auto; display: block; }
.level-intro__title { font-weight: 900; font-size: 1.3rem; color: var(--orange); margin: 6px 0 14px; }
.level-intro .big-btn { max-width: 300px; margin: 0 auto; }

/* Voice lab (admin) */
.slider-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; font-weight: 800; }
.slider { flex: 1; max-width: 60%; height: 30px; }
.voice-info { flex: 1; text-align: left; overflow: hidden; }
.voice-name { font-weight: 900; color: var(--deep-blue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-lang { font-size: 0.8rem; color: var(--blue); font-weight: 700; }
.voice-btn {
  border: none; cursor: pointer; background: #eaf6ff; color: var(--deep-blue);
  border-radius: 12px; min-width: 44px; height: 44px; font-size: 1rem; font-weight: 900; box-shadow: var(--shadow);
}
.voice-btn--use { background: var(--green); color: #fff; padding: 0 12px; }
.voice-btn:active { transform: translateY(2px); }

/* Embedded fox talking (splash / onboarding) — mouth moves while speaking */
.onboard-fox.is-talking .b-smile, .splash-fox.is-talking .b-smile { opacity: 0; }
.onboard-fox.is-talking .b-mouth, .splash-fox.is-talking .b-mouth { opacity: 1; animation: b-mouth 0.26s ease-in-out infinite; }
.onboard-fox.is-talking .wave--mouth, .splash-fox.is-talking .wave--mouth { opacity: 1; animation: b-wave 0.9s ease-out infinite; }

/* Info / policy / how-to pages */
.screen--doc .doc { display: flex; flex-direction: column; gap: 12px; }
.doc-block { background: #fff; border: 1px solid #e2e9ec; border-radius: 18px; box-shadow: none; padding: 16px 18px; }
.doc-h { margin: 0 0 6px; font-size: 1.15rem; color: var(--blue); }
.doc-p { margin: 0; line-height: 1.5; font-weight: 600; color: #3a3a3a; }
.toggle-row {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 800; font-size: 1.15rem; padding: 16px 4px; border-bottom: 2px solid #f1e6cf;
}
.toggle-row input { width: 30px; height: 30px; }

/* Admin › Animation Lab — white preview board + animation buttons */
.anim-stage {
  background: #fff;
  border: 2px dashed #d8d0bd;
  border-radius: 20px;
  min-height: 300px;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 18px 12px 10px;
  overflow: hidden;
}
.anim-caption {
  text-align: center; font-weight: 900; color: var(--blue);
  font-size: 1.1rem; margin: 10px 0 2px;
}
.anim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.anim-btn {
  border: none; border-radius: 16px; cursor: pointer;
  background: #fff; box-shadow: var(--shadow);
  padding: 14px 10px; font-weight: 800; font-size: 1rem;
  color: var(--deep-blue); font-family: inherit;
}
.anim-btn:active { transform: translateY(2px); }

/* ---------- Larger screens ------------------------------------------------ */
@media (min-width: 700px) {
  .pic-grid, .find-grid { gap: 18px; }
  .level-grid { grid-template-columns: repeat(3, 1fr); }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   Persistent chrome: speaker toggle, buddy mascot, friends, sound modal.
   ========================================================================== */

/* Speaker ON/OFF — fixed top-right on every page */
.speaker-toggle {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  right: 8px;
  z-index: 60;
  width: 42px; height: 42px;
  border: none; border-radius: 13px;
  background: #fff; box-shadow: var(--shadow);
  font-size: 1.25rem; cursor: pointer; line-height: 1;
}
.speaker-toggle:active { transform: translateY(2px); }
.speaker-toggle.is-off { background: #ffe0e8; }

/* Always-on header HUD (score + level) top-left — compact */
.hud {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  left: 8px;
  z-index: 60;
  display: flex; gap: 6px; align-items: center;
  background: #fff; box-shadow: var(--shadow);
  border-radius: 13px; padding: 6px 10px;
  font-weight: 900; font-size: 0.85rem; color: var(--deep-blue);
}
.hud__item { white-space: nowrap; }
.hud__item--stars { color: var(--orange); }
.hud__item--level { color: var(--blue); }
.hud__item--done { color: var(--green); }

.teach.is-listening { visibility: hidden; }
.listen-stage {
  position: fixed; inset: 0; z-index: 125;
  background: rgba(2, 48, 71, 0.55);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: clamp(28px, 7vh, 64px);
  padding: 10vh 20px calc(12vh + env(safe-area-inset-bottom));
  animation: fade 0.2s ease;
}
.listen-stage__say {
  background: #fff; color: var(--deep-blue); text-align: center;
  font-weight: 800; font-size: 1.15rem; line-height: 1.4;
  border-radius: 18px; padding: 14px 18px; box-shadow: var(--shadow); max-width: 92%;
}
.listen-stage__say b { font-size: 1.35rem; color: var(--blue); }
.listen-stage__hint { color: #fff; font-weight: 900; font-size: 1.5rem; animation: pulse 1s infinite; }

/* Pulsing mic + rings shown while the child speaks (fox is hidden). */
.listen-stage__mic { position: relative; width: 160px; height: 160px; display: flex; align-items: center; justify-content: center; }
.mic-emoji { font-size: 4.5rem; z-index: 2; }
.mic-rings { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.mic-rings span {
  position: absolute; width: 90px; height: 90px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.85); opacity: 0;
  animation: micring 1.8s ease-out infinite;
}
.mic-rings span:nth-child(2) { animation-delay: 0.6s; }
.mic-rings span:nth-child(3) { animation-delay: 1.2s; }
.listen-stage.is-recording .mic-rings span { border-color: #ffd166; }
@keyframes micring { 0% { transform: scale(0.5); opacity: 0.9; } 100% { transform: scale(2); opacity: 0; } }
.match-label { font-weight: 900; color: var(--blue); font-size: 1.1rem; margin: 2px 0; }

/* Friends row (grows with level) */
.friends { text-align: center; margin-top: 2px; }
.friends-label { font-weight: 900; color: var(--blue); margin: 4px 0; }
.friends-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.friend-avatar { width: 46px; height: 46px; animation: pop 0.4s ease; }

/* Sound re-enable modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(2, 48, 71, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fade 0.2s ease;
}
.listen-stage__close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 12px;
  z-index: 2;
}
.modal-card {
  background: #fff; border-radius: 26px; box-shadow: var(--shadow);
  padding: 26px 22px; text-align: center; max-width: 360px; width: 100%;
  animation: pop 0.3s ease;
}
.modal-emoji { font-size: 3rem; }
.modal-text { font-weight: 900; font-size: 1.3rem; margin: 8px 0 16px; }
.modal-row { display: flex; gap: 12px; }
.modal-row .big-btn { margin: 0; }

/* Bottom sheet (Terms / Privacy / How-to) */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(2, 48, 71, 0); transition: background 0.28s ease;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-overlay.is-open { background: rgba(2, 48, 71, 0.45); }
.sheet {
  width: 100%; max-width: 720px;
  background: #fff; border-radius: 26px 26px 0 0;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.25);
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 0.3s ease;
  max-height: 82vh; display: flex; flex-direction: column;
}
.sheet.is-open { transform: translateY(0); }
.sheet-handle { width: 48px; height: 6px; border-radius: 999px; background: #e0d5bd; margin: 4px auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-title { margin: 0; font-size: 1.3rem; color: var(--blue); }
.sheet-close {
  border: none; background: #f1e6cf; color: var(--deep-blue);
  width: 42px; height: 42px; border-radius: 12px; font-size: 1.1rem; font-weight: 900; cursor: pointer;
}
.sheet-body { overflow-y: auto; margin-top: 10px; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }

/* On wide screens, anchor chrome near the centered app column (with a touch
   more breathing room than the mobile edge-hugging 8px). */
@media (min-width: 760px) {
  .speaker-toggle { top: calc(16px + env(safe-area-inset-top)); right: calc(50vw - 360px + 20px); }
  .home-settings { top: calc(16px + env(safe-area-inset-top)); right: calc(50vw - 360px + 70px); }
  .hud { top: calc(16px + env(safe-area-inset-top)); left: calc(50vw - 360px + 20px); }
  .buddy { left: calc(50vw - 360px + 6px); }
  .screen--home { padding-top: 30px; }
  .home-launcher { grid-template-columns: repeat(2, 1fr); }
  .home-launcher__btn {
    padding: 14px 14px 14px 20px;
    min-height: 118px;
    grid-template-columns: 56px 1fr;
    column-gap: 12px;
  }
  .home-launcher__icon {
    font-size: 2rem;
    width: 46px;
    height: 46px;
  }
  .home-launcher__title { font-size: 1.25rem; }
  .home-launcher__hint { font-size: 0.9rem; }
  .games-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ==========================================================================
   Arcade host (Task M, Batch 2). Only the menu + iframe host live in the main
   app CSS; each game's visuals live in its own folder's style.css (iframe).
   ========================================================================== */
.screen--arcade { display: flex; flex-direction: column; gap: 10px; height: 100%; }

/* On arcade pages the learning HUD, app speaker and buddy are irrelevant (each
   game has its own topbar + per-game mute), so hide them to avoid header overlap
   and reclaim the top strip the main app normally reserves for them. */
.is-arcade #hud,
.is-arcade .speaker-toggle,
.is-arcade .buddy { display: none !important; }
.is-arcade .app { padding-top: calc(12px + env(safe-area-inset-top)); }

/* --- Arcade menu (grouped) --- */
.arcade-group { margin: 8px 2px 2px; font-weight: 900; color: var(--deep-blue); font-size: 1.05rem; }

/* --- Arcade progress + achievements panel (Task N.6) --- */
.arcade-progress {
  background: #fff; border: 3px solid #ffe4b8; border-radius: 18px; padding: 10px 14px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
}
.arcade-progress__stats { display: flex; flex-wrap: wrap; gap: 8px 16px; font-weight: 900; color: var(--deep-blue); font-size: 0.95rem; }
.arcade-ach { display: flex; flex-wrap: wrap; gap: 6px; }
.arcade-ach__item {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px;
  font-weight: 800; font-size: 0.8rem; border: 2px solid #eee;
}
.arcade-ach__item.is-earned { background: #fff4d6; border-color: #ffcf6b; color: #7a5200; }
.arcade-ach__item.is-locked { background: #f1f3f6; border-color: #e2e6ea; color: #9aa3ad; }
.arcade-ach__icon { font-size: 1rem; line-height: 1; }
.arcade-hint {
  display: none; background: #fff3d6; border: 2px solid #ffcf6b; border-radius: 14px;
  padding: 8px 12px; font-weight: 800; color: #7a5200; font-size: 0.92rem;
}
.arcade-hint.is-shown { display: block; }

.arcade-cards { display: grid; grid-template-columns: 1fr; gap: 10px; }
.arcade-card {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start; text-align: left;
  background: #fff; border: 3px solid #ffe4b8; border-radius: 18px; padding: 14px 16px;
  box-shadow: var(--shadow); cursor: pointer;
}
.arcade-card:active { transform: translateY(2px); }
.arcade-card__emoji { font-size: 2.1rem; line-height: 1; }
.arcade-card__title { font-weight: 900; font-size: 1.15rem; color: var(--deep-blue); }
.arcade-card__blurb { font-weight: 700; color: var(--deep-blue); opacity: 0.8; font-size: 0.92rem; }
.arcade-card__pb { font-weight: 900; color: var(--blue); font-size: 0.9rem; margin-top: 2px; }
/* Locked game cards — visibly disabled but still tappable to show the unlock hint. */
.arcade-card--locked { opacity: 0.6; filter: grayscale(0.5); border-style: dashed; cursor: default; }
.arcade-card--locked .arcade-card__blurb { color: #9aa3ad; opacity: 1; }

/* --- Iframe game host --- */
.arcade-frame-wrap { flex: 1 1 auto; min-height: 0; display: flex; }
.arcade-game-frame {
  flex: 1 1 auto; width: 100%; height: 100%; min-height: 60vh;
  border: none; border-radius: 20px; background: #eef5ff; box-shadow: var(--shadow);
}

/* Optional curriculum-linked games keep the app Buddy visible. The normal
   dynamic Buddy safe area shortens this host so the iframe cannot cover it. */
.screen--curriculum-game { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.curriculum-game-frame-wrap { flex: 1 1 auto; min-height: 430px; display: flex; }
.curriculum-game-frame {
  width: 100%; min-height: 430px; border: 0; border-radius: 8px;
  background: #f4fbff;
}
.curriculum-game-page .buddy { width: 140px; }

.curriculum-game-offer {
  width: min(100%, 440px); margin: 18px auto 0; padding-top: 16px;
  border-top: 2px dashed rgba(23, 50, 77, 0.18); text-align: center;
}
.curriculum-game-offer__label {
  color: #587184; font-size: 13px; font-weight: 900; text-transform: uppercase;
}
.curriculum-game-offer__title { margin: 4px 0 10px; color: #17324d; font-size: 19px; font-weight: 900; }

@media (max-width: 480px) {
  .curriculum-game-frame-wrap, .curriculum-game-frame { min-height: 390px; }
}

@media (min-width: 620px) {
  .arcade-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .arcade-cards { grid-template-columns: repeat(3, 1fr); }
}

