/* ============================================================
   GRAMMAR KINGDOM — DESIGN SYSTEM
   Principles adapted from DESIGN.md: one 8px spacing rhythm,
   a single radius scale with pill accents, weight-driven type
   hierarchy, plum-tinted shadows used sparingly, and a pastel
   "world block" palette where color — not shadow — sets the
   scene. Identity stays Grammar Kingdom: warm parchment canvas,
   royal plum ink, adventure green primary, chunky toy buttons.
   ================================================================ */
:root {
  /* ---- Canvas & surfaces ---- */
  --paper: #FBF3E7;          /* warm parchment canvas (brand) */
  --card: #FFFFFF;           /* card surface */
  --surface-soft: #FFF8EC;   /* warm off-white tiles */

  /* ---- Hairlines ---- */
  --hairline: #EEE3CE;       /* default 2px border */
  --hairline-soft: #F3EBDD;  /* subtle dividers */
  --track: #F0E7D5;          /* progress-bar track */

  /* ---- Ink ---- */
  --plum: #3B2A4A;           /* primary ink */
  --ink-soft: #6B5E80;       /* plum-tinted secondary ink — ≥5:1 on every surface */
  --on-dark: #FFF9EE;        /* text on dark surfaces */
  --night: #251C3E;          /* deep royal indigo: toast, scrims */

  /* ---- Kingdom hues (names referenced by game data) ---- */
  --leaf: #55A573;           /* adventure green — primary actions */
  --leaf-dark: #3B7D55;      /* deep green — pressed, headings on light */
  --coral: #EF6F55;          /* sunset coral — secondary, danger */
  --coral-dark: #B54A32;
  --sun: #E3A73E;            /* royal gold — rewards, highlights */
  --sun-dark: #8A6516;
  --blue: #4C8FBD;           /* sky blue */
  --purple: #8B6FB0;         /* magic purple */
  --rose: #D9598B;           /* blossom rose */
  --locked: #C9C1B0;         /* stone — locked, disabled */

  /* ---- Feedback tints ---- */
  --good-bg: #E7F3EA;        /* correct-state fill */
  --bad-bg: #FCEBE5;         /* wrong-state fill */
  --tip-bg: #FFF7EC;         /* tip / info fill */
  --tip-border: #F3DFC0;     /* tip / info border */

  /* ---- World blocks (pastels adapted from DESIGN.md's color
     blocks). One per story section — let the parchment canvas
     separate them so each reads as deliberate. ---- */
  --block-meadow: #DDEEB2;   /* lime meadow */
  --block-lilac: #D6C5F5;    /* magic lilac */
  --block-cream: #F7EED9;    /* royal parchment */
  --block-mint: #C9E7D1;     /* island mint */
  --block-blossom: #F6D7E3;  /* blossom pink */
  --block-peach: #F8D9C6;    /* sunset peach */
  --block-sky: #CFE7F5;      /* open sky */

  /* ---- Typography (kid-first scale; display carries joy) ---- */
  --font-display: 'Baloo 2', 'Trebuchet MS', sans-serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --text-xs: 0.76rem;
  --text-sm: 0.84rem;
  --text-base: 0.95rem;
  --text-md: 1rem;
  --text-lg: 1.12rem;
  --text-xl: 1.35rem;
  --text-2xl: 1.6rem;
  --leading-tight: 1.15;
  --leading-body: 1.55;

  /* ---- Spacing (8px base rhythm) ---- */
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* ---- Radius ---- */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  /* ---- Elevation (plum-tinted, used sparingly) ---- */
  --shadow-xs: 0 2px 6px rgba(59,42,74,0.06);
  --shadow-sm: 0 4px 10px rgba(59,42,74,0.07);
  --shadow-md: 0 8px 20px rgba(59,42,74,0.09);
  --shadow-lg: 0 18px 40px rgba(59,42,74,0.14);

  /* ---- Chunky "toy" buttons: one shared 3D recipe ---- */
  --grad-leaf: linear-gradient(180deg, #4E9470 0%, var(--leaf-dark) 100%);
  --grad-sun: linear-gradient(180deg, #EFB44E 0%, #C0831E 100%);
  --grad-coral: linear-gradient(180deg, #F58A73 0%, #C9533B 100%);
  --btn-drop: 0 5px 0 rgba(43,26,60,0.18);
  --btn-drop-hover: 0 7px 0 rgba(43,26,60,0.18), 0 14px 20px rgba(59,42,74,0.18);
  --btn-drop-sm: 0 3px 0 rgba(43,26,60,0.16);
  --btn-drop-press: 0 1px 0 rgba(43,26,60,0.18);
  --btn-inset: inset 0 2px 0 rgba(255,255,255,0.22);

  /* ---- Interaction ---- */
  --touch: 48px;             /* minimum comfortable touch target */
  --tap: 44px;               /* secondary tap target */
  --focus-ring: 3px solid #2F6B4A;
  --ring-sun: 0 0 0 3px rgba(227,167,62,0.30);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }
img.emoji { height: 1em; width: 1em; margin: 0 0.05em 0 0.1em; vertical-align: -0.15em; }

html { scroll-behavior: smooth; }
::selection { background: color-mix(in srgb, var(--leaf) 30%, transparent); }

/* ---------- Scrollbars: hidden app-wide, scrolling still works ----------
 * Firefox honors scrollbar-width; WebKit/Safari/Chrome honor the
 * pseudo-element. Touch, wheel and keyboard scrolling are unaffected —
 * only the visual bar is hidden, on the page and in every scrollable box. */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  font-family: var(--font-body);
  color: var(--plum);
  display: flex;
  justify-content: center;
  padding: 20px 14px calc(50px + env(safe-area-inset-bottom, 0px));
  -webkit-font-smoothing: antialiased;
  line-height: var(--leading-body);
}

.app { width: 100%; max-width: 560px; }
.app > * { animation: rise-in 0.32s ease both; }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 700px) {
  body {
    background: linear-gradient(160deg, #E6F2EA 0%, #FBEFD3 48%, #F0E1F2 100%);
    align-items: flex-start;
    padding: 40px 20px;
  }
  .app {
    background: var(--paper);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(59,42,74,0.05);
    padding: 28px 26px 44px;
  }
}

h1, h2 { font-family: var(--font-display); margin: 0; line-height: var(--leading-tight); }

button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
a:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: var(--focus-ring); outline-offset: 2px; border-radius: 6px; }

/* Visible focus everywhere + screen-reader-only helper */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Topbar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
/* The coin pill sits directly in the topbar on some screens: keep it
 * shrink-to-fit — only the title block flexes to fill leftover space. */
.topbar > div:not(.coin-pill) { min-width: 0; flex: 1; }
/* The screen name is a pre-reader's landmark: wrap it rather than cut it
 * to an ellipsis when the stat pills crowd a narrow screen. */
.topbar h2 { font-size: 1.45rem; font-weight: 800; color: var(--plum); line-height: 1.18; overflow-wrap: anywhere; }
.topbar .sub { font-size: 0.85rem; color: var(--ink-soft); margin-top: 1px; }
@media (max-width: 380px) {
  .topbar h2 { font-size: 1.15rem; }
  .topbar .sub { font-size: 0.78rem; }
  .topbar-pills .coin-pill { padding: 5px 10px; font-size: 0.76rem; }
}
.back-btn {
  background: var(--card); border: 2px solid var(--hairline); border-radius: var(--radius-sm);
  width: var(--tap); height: var(--tap); font-size: 1.2rem; font-weight: 700; color: var(--plum);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: var(--shadow-xs);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
@media (hover: hover) {
  .back-btn:hover { transform: translateY(-1px); border-color: var(--sun); box-shadow: var(--shadow-sm); }
}
.back-btn:active { transform: translateY(1px); }
.topbar-pills { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.coin-pill {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF6E0 100%); border: 2px solid #F3E2B8;
  border-radius: var(--radius-pill); padding: 6px 13px;
  font-family: var(--font-display); font-weight: 700; font-size: 0.86rem;
  box-shadow: var(--shadow-xs); flex-shrink: 0; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.coin-pill.star-pill { background: linear-gradient(180deg, #FFFFFF 0%, #FFF7DE 100%); border-color: #F3DFAC; }

/* ---------- Home ---------- */
/* The hero is the page's one color-block section (DESIGN.md rhythm):
   a lilac "magic" panel that carries identity + status, then the page
   returns to parchment for the action and everything below it. */
.home { position: relative; text-align: center; }
.hero {
  position: relative; overflow: hidden;
  background: var(--block-lilac);
  border-radius: var(--radius-xl);
  padding: var(--space-lg) var(--space-md) var(--space-md);
  margin-bottom: var(--space-md);
}
.sparkle { position: absolute; font-size: 1.2rem; opacity: 0.55; animation: float-sparkle 6s ease-in-out infinite; pointer-events: none; }
@keyframes float-sparkle { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-14px) rotate(15deg); } }
.home .badge-wrap { position: relative; display: inline-block; margin-bottom: 10px; }
.home .badge-glow {
  position: absolute; inset: -22px; border-radius: 50%; z-index: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 70%);
}
.home .badge {
  position: relative; z-index: 1; font-size: 3.8rem; display: block;
  filter: drop-shadow(0 10px 14px rgba(59,42,74,0.28));
  animation: castle-float 4s ease-in-out infinite;
}
@keyframes castle-float { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-7px) rotate(-2deg); } }
.home h1 {
  font-size: clamp(2rem, 8vw, 2.5rem); font-weight: 800; color: var(--plum);
  letter-spacing: -0.5px; margin: 0;
}
.home .tagline { color: var(--ink-soft); margin: 6px 0 14px; font-size: var(--text-base); font-weight: 600; }

