@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Regular.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Bold.ttf") format("truetype");
  font-weight: 700;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-ExtraBold.ttf") format("truetype");
  font-weight: 800;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Black.ttf") format("truetype");
  font-weight: 900;
}

:root {
  --bg: #f5f7fb;
  --ink: #1f2430;
  --ink-soft: #5d6579;
  --blue: #2f6fed;
  --blue-dark: #1f55c4;
  --blue-bg: #e8effd;
  --violet: #6c4bd8;
  --violet-dark: #5438b8;
  --amber: #f0a832;
  --amber-bg: #fdf3e0;
  --green: #1e9e6a;
  --green-bg: #e3f5ec;
  --red: #d9534f;
  --red-bg: #fbe9e8;
  --card: #ffffff;
  --line: #e2e7f0;
  --radius: 16px;
  --fs-q: 18px;
  --fs-opt: 15.5px;
  --shadow-card: 0 3px 0 var(--line);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Vazirmatn", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
}

.app { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; }
@media (min-width: 900px) { .app { max-width: 880px; } }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--violet); color: #fff;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 700;
  box-shadow: 0 4px 0 var(--violet-dark);
}
.brand-name { font-size: 20px; font-weight: 700; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--ink-soft); line-height: 1.4; }
.badge {
  font-size: 12px; font-weight: 700; color: #8a6414;
  background: #fbeecd; border: 1px solid #f3dd9d;
  padding: 4px 10px; border-radius: 999px;
}

/* screens */
.screen { display: none; }
.screen.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* main tabs (IXL-like sections) */
.main-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.main-tab {
  flex: 1; text-align: center; padding: 9px 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  font-size: 14px; font-weight: 700; color: var(--ink-soft);
}
.main-tab.active { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 3px 0 var(--blue-dark); }
.main-tab.soon { opacity: .75; font-weight: 400; }
.main-tab small { display: block; font-size: 10.5px; line-height: 1.3; }

/* hero */
.hero h1 { font-size: 25px; font-weight: 700; line-height: 1.45; margin: 4px 0 6px; }
.hero p { color: var(--ink-soft); font-size: 14.5px; margin-bottom: 16px; }

/* grade tabs */
.grade-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.grade-tab {
  flex: 1 1 28%; padding: 10px 4px; cursor: pointer;
  background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  font-family: inherit; color: inherit; text-align: center;
}
.grade-tab .g-num { font-size: 22px; font-weight: 700; color: var(--blue); line-height: 1.2; display: block; }
.grade-tab .g-name { font-size: 13px; font-weight: 700; display: block; }
.grade-tab.active { border-color: var(--blue); background: var(--blue-bg); box-shadow: 0 3px 0 var(--blue); }
.grade-card { /* kept for compat with older drivers */ }

/* band selector */
.band-tabs {
  display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px; margin-bottom: 12px;
}
.band-tab {
  flex: 1; border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 700; color: var(--ink-soft);
  padding: 8px 4px; border-radius: 999px;
}
.band-tab.active { background: var(--ink); color: #fff; }
.grade-tab .g-soon { display: block; font-size: 10.5px; color: var(--ink-soft); }
.grade-tab.disabled { opacity: .5; cursor: default; }
.grade-tab.disabled .g-num { color: var(--ink-soft); }

/* mascot (kids band only) */
.mascot { display: none; }
.mascot-practice { display: none; }
.mascot-result { display: none; }
body.kids .mascot-practice {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  background: #e6f7f7; border: 2px solid #bfe8e8; border-radius: 20px; padding: 8px 14px;
}
.mascot-practice .bubble { font-size: 15px; font-weight: 700; }
.mascot-practice .bubble small { display: block; font-weight: 400; color: var(--ink-soft); font-size: 12.5px; }
body.kids .mascot-result { display: block; text-align: center; margin-bottom: 2px; }

/* ================= DESIGN SYSTEM v1.1 — advanced layer ================= */
/* sticky glass topbar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  margin: 0 -16px; padding: 10px 16px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.app { padding-top: 6px; }

/* soft ambient background blobs */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(420px 300px at 88% -40px, color-mix(in srgb, var(--blue) 13%, transparent), transparent 70%),
    radial-gradient(380px 280px at 4% 34%, color-mix(in srgb, var(--amber) 10%, transparent), transparent 70%),
    radial-gradient(460px 320px at 96% 88%, color-mix(in srgb, var(--green) 8%, transparent), transparent 70%);
}

/* hero accent */
.hero h1 .accent {
  background: linear-gradient(90deg, var(--blue), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
body.kids .hero h1 .accent {
  background: linear-gradient(90deg, var(--blue), #12a5a5);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* layered cards */
.dash-card, .q-card, .practice-panel, .result-card, .grade-progress {
  box-shadow: 0 3px 0 var(--line), 0 14px 30px -18px rgba(31, 36, 48, .25);
}
.dash-card {
  background:
    radial-gradient(220px 150px at 92% 0%, color-mix(in srgb, var(--blue) 14%, transparent), transparent 70%),
    linear-gradient(160deg, var(--card), color-mix(in srgb, var(--blue-bg) 55%, var(--card)));
}
.lesson-row, .hub-card { box-shadow: 0 2px 0 var(--line), 0 10px 22px -16px rgba(31, 36, 48, .28); }
.lesson-row { transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.lesson-row:hover { transform: translateY(-2px); }
.grade-tab { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.grade-tab:hover { transform: translateY(-2px); }
.btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--blue) 88%, #fff), var(--blue));
}
.main-tab.active, body.kids .main-tab.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--blue) 88%, #fff), var(--blue));
}

/* score bar: striped moving fill */
.score-fill {
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,.22) 0 8px, transparent 8px 16px);
  background-blend-mode: overlay;
}

/* entrance motion */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.screen.active .dash-card, .screen.active .continue-card,
.screen.active .grade-progress, .screen.active .practice-panel,
.screen.active .q-card, .screen.active .result-card { animation: rise .38s ease both; }
.screen.active .lesson-row, .screen.active .hub-card { animation: rise .38s ease both; }
.screen.active .lesson-row:nth-of-type(2) { animation-delay: .04s; }
.screen.active .lesson-row:nth-of-type(3) { animation-delay: .08s; }
.screen.active .lesson-row:nth-of-type(4) { animation-delay: .12s; }
.screen.active .lesson-row:nth-of-type(5) { animation-delay: .16s; }
.screen.active .lesson-row:nth-of-type(6) { animation-delay: .20s; }

/* mascot idle float */
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.mascot svg, .mascot-result svg { animation: floaty 3.2s ease-in-out infinite; }
.mascot-practice svg { animation: floaty 3.8s ease-in-out infinite; }

/* feedback + correct pop */
@keyframes slideup { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.feedback { animation: slideup .3s ease both; }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.025); } 100% { transform: scale(1); } }
.option.correct { animation: pop .35s ease; }

/* result stars pop-in */
.result-stars .star { display: inline-block; animation: starpop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.result-stars .star:nth-child(2) { animation-delay: .12s; }
.result-stars .star:nth-child(3) { animation-delay: .24s; }
.result-stars .star.empty { color: #d8dee9; }
@keyframes starpop { from { opacity: 0; transform: scale(.2) rotate(-30deg); } to { opacity: 1; transform: scale(1) rotate(0); } }

/* confetti particles */
.confetti {
  position: absolute; width: 8px; height: 8px; border-radius: 2px;
  pointer-events: none; z-index: 5;
  animation: confetti-fly .85s cubic-bezier(.15, .7, .4, 1) forwards;
}
@keyframes confetti-fly {
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) rotateX(560deg) rotateY(320deg); opacity: 0; }
}
.q-card, .result-card { position: relative; overflow: visible; }

/* kids skill path: dotted line connecting lesson rings */
body.kids #chapter-list .lesson-row { position: relative; }
body.kids #chapter-list .lesson-row::before {
  content: ""; position: absolute; right: 40px; top: -12px; height: 26px;
  border-right: 4px dotted color-mix(in srgb, var(--blue) 45%, var(--line));
  z-index: 0;
}
body.kids #chapter-list .chapter-head + .lesson-row::before { display: none; }
body.kids #chapter-list .skill-ring-wrap { z-index: 1; background: var(--card); border-radius: 50%; }

