/* ==========================================================================
   GCKA Malayalam Kalari — visual system
   Backwater teal · kasavu gold · thechi marigold · banana-leaf green · kathakali red
   Malayalam leads; English supports.
   ========================================================================== */

:root {
  --text-scale: 1;

  /* Surfaces & ink */
  --ground: #FFFBF3;
  --ground-2: #F6EFDF;
  --surface: #FFFFFF;
  --surface-2: #FBF6EA;
  --ink: #15302A;
  --ink-2: #455C55;
  --ink-3: #6A7C75;
  --line: #EADFC8;
  --line-2: #D8C9A8;

  /* Brand */
  --teal: #0E6B5F;
  --teal-deep: #0A4A42;
  --teal-soft: #DCEFE9;
  --gold: #D4A03C;
  --gold-deep: #9C7020;
  --gold-soft: #F8EACB;
  --marigold: #F29A2E;
  --marigold-deep: #C8701A;
  --on-marigold: #2B1804;
  --leaf: #2F7D3A;
  --leaf-soft: #E1F1DC;
  --red: #B8392A;
  --red-soft: #F9E1DB;
  --sky: #BFE3EA;

  --ring-track: #EFE6D2;
  --ring-fill: var(--teal);
  --focus: #1F6FD1;
  --guide: #EFE5CF;
  --guide-line: #C9A860;
  --ink-trace: #0E6B5F;

  /* Scene: morning */
  --sky-1: #A6D7E2; --sky-2: #F7E7C6; --sky-3: #FCD7A0;
  --sun: #FFC864; --sun-glow: #FFE2A0; --star: transparent;
  --cloud: #FFFFFF;
  --hill-far: #A3C4BA; --hill-mid: #739F8C; --tea: #5F9A62; --tea-row: #85BB85; --mist: #FFF4DE;
  --shore: #2C5B43;
  --house-wall: #F8EFDD; --house-roof: #A8472B; --house-gable: #B85A3A; --house-gable-face: #F1E4CA; --house-pillar: #8B5A33; --house-door: #6B3A1E; --house-win: #3B2A1D; --house-base: #8C6A4A;
  --water-1: #95C7BE; --water-2: #3E7F76; --ripple: rgba(255,255,255,.55); --sun-trail: rgba(255,236,190,.7);
  --hb-hull: #4A2E1A; --hb-roof: #D8AA66; --hb-rib: #A87B40; --hb-win: #5A3B20;
  --canoe: #3A2616; --person: #2F2A26; --hat: #D9B26A;
  --palm-mid: #245A43; --trunk-mid: #6B5236; --palm-near: #123A2C; --trunk-near: #3D2C1E; --nut: #7A5A2A;
  --banana: #2A6532; --banana-vein: #4E8F4F;
  --bird: #3D4A45;

  /* Type */
  --f-display: "Baloo Chettan 2", "Noto Sans Malayalam", "Manjari", system-ui, sans-serif;
  --f-ml: "Noto Sans Malayalam", "Baloo Chettan 2", "Manjari", sans-serif;
  --f-ui: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Shape & motion */
  --r-sm: 12px; --r-md: 20px; --r-lg: 28px; --r-xl: 40px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(21,48,42,.06), 0 4px 14px rgba(21,48,42,.06);
  --shadow-2: 0 2px 6px rgba(21,48,42,.06), 0 16px 40px rgba(21,48,42,.12);
  --ease: cubic-bezier(.2,.8,.2,1);
  --spring: cubic-bezier(.34,1.56,.64,1);
  --gutter: clamp(16px, 4vw, 40px);
  --rail-w: 244px;
  --top-h: 64px;
  --tab-h: 72px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #0D1A1D; --ground-2: #122428; --surface: #162A2E; --surface-2: #1B3236;
    --ink: #EEF3EC; --ink-2: #BCCBC4; --ink-3: #8FA39B; --line: #25403F; --line-2: #33514F;
    --teal: #6BD0BC; --teal-deep: #A6E6D7; --teal-soft: #173E39; --gold: #E6BE62; --gold-deep: #F0CF84; --gold-soft: #2E2716;
    --marigold: #F5A64A; --marigold-deep: #F8BB70; --leaf: #7FCB82; --leaf-soft: #1B3620; --red: #F08A78; --red-soft: #3A1E1A;
    --ring-track: #24403F; --focus: #7FB6FF; --guide: #20393A; --guide-line: #6E8F7F; --ink-trace: #6BD0BC;
    --sky-1: #0A1630; --sky-2: #1D3153; --sky-3: #40506F; --sun: #F3EEDA; --sun-glow: #8EA6D6; --star: #F3EEDA; --cloud: #6B7C9A;
    --hill-far: #2B3F55; --hill-mid: #1F3A3D; --tea: #1E3A2C; --tea-row: #2B4E3A; --mist: #2B3D5A;
    --shore: #0F2A20; --house-wall: #C9BFA8; --house-roof: #5A2A1C; --house-gable: #6B3322; --house-gable-face: #A99F88; --house-pillar: #3E2A1A; --house-door: #2A1A10; --house-win: #FFC766; --house-base: #3A2C20;
    --water-1: #1D3A4E; --water-2: #0B1C26; --ripple: rgba(190,210,255,.35); --sun-trail: rgba(240,236,210,.45);
    --hb-hull: #1E130B; --hb-roof: #6B5332; --hb-rib: #4A3820; --hb-win: #FFC766; --canoe: #140D07; --person: #0F0D0C; --hat: #6D5A38;
    --palm-mid: #0F2A22; --trunk-mid: #2A2016; --palm-near: #06140F; --trunk-near: #120D08; --nut: #2A1F10; --banana: #0E2614; --banana-vein: #1E3E24; --bird: #90A0B8;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0D1A1D; --ground-2: #122428; --surface: #162A2E; --surface-2: #1B3236;
  --ink: #EEF3EC; --ink-2: #BCCBC4; --ink-3: #8FA39B; --line: #25403F; --line-2: #33514F;
  --teal: #6BD0BC; --teal-deep: #A6E6D7; --teal-soft: #173E39; --gold: #E6BE62; --gold-deep: #F0CF84; --gold-soft: #2E2716;
  --marigold: #F5A64A; --marigold-deep: #F8BB70; --leaf: #7FCB82; --leaf-soft: #1B3620; --red: #F08A78; --red-soft: #3A1E1A;
  --ring-track: #24403F; --focus: #7FB6FF; --guide: #20393A; --guide-line: #6E8F7F; --ink-trace: #6BD0BC;
  --sky-1: #0A1630; --sky-2: #1D3153; --sky-3: #40506F; --sun: #F3EEDA; --sun-glow: #8EA6D6; --star: #F3EEDA; --cloud: #6B7C9A;
  --hill-far: #2B3F55; --hill-mid: #1F3A3D; --tea: #1E3A2C; --tea-row: #2B4E3A; --mist: #2B3D5A;
  --shore: #0F2A20; --house-wall: #C9BFA8; --house-roof: #5A2A1C; --house-gable: #6B3322; --house-gable-face: #A99F88; --house-pillar: #3E2A1A; --house-door: #2A1A10; --house-win: #FFC766; --house-base: #3A2C20;
  --water-1: #1D3A4E; --water-2: #0B1C26; --ripple: rgba(190,210,255,.35); --sun-trail: rgba(240,236,210,.45);
  --hb-hull: #1E130B; --hb-roof: #6B5332; --hb-rib: #4A3820; --hb-win: #FFC766; --canoe: #140D07; --person: #0F0D0C; --hat: #6D5A38;
  --palm-mid: #0F2A22; --trunk-mid: #2A2016; --palm-near: #06140F; --trunk-near: #120D08; --nut: #2A1F10; --banana: #0E2614; --banana-vein: #1E3E24; --bird: #90A0B8;
}
:root[data-contrast="high"] {
  --ink: #000; --ink-2: #1A1A1A; --ink-3: #333; --line: #555; --line-2: #222;
  --teal: #004D43; --teal-deep: #00332C; --gold-deep: #6A4800; --red: #8A1A0E; --leaf: #1B5E22; --focus: #0040C0;
  --ground: #FFFFFF; --ground-2: #F2F2F2; --surface: #FFFFFF; --surface-2: #F7F7F7;
}
:root[data-theme="dark"][data-contrast="high"] { --ink: #FFF; --ink-2: #EEE; --ink-3: #DDD; --line: #AAA; --ground: #000; --surface: #0A0A0A; --surface-2: #111; --teal: #8FF0DC; --focus: #9CC8FF; }

/* ---- Base ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: calc(100% * var(--text-scale)); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 1rem/1.55 var(--f-ui); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.15; margin: 0; text-wrap: balance; font-weight: 700; }
p { margin: 0; }
a { color: var(--teal); }
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; }
.ml, [lang="ml"] { font-family: var(--f-ml); line-height: 1.6; }
h1 .ml, h2 .ml, .ml.big-inline, .ltile-glyph, .ls-glyph, .hero-title, .intro-glyph, .bubble, .tile, .now-letter, .done-glyph, .trace-demo, .try-letter, .fl, .eq-part, .eq-word, .lesson-glyph, .pl-glyph, .match-word, .slot .tile, .vocab-ml { font-family: var(--f-display); }
.en { color: var(--ink-2); }
.hide-translit .translit { display: none !important; }
.hide-english .en, .hide-english .vocab-en, .hide-english .pick-en { visibility: hidden; }
.muted { color: var(--ink-3); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.select { user-select: all; font-weight: 600; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 10px; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--surface); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-2); }
.skip-link:focus { top: 12px; }
[hidden] { display: none !important; }
.icon { width: 1.35em; height: 1.35em; flex: none; }

/* ---- Buttons & controls --------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .55em; min-height: 48px; padding: .6em 1.25em; border-radius: var(--r-pill); border: 2px solid transparent; background: var(--teal); color: #fff; font: 600 1rem/1.2 var(--f-ui); text-decoration: none; cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--primary { background: var(--marigold); color: var(--on-marigold); box-shadow: 0 3px 0 var(--marigold-deep); }
.btn--primary:hover { box-shadow: 0 4px 0 var(--marigold-deep), 0 10px 24px rgba(242,154,46,.3); }
.btn--ghost { background: transparent; color: var(--teal); border-color: var(--line-2); }
.btn--glass { background: rgba(255,255,255,.72); color: var(--teal-deep); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-color: rgba(255,255,255,.8); }
.btn--big { min-height: 58px; padding: .7em 1.6em; font-size: 1.08rem; }
.btn--small { min-height: 40px; padding: .4em .95em; font-size: .92rem; }
.btn--block { width: 100%; }
.btn .ml { font-weight: 700; font-size: 1.12em; line-height: 1; padding-top: .12em; }
.btn-sep { opacity: .45; }
.btn--say { background: var(--gold-soft); color: var(--ink); border-color: var(--gold); }
.is-rec { background: var(--red) !important; color: #fff !important; border-color: var(--red) !important; animation: pulse 1s infinite; }
.iconbtn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; text-decoration: none; }
.iconbtn:hover { background: var(--ground-2); color: var(--ink); }
.link, .link-btn { color: var(--teal); font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.chip { display: inline-flex; align-items: center; gap: .3em; padding: .2em .7em; border-radius: var(--r-pill); background: var(--ground-2); color: var(--ink-2); font: 600 .78rem/1.5 var(--f-ui); white-space: nowrap; vertical-align: middle; }
.chip .icon { width: 1.1em; height: 1.1em; }
.chip--good { background: var(--leaf-soft); color: var(--leaf); }
.chip--warn { background: var(--gold-soft); color: var(--gold-deep); }
.chip--here { background: var(--marigold); color: var(--on-marigold); }
.chip--teacher { background: var(--teal-soft); color: var(--teal); }
.soon { font: 700 .62rem/1 var(--f-ui); letter-spacing: .06em; text-transform: uppercase; padding: .35em .55em; border-radius: var(--r-pill); background: var(--gold-soft); color: var(--gold-deep); }
.eyebrow { font: 700 .78rem/1.3 var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: .5rem; }
.lede { font-size: 1.1rem; color: var(--ink-2); max-width: 60ch; }
.h-en { font-family: var(--f-ui); font-weight: 600; font-size: .55em; color: var(--ink-2); letter-spacing: 0; }

/* Speaker */
.speaker { position: relative; display: inline-grid; place-items: center; border-radius: 50%; border: 0; cursor: pointer; background: var(--teal-soft); color: var(--teal); transition: transform .2s var(--spring), background .2s; vertical-align: middle; flex: none; }
.speaker:hover { transform: scale(1.08); }
.speaker--sm { width: 36px; height: 36px; } .speaker--sm .icon { width: 20px; height: 20px; }
.speaker--md { width: 48px; height: 48px; }
.speaker--lg { width: 64px; height: 64px; } .speaker--lg .icon { width: 32px; height: 32px; }
.speaker--glass { background: rgba(255,255,255,.8); color: var(--teal-deep); box-shadow: 0 6px 20px rgba(10,74,66,.18); backdrop-filter: blur(8px); }
.speaker-waves { position: absolute; inset: 0; pointer-events: none; }
.speaker-waves i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--teal); opacity: 0; }
.is-playing .speaker-waves i, .speaker.is-playing .speaker-waves i { animation: wave 1.4s var(--ease) infinite; }
.speaker-waves i:nth-child(2) { animation-delay: .35s !important; } .speaker-waves i:nth-child(3) { animation-delay: .7s !important; }
@keyframes wave { from { transform: scale(1); opacity: .6; } to { transform: scale(1.9); opacity: 0; } }