.home-stats { display: flex; justify-content: center; gap: var(--space-2xs); flex-wrap: wrap; }
.storage-warning {
  background: var(--bad-bg); border: 2px solid var(--coral); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 0.78rem; color: var(--coral-dark); text-align: center;
  margin-bottom: 18px; line-height: 1.4;
}
.stat-chip {
  background: var(--card); border: 2px solid var(--hairline); border-radius: var(--radius-pill);
  padding: 9px 14px;
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-base);
  box-shadow: var(--shadow-xs);
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}

/* Journey snapshot card: where the player is, how far they've come */
.journey-card {
  background: var(--card); border: 2px solid var(--hairline-soft); border-radius: var(--radius-lg);
  padding: var(--space-md); box-shadow: var(--shadow-md);
  text-align: left; margin-bottom: var(--space-md); position: relative;
  overflow: hidden;
}
.journey-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--leaf), var(--sun), var(--coral), var(--purple));
}
.journey-top { display: flex; align-items: center; gap: var(--space-sm); }
.journey-icon {
  font-size: 1.7rem; width: 52px; height: 52px; border-radius: var(--radius-md); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: white;
  box-shadow: inset 0 -4px 8px rgba(0,0,0,0.14), inset 0 3px 5px rgba(255,255,255,0.35);
}
.journey-world { flex: 1; min-width: 0; }
.journey-name { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: var(--plum); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.journey-sub { font-size: var(--text-sm); color: var(--ink-soft); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.journey-stars { font-family: var(--font-display); font-weight: 800; font-size: 0.95rem; color: var(--sun-dark); flex-shrink: 0; }
.journey-bar { height: 10px; background: var(--track); border-radius: var(--radius-xs); overflow: hidden; margin-top: var(--space-sm); }
.journey-bar-fill { height: 100%; border-radius: var(--radius-xs); background: linear-gradient(90deg, var(--sun), var(--leaf)); transition: width 0.4s ease; }
.journey-meta { display: flex; justify-content: space-between; gap: 10px; font-size: var(--text-xs); color: var(--ink-soft); font-weight: 600; margin-top: var(--space-2xs); }

/* Next-stop pill: the adventure direction, one glance under the CTA */
.cta-hint {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 0 var(--space-md); padding: 8px 16px;
  background: var(--tip-bg); border: 2px solid var(--tip-border); border-radius: var(--radius-pill);
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-sm);
  color: var(--sun-dark); text-align: left;
}

.big-btn {
  width: 100%; padding: 16px; border: none; border-radius: var(--radius-md);
  font-family: var(--font-display); font-weight: 800; font-size: var(--text-lg);
  margin-bottom: var(--space-sm); color: white; min-height: 52px;
  letter-spacing: 0.01em;
  box-shadow: var(--btn-drop), var(--btn-inset);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease;
  text-shadow: 0 1px 1px rgba(0,0,0,0.14);
}
.big-btn:active { transform: translateY(4px); box-shadow: var(--btn-drop-press), var(--btn-inset); }
.big-btn:disabled { filter: saturate(0.35) brightness(1.06); box-shadow: var(--btn-drop); cursor: not-allowed; }
.big-btn.primary { background: linear-gradient(180deg, #63AE85 0%, var(--leaf-dark) 100%); font-size: 1.2rem; }
.big-btn.sun { background: var(--grad-sun); color: var(--plum); text-shadow: none; }
/* Home hero action: the single loudest element on the page */
.big-btn.hero { min-height: 58px; font-size: 1.25rem; padding: 17px; margin-bottom: var(--space-sm); }
/* Quieter secondary action above the hero: jump to world selection. Warm
   parchment tint with a sun-gold hairline keeps it inside the paper world,
   with the shared toy-press drop — quieter than the gold reward hero, but
   unmistakably part of the same play set. */
.map-btn {
  width: 100%; padding: 15px; min-height: 56px; margin-bottom: var(--space-sm);
  background: linear-gradient(180deg, #FFFFFF 0%, var(--surface-soft) 100%);
  border: 2px solid var(--hairline); border-radius: var(--radius-md);
  font-family: var(--font-display); font-weight: 800; font-size: 1.15rem;
  color: var(--plum);
  box-shadow: 0 4px 0 rgba(43,26,60,0.12), inset 0 2px 0 rgba(255,255,255,0.55);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease;
}
@media (hover: hover) {
  .map-btn:hover {
    transform: translateY(-2px); filter: brightness(1.03);
    box-shadow: 0 6px 0 rgba(43,26,60,0.12), 0 12px 18px rgba(59,42,74,0.16), inset 0 2px 0 rgba(255,255,255,0.55);
  }
  .map-btn:hover:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(43,26,60,0.12), inset 0 2px 0 rgba(255,255,255,0.55); }
}
.map-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(43,26,60,0.12), inset 0 2px 0 rgba(255,255,255,0.55); }
.map-btn:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
@media (hover: hover) {
  .big-btn:not(:disabled):hover { transform: translateY(-2px); box-shadow: var(--btn-drop-hover), var(--btn-inset); filter: brightness(1.04); }
  .big-btn:not(:disabled):hover:active { transform: translateY(4px); box-shadow: var(--btn-drop-press), var(--btn-inset); }
}

.icon-btn-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-xs); margin-top: var(--space-2xs); }
.icon-btn {
  background: var(--card); border: 2px solid var(--hairline); border-radius: var(--radius-md);
  padding: 13px 4px; min-height: var(--touch);
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-sm);
  color: var(--plum); box-shadow: var(--shadow-xs);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
@media (hover: hover) {
  .icon-btn:hover { transform: translateY(-2px); border-color: var(--sun); box-shadow: var(--shadow-sm); }
}
.icon-btn:active { transform: translateY(1px); }
.icon-btn .count-badge {
  display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 3px;
  background: var(--coral); color: white; border-radius: 10px;
  font-size: 0.75rem; font-weight: 800; vertical-align: 1px;
}

/* Home feature tiles: vertical icon-first layout, 2-up mobile → 3-up wide.
   Scoped to .home — classroom/account reuse .icon-btn inline. */
.home .icon-btn-row { margin-top: var(--space-2xs); }
@media (min-width: 460px) {
  .home .icon-btn-row { grid-template-columns: repeat(3, 1fr); }
}
.home .icon-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 4px 12px; min-height: 78px; border-radius: var(--radius-md);
}
.tile-ico { font-size: 1.7rem; line-height: 1; }
.home .icon-btn .count-badge {
  position: absolute; top: -7px; right: -5px; margin-left: 0; vertical-align: baseline;
  box-shadow: 0 0 0 2px var(--paper);
}