/* focus visibility (a11y) */
button:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ================= DESIGN SYSTEM v1.2 — interaction layer ================= */
/* dashboard ring gradient */
.dash-ring .ring-fg { stroke: url(#dashGrad); }
.dash-stop-1 { stop-color: var(--blue); }
.dash-stop-2 { stop-color: var(--green); }

/* question progress dots */
.q-dots { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.q-dot { width: 9px; height: 9px; border-radius: 50%; background: #dde4ef; transition: background .3s ease, transform .3s ease; }
.q-dot.ok { background: var(--green); }
.q-dot.no { background: var(--red); opacity: .65; }
.q-dot.now { background: transparent; border: 2px solid var(--blue); width: 11px; height: 11px; margin-top: -1px; animation: dotpulse 1.4s ease-in-out infinite; }
@keyframes dotpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }

/* question transition */
.q-anim .q-text, .q-anim .options { animation: qin .32s ease both; }
.q-anim .options { animation-delay: .05s; }
@keyframes qin { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

/* mastery badge on lesson ring */
.master-badge {
  position: absolute; bottom: -2px; inset-inline-start: -2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--green); border: 2px solid var(--card);
  display: grid; place-items: center; z-index: 2;
}
.master-badge svg { width: 11px; height: 11px; }

/* option ripple */
.option { position: relative; overflow: hidden; }
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: color-mix(in srgb, var(--blue) 22%, transparent);
  transform: scale(0); animation: ripple-go .55s ease-out forwards;
}
@keyframes ripple-go { to { transform: scale(1); opacity: 0; } }

/* mascot cheer reaction */
@keyframes cheer-bounce { 0% { transform: translateY(0); } 30% { transform: translateY(-7px) rotate(-1.5deg); } 55% { transform: translateY(0); } 75% { transform: translateY(-4px); } 100% { transform: translateY(0); } }
.mascot-practice.cheer { animation: cheer-bounce .9s ease; }
.mascot-practice.cheer .bubble span { color: var(--green); }

/* kids ambient dot pattern */
body.kids::before {
  background:
    radial-gradient(circle, color-mix(in srgb, var(--blue) 13%, transparent) 1.6px, transparent 1.7px) 0 0 / 26px 26px,
    radial-gradient(420px 300px at 88% -40px, color-mix(in srgb, var(--blue) 13%, transparent), transparent 70%),
    radial-gradient(380px 280px at 4% 34%, color-mix(in srgb, var(--amber) 10%, transparent), transparent 70%);
}

/* ================= DESIGN SYSTEM v1.3 — sound & delight layer ================= */
/* sound toggle */
.sound-btn {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--line); background: var(--card); color: var(--blue);
  display: grid; place-items: center; cursor: pointer; padding: 0;
  transition: transform .15s ease, border-color .15s ease;
}
.sound-btn:hover { transform: translateY(-1px); }
.sound-btn svg { width: 19px; height: 19px; }
.sound-btn .snd-slash { display: none; }
.sound-btn.muted { color: var(--ink-soft); }
.sound-btn.muted .snd-wave { display: none; }
.sound-btn.muted .snd-slash { display: block; }

/* screen transition */
@keyframes screen-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.screen.active { animation: screen-in .3s ease both; }

/* hero sparkles (kids only) */
.hero { position: relative; }
.hero-sparkles { display: none; }
body.kids .hero-sparkles { display: block; }
.hero-sparkles .sp { position: absolute; color: var(--amber); opacity: .55; pointer-events: none; }
.hero-sparkles .sp1 { width: 22px; top: 6px; inset-inline-start: 12px; animation: floaty 3.4s ease-in-out infinite; }
.hero-sparkles .sp2 { width: 14px; top: 64px; inset-inline-end: 6px; color: var(--blue); animation: floaty 2.8s ease-in-out .5s infinite; }
.hero-sparkles .sp3 { width: 10px; bottom: 10px; inset-inline-start: 38px; color: #12a5a5; animation: floaty 3.9s ease-in-out .9s infinite; }

/* ================= DESIGN SYSTEM v1.4 — dark mode & touch layer ================= */
.top-actions { display: flex; align-items: center; gap: 8px; }
.theme-btn {
  width: 36px; height: 36px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--card); color: var(--amber);
  display: grid; place-items: center; transition: transform .15s ease;
}
.theme-btn:hover { transform: translateY(-1px); }
.theme-btn svg { width: 19px; height: 19px; }
.theme-btn .ic-sun { display: none; }
html.dark .theme-btn .ic-sun { display: block; }
html.dark .theme-btn .ic-moon { display: none; }
::selection { background: color-mix(in srgb, var(--blue) 30%, transparent); }

/* dark tokens — teen */
html.dark body {
  --bg: #0d1322; --card: #16203a; --ink: #eaf0fa; --ink-soft: #a3b1cc; --line: #28355a;
  --blue: #5f8dff; --blue-dark: #9db9ff; --blue-bg: #1d2c52;
  --green: #34c98c; --green-bg: #10382a;
  --amber: #f7bc45; --amber-bg: #42320f;
  --red: #ff8474; --red-bg: #472622;
  --violet: #a58dff;
}
/* dark tokens — kids «night sky» */
html.dark body.kids {
  --bg: #1e1735; --card: #2b2149; --ink: #f8f1e3; --ink-soft: #cabde8; --line: #4a3a75;
  --blue: #ff8f4d; --blue-dark: #ffb98c; --blue-bg: #3d2a63;
  --green: #3ed598; --green-bg: #14382c;
  --amber: #ffc44d; --amber-bg: #4a360f;
  --red: #ff8a7a; --red-bg: #4a2622;
}
/* dark component fixes for hardcoded light colours */
html.dark .badge { background: #3a2f10; color: #f7bc45; border-color: #5c4a1a; }
html.dark .mascot-practice, html.dark body.kids .mascot { background: #12303a; border-color: #1f4a56; }
html.dark .result-stars .star.empty { color: #3d4a6e; }
html.dark .q-dot { background: #2c3a5e; }
html.dark .dot-none { background: #3a4767; }
html.dark .skill-ring .ring-bg, html.dark .ring-bg, html.dark .dash-ring .ring-bg { stroke: #28355a; }
html.dark .score-bar { background: #232f52; }
html.dark .zone-practice { background: #2c447c; }
html.dark .zone-challenge { background: #6b5518; }
html.dark .zone-mastery { background: #1d5c40; }
html.dark .zone-mark { background: #0d1322; }
html.dark .score-num.challenge { color: #f7bc45; }
html.dark .stat { background: #111a30; }
html.dark .hero-sparkles .sp { opacity: .95; }
html.dark .option { background: color-mix(in srgb, var(--card) 84%, #ffffff 13%); }
html.dark .skill-chip, html.dark .status-none, html.dark .chip-soft { background: color-mix(in srgb, var(--card) 86%, var(--ink) 14%); }
html.dark .fb-explain { background: color-mix(in srgb, var(--card) 84%, #ffffff 8%); }
.badge { white-space: nowrap; }

/* mastery glow on the practice panel */
.practice-panel { transition: border-color .4s ease, box-shadow .4s ease; }
.practice-panel.mastered {
  border-color: color-mix(in srgb, var(--green) 55%, var(--line));
  box-shadow: 0 3px 0 var(--line), 0 0 0 4px color-mix(in srgb, var(--green) 13%, transparent), 0 14px 30px -18px rgba(31, 36, 48, .25);
}

/* ================= DESIGN SYSTEM v2.0 — excitement layer ================= */
body { --accent: #6c4bd8; }
body.kids { --accent: #12a5a5; }

/* typography punch: heavier display weights */
.hero h1, .brand-name, .dash-title, .result-card h2 { font-weight: 800; }
.q-text { font-weight: 800; }
.score-num, .ring-num { font-weight: 800; }
body.kids .hero h1, body.kids .q-text { font-weight: 900; }
.timer, .score-num, .ring-num, .dash-ring-num, .skill-ring-num { font-variant-numeric: tabular-nums; }

/* tactile 3D press buttons */
.btn-primary {
  box-shadow: 0 4px 0 color-mix(in srgb, var(--blue) 58%, #000);
  transition: transform .07s ease, box-shadow .07s ease, filter .15s ease;
}
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--blue) 58%, #000); }
.btn-ghost { transition: transform .07s ease, background .15s ease; }
.btn-ghost:active { transform: translateY(2px); }
.grade-tab:active { transform: translateY(1px); }
.lesson-row:active { transform: translateY(1px) scale(.995); }

/* card top highlight */
.dash-card, .q-card, .result-card, .practice-panel, .grade-progress {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 3px 0 var(--line), 0 14px 30px -18px rgba(31, 36, 48, .25);
}
html.dark .dash-card, html.dark .q-card, html.dark .result-card, html.dark .practice-panel, html.dark .grade-progress {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 3px 0 var(--line), 0 14px 30px -18px rgba(0, 0, 0, .5);
}

/* mascot entrance */
@keyframes mascot-in { from { opacity: 0; transform: translateY(16px) scale(.7); } to { opacity: 1; transform: none; } }
.screen.active .mascot { animation: mascot-in .55s cubic-bezier(.2, 1.5, .35, 1) both; }

/* lesson rings draw themselves in */
@keyframes ringdraw { from { stroke-dashoffset: 119.4; } }
.skill-ring .ring-fg { animation: ringdraw .9s ease both; }

/* options stagger in per question */
.q-anim .option { animation: optin .32s ease both; }
.q-anim .option:nth-child(2) { animation-delay: .05s; }
.q-anim .option:nth-child(3) { animation-delay: .1s; }
.q-anim .option:nth-child(4) { animation-delay: .15s; }
@keyframes optin { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

/* living score stripes */
.score-fill { animation: stripes-move 1.1s linear infinite; }
@keyframes stripes-move { to { background-position: 18px 0; } }

/* shine sweep on the correct option */
.option.correct::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
  transform: translateX(130%); animation: shine-sweep .7s ease .05s both;
}
@keyframes shine-sweep { to { transform: translateX(-130%); } }

/* per-grade accent wiring */
.hero h1 .accent, body.kids .hero h1 .accent {
  background: linear-gradient(90deg, var(--blue), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.dash-card {
  background:
    radial-gradient(220px 150px at 92% 0%, color-mix(in srgb, var(--accent) 17%, transparent), transparent 70%),
    linear-gradient(160deg, var(--card), color-mix(in srgb, var(--blue-bg) 55%, var(--card)));
}
#chapter-list .chapter-title { color: var(--accent); }
.grade-tab.active { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 40%, transparent); }
.grade-tab.active .g-num { color: var(--accent); }

/* result medal (teen band) */
.result-medal { display: none; justify-content: center; margin: 0 0 8px; }
.result-medal.show { display: flex; }
.result-medal .medal {
  animation: medal-in .6s cubic-bezier(.2, 1.6, .4, 1) both, medal-sway 3.2s ease-in-out .7s infinite alternate;
  transform-origin: 50% 0; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .18));
}
@keyframes medal-in { from { opacity: 0; transform: translateY(-18px) scale(.6); } to { opacity: 1; transform: none; } }
@keyframes medal-sway { from { transform: rotate(3.5deg); } to { transform: rotate(-3.5deg); } }

/* ================= CHARACTER v2 — Limo comes alive ================= */
.eyes-happy { display: none; }
.eyes-happy.show, .show-happy .eyes-happy { display: block; }
.show-happy .eyes-normal { display: none; }
.show-happy .cheek { opacity: .92; }

/* blinking + wandering gaze */
.eye { transform-box: fill-box; transform-origin: center; animation: blink 4.8s ease-in-out infinite; }
@keyframes blink { 0%, 91%, 100% { transform: scaleY(1); } 94.5% { transform: scaleY(.08); } 97.5% { transform: scaleY(1); } }
.pupil { animation: look 8s ease-in-out infinite; }
.pupil-think { animation: none; }
@keyframes look { 0%, 100% { transform: translate(0, 0); } 22% { transform: translate(1.6px, .4px); } 48% { transform: translate(-1.4px, .8px); } 74% { transform: translate(.5px, -1.1px); } }

/* breathing + head tilt */
.owl-body { transform-box: fill-box; transform-origin: 50% 100%; animation: breathe 3.8s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, 1.022); } }
.owl-head { transform-box: fill-box; transform-origin: 50% 92%; animation: headtilt 9s ease-in-out infinite; }
@keyframes headtilt { 0%, 100% { transform: rotate(0deg); } 30% { transform: rotate(1.6deg); } 65% { transform: rotate(-1.4deg); } }

/* home greeting wave (restarts whenever Home activates) */
.wing-wave { transform-box: fill-box; transform-origin: 18% 12%; }
.screen.active .wing-wave { animation: wave 1.7s ease-in-out 2; }
@keyframes wave { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(-17deg); } 55% { transform: rotate(4deg); } 80% { transform: rotate(-11deg); } }

/* brows: thinking raise (practice) + gentle worry (soft state) */
.brow { transform-box: fill-box; transform-origin: center; transition: transform .3s ease; }
.mascot-practice .brow-r { transform: translateY(-2.5px); }
.show-soft .brow-l { transform: rotate(16deg) translateY(1px); }
.show-soft .brow-r { transform: rotate(-16deg) translateY(1px); }

/* result stars twinkle */
.twinkle { transform-box: fill-box; transform-origin: center; animation: twinkle 2.6s ease-in-out infinite; }
.twinkle.tw2 { animation-delay: .5s; }
.twinkle.tw3 { animation-delay: 1.1s; }
@keyframes twinkle { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.3); opacity: .75; } }

/* ================= DESIGN SYSTEM v2.1 — band personalities & combo ================= */
/* junior (7–9): violet-tinted, hero shapes in the grade accent */
body.junior { --bg: #f5f3fc; }
html.dark body.junior { --bg: #131022; }
body.junior .hero-sparkles { display: block; }
body.junior .hero-sparkles .sp { color: var(--accent); opacity: .3; }
body.junior .hero-sparkles .sp1 { width: 17px; }
body.junior .hero-sparkles .sp2 { width: 11px; }
body.junior .hero-sparkles .sp3 { width: 8px; }
/* senior (10–12): cooler, denser, no floating shapes */
body.senior { --bg: #edf0f5; }
html.dark body.senior { --bg: #0b101d; }

/* coming-soon grade tabs: dashed invitation */
.grade-tab.soon { border-style: dashed; }

/* chapter mastery progress bar */
.chapter-head { flex-wrap: wrap; }
.ch-progress {
  flex: 1 1 100%; height: 6px; margin-top: 7px;
  background: color-mix(in srgb, var(--line) 75%, transparent);
  border-radius: 999px; overflow: hidden;
}
.ch-progress span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--accent));
  transition: width .6s ease;
}

/* combo streak chip (teen bands) */
.combo-wrap { display: flex; justify-content: center; margin-top: 8px; }
.combo-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 800; color: #b06f00;
  background: linear-gradient(90deg, var(--amber-bg), color-mix(in srgb, var(--amber) 22%, var(--card)));
  border: 1.5px solid color-mix(in srgb, var(--amber) 55%, var(--line));
  padding: 3px 12px; border-radius: 999px;
}
.combo-chip b { font-size: 14px; }
.combo-chip[hidden] { display: none; }
.combo-chip.pop { animation: combo-pop .35s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes combo-pop { 0% { transform: scale(.7); } 100% { transform: scale(1); } }
html.dark .combo-chip { color: var(--amber); }

/* ================= DESIGN SYSTEM v2.2 — analytics & awards screens ================= */
button.main-tab { font-family: inherit; cursor: pointer; }
.sub-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.screen-title { font-size: 20px; font-weight: 800; }

.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.sum-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 14px 10px; text-align: center; display: flex; flex-direction: column; gap: 2px;
  box-shadow: 0 2px 0 var(--line), 0 10px 22px -16px rgba(31, 36, 48, .28);
}
.sum-card b { font-size: 24px; font-weight: 800; color: var(--blue); }
.sum-card small { color: var(--ink-soft); font-size: 12.5px; }

.g-row { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 11px 14px; margin-bottom: 9px; }
.g-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.g-row-head span { font-weight: 800; font-size: 14.5px; }
.g-row-head small { color: var(--ink-soft); font-size: 11.5px; text-align: left; }
.g-bar { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--line) 75%, transparent); overflow: hidden; }
.g-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--accent)); transition: width .6s ease; }

.sess-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 10px 14px; margin-bottom: 9px;
}
.sess-main b { display: block; font-size: 14.5px; }
.sess-main small { color: var(--ink-soft); font-size: 11.5px; }
.score-chip {
  flex-shrink: 0; min-width: 44px; text-align: center;
  font-weight: 800; font-size: 15px; padding: 5px 9px; border-radius: 11px;
  background: var(--blue-bg); color: var(--blue);
}
.score-chip.challenge { background: var(--amber-bg); color: #b06f00; }
.score-chip.mastery { background: var(--green-bg); color: var(--green); }
html.dark .score-chip.challenge { color: var(--amber); }

.empty-card {
  background: var(--card); border: 1.5px dashed var(--line); border-radius: 18px;
  padding: 26px 20px; text-align: center;
}
.empty-card b { font-size: 16.5px; display: block; margin-bottom: 6px; }
.empty-card p { color: var(--ink-soft); font-size: 13.5px; line-height: 1.9; }

.awards-head { margin-bottom: 16px; }
.awards-head b { font-size: 16.5px; font-weight: 800; display: block; margin-bottom: 9px; }
.badge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.badge-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 18px;
  padding: 16px 12px 13px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 5px;
  box-shadow: 0 2px 0 var(--line), 0 10px 22px -16px rgba(31, 36, 48, .28);
  animation: rise .38s ease both;
}
.badge-card b { font-size: 14.5px; font-weight: 800; }
.badge-card small { color: var(--ink-soft); font-size: 11.5px; line-height: 1.7; }
.badge-ic {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 3px;
  background: var(--blue-bg); color: var(--blue);
}
.badge-ic svg { width: 26px; height: 26px; }
.badge-card.c1 .badge-ic { background: var(--amber-bg); color: #b06f00; }
.badge-card.c2 .badge-ic { background: var(--green-bg); color: var(--green); }
.badge-card.c3 .badge-ic { background: color-mix(in srgb, var(--violet) 16%, var(--card)); color: var(--violet); }
html.dark .badge-card.c1 .badge-ic { color: var(--amber); }
.badge-state { font-size: 11px; font-weight: 800; color: var(--green); margin-top: 2px; }
.badge-card.locked { opacity: .62; }
.badge-card.locked .badge-ic { background: color-mix(in srgb, var(--line) 55%, var(--card)); color: var(--ink-soft); }
.badge-card.locked .badge-state { color: var(--ink-soft); }

/* SVG icon set (DESIGN_SYSTEM §6) */
.hub-icon { width: 30px; height: 30px; color: var(--blue); flex-shrink: 0; }
.icon-trophy { width: 13px; height: 13px; vertical-align: -2px; }
.zone-label .icon-trophy { width: 12px; height: 12px; }
.result-stars { font-size: 36px; color: var(--amber); letter-spacing: 8px; line-height: 1.2; min-height: 10px; }

/* ---------- KIDS THEME (elementary band) ---------- */
body.kids {
  --blue: #f0762b;
  --blue-dark: #cf5a15;
  --blue-bg: #fdeee1;
  --bg: #fff6ea;
  --line: #f0dcbf;
  --radius: 22px;
  --fs-q: 21px;
  --fs-opt: 17px;
}
body.kids .brand-mark { background: #12a5a5; box-shadow: 0 4px 0 #0d8a8a; }
body.kids .main-tab.active { background: var(--blue); box-shadow: 0 3px 0 var(--blue-dark); }
body.kids .band-tab.active { background: var(--blue); }
body.kids .mascot {
  display: flex; align-items: center; gap: 14px;
  background: #e6f7f7; border: 2px solid #bfe8e8; border-radius: 26px;
  padding: 12px 16px; margin-bottom: 16px;
}
body.kids .mascot-text { display: flex; flex-direction: column; }
body.kids .mascot-text b { font-size: 17px; }
body.kids .mascot-text small { color: var(--ink-soft); font-size: 13px; }
body.kids .hero h1 { font-size: 27px; }
body.kids .hero p { font-size: 16px; }
body.kids .grade-tab { border-radius: 20px; padding: 12px 4px; }
body.kids .grade-tab .g-num { font-size: 26px; }
body.kids .lesson-row { border-radius: 20px; padding: 15px; border-width: 2px; }
body.kids .lesson-main b { font-size: 17px; }
body.kids .btn-primary { border-radius: 18px; }
body.kids .option { padding: 16px 14px; border-radius: 18px; }
body.kids .option .letter { min-width: 36px; height: 36px; border-radius: 12px; font-size: 16px; }
body.kids .fb-title { font-size: 18px; }
body.kids .status-pill { font-size: 13px; padding: 5px 12px; }

/* dashboard card */
.dash-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; box-shadow: 0 3px 0 var(--line); margin-bottom: 18px;
}
.dash-top { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.dash-ring-wrap { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.dash-ring { width: 84px; height: 84px; transform: rotate(-90deg); }
.dash-ring circle { fill: none; stroke-width: 8; }
.dash-ring .ring-bg { stroke: var(--blue-bg); }
.dash-ring .ring-fg { stroke: var(--blue); stroke-linecap: round; stroke-dasharray: 188.5; stroke-dashoffset: 188.5; transition: stroke-dashoffset .8s ease; }
.dash-ring-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 17px; font-weight: 700; }
.dash-info { flex: 1; min-width: 0; }
.dash-title { font-size: 18px; font-weight: 700; }
.dash-sub { font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.dash-stats { display: flex; gap: 14px; font-size: 13px; color: var(--ink-soft); flex-wrap: wrap; }
.dash-stats b { color: var(--ink); font-size: 15px; }

/* sections */
.section-label { font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.continue-card {
  background: var(--amber-bg); border: 1px solid #f3dd9d; border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 18px;
}
.continue-row { display: flex; align-items: center; gap: 12px; }
.continue-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.continue-text b { font-size: 15px; }
.continue-text small { color: var(--ink-soft); font-size: 12.5px; }
.reco { margin-bottom: 6px; }

/* hub */
.hub { margin-top: 22px; }
.hub-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; text-decoration: none; color: inherit;
}
.hub-emoji { font-size: 24px; }
.hub-text { flex: 1; display: flex; flex-direction: column; }
.hub-text b { font-size: 15px; }
.hub-text small { color: var(--ink-soft); font-size: 12.5px; }
.hub-arrow { color: var(--blue); font-weight: 700; }
.foot { margin-top: 26px; text-align: center; font-size: 12px; color: var(--ink-soft); }

/* lessons / skill list */
.nav-row { display: flex; align-items: center; gap: 12px; }
.nav-row h2 { font-size: 20px; }
.muted { color: var(--ink-soft); font-size: 14px; }
.grade-progress {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 14px 0 6px;
}
.grade-progress-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.progress-track { height: 10px; background: var(--blue-bg); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--blue), var(--green)); border-radius: 999px; transition: width .6s ease; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-none { background: #c9d2e3; }
.dot-mid { background: var(--amber); }
.dot-master { background: var(--green); }

.chapter-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 22px 0 8px; }
.chapter-title { font-size: 14.5px; font-weight: 700; color: var(--blue-dark); }
.chapter-progress { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }

.lesson-row {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer;
  font-family: inherit; color: inherit; text-align: right;
}
.lesson-row:active { background: var(--blue-bg); }
.skill-ring-wrap { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
.skill-ring { width: 52px; height: 52px; transform: rotate(-90deg); }
.skill-ring circle { fill: none; stroke-width: 6; }
.skill-ring .ring-bg { stroke: #e8edf5; }
.skill-ring .ring-fg { stroke-linecap: round; stroke-dasharray: 119.4; transition: stroke-dashoffset .5s ease; }
.skill-ring-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.lesson-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lesson-main b { font-size: 15px; line-height: 1.5; }
.lesson-main small { color: var(--ink-soft); font-size: 12px; }
.skill-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.skill-chip { background: #f1f4fa; color: var(--ink-soft); font-size: 11px; padding: 1px 8px; border-radius: 999px; }
.status-pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.status-none { background: #f1f4fa; color: var(--ink-soft); }
.status-mid { background: var(--amber-bg); color: #8a6414; border: 1px solid #f3dd9d; }
.status-master { background: var(--green-bg); color: var(--green); border: 1px solid #cdeeda; }
.lesson-code { font-size: 11px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* buttons */
.btn-ghost {
  background: transparent; border: 1px solid var(--line); color: var(--ink-soft);
  border-radius: 12px; padding: 7px 12px; font-family: inherit; font-size: 13.5px; cursor: pointer;
}
.btn-ghost.big { padding: 12px 16px; font-size: 15px; }
.btn-primary {
  background: var(--blue); color: #fff; border: none; border-radius: 14px;
  padding: 13px 22px; font-family: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 0 var(--blue-dark);
  transition: transform .1s ease, box-shadow .1s ease;
}
.btn-primary:active { transform: translateY(4px); box-shadow: 0 0 0 var(--blue-dark); }
.btn-primary.full { width: 100%; }
.btn-primary.small { padding: 9px 16px; font-size: 14px; border-radius: 12px; box-shadow: 0 3px 0 var(--blue-dark); }

/* practice */
.practice-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 12px; box-shadow: 0 3px 0 var(--line); margin-bottom: 14px;
}
.practice-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.p-stat { text-align: center; }
.p-stat small { display: block; font-size: 11px; color: var(--ink-soft); line-height: 1.4; }
.p-stat b { font-size: 15px; font-variant-numeric: tabular-nums; }
.score-box { text-align: center; min-width: 74px; }
.score-label { font-size: 11.5px; color: var(--ink-soft); }
.score-num { font-size: 30px; font-weight: 700; color: var(--blue); line-height: 1.1; }
.score-num.challenge { color: #c07f10; }
.score-num.mastery { color: var(--green); }

.score-bar { position: relative; height: 14px; border-radius: 999px; overflow: hidden; margin: 10px 0 4px; background: #e8edf5; direction: rtl; }
.zone { position: absolute; top: 0; height: 100%; }
.zone-practice { right: 0; width: 80%; background: #cfddfb; }
.zone-challenge { right: 80%; width: 10%; background: #fbe3ae; }
.zone-mastery { right: 90%; width: 10%; background: #bfe8d2; }
.score-fill {
  position: absolute; top: 0; right: 0; height: 100%; width: 0%;
  background: var(--blue); border-radius: 999px; transition: width .5s ease; z-index: 2;
}
.score-fill.challenge { background: var(--amber); }
.score-fill.mastery { background: var(--green); }
.zone-mark { position: absolute; top: 0; width: 2px; height: 100%; background: #fff; z-index: 3; }
.zone-labels { position: relative; height: 20px; font-size: 11.5px; color: var(--ink-soft); }
.zone-label { position: absolute; transform: translateX(50%); white-space: nowrap; }
#zone-practice { right: 40%; }
#zone-challenge { right: 85%; }
#zone-mastery { right: 96%; }
.zone-label.on { font-weight: 700; color: var(--ink); }
.zone-now { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

.q-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; flex-wrap: wrap; }
.chip { background: var(--blue-bg); color: var(--blue-dark); font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.chip-soft { background: #f1f4fa; color: var(--ink-soft); }
.q-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px; box-shadow: 0 3px 0 var(--line); }
.q-text { font-size: var(--fs-q); font-weight: 700; line-height: 1.9; margin-bottom: 18px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 10px;
  background: #fbfcfe; border: 2px solid var(--line); border-radius: 14px;
  padding: 12px 14px; font-family: inherit; font-size: var(--fs-opt); color: inherit;
  text-align: right; cursor: pointer; line-height: 1.7;
}
.option .letter {
  min-width: 30px; height: 30px; border-radius: 10px; background: var(--blue-bg); color: var(--blue-dark);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.option:not(:disabled):active { border-color: var(--blue); }
.option.correct { background: var(--green-bg); border-color: var(--green); }
.option.correct .letter { background: var(--green); color: #fff; }
.option.wrong { background: var(--red-bg); border-color: var(--red); }
.option.wrong .letter { background: var(--red); color: #fff; }
.option:disabled { cursor: default; opacity: .92; }

.feedback { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 14px; }
.fb-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.fb-title.ok { color: var(--green); }
.fb-title.no { color: var(--red); }
.fb-body { font-size: 14.5px; color: var(--ink); margin-bottom: 8px; }
.fb-explain {
  background: #f7f9fd; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 13.5px; color: var(--ink-soft); margin-bottom: 14px; line-height: 1.8;
}
.fb-explain b { color: var(--ink); }
.lesson-name { text-align: center; color: var(--ink-soft); font-size: 13px; margin-top: 14px; }

/* result */
.result-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 20px; text-align: center; box-shadow: 0 3px 0 var(--line); }
.ring-wrap { position: relative; width: 132px; height: 132px; margin: 0 auto 10px; }
.ring { width: 132px; height: 132px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring-bg { stroke: #e8edf5; }
.ring-fg { stroke: var(--green); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 1s ease; }
.ring-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 40px; font-weight: 700; color: var(--ink); }
.result-zone { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin-bottom: 4px; }
.result-card h2 { font-size: 22px; margin-bottom: 4px; }
.stat-row { display: flex; gap: 10px; margin: 20px 0 24px; }
.stat { flex: 1; background: #fbfcfe; border: 1px solid var(--line); border-radius: 14px; padding: 10px 4px; display: flex; flex-direction: column; }
.stat b { font-size: 19px; }
.stat small { color: var(--ink-soft); font-size: 12px; }
.result-btns { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }

/* ================= DESIGN v3 — PAPER & STICKER (Google Stitch, locked) =================
   Tokens from the Stitch "Paper Sticker RTL" design system (DESIGN.md in stitch-export/):
   canvas #FAF5EC · ink #232946 · teal #0E9594 · tangerine #F2762E · violet #6C4BD8 ·
   amber #F2A93B · green #1E9E6A · 3px ink borders · hard offset shadows · flat only. */
:root {
  --paper: #FAF5EC;
  --ink: #232946;
  --ink-soft: #585d7d;
  --border: #232946;
  --shadow: #232946;
  --blue: #0E9594;
  --blue-dark: #0b7473;
  --blue-bg: #e2f1ef;
  --tang: #F2762E;
  --violet: #6C4BD8;
  --amber: #F2A93B;
  --amber-bg: #fdf0da;
  --green: #1E9E6A;
  --green-bg: #e1f4ea;
  --red: #D64541;
  --red-bg: #fbeae8;
  --card: #ffffff;
  --line: #232946;
}
html.dark {
  --paper: #171b30;
  --card: #222842;
  --ink: #f2efe4;
  --ink-soft: #b9bdd6;
  --border: #0d1020;
  --shadow: #0d1020;
  --blue-bg: #173a3f;
  --green-bg: #14382a;
  --amber-bg: #3d2f16;
  --red-bg: #3d1f22;
  --line: #0d1020;
}

body { background: var(--paper); color: var(--ink); }
body::before, body.kids::before {
  background: radial-gradient(circle, rgba(35, 41, 70, .13) 1.6px, transparent 1.7px) 0 0 / 26px 26px;
}
html.dark body::before, html.dark body.kids::before {
  background: radial-gradient(circle, rgba(255, 255, 255, .09) 1.6px, transparent 1.7px) 0 0 / 26px 26px;
}

/* header pill + logo sticker */
.topbar {
  background: var(--card); border: 3px solid var(--border); border-radius: 18px;
  box-shadow: 0 3px 0 var(--shadow); padding: 8px 12px; margin-top: 10px;
}
.logo-badge {
  background: var(--tang); border: 3px solid var(--border); border-radius: 14px;
  box-shadow: 0 3px 0 var(--shadow); transform: rotate(-3deg); color: #fff;
}
.demo-badge {
  background: var(--amber); border: 2.5px solid var(--border); color: var(--ink);
  border-radius: 999px; font-weight: 800; box-shadow: 0 2px 0 var(--shadow);
}
.theme-btn {
  background: var(--card); border: 3px solid var(--border); border-radius: 50%;
  box-shadow: 0 3px 0 var(--shadow); color: var(--ink);
}

/* hero: flat ink + per-grade accent word (no gradient text) */
.hero h1 { color: var(--ink); }
.hero h1 .accent, body.kids .hero h1 .accent {
  background: none; -webkit-background-clip: initial; background-clip: initial;
  color: var(--accent);
}

/* card system: white, 3px ink border, hard bottom shadow */
.dash-card, .q-card, .practice-panel, .result-card, .grade-progress,
.lesson-row, .hub-card, .continue-card, .rec-card, .sum-card, .g-row,
.sess-row, .badge-card, .empty-card {
  background: var(--card); border: 3px solid var(--border); border-radius: 22px;
  box-shadow: 0 4px 0 var(--shadow);
}
.dash-card { background: var(--card); }
.dash-stop-1, .dash-stop-2 { stop-color: var(--blue); }
.mascot {
  background: var(--card); border: 3px solid var(--border); border-radius: 22px;
  box-shadow: 0 4px 0 var(--shadow);
}
.mascot-practice {
  background: var(--card); border: 3px solid var(--border); border-radius: 20px;
  box-shadow: 0 4px 0 var(--shadow);
}

/* tabs & selectors */
.main-tab {
  background: var(--card); border: 3px solid var(--border); border-radius: 16px;
  box-shadow: 0 3px 0 var(--shadow); color: var(--ink);
}
.main-tab.active, body.kids .main-tab.active {
  background: var(--blue); color: #fff; border-color: var(--border);
  box-shadow: 0 3px 0 var(--shadow);
}
body.kids .main-tab.active { background: var(--tang); }
.band-tab {
  background: var(--card); border: 3px solid var(--border); border-radius: 999px;
  box-shadow: 0 3px 0 var(--shadow); color: var(--ink);
}
.band-tab.active { background: var(--blue); color: #fff; }
body.kids .band-tab.active { background: var(--tang); }
.grade-tab {
  background: var(--card); border: 3px solid var(--border); border-radius: 20px;
  box-shadow: 0 4px 0 var(--shadow); color: var(--ink);
}
.grade-tab.active { background: var(--accent); color: #fff; border-color: var(--border); }
.grade-tab.soon { border-style: dashed; box-shadow: none; background: transparent; }
.grade-tab:hover, .lesson-row:hover { transform: none; }

/* buttons: tangerine primary, directional hard shadow, physical press */
.btn-primary {
  background: var(--tang); color: #fff; border: 3px solid var(--border);
  border-radius: 18px; box-shadow: -4px 4px 0 var(--shadow); font-weight: 800;
}
.btn-primary:active { transform: translate(-2px, 2px); box-shadow: -1px 1px 0 var(--shadow); }
.btn-ghost {
  background: var(--card); color: var(--ink); border: 3px solid var(--border);
  border-radius: 14px; box-shadow: 0 3px 0 var(--shadow); font-weight: 700;
}
.btn-ghost:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shadow); }

/* lessons */
#chapter-list .chapter-title { color: var(--ink); }
.chip {
  border: 2px solid var(--border); border-radius: 999px; font-weight: 700; color: var(--ink);
  background: color-mix(in srgb, var(--blue) 13%, var(--card));
}
.status-pill { border: 2px solid var(--border); font-weight: 800; }
.status-master { background: var(--green); color: #fff; }
.status-mid { background: var(--violet); color: #fff; }
.status-none { background: var(--card); color: var(--ink-soft); }
.master-badge { border: 2px solid var(--border); }
.ch-progress, .progress-track, .g-bar {
  border: 2px solid var(--border); background: var(--card); border-radius: 999px;
}
.ch-progress { height: 10px; }
.progress-track { height: 12px; }
.g-bar { height: 12px; }
.ch-progress span, .progress-fill, .g-bar span { background: var(--blue); }

/* practice */
.score-bar { border: 2.5px solid var(--border); border-radius: 999px; background: var(--card); }
.score-fill { background-image: none; background: var(--blue); }
.score-fill.challenge { background: var(--amber); }
.score-fill.mastery { background: var(--green); }
.q-dot { border: 2px solid var(--border); background: var(--card); }
.q-dot.ok { background: var(--green); }
.q-dot.no { background: var(--red); }
.q-dot.now { background: var(--amber); }
.option {
  background: var(--card); border: 3px solid var(--border); border-radius: 18px;
  box-shadow: 0 3px 0 var(--shadow); color: var(--ink);
}
.option .letter {
  background: var(--ink); color: #fff; border: 2.5px solid var(--border); border-radius: 12px;
}
html.dark .option .letter { background: #39406b; }
.option.correct {
  background: var(--green-bg); border-color: var(--green); box-shadow: 0 3px 0 var(--green);
}
.option.correct .letter { background: var(--green); border-color: var(--green); }
.option.correct::after { display: none; }
.option.wrong {
  background: var(--red-bg); border-color: var(--red); box-shadow: 0 3px 0 var(--red);
}
.option.wrong .letter { background: var(--red); border-color: var(--red); }
.combo-chip {
  background: var(--amber); color: var(--ink); border: 2.5px solid var(--border);
  box-shadow: 0 2px 0 var(--shadow);
}
#feedback {
  background: var(--card); border: 2.5px solid var(--border); border-radius: 16px;
  box-shadow: 0 3px 0 var(--shadow);
}
.fb-explain {
  border: 2px solid var(--border); border-radius: 12px;
  background: color-mix(in srgb, var(--amber) 12%, var(--card));
}
.sound-btn {
  background: var(--card); border: 3px solid var(--border); border-radius: 50%;
  box-shadow: 0 3px 0 var(--shadow); color: var(--ink);
}

/* result */
#result-medal svg, .medal { filter: drop-shadow(3px 3px 0 var(--shadow)); }
.star { color: var(--amber); -webkit-text-stroke: 1.5px var(--border); }
.star.empty { color: #ddd6c2; }
html.dark .star.empty { color: #3a4066; }
.stat {
  background: var(--card); border: 2.5px solid var(--border); border-radius: 16px;
  box-shadow: 0 3px 0 var(--shadow);
}

/* analytics & awards */
.sum-card b { color: var(--ink); }
.score-chip {
  background: var(--blue); color: #fff; border: 2.5px solid var(--border);
  box-shadow: 0 2px 0 var(--shadow);
}
.score-chip.challenge { background: var(--amber); color: var(--ink); }
.score-chip.mastery { background: var(--green); color: #fff; }
.badge-ic { border: 2.5px solid var(--border); }
.badge-card.locked .badge-ic { background: #e9e6da; }
html.dark .badge-card.locked .badge-ic { background: #2c3257; }
.section-label { color: var(--ink); font-weight: 800; }

/* confetti pieces are already flat; keep. focus ring in ink. */
:focus-visible { outline: 3px dashed var(--border); outline-offset: 2px; }

/* ================= DESIGN v3.1 — MOTION & MUSIC SYNC =================
   Beat period at 112 BPM = 0.536s; UI pulses share it while music plays. */
:root { --ease-spring: cubic-bezier(.34, 1.45, .5, 1); }
html { scroll-behavior: smooth; }

.screen.active { animation: screen-in .38s var(--ease-spring) both; }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(16px) scale(.985); }
  to { opacity: 1; transform: none; }
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: none; }
}
.screen.active .dash-card { animation: card-in .5s var(--ease-spring) .03s both; }
.screen.active .continue-card { animation: card-in .5s var(--ease-spring) .1s both; }
.screen.active .rec-card { animation: card-in .5s var(--ease-spring) .16s both; }
.screen.active .sum-card, .screen.active .g-row, .screen.active .sess-row { animation: card-in .45s var(--ease-spring) both; }
.screen.active .badge-card { animation: card-in .45s var(--ease-spring) both; }
.screen.active .badge-card:nth-child(2) { animation-delay: .05s; }
.screen.active .badge-card:nth-child(3) { animation-delay: .1s; }
.screen.active .badge-card:nth-child(4) { animation-delay: .15s; }
.screen.active .badge-card:nth-child(5) { animation-delay: .2s; }
.screen.active .badge-card:nth-child(6) { animation-delay: .25s; }
.screen.active .badge-card:nth-child(7) { animation-delay: .3s; }
.screen.active .badge-card:nth-child(8) { animation-delay: .35s; }
#chapter-list .lesson-row { animation: card-in .4s var(--ease-spring) both; }
#chapter-list .lesson-row:nth-child(2) { animation-delay: .04s; }
#chapter-list .lesson-row:nth-child(3) { animation-delay: .08s; }
#chapter-list .lesson-row:nth-child(4) { animation-delay: .12s; }
#chapter-list .lesson-row:nth-child(5) { animation-delay: .16s; }
#chapter-list .lesson-row:nth-child(6) { animation-delay: .2s; }
#options .option { animation: card-in .38s var(--ease-spring) both; }
#options .option:nth-child(2) { animation-delay: .05s; }
#options .option:nth-child(3) { animation-delay: .1s; }
#options .option:nth-child(4) { animation-delay: .15s; }

@media (hover: hover) {
  .lesson-row, .grade-tab, .badge-card, .sess-row { transition: transform .18s var(--ease-spring), box-shadow .18s var(--ease-spring); }
  .lesson-row:hover, .grade-tab:hover, .badge-card:hover {
    transform: translateY(-2px); box-shadow: 0 6px 0 var(--shadow);
  }
}

/* floating hero sparkles drift */
.hero-sparkles .sp2 { animation: sp-drift 5.5s ease-in-out infinite; }
.hero-sparkles .sp3 { animation: sp-drift 6.5s ease-in-out .8s infinite; }
@keyframes sp-drift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-7px) rotate(14deg); }
}

/* beat-synced pulse while music plays (period = one beat @112 BPM) */
body.music-on .logo-badge { animation: logo-bop .536s ease-in-out infinite; }
@keyframes logo-bop {
  0%, 100% { transform: rotate(-3deg) scale(1); }
  30% { transform: rotate(-3deg) scale(1.07); }
}
body.music-on .mascot svg { animation: svg-bop .536s ease-in-out infinite; }
@keyframes svg-bop {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-3px); }
}

/* music button equalizer */
#music-btn { position: relative; }
#music-btn .eq {
  position: absolute; inset-inline-end: 4px; bottom: 4px;
  display: none; align-items: flex-end; gap: 1.5px; height: 8px;
}
#music-btn .eq i { width: 2.5px; background: currentColor; border-radius: 1px; height: 3px; }
#music-btn.playing { background: var(--amber); color: var(--ink); }
#music-btn.playing .eq { display: inline-flex; }
#music-btn.playing .eq i { animation: eq-bounce .536s ease-in-out infinite; }
#music-btn.playing .eq i:nth-child(2) { animation-delay: .18s; }
#music-btn.playing .eq i:nth-child(3) { animation-delay: .36s; }
@keyframes eq-bounce { 0%, 100% { height: 3px; } 50% { height: 8px; } }
#music-btn.off svg { opacity: .4; }

@media (prefers-reduced-motion: reduce) {
  body.music-on .logo-badge, body.music-on .mascot svg,
  #music-btn.playing .eq i, .hero-sparkles .sp2, .hero-sparkles .sp3 { animation: none; }
}

/* ===== DESIGN v3.3 — design pass 2: picture & audio questions (§9.7) ===== */
.q-stage { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 4px 0 10px; }
.q-stage[hidden] { display: none; }
.q-pic { width: 132px; height: 132px; padding: 12px; background: #fffdf6; border: 3px solid var(--ink, #232946); border-radius: 22px; box-shadow: 0 4px 0 var(--ink, #232946); color: #232946; }
.q-pic svg { width: 100%; height: 100%; display: block; }
.audio-btn { width: 76px; height: 76px; border-radius: 50%; border: 3px solid var(--ink, #232946); background: #f2762e; box-shadow: 0 4px 0 var(--ink, #232946); color: #232946; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .08s ease, box-shadow .08s ease; }
.audio-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink, #232946); }
.audio-btn svg { width: 44px; height: 44px; }
.options.pic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.option.pic { flex-direction: column; gap: 6px; min-height: 118px; padding: 12px 8px 10px; background: #fffdf6; color: #232946; }
.option.pic svg { width: 62px; height: 62px; }
.option.pic .pic-label { font-size: 1.15rem; font-weight: 800; color: var(--ink, #232946); }
html.dark .option.pic, html.dark .q-pic { background: #2a3050; color: #e8e4da; }
html.dark .option.pic .pic-label { color: #e8e4da; }

/* ---------- AI picture assets (replace hand-drawn SVG icons, 2026-11-15) ---------- */
.q-pic img.qimg { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: 18px; }
.option.pic img.qimg { width: 62px; height: 62px; object-fit: contain; }
img.lim-o { object-fit: cover; background: #fff; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.mascot img.lim-o { width: 92px; height: 92px; border-radius: 22px; animation: floaty 3.2s ease-in-out infinite; }
.mascot-result img.lim-o { width: 84px; height: 84px; border-radius: 20px; animation: floaty 3.2s ease-in-out infinite; }
.mascot-practice img.lim-o { width: 54px; height: 54px; border-radius: 15px; box-shadow: 3px 3px 0 var(--ink); animation: floaty 3.8s ease-in-out infinite; }
.mascot-practice.show-soft img.lim-o { transform: rotate(-4deg); }
body.music-on .mascot img.lim-o { animation: svg-bop .536s ease-in-out infinite; }

/* ---------- Responsive pass (2026-11-15): small phones, safe areas, short screens ---------- */
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }
* { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
.app {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}
@media (max-width: 400px) {
  .app { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .practice-panel { padding: 12px 10px; }
  .practice-head { gap: 5px; }
  .practice-head .btn-ghost { padding: 6px 8px; font-size: 12px; }
  .sound-btn { width: 36px; height: 36px; flex: none; }
  .p-stat small { font-size: 10px; }
  .p-stat b { font-size: 13px; }
  .score-label { font-size: 10px; }
  .score-num { font-size: 17px; }
  .grade-tab { padding: 10px 4px; }
  .options.pic-grid { gap: 8px; }
  .option.pic { min-height: 104px; }
  .mascot-text b { font-size: 15px; }
}
@media (max-height: 640px) {
  .mascot-practice img.lim-o { width: 44px; height: 44px; }
  .mascot-practice { padding: 8px 10px; }
  .q-pic { height: 112px; }
  .practice-panel { margin-top: 8px; }
}

/* ---------- Game layer v3.4: XP/coins/streak/missions/path/rush/boss/collection/league ---------- */
.game-card { background: #fff; border: 3px solid var(--ink); border-radius: 20px; box-shadow: 5px 5px 0 var(--ink); padding: 14px; margin: 14px 0; }
.game-top { display: flex; gap: 12px; align-items: center; }
.level-badge { flex: none; width: 62px; height: 62px; border-radius: 50%; background: var(--amber); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.level-badge span { font-size: 10px; font-weight: 700; }
.level-badge b { font-size: 24px; font-weight: 900; }
.game-mid { flex: 1; min-width: 0; }
.xp-track { position: relative; height: 24px; background: #efe9da; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; }
.xp-fill { position: absolute; inset: 0 auto 0 0; background: var(--green); transition: width .6s cubic-bezier(.2,.9,.3,1.2); }
[dir="rtl"] .xp-fill { inset: 0 0 0 auto; }
.xp-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }
.game-stats { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.coin-pill { display: inline-flex; align-items: center; gap: 6px; background: #fdf3e0; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.coin-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--amber); border: 2px solid var(--ink); flex: none; }
.streak-pill { display: inline-flex; align-items: center; background: #e3f5ec; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.btn-rush { width: 100%; margin-top: 12px; padding: 12px; border: 3px solid var(--ink); border-radius: 14px; background: var(--orange, #f2762e); color: #fff; font-family: inherit; font-size: 15px; font-weight: 900; box-shadow: 4px 4px 0 var(--ink); cursor: pointer; }
.btn-rush:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.missions-card { margin: 14px 0; }
.mission-row { display: flex; align-items: center; gap: 10px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 3px 3px 0 var(--ink); padding: 9px 11px; margin-bottom: 8px; }
.mission-check { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--ink); background: #efe9da; display: flex; align-items: center; justify-content: center; font-weight: 900; color: #fff; }
.mission-row.done .mission-check { background: var(--green); }
.mission-row.done { opacity: .75; }
.mission-main { flex: 1; min-width: 0; }
.mission-main b { font-size: 13px; display: block; }
.mission-bar { display: block; height: 8px; background: #efe9da; border: 2px solid var(--ink); border-radius: 999px; margin-top: 5px; overflow: hidden; }
.mission-bar i { display: block; height: 100%; background: var(--teal, #0e9594); transition: width .5s; }
.mission-meta { flex: none; font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.mission-bonus { background: #fdf3e0; border: 3px dashed var(--amber); border-radius: 12px; padding: 8px 11px; font-size: 12.5px; font-weight: 800; text-align: center; }
.path-wrap { position: relative; padding: 2px 0 6px; }
.path-wrap::before { content: ""; position: absolute; top: 10px; bottom: 10px; inset-inline-start: 40px; border-inline-start: 3px dashed #d9d0ba; }
.path-wrap .lesson-row { position: relative; margin-bottom: 10px; }
.path-wrap .pos-1 { margin-inline-start: 30px; }
.path-wrap .pos-2 { margin-inline-start: 60px; }
.path-wrap .pos-3 { margin-inline-start: 30px; }
.lesson-row.path-locked { opacity: .55; filter: grayscale(.7); }
.lesson-row.path-current { outline: 3px solid var(--amber); outline-offset: 2px; }
.path-limo { position: absolute; top: -16px; inset-inline-end: 10px; width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--ink); background: #fff; animation: limo-bob 1.6s ease-in-out infinite; z-index: 2; }
@keyframes limo-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.path-star { position: absolute; top: -9px; inset-inline-start: 12px; color: var(--amber); font-size: 19px; text-shadow: 0 1px 0 var(--ink); }
.shake { animation: shake-x .4s ease; }
@keyframes shake-x { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.boss-node { background: #efe9fb; }
.boss-node.beaten { background: #e3f5ec; }
.boss-node-img { width: 52px; height: 52px; border-radius: 14px; border: 3px solid var(--ink); background: #fff; object-fit: cover; flex: none; }
.boss-bar { display: flex; align-items: center; gap: 10px; background: #efe9fb; border: 3px solid var(--ink); border-radius: 14px; padding: 8px 10px; margin-bottom: 10px; }
.boss-bar[hidden] { display: none; }
.boss-img { width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--ink); background: #fff; object-fit: cover; flex: none; }
.boss-mid { flex: 1; min-width: 0; }
.boss-name { font-size: 12px; font-weight: 800; margin-bottom: 5px; }
.boss-hp { height: 14px; background: #fff; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.boss-hp i { display: block; height: 100%; background: #d9534f; transition: width .45s cubic-bezier(.2,.9,.3,1.1); }
.boss-bar.hit .boss-img { animation: shake-x .35s ease; }
.boss-hearts { font-size: 17px; color: #d9534f; letter-spacing: 2px; flex: none; }
.result-rewards { font-size: 15px; font-weight: 800; margin: 8px 0 0; }
.result-rewards b { color: var(--green); }
.coll-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.coll-head small { color: var(--ink-soft); font-weight: 700; }
.coll-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; position: relative; }
.coll-cell { background: #fff; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 3px 3px 0 var(--ink); padding: 7px 4px 5px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-family: inherit; cursor: pointer; }
.coll-cell img { width: 44px; height: 44px; object-fit: contain; }
.coll-cell:not(.owned) img { filter: brightness(0); opacity: .16; }
.coll-cell span { font-size: 10.5px; font-weight: 800; color: var(--ink-soft); }
.coll-cell.owned span { color: var(--green); }
.league-card { background: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 4px 4px 0 var(--ink); padding: 10px 12px; margin-bottom: 16px; }
.league-row { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 10px; }
.league-row + .league-row { border-top: 2px dashed #e7e0cd; }
.league-row.me { background: #fdf3e0; border: 2px solid var(--amber); }
.league-rank { width: 26px; height: 26px; flex: none; border-radius: 50%; background: #efe9da; border: 2px solid var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 12px; }
.league-row.me .league-rank { background: var(--amber); }
.league-name { flex: 1; font-weight: 800; font-size: 13.5px; }
.league-note { font-size: 11.5px; color: var(--ink-soft); margin: 8px 2px 2px; }
@media (max-width: 400px) {
  .path-wrap .pos-2 { margin-inline-start: 40px; }
  .coll-grid { gap: 7px; }
  .coll-cell img { width: 38px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .path-limo { animation: none; }
}

/* ---------- Game scene + Rive (presentation build v3.5) ---------- */
.scene-strip { position: relative; height: 64px; border: 3px solid var(--ink); border-radius: 16px; background: #bfe8e4; overflow: hidden; margin-bottom: 10px; box-shadow: 4px 4px 0 var(--ink); }
.scene-strip .hill { position: absolute; bottom: -34px; border-radius: 50%; background: #1e9e6a; }
.scene-strip .h1 { width: 220px; height: 90px; inset-inline-start: -40px; }
.scene-strip .h2 { width: 260px; height: 100px; inset-inline-end: -60px; background: #17b978; bottom: -44px; }
.scene-strip .cloud { position: absolute; top: 10px; width: 52px; height: 18px; border-radius: 999px; background: #fff; border: 2px solid var(--ink); animation: cloud-drift 11s linear infinite; }
.scene-strip .cloud::after { content: ""; position: absolute; top: -9px; inset-inline-start: 10px; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); border-bottom-color: transparent; }
.scene-strip .c2 { top: 22px; transform: scale(.7); animation-duration: 15s; animation-delay: -6s; }
.scene-strip .c3 { top: 6px; transform: scale(.55); animation-duration: 19s; animation-delay: -11s; }
@keyframes cloud-drift { from { inset-inline-start: -70px; } to { inset-inline-start: 105%; } }
.scene-name { position: absolute; bottom: 6px; inset-inline-start: 12px; font-size: 12px; font-weight: 900; background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 2px 10px; }
#rive-canvas { width: 84px; height: 84px; flex: none; border-radius: 16px; border: 3px solid var(--ink); background: #fff; box-shadow: 3px 3px 0 var(--ink); }
#rive-canvas[hidden] { display: none; }
.rive-shake { animation: shake-x .4s ease; }
.q-card.q-anim { animation: q-spring .55s cubic-bezier(.2, 1.35, .3, 1) both; }
@keyframes q-spring { 0% { transform: translateY(-16px) scale(.96) rotate(-.6deg); opacity: 0; } 100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; } }
.option.opt-in { animation: opt-pop .45s cubic-bezier(.2, 1.3, .3, 1) both; }
@keyframes opt-pop { 0% { transform: translateY(14px) scale(.94); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }
.q-dot { width: 11px; height: 11px; border-radius: 4px; border: 2px solid var(--ink); background: #efe9da; }
.q-dot.ok { background: var(--green); }
.q-dot.no { background: var(--red); }
.q-dot.now { background: var(--amber); animation: stone-pulse 1.1s ease-in-out infinite; }
@keyframes stone-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.3); } }
@media (prefers-reduced-motion: reduce) {
  .scene-strip .cloud { animation: none; }
  .q-dot.now { animation: none; }
}
/* v3.5: the companion strip is core to the game scene — show it for every band in practice */
body.junior .mascot-practice, body.senior .mascot-practice { display: flex; align-items: center; gap: 10px; }
body.junior .mascot-practice, body.senior .mascot-practice {
  margin-bottom: 12px; background: #e6f7f7; border: 3px solid var(--ink); border-radius: 20px;
  padding: 8px 14px; box-shadow: 4px 4px 0 var(--ink);
}

/* ---------- Server stats card (real backend data) ---------- */
.an-card { border: 3px solid var(--ink); border-radius: 18px; background: #eef7ee; box-shadow: 4px 4px 0 var(--ink); padding: 14px; margin: 12px 0; }
.an-card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 900; }
.an-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.an-stat { background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 8px 10px; text-align: center; }
.an-stat b { display: block; font-size: 19px; font-weight: 900; }
.an-stat span { font-size: 11px; color: var(--ink-soft); }
.an-note { font-size: 12px; color: var(--ink-soft); margin: 10px 0 0; line-height: 1.9; }

/* ---------- Learner row + teacher view ---------- */
.learner-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.learner-row .btn-ghost.small { padding: 3px 10px; font-size: 12px; }
.learner-edit { display: inline-flex; gap: 6px; align-items: center; }
.learner-edit[hidden] { display: none; }
.learner-edit input { font: inherit; padding: 6px 10px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; width: 150px; }
button.hub-card { font: inherit; text-align: inherit; width: 100%; cursor: pointer; background: #fff; }
.teacher-row { border: 3px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 4px 4px 0 var(--ink); padding: 12px 14px; margin: 10px 0; }
.teacher-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; margin-bottom: 8px; }
.teacher-top span { color: var(--ink-soft); font-size: 12.5px; white-space: nowrap; }
.acc-track { position: relative; height: 22px; border: 2px solid var(--ink); border-radius: 999px; background: #efe9da; overflow: hidden; }
.acc-fill { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; background: var(--green); }
.acc-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; }
.teacher-sub { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
#teacher-refresh { width: 100%; margin-top: 6px; }

/* ---------- Assignment loop ---------- */
.assign-banner { display: flex; align-items: center; gap: 10px; border: 3px solid var(--ink); border-radius: 16px; background: #fdf0d3; box-shadow: 4px 4px 0 var(--ink); padding: 10px 14px; margin-bottom: 12px; }
.assign-banner[hidden] { display: none; }
.assign-text { flex: 1; display: flex; flex-direction: column; }
.assign-text b { font-size: 14.5px; }
.assign-text small { color: var(--ink-soft); font-size: 12px; }
.assign-builder { border: 3px solid var(--ink); border-radius: 18px; background: #fff; box-shadow: 4px 4px 0 var(--ink); padding: 14px; margin-bottom: 12px; }
.assign-fields { display: flex; gap: 8px; margin: 8px 0; }
.assign-fields select { flex: 1; font: inherit; font-size: 13.5px; padding: 8px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; min-width: 0; }
.assign-out { display: flex; gap: 8px; }
.assign-out input { flex: 1; font-size: 12px; padding: 8px; border: 2px solid var(--ink); border-radius: 10px; background: #faf5ec; direction: ltr; min-width: 0; }

/* ---------- Android/mobile responsive fixes (2026-11-15 audit) ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.path-wrap .lesson-row { width: auto; }
.learner-edit input { font-size: 16px; }
.assign-fields select { font-size: 16px; }
.assign-out input { font-size: 16px; }
.learner-row .btn-ghost.small, .assign-banner .btn-ghost.small { min-height: 34px; }

/* ---------- spacing fix (2026-11-15): header box was glued to the tab buttons ---------- */
header.topbar { margin-bottom: 12px; }
#screen-lessons .nav-row { margin-bottom: 8px; }

/* ---------- app-style bottom navigation + character hero (2026-11-15) ---------- */
#bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; background: var(--card); border-top: 3px solid var(--ink); transition: transform .3s ease; }
body.nav-hidden #bottom-nav { transform: translateY(106%); }
.bnav-wrap { display: flex; max-width: 560px; margin: 0 auto; padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); gap: 2px; }
.bnav-btn { flex: 1; background: none; border: none; font: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px 0 1px; color: #9aa0b8; cursor: pointer; touch-action: manipulation; }
.bnav-ic { width: 46px; height: 33px; display: flex; align-items: center; justify-content: center; border-radius: 999px; border: 2.5px solid transparent; transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease; }
.bnav-ic svg { width: 23px; height: 23px; }
.bnav-label { font-size: 11px; font-weight: 700; line-height: 1.4; }
.bnav-btn.active { color: var(--ink); }
.bnav-btn.active .bnav-label { font-weight: 900; }
.bnav-btn.active .bnav-ic { border-color: var(--ink); color: #fff; box-shadow: 2px 2px 0 var(--ink); transform: translateY(-3px); }
.bnav-btn[data-nav="home"].active .bnav-ic { background: #0E9594; }
.bnav-btn[data-nav="lessons"].active .bnav-ic { background: #6C4BD8; }
.bnav-btn[data-nav="analytics"].active .bnav-ic { background: #F2A93B; color: var(--ink); }
.bnav-btn[data-nav="awards"].active .bnav-ic { background: #F2762E; }
.bnav-btn[data-nav="teacher"].active .bnav-ic { background: #1E9E6A; }
body:not(.nav-hidden) .screen { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.hero-char { display: flex; align-items: center; gap: 13px; margin-bottom: 13px; }
.lim-o-big { width: 88px; height: 88px; object-fit: contain; flex-shrink: 0; animation: floaty 3.6s ease-in-out infinite; }
.bubble { position: relative; flex: 1; background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 10px 14px; box-shadow: 4px 4px 0 var(--ink); }
.bubble::before { content: ""; position: absolute; top: 50%; inset-inline-start: -10px; width: 15px; height: 15px; background: #fff; border-inline-start: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: translateY(-50%) rotate(45deg); }
.bubble b { display: block; font-size: 16.5px; font-weight: 900; line-height: 1.7; }
.bubble small { display: block; color: #5a5f7d; font-size: 12.5px; line-height: 1.9; }
.hero-cta { font-size: 17px; padding: 14px; margin-bottom: 16px; }
@media (prefers-reduced-motion: reduce) { .lim-o-big { animation: none; } #bottom-nav { transition: none; } }


/* ---------- step 3: feedback as an app-style bottom sheet (2026-11-15) ---------- */
#feedback {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 58;
  border-radius: 22px 22px 0 0; border-bottom: none;
  padding: 16px max(18px, calc((100% - 560px) / 2)) calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -14px 30px -14px rgba(35, 41, 70, .35);
  max-height: 64svh; overflow-y: auto;
  animation: sheet-up .38s cubic-bezier(.3, 1.3, .4, 1) both;
}
@keyframes sheet-up { from { transform: translateY(55%); opacity: .3; } to { transform: translateY(0); opacity: 1; } }
#feedback:has(.fb-title.ok) { background: color-mix(in srgb, var(--green) 15%, var(--card)); }
#feedback:has(.fb-title.no) { background: color-mix(in srgb, var(--red) 11%, var(--card)); }
#feedback .fb-limo { width: 54px; height: 54px; object-fit: contain; float: inline-start; margin-inline-end: 10px; }
#feedback:has(.fb-title.no) .fb-limo { content: url("img/icons/lim-o-think.webp"); }
#feedback #next-btn { width: 100%; padding: 14px; font-size: 16.5px; margin-top: 10px; }
body:has(#feedback:not([hidden])) #screen-practice { padding-bottom: 300px; }
@media (prefers-reduced-motion: reduce) { #feedback { animation: none; } }

/* ---------- step 4: chapter banners + kids scale polish (2026-11-15) ---------- */
.chapter-head {
  background: var(--card); border: 2.5px solid var(--border); border-radius: 14px;
  padding: 10px 14px; box-shadow: 0 3px 0 var(--shadow); align-items: center;
}
.chapter-head .chapter-title { font-weight: 900; font-size: 16.5px; }
#chapter-list .chapter-head:nth-of-type(8n+1) { background: color-mix(in srgb, #0E9594 13%, var(--card)); }
#chapter-list .chapter-head:nth-of-type(8n+3) { background: color-mix(in srgb, #F2762E 13%, var(--card)); }
#chapter-list .chapter-head:nth-of-type(8n+5) { background: color-mix(in srgb, #6C4BD8 13%, var(--card)); }
#chapter-list .chapter-head:nth-of-type(8n+7) { background: color-mix(in srgb, #F2A93B 16%, var(--card)); }
body.kids .lesson-row { border-radius: 20px; }
body.kids .bnav-label { font-size: 12px; }
body.kids .opt-btn, body.kids .option { font-size: 16.5px; }

/* ---------- diagnostic (v3.7) ---------- */
.diag-card { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px; padding: 14px 16px; text-align: right; font: inherit; cursor: pointer; color: var(--ink); background: color-mix(in srgb, #6C4BD8 10%, var(--card)); border: 3px solid var(--ink); border-radius: 20px; box-shadow: 0 5px 0 var(--ink); transition: transform .12s ease, box-shadow .12s ease; }
.diag-card:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.diag-ic { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: #6C4BD8; color: #fff; border: 3px solid var(--ink); }
.diag-ic svg { width: 26px; height: 26px; }
.diag-tx { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.diag-tx b { font-size: 16.5px; font-weight: 900; }
.diag-tx small { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.diag-arrow { font-size: 20px; font-weight: 900; color: #6C4BD8; }
.diag-verdict { margin-top: 12px; padding: 14px 16px; text-align: right; line-height: 1.9; background: color-mix(in srgb, #6C4BD8 10%, var(--card)); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); }
.diag-verdict[hidden] { display: none; }
.diag-verdict .btn-primary { display: block; width: 100%; margin-top: 10px; }

/* ---------- sims + profile picker (v3.8) ---------- */
.sims-grade { margin-top: 20px; }
.sims-grade-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sims-grade-head h3 { font-size: 16.5px; font-weight: 900; }
.sims-count { font-size: 12px; font-weight: 800; color: var(--muted); }
.sim-row { display: flex; align-items: center; gap: 10px; background: var(--card); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); padding: 12px 14px; margin-bottom: 8px; text-decoration: none; color: var(--ink); transition: transform .12s ease, box-shadow .12s ease; }
.sim-row:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.sim-tx { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.sim-tx b { font-size: 14.5px; }
.sim-chip { align-self: flex-start; font-size: 11px; font-weight: 800; color: #6C4BD8; background: color-mix(in srgb, #6C4BD8 12%, var(--card)); border-radius: 999px; padding: 1px 10px; }
.sim-go { font-weight: 900; color: #0E9594; font-size: 13px; white-space: nowrap; }
.sims-empty { font-size: 13px; color: var(--muted); border: 2.5px dashed color-mix(in srgb, var(--ink) 35%, transparent); border-radius: 14px; padding: 10px 14px; }
.profile-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.profile-pick[hidden] { display: none; }
.profile-pick select { font: inherit; font-size: 16px; padding: 7px 10px; border: 2.5px solid var(--ink); border-radius: 12px; background: var(--card); color: var(--ink); max-width: 44%; }

/* parent inbox (teacher in-app messages) */
#parent-inbox { margin: 14px 0 4px; }
.pinbox { background: #fff; border: 3px solid #232946; border-radius: 18px; box-shadow: 0 5px 0 #232946; padding: 14px 16px; }
.pinbox h3 { margin: 0 0 8px; font-size: 16px; color: #6C4BD8; }
.pinbox-msg { border-top: 2px dashed #d8d2c0; padding: 9px 0 4px; }
.pinbox-msg:first-of-type { border-top: none; }
.pinbox-msg p { margin: 2px 0 6px; line-height: 1.9; font-size: 14.5px; }
.pinbox-meta { font-size: 12.5px; color: #5a5e7d; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.pinbox-dot { width: 9px; height: 9px; border-radius: 50%; background: #F2762E; display: inline-block; }
.pinbox-msg.unread p { font-weight: 600; }