.audio-controls { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); }
.audio-btn { display: inline-flex; align-items: center; gap: .4em; min-height: 44px; min-width: 44px; justify-content: center; padding: 0 .9em; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink-2); font: 600 .9rem var(--f-ui); cursor: pointer; }
.audio-btn:hover { background: var(--ground-2); color: var(--ink); }
.audio-btn--main { background: var(--teal); color: #fff; }
.audio-btn--main:hover { background: var(--teal-deep); color: #fff; }
:root[data-theme="dark"] .audio-btn--main, :root[data-theme="dark"] .audio-btn--main:hover { color: #06231F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .audio-btn--main, :root:not([data-theme="light"]) .audio-btn--main:hover { color: #06231F; } }
.audio-controls.is-playing .audio-btn--main { animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(14,107,95,.35); } 50% { box-shadow: 0 0 0 8px rgba(14,107,95,0); } }

/* Pictures */
.picture { display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 42%, var(--surface) 0 38%, var(--gold-soft) 70%); position: relative; max-width: 100%; }
.picture svg, .picture img { width: 82%; height: 82%; object-fit: contain; border-radius: 18%; }
.picture-emoji { font-size: 3.6rem; line-height: 1; filter: drop-shadow(0 4px 6px rgba(0,0,0,.12)); }
.picture--xs { width: 48px; } .picture--xs .picture-emoji { font-size: 1.7rem; }
.picture--sm { width: 84px; } .picture--sm .picture-emoji { font-size: 2.6rem; }
.picture--md { width: 128px; }
.picture--lg { width: 168px; } .picture--lg .picture-emoji { font-size: 5rem; }

/* Rings, stars, medals */
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring circle:last-child { transition: stroke-dashoffset 1s var(--ease); }
.ring-label { font: 700 .82rem var(--f-ui); color: var(--ink-2); }
.stars { display: inline-flex; gap: 4px; }
.stars .icon { width: 40px; height: 40px; stroke-width: 1.2; }
.stars .on { color: var(--marigold); stroke: var(--marigold-deep); }
.stars .off { color: var(--line); stroke: var(--line-2); }
.medal { position: relative; display: grid; place-items: center; flex: none; }
.medal--sm { width: 40px; height: 40px; } .medal--md { width: 76px; height: 76px; } .medal--lg { width: 104px; height: 104px; }
.medal-bloom { position: absolute; inset: 0; } .medal-bloom svg { width: 100%; height: 100%; }
.medal.is-earned .medal-bloom { animation: spin 60s linear infinite; }
.medal-core { position: relative; display: grid; place-items: center; width: 52%; height: 52%; border-radius: 50%; background: var(--surface); color: var(--teal); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.medal-core .icon { width: 58%; height: 58%; }
.medal.is-locked .medal-core { color: var(--ink-3); }
.medal.is-locked { opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toasts & petals */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; gap: 8px; width: min(520px, calc(100% - 32px)); pointer-events: none; }
@media (min-width: 960px) { .toasts { bottom: 24px; } }
.toast { pointer-events: auto; padding: 14px 18px; border-radius: 18px; background: var(--ink); color: var(--ground); box-shadow: var(--shadow-2); font-weight: 500; animation: toastIn .35s var(--spring); }
.toast .link-btn { color: inherit; }
.toast--good { background: var(--teal-deep); color: #fff; }
.toast--warn { background: #5A3B0C; color: #FFF3DD; }
.toast.out { opacity: 0; transform: translateY(10px); transition: .35s; }
.toast-badge { display: flex; align-items: center; gap: 12px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
.petals { position: fixed; inset: 0; pointer-events: none; z-index: 95; }
.petals i { position: absolute; width: 10px; height: 16px; border-radius: 60% 40% 60% 40%; animation: petal 1.2s var(--ease) forwards; }
@keyframes petal { to { transform: translate(var(--dx), calc(var(--dy) + 60px)) rotate(var(--r)); opacity: 0; } }

/* ---- Shell ---------------------------------------------------------------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-text { display: grid; line-height: 1.05; }
.brand-ml { font: 700 1.2rem/1.2 var(--f-display); color: var(--teal-deep); }
.brand-en { font: 600 .72rem/1.2 var(--f-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: color-mix(in srgb, var(--ground) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: var(--top-h); padding-inline: var(--gutter); }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.userchip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; min-height: 44px; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--gold-soft); font-size: 1.2rem; box-shadow: inset 0 0 0 2px var(--gold); flex: none; }
.userchip-name { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.shell { min-height: 100vh; }
.main { max-width: 1120px; margin: 0 auto; padding: 24px var(--gutter) calc(var(--tab-h) + 40px + env(safe-area-inset-bottom, 0px)); outline: none; }
.main--wide { max-width: 1240px; }
.rail { display: none; }
.tabbar { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; gap: 2px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(21,48,42,.06); }
.tab-link { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 6px 2px; min-height: 58px; border-radius: 16px; border: 0; background: none; color: var(--ink-3); text-decoration: none; cursor: pointer; }
.tab-link .icon { width: 26px; height: 26px; }
.tab-link .nav-label { display: grid; justify-items: center; line-height: 1.1; }
.tab-link .nav-label .ml { font-size: .78rem; font-weight: 600; }
.tab-link .nav-label .en { display: none; }
.tab-link .soon { display: none; }
.tab-link.is-active { color: var(--teal); background: var(--teal-soft); }
@media (min-width: 960px) {
  .shell:not(.shell--guest) { display: grid; grid-template-columns: var(--rail-w) 1fr; grid-template-rows: auto 1fr; }
  .shell:not(.shell--guest) .topbar { grid-column: 1 / -1; }
  .rail { display: flex; flex-direction: column; gap: 4px; padding: 20px 14px; position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; border-right: 1px solid var(--line); }
  .rail-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; color: var(--ink-2); text-decoration: none; }
  .rail-link:hover { background: var(--ground-2); color: var(--ink); }
  .rail-link.is-active { background: var(--teal-soft); color: var(--teal-deep); }
  .rail-link .nav-label { display: grid; line-height: 1.2; flex: 1; }
  .rail-link .nav-label .ml { font-weight: 600; font-size: .98rem; }
  .rail-link .nav-label .en { font-size: .78rem; }
  .tabbar { display: none; }
  .main { padding-bottom: 64px; }
}
.guest-note { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: center; padding: 12px 18px; margin-bottom: 20px; border-radius: 18px; background: var(--gold-soft); color: var(--ink); font-weight: 500; }
.shell--guest .main { padding-bottom: 64px; }

/* Sheets */
.sheet { border: 0; padding: 0; border-radius: 28px 28px 0 0; width: 100%; max-width: 560px; margin: auto auto 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); max-height: 88vh; }
@media (min-width: 700px) { .sheet { border-radius: 28px; margin: auto; } }
.sheet::backdrop { background: rgba(8,30,26,.45); backdrop-filter: blur(3px); }
.sheet[open] { animation: sheetIn .35s var(--spring); }
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 18px 6px 24px; }
.sheet-head h2 { font-size: 1.35rem; }
.settings, .account { display: grid; gap: 18px; padding: 8px 24px 28px; }
.account { gap: 12px; }
.seg { border: 0; padding: 0; margin: 0; }
.seg legend { font-weight: 600; margin-bottom: 8px; }
.seg-row { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; }
.seg-opt span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); border: 2px solid var(--line); cursor: pointer; font-weight: 600; }
.seg-opt input:checked + span { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-deep); }
.seg-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.settings-note { font-size: .9rem; color: var(--ink-2); padding: 12px 14px; background: var(--surface-2); border-radius: 14px; }
.more-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 8px 20px 28px; }
.more-link { display: grid; gap: 2px; padding: 16px; border-radius: 20px; background: var(--surface-2); text-decoration: none; color: var(--ink); position: relative; }
.more-link .icon { color: var(--teal); width: 28px; height: 28px; margin-bottom: 6px; }
.more-link .ml { font-weight: 600; } .more-link .en { font-size: .85rem; }
.more-link .soon { position: absolute; top: 12px; right: 12px; }