/* ---------- Shop ---------- */
.shop-section-label { font-family: var(--font-display); font-weight: 700; font-size: 0.85rem; color: var(--leaf-dark); margin: 4px 0 8px; }
.shop-preview { text-align: center; background: var(--card); border: 2px solid var(--hairline-soft); border-radius: var(--radius-md); padding: 18px; margin-bottom: var(--space-md); box-shadow: var(--shadow-xs); }
.shop-preview .emoji { font-size: 3rem; animation: mascot-idle 3s ease-in-out infinite; }
.shop-preview .label { font-family: var(--font-display); font-weight: 700; font-size: 0.9rem; margin-top: 6px; color: var(--leaf-dark); }
.shop-item { display: flex; align-items: center; gap: var(--space-sm); background: var(--card); border: 2px solid var(--hairline-soft); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow-xs); }
.shop-item.equipped { border-color: var(--leaf); box-shadow: 0 0 0 1px var(--leaf), var(--shadow-xs); }
.shop-item-icon {
  font-size: 1.8rem; width: 44px; text-align: center; flex-shrink: 0;
  cursor: pointer; animation: mascot-idle 3s ease-in-out infinite;
}
.rarity-pill { font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 8px; color: white; margin-left: 4px; vertical-align: middle; }
.theme-swatch { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.5); }
.shop-item-info { flex: 1; min-width: 0; }
.shop-item-name { font-family: var(--font-display); font-weight: 700; font-size: 0.9rem; }
.shop-item-desc { font-size: 0.78rem; color: var(--ink-soft); margin-top: 2px; }
.shop-buy-btn { flex-shrink: 0; border: none; border-radius: var(--radius-sm); padding: 11px 15px; min-height: var(--tap); font-family: var(--font-display); font-weight: 700; font-size: 0.84rem; background: var(--grad-leaf); color: white; box-shadow: var(--btn-drop-sm), var(--btn-inset); transition: transform 0.1s ease, box-shadow 0.1s ease; }
.shop-buy-btn:active { transform: translateY(2px); box-shadow: var(--btn-drop-press), var(--btn-inset); }
.shop-buy-btn:disabled { background: var(--locked); box-shadow: var(--btn-drop-sm); }
.shop-buy-btn.cant-afford { opacity: 0.55; background: var(--locked); cursor: not-allowed; }
.shop-owned { flex-shrink: 0; font-size: 0.8rem; font-weight: 700; color: var(--leaf-dark); }
.hint-btn {
  display: block; margin: 0 auto var(--space-md); background: var(--grad-sun); color: var(--plum); border: none;
  border-radius: 20px; padding: 11px 18px; min-height: var(--tap); font-family: var(--font-display); font-weight: 700; font-size: 0.86rem;
  box-shadow: var(--btn-drop-sm), var(--btn-inset);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.hint-btn:active { transform: translateY(2px); box-shadow: var(--btn-drop-press), var(--btn-inset); }
.option.eliminated { opacity: 0.35; text-decoration: line-through; }

/* ---------- New question types ---------- */
.tile-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tile-option { flex: 0 0 auto; border-radius: 20px; padding: 10px 18px; }

.order-built {
  min-height: 60px; display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center;
  justify-content: center; padding: 12px; border: 2px dashed var(--hairline); border-radius: var(--radius-sm); margin-bottom: 14px;
}
.order-placeholder { font-size: var(--text-sm); color: var(--ink-soft); }
.order-pool { display: flex; flex-wrap: wrap; gap: var(--space-xs); justify-content: center; margin-bottom: 14px; }
.order-tile {
  display: inline-block; padding: 10px 16px; border-radius: var(--radius-sm); background: var(--surface-soft);
  border: 2px solid var(--hairline); font-weight: 700; font-size: 1rem; cursor: pointer;
  font-family: inherit; color: var(--plum); min-height: 48px;
}
.order-tile.placed { background: var(--card); border-color: var(--sun); }
.order-tile.correct { background: var(--good-bg); border-color: var(--leaf); color: var(--leaf-dark); }
.order-tile.wrong { background: var(--bad-bg); border-color: var(--coral); color: var(--coral-dark); }
button.order-tile { -webkit-appearance: none; appearance: none; line-height: 1.2; }
.order-tile.correct::after { content: " ✓"; }
.order-tile.wrong::after { content: " ✕"; }

.mistake-sentence { text-align: center; font-size: 1.25rem; line-height: 2.2; margin: 0 0 18px; }
.mistake-word {
  display: inline-block; padding: 6px 12px; margin: 2px; border-radius: var(--radius-xs); cursor: pointer;
  transition: background 0.15s;
  font-family: inherit; font-size: inherit; color: inherit; line-height: inherit;
  border: none; background: transparent; -webkit-appearance: none; appearance: none;
}
.mistake-word.correct { background: var(--good-bg); color: var(--leaf-dark); font-weight: 700; }
.mistake-word.wrong { background: var(--bad-bg); color: var(--coral-dark); font-weight: 700; }
.mistake-word.correct::after { content: " ✓"; }
.mistake-word.wrong::after { content: " ✕"; }

.submit-btn {
  display: block; width: 100%; margin-top: var(--space-2xs); padding: 14px; border: none; border-radius: var(--radius-sm);
  background: var(--grad-leaf); color: white; font-family: var(--font-display); font-weight: 700; font-size: 0.98rem;
  min-height: var(--touch);
  box-shadow: var(--btn-drop-sm), var(--btn-inset);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.submit-btn:active { transform: translateY(2px); box-shadow: var(--btn-drop-press), var(--btn-inset); }
.submit-btn:disabled { background: var(--locked); box-shadow: var(--btn-drop-sm); }
.typed-input {
  width: 100%; padding: 14px; border-radius: var(--radius-sm); border: 2px solid var(--hairline);
  font-size: 1.15rem; text-align: center; margin-bottom: var(--space-sm); box-sizing: border-box; font-family: inherit;
  min-height: 56px;
}
.typed-input::placeholder { color: var(--ink-soft); opacity: 1; }
.typed-input:focus { border-color: var(--sun); outline: none; box-shadow: var(--ring-sun); }
.typed-input.correct { border-color: var(--leaf); background: var(--good-bg); }
.typed-input.wrong { border-color: var(--coral); background: var(--bad-bg); }

.tf-row { display: flex; gap: 10px; }
.tf-btn {
  flex: 1; padding: 16px 10px; min-height: 56px; border-radius: var(--radius-sm); border: 2px solid var(--hairline); background: var(--surface-soft);
  font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; color: var(--plum);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
@media (hover: hover) {
  .tf-btn:not(:disabled):hover { transform: translateY(-1px); border-color: var(--sun); }
}
.tf-btn.correct { background: var(--good-bg); border-color: var(--leaf); color: var(--leaf-dark); }
.tf-btn.wrong { background: var(--bad-bg); border-color: var(--coral); color: var(--coral-dark); }
.tf-btn.correct::after { content: " ✓"; }
.tf-btn.wrong::after { content: " ✕"; }

/* ---------- World map (winding path, game-style) ---------- */
.map-frame { position: relative; }
.map-fade {
  position: absolute; left: 0; right: 0; bottom: 0; height: 80px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.55) 70%, rgba(255,255,255,0.8) 100%);
}
.map-wrap {
  position: relative; width: 100%; height: 810px; margin-top: 4px;
  border-radius: var(--radius-lg); overflow-y: auto; overflow-x: hidden;
  background: linear-gradient(180deg, #BFE8D4 0%, #FCE7A8 22%, #FBC9B8 48%, #A9D4EC 74%, #C9AEE0 100%);
  box-shadow: inset 0 0 40px rgba(59,42,74,0.06);
}
/* Desktop: the map fills the remaining window height so the page itself
 * doesn't scroll — the world map stays the single scroll context instead
 * of scroll-inside-scroll. (Overrides the fixed mobile height above.) */
@media (min-width: 700px) {
  .map-wrap { height: clamp(520px, calc(100vh - 245px), 810px); }
}
.map-track { position: relative; width: 100%; }
.map-glow {
  position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 70%);
  pointer-events: none;
}
.map-cloud { position: absolute; font-size: 1.8rem; opacity: 0.55; animation: drift 18s ease-in-out infinite; pointer-events: none; }
@keyframes drift { 0%, 100% { transform: translateX(-8px); } 50% { transform: translateX(8px); } }
.map-star { position: absolute; font-size: 0.9rem; opacity: 0.7; animation: twinkle 2.4s ease-in-out infinite; pointer-events: none; }
@keyframes twinkle { 0%, 100% { opacity: 0.25; transform: scale(0.85); } 50% { opacity: 0.9; transform: scale(1.1); } }
.map-decor { position: absolute; font-size: 1.4rem; opacity: 0.85; pointer-events: none; transform: translate(-50%, -50%); }
.path-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%; transform: translate(-50%, -50%); }
.path-dot.active { background: var(--leaf); box-shadow: 0 0 6px rgba(85,165,115,0.6); animation: dot-pulse 1.6s ease-in-out infinite; }
.path-dot.inactive { background: var(--locked); opacity: 0.65; }
@keyframes dot-pulse { 0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.9); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.25); } }

.map-node {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: none; padding: 0; width: 118px;
}
.node-circle {
  width: 76px; height: 76px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem; color: white; border: 5px solid var(--card);
  box-shadow: 0 10px 0 rgba(0,0,0,0.13), 0 14px 18px rgba(59,42,74,0.25),
    inset 0 -6px 10px rgba(0,0,0,0.15), inset 0 6px 8px rgba(255,255,255,0.35);
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.map-node:active .node-circle {
  transform: translateY(6px);
  box-shadow: 0 3px 0 rgba(0,0,0,0.13), 0 5px 8px rgba(59,42,74,0.2), inset 0 -6px 10px rgba(0,0,0,0.15);
}
.map-node.locked .node-circle {
  background: var(--locked) !important;
  box-shadow: 0 8px 0 rgba(0,0,0,0.08), 0 10px 14px rgba(59,42,74,0.12);
}
.node-ground { width: 44px; height: 9px; background: rgba(59,42,74,0.14); border-radius: 50%; filter: blur(2px); margin-top: -2px; }
/* Current island: gold label pill + pulsing ring + mascot — unmistakable */
.map-mascot {
  position: absolute; top: -42px; left: 50%; transform: translateX(-50%);
  filter: drop-shadow(0 4px 4px rgba(0,0,0,0.2));
}
.map-mascot span { display: inline-block; font-size: 2.1rem; animation: mascot-idle 3s ease-in-out infinite; }
@keyframes mascot-idle { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-6px) rotate(-4deg); } }
.map-node.current .node-circle::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  border: 3px solid var(--sun); animation: pulse-ring 1.8s ease-out infinite;
}
@keyframes pulse-ring { 0% { transform: scale(0.9); opacity: 0.8; } 100% { transform: scale(1.35); opacity: 0; } }
.node-lock { font-size: 1.1rem; }
.trophy-badge {
  position: absolute; top: -12px; right: -14px; font-size: 1.25rem;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.25));
  animation: trophy-bounce 2.4s ease-in-out infinite; pointer-events: none;
}
@keyframes trophy-bounce { 0%, 100% { transform: translateY(0) rotate(6deg); } 50% { transform: translateY(-4px) rotate(0deg); } }
.node-label {
  font-family: var(--font-display); font-weight: 700; font-size: 0.8rem;
  background: var(--card); padding: 4px 11px 5px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm); text-align: center; line-height: 1.25;
  max-width: 150px;
}
.node-name { display: block; overflow-wrap: break-word; }
.node-label.done { color: var(--leaf-dark); }
.node-label.here { background: var(--sun); color: var(--plum); box-shadow: 0 3px 10px rgba(227,167,62,0.45); }
.node-badge { font-size: 0.78rem; letter-spacing: -1px; }
/* Locked worlds: invite exploration — the hint names how to unlock */
.node-hint {
  font-family: var(--font-display); font-weight: 700; font-size: 0.75rem; line-height: 1.2;
  background: var(--card); border: 2px solid var(--hairline); border-radius: var(--radius-pill);
  padding: 3px 9px; color: var(--plum); box-shadow: var(--shadow-xs);
  max-width: 150px; text-align: center;
}
.map-node.locked .node-label { opacity: 0.85; }
.map-node[aria-disabled="true"] { cursor: default; }
.map-node:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; border-radius: var(--radius-md); }
@media (hover: hover) {
  .map-node:not([aria-disabled="true"]):hover .node-circle { transform: translateY(-4px); }
}

/* ---------- Level select ---------- */
.level-continue { margin-bottom: 14px; }
.world-progress-card {
  background: var(--card); border-radius: var(--radius-md); padding: 13px 15px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.world-progress-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 0.82rem; color: var(--leaf-dark); margin-bottom: 7px; }
.world-progress-bar { height: 10px; background: var(--track); border-radius: var(--radius-xs); overflow: hidden; }
.world-progress-fill { height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--sun), var(--leaf)); transition: width 0.4s ease; }
.level-select-bg {
  border-radius: 22px; padding: 18px 14px; margin-top: 4px;
  background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.1));
}
.level-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 360px) {
  .level-grid { gap: 9px; }
  .level-node { padding: 18px 4px 15px; }
}
.level-node {
  background: var(--card); border-radius: 20px; padding: 24px 8px 20px; text-align: center;
  border: none; box-shadow: 0 5px 0 rgba(0,0,0,0.1), 0 9px 14px rgba(59,42,74,0.14);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  color: var(--plum);
}
.level-node:active:not(.locked) { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,0.1), 0 3px 6px rgba(59,42,74,0.12); }
@media (hover: hover) {
  .level-node:hover:not(.locked) { transform: translateY(-3px); box-shadow: 0 7px 0 rgba(0,0,0,0.1), 0 14px 20px rgba(59,42,74,0.18); }
}
.level-node.locked { opacity: 0.6; box-shadow: 0 4px 0 rgba(0,0,0,0.06), 0 6px 10px rgba(59,42,74,0.08); cursor: default; }
.num-badge {
  width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-family: var(--font-display); font-weight: 800; font-size: 1.45rem;
  box-shadow: 0 3px 0 rgba(0,0,0,0.15), 0 5px 8px rgba(59,42,74,0.2), inset 0 3px 4px rgba(255,255,255,0.3);
}
.level-node.locked .num-badge { background: var(--locked) !important; box-shadow: none; color: var(--plum); }
.level-diff { font-family: var(--font-display); font-weight: 800; font-size: 1.12rem; color: var(--plum); line-height: 1.15; margin-top: 2px; }
.level-node .stars { font-size: 1.1rem; margin-top: 2px; letter-spacing: 1px; color: var(--sun); }
.level-node .best { font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; margin-top: 3px; }
.level-meter { display: flex; align-items: center; gap: 5px; margin: 9px 8px 0; }
.level-meter .meter-fig { font-size: 0.7rem; font-weight: 700; flex-shrink: 0; white-space: nowrap; }
.m-correct .meter-fig { color: var(--leaf-dark); }
.m-tried .meter-fig { color: var(--ink-soft); }
.meter-track { flex: 1; height: 6px; background: var(--track); border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.m-correct .meter-fill { background: var(--leaf); }
.m-tried .meter-fill { background: var(--sun); }
@media (max-width: 480px) {
  .level-meter { flex-direction: column; align-items: stretch; gap: 3px; margin: 9px 4px 0; }
  .level-meter .meter-track { flex: none; }
}
.world-tip {
  background: var(--tip-bg); border: 2px solid var(--tip-border);
  border-radius: var(--radius-sm); padding: 13px 15px; font-size: 0.9rem; line-height: 1.55;
  margin-bottom: 18px;
  display: flex; gap: 10px; align-items: flex-start;
}
.world-tip .tip-icon {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--sun) 22%, white); font-size: 1.05rem;
}

/* ---------- Quiz ---------- */
.quiz-progress-bar { height: 10px; background: var(--track); border-radius: var(--radius-xs); overflow: hidden; margin-bottom: 6px; }
.quiz-progress-fill { height: 100%; border-radius: var(--radius-xs); background: linear-gradient(90deg, var(--leaf), var(--leaf-dark)); transition: width 0.3s ease; }
.progress-row {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-base);
  color: var(--leaf-dark); margin-bottom: var(--space-md);
}
.progress-score-wrap { display: inline-flex; align-items: center; gap: 8px; }
/* Streak chip: live combo state, pops in when a streak reaches x2 */
.combo-chip {
  display: inline-flex; align-items: center;
  background: linear-gradient(180deg, #FFF6E0 0%, #FCEEC9 100%);
  border: 2px solid #F3E2B8; border-radius: var(--radius-pill);
  padding: 2px 10px 3px; font-family: var(--font-display); font-weight: 800;
  font-size: 0.82rem; color: var(--sun-dark);
  opacity: 0; transform: scale(0.6);
  transition: opacity 0.2s ease, transform 0.25s var(--ease-pop);
}
.combo-chip.show { opacity: 1; transform: scale(1); }

.card { position: relative; background: var(--card); border-radius: var(--radius-lg); padding: var(--space-lg) 20px; box-shadow: var(--shadow-lg); overflow: visible; }

.mascot { font-size: 2rem; text-align: center; margin-bottom: 8px; }
.mascot.happy { animation: mascot-bounce 0.5s; }
.mascot.sad { animation: mascot-shake 0.4s; }
@keyframes mascot-bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px) scale(1.1); } }
@keyframes mascot-shake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }

/* Coach line under the question cue (read-aloud instructions) */
.quiz-hint { text-align: center; font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; margin: 0 0 10px; }
/* Prompt line shown above the sentence on claim-style questions (MCQ + true/false) */
.q-claim { font-size: 1rem; color: var(--plum); font-weight: 700; }
/* Letter badge on straight multiple-choice options */
.opt-letter { color: var(--ink-soft); font-weight: 800; margin-right: 7px; }

/* Quest badge: the question-type cue, kept quiet so the question dominates */
.prompt-row {
  display: flex; justify-content: center; align-items: center;
  position: relative; margin-bottom: 14px;
}
.prompt-row .prompt-label { margin: 0; }
/* Read-aloud lives beside the quest badge so the question spans the card */
.prompt-row .speak-btn { position: absolute; right: 0; top: 50%; transform: translateY(-50%); margin-bottom: 0; }
.prompt-row .speak-btn:active { transform: translateY(-50%) scale(0.92); }
.prompt-label {
  display: table; margin: 0 auto 14px;
  font-family: var(--font-display); font-weight: 700; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--coral-dark); background: var(--surface-soft); border: 2px solid var(--hairline);
  border-radius: var(--radius-pill); padding: 5px 14px; text-align: center;
}
.sentence { font-size: 1.42rem; line-height: 1.6; margin-bottom: 22px; text-align: center; font-weight: 700; overflow-wrap: break-word; }
.sentence-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.sentence-row .sentence { margin-bottom: 22px; flex: 1; }
.hint-row { position: relative; margin: 2px 0 16px; }
.hint-row .quiz-hint { flex: 1; text-align: center; }
.speak-btn {
  flex-shrink: 0; width: var(--tap); height: var(--tap); border-radius: 50%; border: 2px solid var(--sun-dark);
  background: var(--sun); color: white; font-size: 1.15rem; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(227,167,62,0.4);
  transition: transform 0.12s ease;
}
.speak-btn:active { transform: scale(0.92); }
.blank { display: inline-block; min-width: 60px; border-bottom: 3px solid var(--sun); text-align: center; font-weight: 700; color: var(--leaf-dark); }