/* ---- Scene ------------------------------------------------------------- */
.scene { display: block; width: 100%; height: 100%; }
.scene .sun { fill: var(--sun); }
.scene .star { fill: var(--star); }
.scene .cloud { fill: var(--cloud); opacity: .85; } .scene .cloud.soft { opacity: .6; }
.scene .hill-far { fill: var(--hill-far); } .scene .hill-mid { fill: var(--hill-mid); }
.scene .tea { fill: var(--tea); } .scene .tea-row { fill: none; stroke: var(--tea-row); stroke-width: 3; stroke-linecap: round; opacity: .8; }
.scene .shore { fill: var(--shore); }
.scene .house-wall { fill: var(--house-wall); } .scene .house-roof { fill: var(--house-roof); } .scene .house-gable { fill: var(--house-gable); }
.scene .house-gable-face { fill: var(--house-gable-face); } .scene .house-pillar { fill: var(--house-pillar); } .scene .house-door { fill: var(--house-door); }
.scene .house-win { fill: var(--house-win); } .scene .house-base { fill: var(--house-base); }
.scene .house-roof-line { stroke: rgba(0,0,0,.18); stroke-width: 2; fill: none; }
.scene .sun-trail rect { fill: var(--sun-trail); }
.scene .ripples path { fill: none; stroke: var(--ripple); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 40 30; animation: ripple 7s linear infinite; }
.scene .hb-hull { fill: var(--hb-hull); } .scene .hb-roof { fill: var(--hb-roof); } .scene .hb-rib { stroke: var(--hb-rib); stroke-width: 3; }
.scene .hb-win { fill: var(--hb-win); }
.scene .cn-hull { fill: var(--canoe); } .scene .cn-person { fill: var(--person); } .scene .cn-hat { fill: var(--hat); } .scene .cn-pole { stroke: var(--canoe); stroke-width: 4; stroke-linecap: round; }
.scene .palm.mid .trunk { fill: var(--trunk-mid); } .scene .palm.mid .fronds { fill: var(--palm-mid); }
.scene .palm.near .trunk { fill: var(--trunk-near); } .scene .palm.near .fronds { fill: var(--palm-near); }
.scene .palm .ring { fill: none; stroke: rgba(0,0,0,.18); stroke-width: 1.5; }
.scene .nuts { fill: var(--nut); }
.scene .banana path { fill: var(--banana); } .scene .banana .vein { fill: none; stroke: var(--banana-vein); stroke-width: 3; } .scene .banana .stem { fill: var(--trunk-mid); }
.scene .birds path { fill: none; stroke: var(--bird); stroke-width: 2.5; stroke-linecap: round; }
.scene .layer { transition: transform .1s linear; will-change: transform; }
.scene .sway { transform-box: view-box; animation: sway 7s ease-in-out infinite alternate; }
.scene .drift { animation: drift 140s linear infinite; }
.scene .boat-drift { animation: boat 70s ease-in-out infinite alternate; }
.scene .canoe-drift { animation: canoe 26s ease-in-out infinite alternate; }
.scene .bird-drift { animation: birds 60s linear infinite; }
@keyframes sway { from { transform: rotate(-1.6deg); } to { transform: rotate(1.8deg); } }
@keyframes drift { from { transform: translateX(-120px); } to { transform: translateX(160px); } }
@keyframes boat { from { transform: translateX(-160px); } to { transform: translateX(200px); } }
@keyframes canoe { from { transform: translate(-40px, 0); } to { transform: translate(60px, 4px); } }
@keyframes birds { from { transform: translateX(-500px); } to { transform: translateX(1200px); } }
@keyframes ripple { to { stroke-dashoffset: -140; } }