.options { display: grid; gap: var(--space-sm); }
.option {
  font-size: 1.12rem; font-weight: 700; padding: 15px 16px; min-height: 56px; border-radius: var(--radius-sm);
  border: 2px solid var(--hairline); background: var(--surface-soft); color: var(--plum); text-align: left;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
@media (hover: hover) {
  .option:not(:disabled):hover { transform: translateY(-1px); border-color: var(--sun); box-shadow: var(--shadow-sm); }
}
.option:not(:disabled):active { transform: translateY(1px); }
.option:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.option.correct { background: var(--good-bg); border-color: var(--leaf); color: var(--leaf-dark); }
.option.correct::after { content: " ✓"; }
.option.wrong { background: var(--bad-bg); border-color: var(--coral); color: var(--coral-dark); }
.option.wrong::after { content: " ✕"; }
.option[disabled] { cursor: default; }
@keyframes option-pop { 0% { transform: scale(1); } 50% { transform: scale(1.04); } 100% { transform: scale(1); } }
.option.pop { animation: option-pop 0.25s ease; }
.tile-option { text-align: center; min-height: 48px; padding: 11px 20px; border-radius: var(--radius-pill); font-size: 1.05rem; }

.feedback { margin-top: 14px; font-size: 1rem; min-height: 1.3em; font-weight: 700; text-align: center; }
.feedback.good { color: var(--leaf-dark); animation: feedback-pop 0.35s var(--ease-pop); }
.feedback.bad { color: var(--coral-dark); }
@keyframes feedback-pop { 0% { transform: scale(0.92); opacity: 0.4; } 60% { transform: scale(1.04); opacity: 1; } 100% { transform: scale(1); } }

/* Wrong-answer encouragement + explanation block (built with textContent only). */
.explain-box {
  margin-top: 10px; padding: 12px 14px; text-align: left;
  background: var(--tip-bg); border: 1.5px solid var(--tip-border); border-radius: var(--radius-sm);
  display: flex; flex-direction: column; gap: var(--space-xs);
}
.explain-row { display: flex; flex-direction: column; }
.explain-label { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--sun-dark); }
.explain-value { font-size: 0.95rem; font-weight: 600; line-height: 1.45; color: var(--plum); }

/* Success reveal for "Find the mistake": the sentence with the faulty word
   struck through and the intended correction in its place. The green pill
   wraps ONLY the correct word — the struck old word and the arrow stay
   outside it. */
.correction-reveal {
  margin-top: 10px; padding: 12px 14px; text-align: center;
  background: var(--good-bg); border: 1.5px solid color-mix(in srgb, var(--leaf) 32%, transparent);
  border-radius: var(--radius-sm);
  display: flex; flex-direction: column; gap: 7px;
  animation: feedback-pop 0.35s var(--ease-pop);
}
.correction-label { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--leaf-dark); }
.correction-sentence { font-size: 0.98rem; font-weight: 600; line-height: 2; color: var(--plum); }
.correction-old { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--coral); color: var(--coral-dark); font-weight: 700; }
.correction-arrow { margin: 0 7px; font-weight: 800; color: var(--ink-soft); }
.correction-new {
  background: var(--leaf); color: var(--on-dark); font-weight: 800;
  padding: 2px 10px; border-radius: var(--radius-pill); white-space: nowrap;
  box-shadow: 0 2px 6px rgba(59, 125, 85, 0.35);
}

.next-btn {
  display: none;
  margin-top: var(--space-md); width: 100%; padding: 13px; border: none; border-radius: var(--radius-sm);
  background: var(--grad-leaf); color: white; font-family: var(--font-display);
  font-weight: 700; font-size: var(--text-md);
  box-shadow: var(--btn-drop-sm), var(--btn-inset);
}
.next-btn.show { display: block; animation: next-rise 0.3s var(--ease-pop); }
.next-btn.show:active { transform: translateY(2px); box-shadow: var(--btn-drop-press), var(--btn-inset); }
@keyframes next-rise { from { transform: translateY(10px); } to { transform: translateY(0); } }

.exit-link { display: block; text-align: center; background: none; border: none; color: var(--ink-soft); font-size: var(--text-sm); margin: 6px auto 0; padding: 13px 10px; text-decoration: underline; width: 100%; }

.shake { animation: shake-anim 0.35s; }
@keyframes shake-anim { 10%,90% { transform: translateX(-4px); } 20%,80% { transform: translateX(6px); } 30%,50%,70% { transform: translateX(-8px); } 40%,60% { transform: translateX(8px); } }

.float-pop {
  position: absolute; right: 18px; top: 12px; font-family: var(--font-display);
  font-weight: 800; color: var(--sun); font-size: 1.05rem;
  animation: float-up 1s ease-out forwards; pointer-events: none;
}
@keyframes float-up { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-40px); opacity: 0; } }

/* ---------- Confetti ---------- */
.confetti-piece { position: absolute; top: 0; width: 8px; height: 14px; opacity: 0.9; animation: confetti-fall 1.3s ease-in forwards; }
@keyframes confetti-fall { to { transform: translate(var(--dx), 340px) rotate(var(--rot)); opacity: 0; } }

/* ---------- Level complete ---------- */
.finished { text-align: center; }
.finished .prompt-label { font-size: 1.05rem; padding: 7px 18px; color: var(--coral-dark); }
.finished .stars-big { font-size: 2.6rem; margin: 6px 0; letter-spacing: 4px; color: var(--sun); text-shadow: 0 2px 0 rgba(255,255,255,0.6); }
.star-pop { display: inline-block; animation: star-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes star-pop { from { opacity: 0; transform: scale(0.2) rotate(-30deg); } to { opacity: 1; transform: scale(1) rotate(0deg); } }
.finished .score { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--leaf-dark); margin: 4px 0 8px; }
.finished .msg { font-size: 0.98rem; color: var(--ink-soft); margin-bottom: 20px; line-height: 1.55; }
.finished .btn-row { display: grid; gap: 10px; }
.reward-chip {
  display: inline-block; background: linear-gradient(180deg, #FFF6E0 0%, #FCEEC9 100%);
  border: 2px solid #F3E2B8; border-radius: 14px; padding: 7px 14px; margin-bottom: 12px;
  font-family: var(--font-display); font-weight: 800; font-size: 0.92rem; color: var(--sun-dark);
  box-shadow: 0 3px 8px rgba(59,42,74,0.06);
}
.reward-chip.unlock-chip { background: var(--good-bg); border-color: #BFE0CC; color: var(--leaf-dark); animation: unlock-chip 0.5s var(--ease-pop) both; }
@keyframes unlock-chip { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }
.fbtn { padding: 14px; min-height: var(--touch); border: none; border-radius: var(--radius-sm); font-family: var(--font-display); font-weight: 700; font-size: var(--text-md); color: white; box-shadow: var(--btn-drop-sm), var(--btn-inset); transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease; text-shadow: 0 1px 1px rgba(0,0,0,0.14); }
.fbtn:active { transform: translateY(3px); box-shadow: var(--btn-drop-press), var(--btn-inset); }
@media (hover: hover) {
  .fbtn:not(:disabled):hover { transform: translateY(-2px); box-shadow: var(--btn-drop-hover), var(--btn-inset); filter: brightness(1.04); }
}
.fbtn.next { background: var(--grad-leaf); }
.fbtn.retry { background: var(--grad-sun); color: var(--plum); text-shadow: none; }
.fbtn.exit { background: var(--grad-coral); }

/* ---------- Practice Zone (Weak Spots) ---------- */
/* Hub before practice: a friendly overview of what's waiting, grouped by
   kingdom. The mint world-block gives the zone its own calm identity. */
.ws-overview {
  position: relative; overflow: hidden;
  background: var(--block-mint); border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-md); margin-bottom: var(--space-md); text-align: center;
}
.ws-overview-num { font-family: var(--font-display); font-weight: 800; font-size: 2.2rem; line-height: 1; color: var(--plum); }
.ws-overview-label { font-family: var(--font-display); font-weight: 700; font-size: var(--text-base); color: var(--plum); margin-top: 2px; }
.ws-overview-hint { font-size: var(--text-sm); margin-top: 6px; color: var(--ink-soft); font-weight: 600; }
.ws-section-label { font-family: var(--font-display); font-weight: 700; font-size: 0.9rem; color: var(--leaf-dark); margin: 0 0 14px; text-align: left; }
.ws-note { font-size: var(--text-sm); color: var(--ink-soft); text-align: center; margin: 2px 0 0; }
.ws-empty-emoji { font-size: 2.6rem; margin-bottom: 10px; }
/* Practice Zone: one tappable row per question */
.ws-hint { font-size: var(--text-sm); color: var(--ink-soft); text-align: center; margin: 0 0 14px; }
.ws-q {
  display: flex; align-items: center; gap: var(--space-sm);
  background: var(--card); border: 2px solid var(--hairline-soft);
  border-radius: var(--radius-sm); padding: 10px 12px; width: 100%;
  font: inherit; text-align: left; cursor: pointer; box-shadow: var(--shadow-xs);
  margin-bottom: 10px; transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.ws-q:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(45, 26, 71, 0.10); }
.ws-q:active { transform: scale(0.99); }
.ws-q-icon {
  width: 42px; height: 42px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem; color: white;
  box-shadow: inset 0 -3px 6px rgba(0,0,0,0.14), inset 0 2px 4px rgba(255,255,255,0.35);
}
.ws-q-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.ws-q-title { font-family: var(--font-display); font-weight: 800; font-size: 0.95rem; color: var(--plum); }
.ws-q-sub { font-size: var(--text-xs); color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-q-go {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: var(--radius-pill);
  background: var(--tip-bg); border: 2px solid var(--tip-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; color: var(--sun-dark);
}

/* ---------- High scores ---------- */
/* Each world section is coded by its own hue via --world-color (set inline) */
.hs-world { margin-bottom: 20px; }
.hs-world h3 { font-family: var(--font-display); font-size: 0.98rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.hs-world-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 10px; font-size: 1.05rem; flex-shrink: 0;
  background: color-mix(in srgb, var(--world-color, var(--leaf)) 20%, white);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--world-color, var(--leaf)) 40%, white);
}
.hs-row { display: flex; justify-content: space-between; align-items: center; background: var(--card); border-radius: 10px; padding: 9px 12px; margin-bottom: 6px; font-size: 0.88rem; }
.hs-row .lvl-label { font-weight: 700; }
.hs-row .lvl-best { color: var(--ink-soft); font-weight: 600; }
.hs-total { background: linear-gradient(135deg, var(--leaf-dark), var(--leaf)); color: white; border-radius: 16px; padding: 18px; text-align: center; margin-bottom: 20px; box-shadow: 0 8px 20px rgba(63,125,87,0.3); }
.hs-total .num { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; }

/* ---------- Achievements (trophy room) ---------- */
.ach-hero {
  background: var(--block-cream); border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-md); margin-bottom: var(--space-md);
  text-align: center;
}
.ach-hero-emoji { font-size: 2.8rem; line-height: 1; margin-bottom: 6px; filter: drop-shadow(0 6px 10px rgba(59,42,74,0.18)); animation: castle-float 4s ease-in-out infinite; }
.ach-hero-title { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; color: var(--plum); }
.ach-hero-sub { font-size: var(--text-sm); margin: 4px 0 14px; color: var(--ink-soft); font-weight: 600; }
.ach-hero .ach-progress-bar { background: var(--card); margin-bottom: 0; }
.ach-hero .big-btn { margin-top: 14px; margin-bottom: 0; }
.ach-progress-bar { height: 12px; background: var(--track); border-radius: var(--radius-xs); overflow: hidden; margin-bottom: 18px; }
.ach-progress-fill { height: 100%; border-radius: var(--radius-xs); background: linear-gradient(90deg, var(--sun), var(--leaf)); transition: width 0.4s ease; }
.ach-section-label { font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--plum); margin: 0 0 10px; text-align: left; }
.ach-section-label.after { margin-top: 20px; }
.ach-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 380px) { .ach-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 520px) { .ach-grid { grid-template-columns: repeat(3, 1fr); } }
.ach-card {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 4px; min-width: 0;
  background: var(--card); border: 2px solid var(--hairline-soft); border-radius: var(--radius-sm);
  padding: 14px 8px 12px; box-shadow: var(--shadow-xs);
}
.ach-card.earned { border-color: var(--tip-border); animation: ach-pop 0.4s var(--ease-pop) both; }
@media (hover: hover) {
  .ach-card.earned:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
}
.ach-card-icon { position: relative; font-size: 2rem; line-height: 1; margin-bottom: 4px; }
.ach-card.earned .ach-card-icon { filter: drop-shadow(0 0 8px rgba(227,167,62,0.55)); }
.ach-check {
  position: absolute; top: -6px; right: -10px; width: 22px; height: 22px;
  background: var(--leaf); color: white; border-radius: 50%;
  font-family: var(--font-display); font-size: 0.75rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--card);
}
.ach-card.locked { border-style: dashed; background: var(--surface-soft); }
.ach-card.locked .ach-card-name { color: var(--ink-soft); }
.ach-card.locked .ach-card-desc { color: var(--ink-soft); }
.ach-card-name { font-family: var(--font-display); font-weight: 700; font-size: 0.88rem; color: var(--plum); line-height: 1.2; }
.ach-premium-tag {
  display: inline-block; font-family: var(--font-display); font-weight: 700; font-size: 0.75rem;
  color: var(--sun-dark); background: #FDF4E3; border: 1.5px solid #F3E2B8;
  border-radius: var(--radius-pill); padding: 1px 8px; margin-top: 3px;
}
.ach-card-desc { font-size: 0.75rem; color: var(--ink-soft); line-height: 1.4; }
@keyframes ach-pop { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }

/* ---------- Settings ---------- */
.settings-row { display: flex; justify-content: space-between; align-items: center; background: var(--card); border: 2px solid var(--hairline-soft); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: var(--space-sm); box-shadow: var(--shadow-xs); }
#classSection { margin: var(--space-2xs) 0 18px; }
.toggle-btn { border: none; border-radius: var(--radius-pill); padding: 8px 16px; font-family: var(--font-display); font-weight: 700; font-size: 0.9rem; color: white; min-height: var(--tap); box-shadow: var(--btn-drop-sm), var(--btn-inset); transition: transform 0.1s ease; }
.toggle-btn:active { transform: translateY(2px); box-shadow: var(--btn-drop-press), var(--btn-inset); }
.toggle-btn.on { background: var(--grad-leaf); }
.toggle-btn.off { background: var(--locked); color: var(--plum); }
.toggle-btn.signout { background: var(--grad-coral); }
.danger-btn { width: 100%; background: var(--grad-coral); color: white; border: none; border-radius: var(--radius-sm); padding: 14px; font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; margin-top: 10px; min-height: var(--touch); box-shadow: var(--btn-drop-sm), var(--btn-inset); transition: transform 0.1s ease, box-shadow 0.1s ease; }
.danger-btn:active { transform: translateY(2px); box-shadow: var(--btn-drop-press), var(--btn-inset); }

/* ---------- Toast ---------- */
.toast {
  /* Bottom-center: the thumb zone, clear of the hero, topbar and any text
     the toast would otherwise cover (it used to sit over the boot hero).
     pointer-events:none keeps it from ever stealing taps: it overlaps the
     bottom tile rows on Home for ~2.5s after boot, and a tap swallowed by
     a notification feels exactly like a broken button. */
  pointer-events: none;
  position: fixed; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%) translateY(120px);
  background: var(--night); color: var(--on-dark); padding: 12px 18px; border-radius: var(--radius-md);
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-base);
  box-shadow: var(--shadow-lg); z-index: 999;
  max-width: min(92vw, 480px); text-align: center;
  display: flex; align-items: center; justify-content: center; gap: var(--space-xs); transition: transform 0.4s var(--ease-pop);
}
.toast.show { transform: translateX(-50%) translateY(0); }

.loading { text-align: center; padding-top: 70px; }
.loading .mascot { animation: castle-float 3s ease-in-out infinite; }
.loading-title { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; color: var(--leaf-dark); margin-top: 6px; }
.loading-sub { font-size: 0.88rem; color: var(--ink-soft); margin-top: 6px; }