/* ---- Landing ------------------------------------------------------------- */
.landing { background: var(--ground); }
.hero { position: relative; min-height: clamp(640px, 100svh, 940px); display: grid; grid-template-rows: auto 1fr; overflow: hidden; isolation: isolate; }
.hero-scene { position: absolute; inset: 0; z-index: -3; }
.float-layer { position: absolute; inset: 0 0 12% 0; z-index: -1; pointer-events: none; }
.fl { position: absolute; left: 0; top: 0; font-weight: 700; line-height: 1; color: rgba(255,255,255,.95); text-shadow: 0 2px 0 rgba(212,160,60,.55), 0 10px 30px rgba(10,74,66,.25); user-select: none; will-change: transform; }
.fl--near { pointer-events: auto; cursor: pointer; }
.fl--pop { animation: flpop .6s var(--spring); }
@keyframes flpop { 50% { color: var(--marigold); scale: 1.3; } }
.hero-veil { position: absolute; inset: 0; z-index: -2; background: radial-gradient(ellipse 60% 70% at 22% 50%, rgba(255,251,243,.82), rgba(255,251,243,.35) 55%, rgba(255,251,243,0) 75%); pointer-events: none; }
:root[data-theme="dark"] .hero-veil { background: radial-gradient(ellipse 70% 60% at 30% 46%, rgba(10,22,40,.6), transparent 70%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-veil { background: radial-gradient(ellipse 70% 60% at 30% 46%, rgba(10,22,40,.6), transparent 70%); } }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: max(18px, env(safe-area-inset-top)) var(--gutter) 0; }
.hero-top .brand-ml { color: var(--teal-deep); }
.hero-content { align-self: center; padding: 24px var(--gutter) 120px; max-width: 900px; display: grid; gap: 18px; justify-items: start; animation: rise 1s var(--ease) both; }
.hero-eyebrow { font: 700 .82rem/1 var(--f-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--teal-deep); background: rgba(255,255,255,.66); padding: 8px 14px; border-radius: var(--r-pill); backdrop-filter: blur(6px); }
.hero-title-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero-title { font-size: clamp(2.9rem, 1.6rem + 5.4vw, 5.8rem); font-weight: 800; line-height: 1.05; color: var(--teal-deep); letter-spacing: -.01em; text-shadow: 0 2px 0 rgba(255,255,255,.6), 0 12px 40px rgba(255,240,210,.9); padding-top: .12em; }
.hero-lines { display: grid; gap: 2px; font: 700 clamp(1.25rem, 1rem + 1.1vw, 1.75rem)/1.3 var(--f-display); color: var(--ink); }
.hero-lines span:nth-child(2) { color: var(--gold-deep); } .hero-lines span:nth-child(3) { color: var(--teal); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.hero-skills { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; list-style: none; padding: 0; margin: 6px 0 0; }
.hero-skills li { display: flex; align-items: center; gap: 6px; }
.hero-skills .dot { color: var(--gold-deep); font-weight: 700; }
.skill-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 14px 4px 10px; border-radius: var(--r-pill); border: 1px solid rgba(255,255,255,.8); background: rgba(255,255,255,.66); backdrop-filter: blur(8px); cursor: pointer; color: var(--teal-deep); }
.skill-pill .ml { font-weight: 700; font-size: 1.05rem; line-height: 1; padding-top: .15em; }
.skill-pill .en { font-size: .8rem; }
.hero-kasavu { position: absolute; left: 0; right: 0; bottom: 0; height: 14px; background: linear-gradient(var(--gold) 0 3px, #FFF7E4 3px 6px, var(--gold) 6px 9px, var(--ground) 9px); }
:root[data-theme="dark"] .hero-eyebrow, :root[data-theme="dark"] .skill-pill, :root[data-theme="dark"] .btn--glass { background: rgba(10,22,40,.55); color: var(--ink); border-color: rgba(255,255,255,.18); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-eyebrow, :root:not([data-theme="light"]) .skill-pill, :root:not([data-theme="light"]) .btn--glass { background: rgba(10,22,40,.55); color: var(--ink); border-color: rgba(255,255,255,.18); } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@media (max-width: 640px) {
  .hero-content { align-self: start; padding-top: 28px; gap: 14px; }
  .hero-skills .dot { display: none; }
  .hero-eyebrow { letter-spacing: .08em; font-size: .72rem; }
  .skill-pill { min-height: 40px; padding: 2px 12px 2px 8px; }
  .hero-cta .btn { width: 100%; }
  .hero-veil { background: linear-gradient(rgba(255,251,243,.75), rgba(255,251,243,.2) 70%, transparent); }
  .hero-top .btn { display: none; }
}

.band { padding-block: clamp(56px, 8vw, 104px); }
.band-inner { max-width: 1160px; margin: 0 auto; padding-inline: var(--gutter); }
.band h2 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3.2rem); margin-bottom: 14px; }
.band--try { background: var(--ground); }
.try { display: grid; gap: 40px; align-items: center; }
@media (min-width: 880px) { .try { grid-template-columns: 1fr 1.1fr; } }
.try-copy { display: grid; gap: 14px; justify-items: start; }
.try-stage { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; padding: 28px; border-radius: var(--r-xl); background: var(--teal-deep); background-image: radial-gradient(circle at 20% 30%, rgba(212,160,60,.25), transparent 50%), repeating-linear-gradient(90deg, transparent 0 22px, rgba(255,255,255,.03) 22px 24px); }
@media (max-width: 560px) { .try-stage { grid-template-columns: 1fr; justify-items: center; } }
.try-letter { width: 160px; height: 160px; border-radius: 42px; border: 0; background: var(--gold-soft); color: var(--teal-deep); font-size: 5.2rem; line-height: 1; font-weight: 800; cursor: pointer; box-shadow: 0 6px 0 var(--gold), 0 20px 40px rgba(0,0,0,.25); transition: transform .25s var(--spring); padding-top: .15em; }
.try-letter:hover { transform: rotate(-4deg) scale(1.04); }
.try-letter:active { transform: scale(.94); }
.try-words { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.try-word { width: 100%; display: grid; justify-items: center; gap: 2px; padding: 12px 8px; border: 0; border-radius: 24px; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; transition: background .2s, transform .2s var(--spring); animation: rise .7s var(--ease) both; animation-delay: calc(var(--i) * 90ms + 200ms); }
.try-word:hover { background: rgba(255,255,255,.16); transform: translateY(-3px); }
.try-word .ml { font-size: 1.35rem; font-weight: 700; } .try-word .en { color: rgba(255,255,255,.75); font-size: .85rem; }
.try-word .picture { background: radial-gradient(circle, #fff 0 40%, var(--gold-soft) 72%); }

.band--journey { background: linear-gradient(var(--teal-soft), var(--ground)); }
.river { list-style: none; margin: 36px 0 0; padding: 0; display: grid; gap: 18px; position: relative; }
.river::before { content: ""; position: absolute; left: 31px; top: 20px; bottom: 20px; width: 6px; border-radius: 6px; background: repeating-linear-gradient(var(--teal) 0 14px, transparent 14px 24px); opacity: .4; }
.river-stop { position: relative; display: grid; grid-template-columns: 68px 1fr; gap: 18px; align-items: start; }
.river-num { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: var(--surface); border: 3px solid var(--gold); font: 800 1.9rem/1 var(--f-display); color: var(--teal-deep); box-shadow: var(--shadow-1); padding-top: .12em; }
.river-ml { font: 700 1.5rem/1.3 var(--f-display); color: var(--teal-deep); }
.river-en { font-weight: 700; color: var(--gold-deep); font-size: .9rem; letter-spacing: .02em; }
.river-sum { color: var(--ink-2); max-width: 58ch; }
@media (min-width: 900px) {
  .river { grid-template-columns: repeat(5, 1fr); gap: 20px; }
  .river::before { left: 34px; right: 34px; top: 31px; bottom: auto; width: auto; height: 6px; background: repeating-linear-gradient(90deg, var(--teal) 0 14px, transparent 14px 24px); }
  .river-stop { grid-template-columns: 1fr; }
  .river-stop:nth-child(even) { margin-top: 40px; }
}

.band--child { background: var(--ground); }
.child { display: grid; gap: 36px; align-items: center; }
@media (min-width: 880px) { .child { grid-template-columns: 1.1fr 1fr; } }
.skill-sample { display: grid; gap: 14px; padding: 28px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-2); border: 1px solid var(--line); }
.ss-row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; }
.ss-name { display: grid; line-height: 1.2; } .ss-name .ml { font-weight: 700; font-size: 1.15rem; } .ss-name .en { font-size: .82rem; }
.ss-track, .sl-track { display: inline-flex; gap: 6px; }
.ss-track i, .sl-track i { width: 22px; height: 22px; border-radius: 50%; background: var(--ring-track); position: relative; }
.ss-track i.on, .sl-track i.on { background: var(--gold); box-shadow: inset 0 0 0 5px var(--marigold); }
.ss-lv, .sl-lv { font: 700 .85rem var(--f-ui); color: var(--ink-2); min-width: 4.6em; text-align: right; }
.site-foot { background: var(--teal-deep); color: #E6F2EE; padding-block: 40px; border-top: 8px solid var(--gold); }
.site-foot .brand, .site-foot .brand-ml, .site-foot .brand-en { color: #fff; }
.site-foot a { color: #FFE2A0; }
.foot { display: grid; gap: 14px; }

/* ---- Login --------------------------------------------------------------- */
.login { min-height: 100svh; display: grid; }
.login-scene { position: fixed; inset: 0; z-index: -1; }
.login-panel { align-self: center; justify-self: center; width: min(480px, calc(100% - 32px)); margin-block: 32px; padding: 24px clamp(20px, 5vw, 36px) 32px; border-radius: 32px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--shadow-2); display: grid; gap: 18px; animation: rise .6s var(--ease) both; }
.login-head { display: flex; justify-content: space-between; align-items: center; }
.login-title { display: grid; gap: 2px; } .login-title .ml { font-size: 2.4rem; color: var(--teal-deep); } .login-title .en { font: 600 1rem var(--f-ui); }
.login-form { display: grid; gap: 14px; }
.role-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 20px; background: var(--ground-2); }
.role-tab { display: grid; gap: 0; justify-items: center; padding: 8px 4px; min-height: 56px; border: 0; border-radius: 16px; background: none; cursor: pointer; color: var(--ink-2); }
.role-tab .ml { font-weight: 700; font-size: .98rem; } .role-tab .en { font-size: .75rem; }
.role-tab[aria-selected="true"] { background: var(--surface); color: var(--teal-deep); box-shadow: var(--shadow-1); }
.field { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
.field input, .field select, .export { font: 500 1.05rem var(--f-ui); min-height: 52px; padding: 10px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; }
.field input:focus, .field select:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 4px var(--teal-soft); }
.field input.ml { font-family: var(--f-ml); font-size: 1.2rem; }
.form-error { color: var(--red); font-weight: 600; min-height: 1.2em; }
.demo { display: grid; gap: 8px; padding-top: 8px; border-top: 1px dashed var(--line-2); }
.demo-title { font-weight: 700; font-size: .85rem; color: var(--ink-2); }
.demo-list { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; min-height: 44px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; }
.demo-chip .avatar { width: 30px; height: 30px; font-size: 1rem; }
.demo-hint, .login-note { font-size: .85rem; color: var(--ink-3); }

/* ---- Page heads & sections ---------------------------------------------------- */
.page-head { display: grid; gap: 6px; margin: 8px 0 24px; }
.page-head h1 { font-size: clamp(2.1rem, 1.5rem + 2.4vw, 3.3rem); }
.page-head h1 .ml { color: var(--teal-deep); }
.sec-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 1.3rem; margin-bottom: 14px; }
.sec-title .ml { color: var(--teal-deep); }
.sec-title .icon { color: var(--gold-deep); }
.sec-sub { color: var(--ink-3); font-size: .92rem; margin: -8px 0 14px; }
.sec-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sec-row .sec-sub { margin: 0 0 14px; }
.empty { color: var(--ink-3); padding: 18px; border-radius: 18px; background: var(--surface-2); }
.empty-page { display: grid; gap: 16px; justify-items: start; padding: 48px var(--gutter); }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; min-height: 44px; }

/* ---- Student dashboard ------------------------------------------------------ */
.greet { position: relative; border-radius: var(--r-xl); overflow: hidden; min-height: 270px; display: grid; align-items: end; box-shadow: var(--shadow-2); isolation: isolate; }
.greet-scene { position: absolute; inset: 0; z-index: -1; }
.greet-scene .scene { height: 100%; }
.greet-body { display: flex; gap: 18px; align-items: flex-end; padding: 80px 28px 26px; background: linear-gradient(transparent, color-mix(in srgb, var(--surface) 90%, transparent) 55%); }
.greet-avatar { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; font-size: 2.8rem; background: var(--gold-soft); box-shadow: inset 0 0 0 4px var(--gold), var(--shadow-1); flex: none; }
.greet-title { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.7rem); color: var(--ink); }
.greet-title .ml { color: var(--teal-deep); }
.wave { display: inline-block; animation: wave-hand 2.4s ease-in-out 1; transform-origin: 70% 80%; }
@keyframes wave-hand { 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-8deg); } 50% { transform: none; } }
.greet-sub { font-size: 1.1rem; color: var(--ink-2); margin: 2px 0 14px; }
.greet-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.level-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); }
.level-pill b { color: var(--gold-deep); } .level-pill .ml { font-weight: 600; } .level-pill .en { font-size: .85rem; }
@media (max-width: 560px) { .greet-body { flex-direction: column; align-items: flex-start; padding: 110px 20px 22px; } .greet-avatar { width: 64px; height: 64px; font-size: 2.1rem; } }