/* ---------- Modal / Unlock ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: color-mix(in srgb, var(--night) 55%, transparent);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--card); border-radius: var(--radius-lg); padding: 28px 22px; max-width: 360px;
  text-align: center; box-shadow: var(--shadow-lg);
  animation: modal-pop 0.28s var(--ease-pop) both;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}
@keyframes modal-pop { from { opacity: 0; transform: scale(0.85) translateY(12px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-box h2 { font-size: 1.3rem; margin: 8px 0; color: var(--leaf-dark); }
.modal-box p { font-size: 0.92rem; line-height: 1.6; color: var(--ink-soft); text-align: left; }
.code-input {
  width: 100%; padding: 13px; border-radius: var(--radius-sm); border: 2px solid var(--hairline);
  font-size: 1rem; text-align: center; margin-bottom: 10px; box-sizing: border-box;
  font-family: inherit; min-height: 50px;
}
.code-input:focus { border-color: var(--sun); outline: none; box-shadow: var(--ring-sun); }
.code-error { color: var(--coral-dark); font-size: 0.85rem; margin-top: var(--space-xs); min-height: 1.2em; }
.backup-textarea {
  width: 100%; height: 100px; padding: 10px; border-radius: var(--radius-sm); border: 2px solid var(--hairline);
  font-size: 0.75rem; font-family: monospace; margin-bottom: 10px; box-sizing: border-box;
  resize: none; text-align: left; color: var(--plum);
}
.unlock-link { display: block; text-decoration: none; text-align: center; margin-bottom: 14px; }

/* ---------- Premium payment options ---------- */
.pay-hero { text-align: center; }
.pay-hero-icon { font-size: 2.6rem; margin-bottom: 2px; }
.pay-hero-title { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; color: var(--leaf-dark); margin: 4px 0 2px; }
.pay-hero-sub { font-size: 0.9rem; opacity: 0.75; margin: 0 0 14px; }
.benefit-list {
  display: flex; flex-direction: column; gap: 8px; text-align: left;
  background: var(--paper); border-radius: 14px; padding: 13px 15px; margin-bottom: 16px;
}
.benefit-row { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; font-weight: 600; color: var(--plum); }
.benefit-row .benefit-ico { font-size: 1.15rem; flex-shrink: 0; width: 24px; text-align: center; }
.pay-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.pay-btn { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.pay-plan-name { font-size: inherit; font-weight: inherit; }
.pay-plan-sub { display: block; font-size: 0.76rem; font-weight: 600; opacity: 0.85; line-height: 1.35; }
.pay-btn:disabled { opacity: 0.55; cursor: wait; transform: none; box-shadow: 0 4px 0 rgba(0,0,0,0.15); }
.pay-note { font-size: 0.78rem; color: var(--ink-soft); margin-top: 4px; line-height: 1.5; }
.pay-status { font-size: 0.85rem; min-height: 1.2em; margin-top: 8px; }
.pay-status.loading { color: var(--ink-soft); }
.pay-status.error { color: var(--coral-dark); }
.pay-spinner {
  width: 34px; height: 34px; margin: 6px auto 0; border-radius: 50%;
  border: 4px solid rgba(59,42,74,0.15); border-top-color: var(--coral);
  animation: pay-spin 0.9s linear infinite;
}
@keyframes pay-spin { to { transform: rotate(360deg); } }

/* ---------- Checkout agreement & Total Price ---------- */
.pay-agree {
  display: flex; align-items: flex-start; gap: 10px; text-align: left;
  background: var(--surface-soft); border: 2px solid var(--hairline);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 12px;
  font-size: 0.82rem; line-height: 1.5; color: var(--ink-soft);
  cursor: pointer;
}
.pay-agree a { color: var(--leaf-dark); font-weight: 700; }
.pay-agree input[type="checkbox"] {
  width: 20px; height: 20px; margin: 1px 0 0; flex-shrink: 0;
  accent-color: var(--leaf-dark); cursor: pointer;
}
.pay-total-line {
  display: block; font-size: 0.8rem; font-weight: 700; margin-top: 2px;
  color: var(--sun-dark);
}
.pay-total-line strong { color: var(--plum); font-size: 0.9rem; }
.pay-legal-links {
  font-size: 0.76rem; margin-top: 10px; color: var(--ink-soft);
}
.pay-legal-links a { color: var(--ink-soft); }
.legal-sep { margin: 0 7px; opacity: 0.45; }

/* ---------- Site footer (home landing page) ---------- */
.site-footer {
  margin-top: 26px; padding: 16px 12px 6px;
  border-top: 2px solid var(--hairline-soft);
  text-align: center; font-size: 0.76rem; line-height: 1.7; color: var(--ink-soft);
}
.site-footer-links a { color: var(--ink-soft); }
.site-footer-biz { margin-top: 6px; font-weight: 700; color: var(--plum); opacity: 0.8; }
.site-footer-mail a { color: var(--ink-soft); }

/* ---------- Legal pages ---------- */
.legal-page { text-align: left; padding: 24px 22px 20px; }
.legal-page-icon { font-size: 2.2rem; text-align: center; }
.legal-page-title {
  font-family: var(--font-display); font-weight: 800; font-size: 1.35rem;
  color: var(--leaf-dark); text-align: center; margin: 6px 0 16px;
}
.legal-page-body { font-size: 0.9rem; line-height: 1.65; color: var(--ink-soft); }
.legal-page-body h3 {
  font-family: var(--font-display); font-weight: 800; font-size: 0.98rem;
  color: var(--plum); margin: 18px 0 6px;
}
.legal-page-body p { margin: 0 0 10px; }
.legal-page-body ul { margin: 0 0 10px; padding-left: 20px; }
.legal-page-body li { margin-bottom: 4px; }
.legal-page-body a { color: var(--leaf-dark); font-weight: 700; }
.legal-page-footer {
  margin-top: 20px; padding-top: 14px; border-top: 2px solid var(--hairline-soft);
  text-align: center; font-size: 0.76rem; color: var(--ink-soft); line-height: 1.7;
}
.legal-page-footer a { color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
  .option, .option.pop, .quiz-progress-fill, .sparkle, .mascot.happy, .mascot.sad, .shake, .float-pop, .confetti-piece, .toast, .map-star, .path-dot.active, .pay-spinner, .app > *, .modal-box,
  .badge, .map-mascot span, .map-node.current .node-circle::after, .shop-preview .emoji, .shop-item-icon,
  .trophy-badge, .star-pop, .reward-chip.unlock-chip, .journey-bar-fill, .world-progress-fill,
  .ach-progress-fill, .report-bar-fill, .level-node, .big-btn, .icon-btn, .fbtn, .speak-btn, .loading .mascot,
  .loading .mascot.happy, .modal-overlay, .feedback.good, .next-btn.show, .ach-card.earned, .ach-hero-emoji,
  .correction-reveal, .google-btn, .combo-chip {
    animation: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
}

/* ---------- How to Play ---------- */
.help-card { text-align: left; padding: 18px 18px 14px; }
.help-card + .help-card { margin-top: var(--space-xs); }
.help-title { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: var(--plum); margin: 0 0 8px; }
.help-text { font-size: 0.9rem; line-height: 1.6; color: var(--ink-soft); margin: 0 0 10px; }
.help-text strong { color: var(--plum); }
.help-text:last-child { margin-bottom: 2px; }
/* Callout line inside a help card: the one rule worth remembering,
   boxed like a tip so it pops out of the paragraphs around it. */
.help-key {
  font-size: 0.9rem; line-height: 1.6; color: var(--plum); font-weight: 600;
  background: var(--tip-bg); border: 2px solid var(--tip-border); border-radius: var(--radius-sm);
  padding: 10px 12px; margin: 0 0 10px;
}
.help-key strong { color: var(--sun-dark); }
.help-key:last-child { margin-bottom: 2px; }

/* ---------- Sign-in gate ---------- */.gate-welcome { font-size: 1.15rem; margin: 0 0 8px; color: var(--plum); }
.gate-copy { font-size: 0.95rem; line-height: 1.6; margin: 0 0 18px; color: var(--ink-soft); }
.gate-copy code { font-size: 0.82em; }
.gate-note { font-size: 0.8rem; color: var(--ink-soft); margin: 12px 0 0; line-height: 1.5; }
/* Google OAuth button: white surface + official G mark — the recognised
   trust pattern for account buttons. */
.google-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: var(--touch); padding: 14px 16px;
  background: var(--card); border: 2px solid var(--hairline); border-radius: var(--radius-sm);
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); color: var(--plum);
  text-decoration: none; box-shadow: var(--shadow-xs);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
@media (hover: hover) {
  .google-btn:hover { transform: translateY(-1px); border-color: var(--sun); box-shadow: var(--shadow-sm); }
}
.google-btn:active { transform: translateY(1px); }
.google-btn:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.google-btn .google-g { flex-shrink: 0; }
.google-btn[data-loading] { pointer-events: none; opacity: 0.75; }
.google-btn[data-loading] .g-label { visibility: hidden; }
.google-btn[data-loading]::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px;
  margin: -9px 0 0 -9px; border-radius: 50%;
  border: 3px solid rgba(59,42,74,0.2); border-top-color: var(--plum);
  animation: pay-spin 0.9s linear infinite;
}
/* A peek at what awaits: the 9 world icons under the sign-in card turn the
 * auth wall into a window — kids see the adventure before they can enter. */
.gate-worlds { margin-top: var(--space-md); text-align: center; }
.gate-worlds-icons {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 10px;
  max-width: 340px; margin: 0 auto;
}
.gate-world {
  width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.5rem; border-radius: 50%;
  border: 3px solid var(--card); box-shadow: var(--shadow-sm);
}
.gate-worlds-label {
  font-family: var(--font-display); font-weight: 700; font-size: 0.95rem;
  color: var(--ink-soft); margin: 12px 0 0;
}

/* ---------- Google account ---------- */
.gk-avatar { width: 22px; height: 22px; border-radius: 50%; vertical-align: -5px; margin-right: 2px; }
.gk-avatar-lg { width: 44px; height: 44px; border-radius: 50%; }
.gk-signin { text-decoration: none; cursor: pointer; }
.account-card {
  display: flex; align-items: center; gap: var(--space-sm);
  background: var(--surface-soft); border: 2px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.account-info { flex: 1; min-width: 0; }
.account-name { font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--plum); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-email { font-size: 0.78rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-sync { font-size: 0.75rem; color: var(--ink-soft); margin-top: 2px; }
.gk-signin-btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }

/* ---------- Account & Settings page structure ---------- */
.page-section-label { font-family: var(--font-display); font-weight: 800; font-size: 0.9rem; letter-spacing: 0.02em; color: var(--leaf-dark); margin: 18px 0 10px; text-align: left; }
.settings-row-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-row-sub { font-size: 0.75rem; color: var(--ink-soft); }
.settings-note { text-align: center; font-size: 0.78rem; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.5; }
.settings-credit { text-align: center; font-size: 0.75rem; color: var(--ink-soft); margin-top: 18px; }
.settings-credit a { color: inherit; }

/* Profile header (Account screen) */
.acct-profile {
  background: var(--card); border: 2px solid var(--hairline-soft); border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-md); text-align: center; box-shadow: var(--shadow-md); margin-bottom: 4px;
}
.gk-avatar-hero { width: 64px; height: 64px; border-radius: 50%; box-shadow: var(--shadow-sm); }
.acct-avatar-fallback { display: block; font-size: 2.6rem; line-height: 1; }
.acct-name { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: var(--plum); margin-top: 8px; overflow-wrap: anywhere; }
.acct-email { font-size: 0.85rem; color: var(--ink-soft); margin-top: 1px; overflow-wrap: anywhere; }
.acct-sync {
  display: inline-block; margin-top: 10px; font-size: 0.75rem; font-weight: 700;
  background: var(--good-bg); color: var(--leaf-dark); border-radius: var(--radius-pill); padding: 4px 12px;
}
.acct-sync.warn { background: var(--tip-bg); color: var(--sun-dark); }

/* Premium / access status block */
.acct-access {
  background: var(--surface-soft); border: 2px solid var(--hairline-soft); border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.acct-access-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 0.92rem; color: var(--plum); }
.acct-access-detail { font-size: 0.82rem; color: var(--ink-soft); margin-top: 4px; line-height: 1.45; }
.acct-status {
  flex-shrink: 0; font-family: var(--font-display); font-weight: 800; font-size: 0.75rem;
  letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 9px; border-radius: var(--radius-pill); color: white;
}
.acct-status.on { background: var(--leaf-dark); }
.acct-status.off { background: var(--locked); color: var(--plum); }

/* ---------- Parent/Teacher Progress Report ---------- */
.report-hero {
  background: linear-gradient(135deg, var(--leaf-dark), var(--leaf));
  color: white; border-radius: var(--radius-lg); padding: 22px 20px; margin-bottom: 12px;
  box-shadow: var(--shadow-md);
}
.report-name { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; line-height: 1.25; overflow-wrap: anywhere; }
.report-hero-sub { font-size: 0.88rem; opacity: 0.92; margin: 3px 0 2px; }
.report-generated { font-size: 0.75rem; opacity: 0.75; margin: 0 0 14px; }
.report-hero-stat { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.report-hero-num { font-family: var(--font-display); font-size: 2rem; font-weight: 800; }
.report-hero-lbl { font-family: var(--font-display); font-weight: 700; font-size: 0.85rem; opacity: 0.9; }
/* Meta rows inherit the hero's dark green ground, not the page ink */
.report-hero .report-row-meta { color: rgba(255,255,255,0.88); }

.report-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.report-tile {
  background: var(--card); border-radius: var(--radius-md); padding: 14px 12px; text-align: center;
  box-shadow: var(--shadow-xs); min-width: 0;
}
.report-tile-num { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; color: var(--leaf-dark); }
.report-tile-lbl { font-size: 0.75rem; color: var(--ink-soft); margin-top: 3px; line-height: 1.3; }

.report-section {
  background: var(--card); border-radius: var(--radius-lg); padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm); margin-bottom: 14px; min-width: 0;
}
.report-section h3 { font-family: var(--font-display); font-size: 1.02rem; font-weight: 800; margin: 0 0 12px; color: var(--plum); }
.report-lede { font-size: 0.9rem; margin: 0 0 12px; line-height: 1.5; }
.report-note { font-size: 0.85rem; color: var(--ink-soft); line-height: 1.5; background: var(--paper); border-radius: var(--radius-sm); padding: 10px 12px; }

.report-item { background: var(--paper); border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 8px; }
.report-item:last-child { margin-bottom: 0; }
.report-item-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.report-item-name { font-family: var(--font-display); font-weight: 700; font-size: 0.92rem; min-width: 0; overflow-wrap: anywhere; }
.report-item-num { font-family: var(--font-display); font-weight: 800; font-size: 0.92rem; color: var(--leaf-dark); flex-shrink: 0; }
.report-item-note { font-size: 0.78rem; color: var(--ink-soft); line-height: 1.4; }
.report-item .report-bar { margin-top: 8px; }

.report-bar { height: 10px; background: var(--track); border-radius: var(--radius-xs); overflow: hidden; }
.report-bar-fill { height: 100%; border-radius: var(--radius-xs); transition: width 0.4s ease; }
.report-bar-fill.tone-excellent, .report-bar-fill.tone-strong { background: linear-gradient(90deg, var(--leaf), var(--leaf-dark)); }
.report-bar-fill.tone-good { background: var(--leaf); }
.report-bar-fill.tone-leaf { background: linear-gradient(90deg, #8FC9A4, var(--leaf-dark)); }
.report-bar-fill.tone-developing { background: linear-gradient(90deg, var(--sun), #D9922F); }
.report-bar-fill.tone-practice { background: linear-gradient(90deg, #F5967F, var(--coral)); }
.report-bar-fill.tone-sun { background: linear-gradient(90deg, #F0BE6B, var(--sun)); }
.report-bar-fill.tone-muted { background: var(--locked); }
.report-row-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 0.75rem; color: var(--ink-soft); margin-top: 5px; }

.report-pill {
  flex-shrink: 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em;
  padding: 3px 9px; border-radius: 10px; color: white; white-space: nowrap;
}
.report-pill.tone-excellent { background: var(--leaf-dark); }
.report-pill.tone-strong { background: var(--leaf); }
.report-pill.tone-good { background: #7FB894; }
.report-pill.tone-developing { background: var(--sun); }
.report-pill.tone-practice { background: var(--coral); }
.report-pill.tone-muted { background: var(--locked); color: var(--plum); }

.report-mini-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--paper); border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 6px; font-size: 0.85rem; }
.report-mini-row:last-child { margin-bottom: 0; }
.report-mini-row.head { background: transparent; padding: 0 2px; font-size: 0.8rem; color: var(--ink-soft); margin-bottom: 8px; }

.report-topic-row { padding: 11px 0; border-bottom: 1.5px solid #F0E9DC; }
.report-topic-row:last-child { border-bottom: none; padding-bottom: 2px; }
.report-topic-row:first-of-type { padding-top: 2px; }
.report-topic-row.muted { color: var(--ink-soft); }
.report-topic-row .report-item-head { margin-bottom: 7px; }

.report-kingdom-row { margin-bottom: 13px; }
.report-kingdom-row:last-child { margin-bottom: 0; }
.report-exam-row { background: #FBF6EC; border-radius: var(--radius-sm); padding: 11px 13px; }
.report-kingdom-total { margin-top: 12px; padding-top: 10px; border-top: 1.5px solid #F0E9DC; font-family: var(--font-display); font-weight: 700; font-size: 0.8rem; color: var(--ink-soft); }

.report-trend { font-size: 0.9rem; line-height: 1.55; border-radius: var(--radius-sm); padding: 11px 13px; }
.report-trend.up { background: var(--good-bg); color: var(--leaf-dark); }
.report-trend.flat { background: #FDF4E3; color: #8A6516; }
.report-trend.down { background: #FDF0E9; color: #A6492F; }

/* Earlier-vs-recent accuracy comparison (real trend data only) */
.report-compare { margin-top: 10px; display: grid; gap: 8px; }
  .report-compare-row { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 10px; }
.report-compare-lbl { font-size: 0.78rem; color: var(--ink-soft); }
.report-compare-val { font-family: var(--font-display); font-weight: 800; font-size: 0.88rem; color: var(--leaf-dark); text-align: right; }

.report-summary { font-size: 0.92rem; line-height: 1.65; margin: 0; background: var(--paper); border-radius: var(--radius-sm); padding: 12px 14px; }

.report-rec-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.report-rec-list li { font-size: 0.9rem; line-height: 1.5; }

/* One clear next action, using existing navigation */
.report-action {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  margin-top: 14px; padding: 13px 16px; min-height: var(--touch);
  background: var(--card); border: 2px solid var(--hairline); border-radius: var(--radius-sm);
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-md); color: var(--plum);
  box-shadow: var(--shadow-xs);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
@media (hover: hover) {
  .report-action:hover { transform: translateY(-1px); border-color: var(--sun); box-shadow: var(--shadow-sm); }
}
.report-action:active { transform: translateY(1px); }
.report-action:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

.report-ach-section .report-bar { margin-bottom: 12px; }
.report-ach-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.report-chip {
  background: #FDF4E3; border: 1.5px solid #F3E2B8; color: #8A6516;
  font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 12px;
}

.report-empty { text-align: center; padding: 40px 22px; }
.report-empty-icon { font-size: 3rem; margin-bottom: 8px; }
.report-empty h3 { margin-bottom: 8px; }
.report-empty p { font-size: 0.9rem; color: var(--ink-soft); line-height: 1.6; margin: 0 auto; max-width: 300px; }

@media (min-width: 700px) {
  .report-metrics { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Small phones: reclaim content room ---------- */
@media (max-width: 420px) {
  .card { padding: 18px 14px; }
  .report-section { padding: 16px 14px; }
  .ach-hero { padding: 20px 14px; }
  .ws-overview { padding: 20px 14px; }
  .hero { padding: 20px 12px 16px; }
  .report-compare-row { grid-template-columns: 100px 1fr 40px; }
  .node-label { max-width: 128px; }
}

/* ---------- Onboarding: three scannable how-to-play rows ---------- */
.onb-list { display: flex; flex-direction: column; gap: 10px; text-align: left; margin: 4px 0 16px; }
.onb-row { display: flex; align-items: center; gap: 10px; font-size: 0.92rem; line-height: 1.45; color: var(--plum); font-weight: 600; }
.onb-ico {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem;
  background: var(--surface-soft); border: 2px solid var(--hairline-soft);
}

@media (prefers-reduced-motion: reduce) {
  .report-bar-fill { transition: none !important; }
}