.dash-grid { display: grid; gap: 28px 24px; margin-top: 28px; }
@media (min-width: 900px) {
  .dash-grid { grid-template-columns: repeat(12, 1fr); }
  .now { grid-column: span 7; } .stats { grid-column: span 5; } .notes { grid-column: span 7; } .week { grid-column: span 5; }
  .skills { grid-column: span 6; } .badges { grid-column: span 6; }
  .dash-grid > .notes:only-child { grid-column: 1 / -1; }
}
.now-card { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 18px 22px 18px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-1); transition: transform .2s var(--ease), box-shadow .2s; }
.now-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.now-letter { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 28px; background: var(--teal-deep); color: var(--gold-soft); font-size: 3.1rem; font-weight: 800; line-height: 1; padding-top: .14em; box-shadow: inset 0 -6px 0 rgba(0,0,0,.18); }
:root[data-theme="dark"] .now-letter { background: var(--teal-soft); color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .now-letter { background: var(--teal-soft); color: var(--gold); } }
.now-title { font: 700 1.25rem var(--f-display); }
.now-meta { color: var(--ink-3); font-size: .9rem; }
.now-next { margin-top: 4px; font-weight: 600; color: var(--teal); }
@media (max-width: 480px) { .now-card { grid-template-columns: auto 1fr; } .now-card .ring { display: none; } .now-letter { width: 76px; height: 76px; font-size: 2.5rem; } }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; align-content: start; }
.stats--wide { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 28px; }
.stat { display: grid; gap: 2px; padding: 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.stat-icon { color: var(--gold-deep); }
.stat-num { font: 800 2.1rem/1.1 var(--f-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-num small { font: 600 .9rem var(--f-ui); color: var(--ink-3); }
.stat-label { display: grid; line-height: 1.25; } .stat-label .ml { font-weight: 600; font-size: .92rem; } .stat-label .en { font-size: .8rem; }
.stat--lamp { background: linear-gradient(160deg, var(--gold-soft), var(--surface-2)); }
.lamp { width: 72px; height: 50px; }
.lamp-metal { fill: var(--gold); }
.lamp .wick path { fill: var(--line-2); transform-box: fill-box; transform-origin: 50% 100%; }
.lamp .wick.on path { fill: var(--marigold); animation: flicker 1.8s ease-in-out infinite alternate; filter: drop-shadow(0 0 3px rgba(242,154,46,.8)); }
@keyframes flicker { 50% { transform: scaleY(1.15) scaleX(.9); } }

.notes { display: grid; gap: 10px; align-content: start; }
.note { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.note > .icon { color: var(--marigold-deep); margin-top: 3px; }
.note--hw { border-left: 0; background: linear-gradient(90deg, var(--gold-soft), var(--surface) 60%); }
.note-title { font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.note-title.ml { font-family: var(--f-display); font-size: 1.15rem; }
.note-text { color: var(--ink-2); } .note-meta { font-size: .82rem; color: var(--ink-3); margin-top: 2px; }

.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 170px; padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.wb { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; gap: 6px; height: 100%; }
.wb-count { font: 700 .8rem var(--f-ui); color: var(--ink-2); min-height: 1.2em; }
.wb-bar { align-self: end; width: 100%; max-width: 30px; border-radius: 10px 10px 6px 6px; background: var(--ring-track); }
.wb-bar.has { background: linear-gradient(var(--marigold), var(--gold)); }
.wb-day { font-size: .78rem; font-weight: 600; color: var(--ink-3); }
.wb.is-today .wb-day { color: var(--teal); }

.skill-levels { list-style: none; margin: 0; padding: 16px 18px; display: grid; gap: 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.sl { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; }
.sl-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--teal-soft); color: var(--teal); }
.sl-name { display: grid; line-height: 1.2; } .sl-name .ml { font-weight: 600; } .sl-name .en { font-size: .78rem; }
.sl-track i { width: 16px; height: 16px; } .sl-track i.on { box-shadow: inset 0 0 0 4px var(--marigold); }
@media (max-width: 420px) { .sl { grid-template-columns: auto 1fr auto; } .sl-track { display: none; } }

.badge-row, .badge-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.badge-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px; }
.badge-item { display: grid; justify-items: center; text-align: center; gap: 4px; }
.badge-ml { font-weight: 700; font-size: .92rem; line-height: 1.35; }
.badge-en { font-size: .8rem; color: var(--ink-2); } .badge-desc { font-size: .78rem; color: var(--ink-3); }
.badge-item.locked .badge-ml { color: var(--ink-3); }
.me-head { display: flex; gap: 16px; align-items: center; }

/* Journey page */
.path-river { display: grid; gap: 22px; position: relative; }
.path-level { position: relative; padding: 22px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 14px; }
.path-level.is-mine { border: 2px solid var(--marigold); box-shadow: 0 0 0 6px color-mix(in srgb, var(--marigold) 18%, transparent); }
.pl-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.pl-head > div { flex: 1; min-width: 200px; }
.pl-head h2 { display: grid; font-size: 1.6rem; } .pl-head h2 .en { font: 700 .88rem var(--f-ui); color: var(--gold-deep); }
.pl-head p { color: var(--ink-2); }
.pl-num { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--teal-deep); color: var(--gold-soft); font: 800 1.7rem/1 var(--f-display); padding-top: .12em; flex: none; }
.pl-focus { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .85rem; color: var(--ink-3); }
.pl-modules { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.path-module { padding: 14px; border-radius: var(--r-md); background: var(--surface-2); }
.pm-title { display: grid; line-height: 1.25; margin-bottom: 10px; } .pm-title .ml { font-weight: 700; } .pm-title .en { font-size: .82rem; }
.pm-lessons { display: flex; flex-wrap: wrap; gap: 8px; }
.pm-soon { font-size: .85rem; color: var(--ink-3); }
.path-lesson { display: inline-flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 18px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); min-height: 52px; }
.path-lesson.is-open { border-color: var(--gold); }
.path-lesson.is-open:hover { background: var(--gold-soft); }
.pl-glyph { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--teal-soft); color: var(--teal-deep); font-size: 1.25rem; font-weight: 800; line-height: 1; padding-top: .14em; }
.path-lesson.is-soon { opacity: .6; } .path-lesson.is-soon .pl-glyph { background: var(--ground-2); color: var(--ink-3); }
.pl-en { font-size: .85rem; font-weight: 600; }

/* ---- Alphabet explorer ---------------------------------------------------- */
.explorer-head { position: relative; padding: 28px 0 8px; overflow: visible; }
.explorer-head h1 { font-size: clamp(2.8rem, 2rem + 4vw, 4.6rem); }
.explorer-bloom { position: absolute; right: -40px; top: -30px; width: 220px; opacity: .32; pointer-events: none; animation: spin 120s linear infinite; z-index: -1; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; list-style: none; padding: 0; margin: 10px 0 0; font-size: .85rem; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.lg { margin-top: 26px; }
.lg-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 1.45rem; margin-bottom: 14px; }
.lg-title .ml { color: var(--teal-deep); } .lg-title .en { font: 600 .9rem var(--f-ui); }
.letter-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
.ltile { position: relative; display: grid; justify-items: center; align-content: center; gap: 0; aspect-ratio: 1; border-radius: 28px; background: var(--surface); border: 2px solid var(--line); color: var(--ink); text-decoration: none; transition: transform .25s var(--spring), box-shadow .2s, border-color .2s; animation: pop .5s var(--spring) both; animation-delay: calc(var(--i) * 18ms); }
.ltile:hover { transform: translateY(-4px) rotate(-2deg); box-shadow: var(--shadow-2); border-color: var(--teal); }
.ltile:active { transform: scale(.94); }
.ltile-glyph { font-size: clamp(2.3rem, 1.8rem + 1.6vw, 2.9rem); font-weight: 700; line-height: 1; padding-top: .18em; }
.ltile-tr { font: 600 .78rem var(--f-ui); color: var(--ink-3); }
.ltile.has-lesson { background: linear-gradient(160deg, var(--gold-soft), var(--surface) 70%); border-color: var(--gold); box-shadow: 0 4px 0 var(--gold); }
.ltile.has-lesson .ltile-glyph { color: var(--teal-deep); }
.ltile-flag { position: absolute; top: -8px; right: -8px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--marigold); color: var(--on-marigold); box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.ltile-flag .icon { width: 16px; height: 16px; }
.ltile.is-learned .ltile-flag, .ltile-flag.is-done { background: var(--leaf); color: #fff; }
.ltile-dot { position: absolute; top: 10px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--teal); }
.ltile-flag.demo, .ltile-dot.demo { position: static; flex: none; }
.ltile-dot.demo { display: inline-block; }
@keyframes pop { from { opacity: 0; transform: scale(.8) translateY(10px); } }

/* Letter page */
.letter-stage { position: relative; display: grid; gap: 20px; align-items: center; justify-items: center; text-align: center; padding: 20px 0 32px; isolation: isolate; }
@media (min-width: 820px) { .letter-stage { grid-template-columns: auto 1fr; text-align: left; justify-items: start; } }
.ls-bloom { position: absolute; left: 50%; top: 50%; width: min(420px, 90vw); translate: -50% -50%; opacity: .28; z-index: -1; pointer-events: none; animation: spin 90s linear infinite; }
@media (min-width: 820px) { .ls-bloom { left: 170px; } }
.ls-glyph { width: clamp(220px, 40vw, 300px); aspect-ratio: 1; display: grid; place-items: center; border: 0; border-radius: 64px; background: var(--surface); box-shadow: 0 10px 0 var(--gold), var(--shadow-2); color: var(--teal-deep); font-size: clamp(6.6rem, 17vw, 9.4rem); font-weight: 800; line-height: 1; padding-top: .14em; cursor: pointer; transition: transform .3s var(--spring); }
.ls-glyph:hover { transform: rotate(-3deg) scale(1.02); } .ls-glyph:active { transform: scale(.95); }
.ls-info { display: grid; gap: 14px; justify-items: inherit; max-width: 52ch; }
.ls-tr { font-size: 1.15rem; } .ls-tr .translit { font: 800 1.6rem var(--f-display); color: var(--gold-deep); } .ls-sound { color: var(--ink-2); }
.ls-intro { color: var(--ink-2); font-size: 1.05rem; }
.lesson-box { padding: 22px; border-radius: var(--r-lg); background: var(--teal-deep); color: #EAF5F1; display: grid; gap: 16px; margin-bottom: 36px; background-image: radial-gradient(circle at 90% 10%, rgba(212,160,60,.28), transparent 45%); }
.lesson-box .eyebrow { color: #FFD98A; } .lesson-box h2 { font-size: 1.6rem; color: #fff; } .lesson-box h2 .ml { color: #FFE2A0; }
:root[data-theme="dark"] .lesson-box { background-color: #0E3A33; }
.lb-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; } .lb-head > div { flex: 1; min-width: 200px; }
.lesson-box .ring { --ring-track: rgba(255,255,255,.18); --ring-fill: #FFD98A; } .lesson-box .ring-label { color: #fff; }
.act-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.act-chip { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; min-height: 52px; border-radius: 18px; background: rgba(255,255,255,.08); color: #fff; text-decoration: none; transition: background .2s; }
.act-chip:hover { background: rgba(255,255,255,.16); }
.act-chip .ml { display: block; font-weight: 600; line-height: 1.3; } .act-chip .en { display: block; color: rgba(255,255,255,.7); font-size: .8rem; }
.act-n { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.14); font-weight: 700; flex: none; }
.act-chip.is-done .act-n { background: #7FCB82; color: #0C2A12; }
.word-garden { margin-bottom: 32px; }
.vocab-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.letter-nav { display: flex; justify-content: space-between; gap: 12px; padding-top: 12px; }
.letter-nav .ml { font-size: 1.5rem; line-height: 1; padding-top: .15em; }

/* Vocabulary card */
.vocab { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 18px 14px 14px; border-radius: 32px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); transition: transform .25s var(--spring), box-shadow .2s; }
.vocab:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.vocab.tone-1 .picture { background: radial-gradient(circle at 50% 42%, var(--surface) 0 38%, var(--teal-soft) 70%); }
.vocab.tone-2 .picture { background: radial-gradient(circle at 50% 42%, var(--surface) 0 38%, var(--leaf-soft) 70%); }
.vocab.tone-3 .picture { background: radial-gradient(circle at 50% 42%, var(--surface) 0 38%, var(--red-soft) 70%); }
.vocab.tone-4 .picture { background: radial-gradient(circle at 50% 42%, var(--surface) 0 38%, #E4EEF8 70%); }
.vocab > .audio-controls { margin-top: auto; }
.vocab-pic { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; transition: transform .25s var(--spring); }
.vocab-pic:hover { transform: scale(1.05) rotate(-3deg); } .vocab-pic:active { transform: scale(.95); }
.vocab-body { display: grid; gap: 0; }
.vocab-ml { font-size: 1.9rem; font-weight: 700; line-height: 1.3; color: var(--ink); }
.vocab-translit { font: 600 .9rem var(--f-ui); color: var(--gold-deep); font-style: italic; }
.vocab-en { font-weight: 600; color: var(--ink-2); }
.vocab.is-heard::after { content: "✓"; position: absolute; top: 12px; right: 14px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--leaf); color: #fff; font-weight: 800; font-size: .85rem; }
.vocab-example { width: 100%; text-align: left; font-size: .92rem; border-top: 1px dashed var(--line-2); padding-top: 8px; }
.vocab-example summary { cursor: pointer; font-weight: 600; color: var(--teal); min-height: 32px; display: flex; align-items: center; }
.vocab-example p.ml { font-size: 1.05rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vocab-note { font-size: .82rem; color: var(--ink-3); }

/* ---- Lesson player ------------------------------------------------------- */
.lesson { min-height: 100svh; background: radial-gradient(ellipse at 50% -10%, var(--gold-soft), transparent 60%), var(--ground); }
.lesson-top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px var(--gutter); background: color-mix(in srgb, var(--ground) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.lesson-dots { flex: 1; display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; justify-content: center; flex-wrap: wrap; }
.ldot { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ring-track); color: var(--ink-3); font: 700 .8rem var(--f-ui); text-decoration: none; transition: transform .2s var(--spring); }
.ldot .icon { width: 18px; height: 18px; }
.ldot.is-done { background: var(--leaf); color: #fff; }
.ldot.is-current { background: var(--marigold); color: var(--on-marigold); transform: scale(1.15); box-shadow: 0 0 0 4px color-mix(in srgb, var(--marigold) 30%, transparent); }
.lesson-glyph { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--teal-deep); color: var(--gold-soft); font-size: 1.4rem; font-weight: 800; line-height: 1; padding-top: .16em; }
.lesson-main { max-width: 980px; margin: 0 auto; padding: 12px var(--gutter) 64px; outline: none; }
.act-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; text-align: center; margin: 8px 0 22px; }
.act-title .ml { font-size: clamp(1.7rem, 1.3rem + 1.8vw, 2.4rem); color: var(--teal-deep); }
.act-title .en { flex-basis: 100%; font: 600 1rem var(--f-ui); }
.stage { animation: rise .45s var(--ease) both; }
.act { display: grid; gap: 20px; }
.act-lede { font-size: 1.1rem; text-align: center; color: var(--ink-2); }
.big-inline { font-size: 1.6em; color: var(--teal-deep); vertical-align: -0.12em; }
.act-foot { display: flex; justify-content: center; padding-top: 6px; }
.feedback { text-align: center; font-weight: 600; min-height: 1.6em; display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.feedback .icon { color: var(--leaf); }
.round-count { text-align: center; font: 700 .85rem var(--f-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

.result, .done { display: grid; justify-items: center; text-align: center; gap: 12px; padding: 36px 20px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-2); }
.result-ml { font: 800 2.4rem var(--f-display); color: var(--teal-deep); display: flex; align-items: center; gap: 10px; }
.result-en { color: var(--ink-2); font-size: 1.1rem; }
.result-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 8px; }
.done-glyph { font-size: 7rem; line-height: 1; font-weight: 800; color: var(--gold-deep); padding-top: .12em; animation: pop .7s var(--spring); }
.done h2 { font-size: 2.2rem; color: var(--teal-deep); display: flex; align-items: center; gap: 10px; }
.done-badge { display: grid; justify-items: center; gap: 6px; padding: 14px 22px; border-radius: 24px; background: var(--gold-soft); }
.guest-inline { padding: 10px 16px; border-radius: 14px; background: var(--gold-soft); }

/* Intro */
.intro-stage { display: grid; gap: 24px; align-items: center; justify-items: center; text-align: center; }
@media (min-width: 760px) { .intro-stage { grid-template-columns: auto 1fr; text-align: left; justify-items: start; } }
.intro-glyph { width: clamp(200px, 36vw, 260px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 56px; background: var(--surface); box-shadow: 0 8px 0 var(--gold), var(--shadow-2); font-size: clamp(6rem, 15vw, 8.2rem); font-weight: 800; line-height: 1; color: var(--teal-deep); padding-top: .14em; overflow: hidden; }
.intro-glyph .draw { display: inline-block; clip-path: inset(0 100% 0 0); animation: draw 1.6s .2s var(--ease) forwards; }
@keyframes draw { to { clip-path: inset(0 0 0 0); } }
.intro-copy { display: grid; gap: 12px; justify-items: inherit; }
.intro-ml { font: 700 1.7rem/1.4 var(--f-display); color: var(--teal-deep); }
.intro-en { font-size: 1.1rem; color: var(--ink-2); max-width: 48ch; }
.tip { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 12px 16px; border-radius: 16px; background: var(--gold-soft); color: var(--ink); max-width: 48ch; }
.tip .icon { color: var(--gold-deep); margin-top: 2px; }
.intro-word { display: flex; justify-content: center; }
.intro-word-btn { display: flex; align-items: center; gap: 16px; padding: 10px 26px 10px 10px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); cursor: pointer; box-shadow: var(--shadow-1); }
.intro-word-btn .picture { width: 72px; } .intro-word-btn .picture-emoji { font-size: 2.3rem; }
.intro-word-btn .ml { font: 700 2rem var(--f-display); } .hl { color: var(--marigold-deep); }
.say-row { display: grid; justify-items: center; gap: 6px; }
.say-count { font-weight: 600; color: var(--leaf); min-height: 1.4em; }

/* Gallery meter */
.meter-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.meter { width: min(320px, 100%); height: 14px; border-radius: 10px; background: var(--ring-track); overflow: hidden; }
.meter-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--marigold)); border-radius: 10px; transition: width .4s var(--ease); }
.meter-label { font-weight: 600; color: var(--ink-2); }

/* Listen & choose */
.listen-bar { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; }
.big-listen { display: inline-flex; align-items: center; gap: 10px; min-height: 64px; padding: 0 28px; border-radius: var(--r-pill); border: 0; background: var(--teal); color: #fff; font: 700 1.15rem var(--f-ui); cursor: pointer; box-shadow: 0 5px 0 var(--teal-deep); }
.big-listen .icon { width: 30px; height: 30px; }
.big-listen:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--teal-deep); }
:root[data-theme="dark"] .big-listen { color: #06231F; }
.listen-bar .audio-btn { border: 1px solid var(--line); background: var(--surface); }
.listen-bar .round-count { flex-basis: 100%; }
.hint-row { display: flex; justify-content: center; align-items: center; gap: 12px; }
.reveal { font: 700 1.8rem var(--f-display); color: var(--teal-deep); }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 560px; margin: 0 auto; width: 100%; }
@media (min-width: 760px) { .choices { grid-template-columns: repeat(4, 1fr); max-width: none; } }
.choice { position: relative; display: grid; place-items: center; padding: 16px; border-radius: 32px; border: 3px solid var(--line); background: var(--surface); cursor: pointer; transition: transform .2s var(--spring), border-color .2s; min-height: 150px; }
.choice:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--teal); }
.choice .picture { width: min(128px, 100%); }
.choice.is-right { border-color: var(--leaf); background: var(--leaf-soft); }
.choice.is-wrong { border-color: var(--red); background: var(--red-soft); opacity: .7; }
.choice-mark, .pick-mark, .match-mark { position: absolute; top: 10px; right: 10px; }
.choice-mark .icon, .pick-mark .icon, .match-mark .icon { width: 28px; height: 28px; padding: 4px; border-radius: 50%; color: #fff; stroke-width: 3; }
.is-right .icon, .is-matched .match-mark .icon { background: var(--leaf); }
.is-wrong .choice-mark .icon, .is-wrong .pick-mark .icon { background: var(--red); }

/* Starts with */
.pick-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .pick-grid { grid-template-columns: repeat(4, 1fr); } }
.pick { position: relative; display: grid; justify-items: center; }
.pick-btn { position: relative; width: 100%; display: grid; justify-items: center; gap: 2px; padding: 14px 10px 44px; border-radius: 28px; border: 3px solid var(--line); background: var(--surface); cursor: pointer; transition: transform .2s var(--spring), border-color .2s, background .2s; }
.pick-btn:hover { transform: translateY(-2px); }
.pick-ml { font: 700 1.6rem/1.3 var(--f-display); }
.pick-ml.starts { text-decoration: underline wavy var(--marigold); text-underline-offset: 6px; }
.pick-en { font-size: .85rem; color: var(--ink-2); }
.pick > .speaker { position: absolute; bottom: 8px; }
.pick.is-chosen .pick-btn { border-color: var(--marigold); background: var(--gold-soft); }
.pick.is-chosen .pick-btn::before { content: "✓ picked"; position: absolute; top: 8px; left: 12px; font: 700 .72rem var(--f-ui); color: var(--marigold-deep); }
.pick.is-right .pick-btn { border-color: var(--leaf); }
.pick.is-wrong .pick-btn { border-color: var(--red); }

/* Find the letter */
.find-head { display: grid; justify-items: center; gap: 10px; }
.tally { display: flex; gap: 8px; justify-content: center; }
.tally i { width: 20px; height: 20px; border-radius: 50%; background: var(--ring-track); transition: background .3s, transform .3s var(--spring); }
.tally i.on { background: var(--marigold); transform: scale(1.2); }
.bubbles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; max-width: 520px; margin: 0 auto; width: 100%; }
.bubble { position: relative; aspect-ratio: 1; border-radius: 50%; border: 3px solid var(--line); background: var(--surface); font-size: clamp(2.4rem, 8vw, 3.4rem); font-weight: 700; line-height: 1; padding-top: .16em; cursor: pointer; color: var(--ink); animation: pop .5s var(--spring) both; animation-delay: calc(var(--i) * 30ms); transition: transform .2s var(--spring); }
.bubble:hover { transform: scale(1.06); }
.bubble.is-found { background: var(--gold-soft); border-color: var(--gold); color: var(--teal-deep); }
.bubble-mark { position: absolute; top: -4px; right: -4px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--leaf); color: #fff; }
.bubble-mark .icon { width: 16px; height: 16px; stroke-width: 3; }

/* Picture match */
.match-board { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 28px; max-width: 620px; margin: 0 auto; width: 100%; }
.match-col { display: grid; gap: 12px; }
.match { position: relative; display: grid; place-items: center; min-height: 104px; padding: 10px; border-radius: 26px; border: 3px solid var(--line); background: var(--surface); cursor: pointer; transition: transform .2s var(--spring), border-color .2s, background .2s; }
.match:hover:not(:disabled) { border-color: var(--teal); }
.match-word { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); font-weight: 700; line-height: 1.3; padding-top: .1em; }
.match.is-selected { border-color: var(--marigold); background: var(--gold-soft); transform: scale(1.03); }
.match.is-matched { border-style: solid; cursor: default; }
.match.pair-1 { border-color: var(--leaf); background: var(--leaf-soft); } .match.pair-2 { border-color: var(--teal); background: var(--teal-soft); }
.match.pair-3 { border-color: var(--gold); background: var(--gold-soft); } .match.pair-4 { border-color: #7C8CD6; background: #E8ECFA; }
:root[data-theme="dark"] .match.pair-4 { background: #1E2644; }

/* Build the word */
.build-card { display: flex; align-items: center; justify-content: center; gap: 20px; flex-wrap: wrap; }
.build-en { font: 700 1.4rem var(--f-display); margin-bottom: 8px; }
.slots { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.slot { display: grid; place-items: center; min-width: 92px; height: 104px; padding: 6px; border-radius: 26px; border: 3px dashed var(--line-2); background: var(--surface-2); }
.slots.is-built .slot { border-style: solid; border-color: var(--leaf); background: var(--leaf-soft); }
.tray { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; min-height: 100px; padding: 14px; border-radius: 28px; background: var(--ground-2); }
.tile { min-width: 80px; height: 88px; padding: 0 16px; border-radius: 22px; border: 0; background: var(--surface); box-shadow: 0 5px 0 var(--gold), var(--shadow-1); font-size: 2.6rem; font-weight: 700; line-height: 1; padding-top: .16em; color: var(--teal-deep); cursor: grab; touch-action: none; user-select: none; transition: transform .2s var(--spring); }
.tile:hover { transform: translateY(-3px); }
.tile.is-lifted { opacity: .35; }
.tile--ghost { position: fixed; z-index: 99; pointer-events: none; transform: translate(-50%, -60%) rotate(-4deg) scale(1.08); box-shadow: 0 16px 30px rgba(0,0,0,.2); }
.slot .tile { box-shadow: none; background: transparent; }
.equation { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; animation: pop .6s var(--spring); }
.eq-part { font-size: 2.2rem; font-weight: 700; padding: 4px 16px; border-radius: 16px; background: var(--gold-soft); line-height: 1.3; }
.eq-op { font: 800 1.8rem var(--f-ui); color: var(--ink-3); }
.eq-word { font-size: 3rem; font-weight: 800; color: var(--teal-deep); line-height: 1.2; }

/* Trace */
.act-trace { grid-template-columns: 1fr; justify-items: center; }
@media (min-width: 820px) { .act-trace { grid-template-columns: 1fr auto; align-items: start; } }
.trace-side { display: grid; justify-items: center; gap: 14px; }
.trace-demo { width: 150px; height: 150px; display: grid; place-items: center; border-radius: 32px; background: var(--surface); box-shadow: var(--shadow-1); font-size: 4.6rem; font-weight: 800; line-height: 1; color: var(--teal-deep); padding-top: .14em; overflow: hidden; }
.trace-demo span { clip-path: inset(0 100% 0 0); animation: draw 2.4s var(--ease) infinite; }
.trace-demo.still span { clip-path: none; animation: none; }
.trace-pad { display: grid; gap: 12px; justify-items: center; }
.trace-canvas { border-radius: 36px; background: var(--surface); box-shadow: inset 0 0 0 3px var(--line), var(--shadow-1); touch-action: none; cursor: crosshair; max-width: 100%; height: auto !important; aspect-ratio: 1; }
.trace-tools { display: flex; gap: 12px; }

/* ---- Staff (teacher & admin) ---------------------------------------------- */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 24px; }
.kpi { display: grid; gap: 2px; padding: 16px 18px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
a.kpi:hover { border-color: var(--teal); }
.kpi-n { font: 800 1.9rem/1.15 var(--f-display); font-variant-numeric: tabular-nums; }
.kpi-l { font-size: .85rem; color: var(--ink-2); font-weight: 600; }
.panel { padding: 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); margin-bottom: 20px; }
.panel--help { background: linear-gradient(120deg, var(--gold-soft), var(--surface) 70%); }
.help-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.help-list li { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.help-list a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.help-list span:last-child { color: var(--ink-2); font-size: .9rem; }
.class-pick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.class-tab { padding: 8px 16px; border-radius: var(--r-pill); border: 1px solid var(--line); text-decoration: none; color: var(--ink-2); font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.class-tab[aria-selected="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.roster { width: 100%; border-collapse: collapse; font-size: .93rem; }
.roster th, .roster td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.roster thead th { font: 700 .75rem var(--f-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.roster tbody th { font-weight: 600; }
.roster .num { text-align: right; font-variant-numeric: tabular-nums; }
.roster td.ml, .roster th.ml { font-size: 1.15rem; }
.stu { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.stu .avatar, .help-list .avatar, .roster .avatar { width: 30px; height: 30px; font-size: 1rem; }
.mini-bar { display: inline-block; width: 70px; height: 8px; border-radius: 6px; background: var(--ring-track); overflow: hidden; vertical-align: middle; }
.mini-bar i { display: block; height: 100%; background: var(--teal); border-radius: 6px; }
.as-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.as-list li { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 16px; background: var(--surface-2); }
.as-list li > div:not(.ring) { flex: 1; } .as-list p { color: var(--ink-2); font-size: .9rem; }
.as-list li > .icon { color: var(--marigold-deep); }
.form-card { display: grid; gap: 16px; padding: 22px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); margin-bottom: 20px; justify-items: start; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); width: 100%; }
.span-2 { grid-column: 1 / -1; }
.pic-pick { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.emoji-row { display: flex; flex-wrap: wrap; gap: 4px; }
.emoji-opt { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 1.4rem; cursor: pointer; }
.emoji-opt:hover { border-color: var(--teal); }
.studio-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.studio-tab { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: var(--r-pill); border: 1px solid var(--line); font-weight: 600; color: var(--ink-3); }
.studio-tab.is-on { background: var(--teal); border-color: var(--teal); color: #fff; }
.studio-list { display: grid; gap: 8px; }
.studio-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 18px; background: var(--surface-2); }
.sr-word { display: grid; justify-items: start; line-height: 1.3; } .sr-word b.ml { font-size: 1.3rem; font-family: var(--f-display); } .sr-word span { color: var(--ink-2); font-size: .88rem; }
.sr-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
@media (min-width: 900px) { .studio-row { grid-template-columns: auto minmax(160px, 1fr) auto auto auto; } .sr-actions { grid-column: auto; } }
.edit-box { margin-top: 14px; } .edit-box summary { cursor: pointer; font-weight: 600; color: var(--teal); min-height: 40px; display: flex; align-items: center; }
.skill-edit { display: grid; gap: 14px; margin-top: 10px; justify-items: start; }
.skill-edit-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); width: 100%; }
.activity-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .92rem; }
.activity-log li { display: flex; gap: 14px; } .activity-log time { color: var(--ink-3); min-width: 9.5em; font-variant-numeric: tabular-nums; }
.level-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.level-bars li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); }
.lvb-meta { color: var(--ink-2); font-size: .9rem; }
.sys { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 16px; }
.sys dt { font-weight: 600; color: var(--ink-2); } .sys dd { margin: 0; }
@media (max-width: 560px) { .sys { grid-template-columns: 1fr; } .sys dd { margin-bottom: 8px; } }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.export { font: 400 .8rem/1.4 ui-monospace, monospace; min-height: 200px; }
.tree, .tree ul, .tree-acts { list-style: none; margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.tree { padding-left: 0; }
.tree details > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; min-height: 44px; }
.tree details > summary:hover { background: var(--surface-2); }
.tree details > p { padding-left: 12px; }
.tree-kind { font: 700 .65rem var(--f-ui); letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; background: var(--teal-soft); color: var(--teal); }
.tree-acts li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 10px; font-size: .92rem; }
.tree code { font-size: .78rem; background: var(--ground-2); padding: 2px 6px; border-radius: 6px; }

/* ---- Soon pages ---------------------------------------------------------- */
.soon-page { border-radius: var(--r-xl); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.soon-scene { height: 220px; }
.soon-body { display: grid; gap: 10px; justify-items: start; padding: 26px; margin-top: -40px; position: relative; }
.soon-icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 24px; background: var(--marigold); color: var(--on-marigold); box-shadow: var(--shadow-2); }
.soon-icon .icon { width: 36px; height: 36px; }
.soon-body h1 { font-size: clamp(2.2rem, 1.6rem + 2.4vw, 3.2rem); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.soon-body .h-en { font-size: 1.1rem; }
.soon-items { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 4px 0 10px; }
.soon-items li { padding: 8px 14px; border-radius: var(--r-pill); background: var(--gold-soft); font-weight: 600; }

/* ---- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) *, :root:not([data-motion="full"]) *::before, :root:not([data-motion="full"]) *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }

@media (max-width: 420px) { .brand-en { display: none; } .level-pill { flex-wrap: wrap; row-gap: 0; } }
.sr-only { left: 0; top: 0; }
.tab-link { min-width: 0; }
.tab-link .nav-label { max-width: 100%; }
.tab-link .nav-label .ml { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .74rem; }
.explorer, .letter-page { overflow-x: clip; }
@media (max-width: 600px) {
  .studio-row { grid-template-columns: auto 1fr auto; }
  .rec-state { grid-column: 1 / -1; }
}
:root[data-theme="dark"] .hero-title { text-shadow: 0 4px 30px rgba(0,0,0,.45); }
:root[data-theme="dark"] .speaker--glass { background: rgba(10,22,40,.6); color: var(--ink); }
:root[data-theme="dark"] .fl { color: rgba(240,236,218,.9); text-shadow: 0 0 18px rgba(143,166,214,.5); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero-title { text-shadow: 0 4px 30px rgba(0,0,0,.45); }
  :root:not([data-theme="light"]) .speaker--glass { background: rgba(10,22,40,.6); color: var(--ink); }
  :root:not([data-theme="light"]) .fl { color: rgba(240,236,218,.9); text-shadow: 0 0 18px rgba(143,166,214,.5); }
}
