/* Age themes (theme.js sets <html data-theme data-mascot>). One page, three looks:
   Explorer (7–10) bright sky, big rounded controls and a mascot beside the question;
   Buddy (11–14) violet and cyan gradients, a smaller mascot and rewards;
   Studio (15–18) warm ivory, indigo and violet, the mascot only beside the tutor, no rewards.
   Each theme sets tokens; the components below read them, so every view follows. Light and dark each have their own
   values. Only the look changes: the questions and the help never do. */

/* --- Tokens the components read (Studio's values are the default) --- */
:root {
  --card-radius: 20px; --btn-radius: 12px; --title-font: var(--serif); --title-weight: 500;
  --card-bg: var(--surface); --card-border: 1px solid var(--line); --card-shadow: var(--shadow);
  --coach-bg: var(--raised); --coach-border: 1px solid var(--line);
  --primary-bg: var(--primary); --btn-lift: none;
  --page-art: none; --head-art: none;
  --side-bg: var(--side); --side-ink: var(--ink); --side-muted: var(--muted); --side-hover: var(--hover); --side-selected: var(--selected); --side-line: var(--line);
  --side-accent: var(--accent);
  --new-bg: var(--surface); --new-ink: var(--ink); --new-border: 1px solid var(--line-2);
  --say-bg: var(--surface); --say-ink: var(--ink);
  --reward-bg: var(--accent-wash); --hint-bg: var(--raised); --hint-border: var(--line-2);
  --stage-size: 0px; --stage-overlap: 0px; --head-size: 46px;
  --q-size: clamp(1.45rem, 3vw, 2rem);
  --star: #f2b100; --flame: #f97316;
  /* Studio shell accents are separate from lesson/tutor colours. */
  --studio-teal-panel: #0f766e; --studio-teal-deep: #095957; --studio-on-teal: #fff;
  --studio-teal-ink: #0f766e; --studio-teal-wash: #e4f4f1;
  --studio-amber-ink: #946110; --studio-amber-wash: #fff2d4;
  --studio-coral: #e56a60; --studio-amber: #e7ab35;
}

@media (prefers-color-scheme: light) {
  :root[data-theme="studio"] {
    --page: #f8f7f3; --surface: #fff; --raised: #fcfbf8; --side: #efedf7; --bubble: #eae7f3;
    --ink: #20204a; --ink-2: #43435f; --muted: #686878; --line: #e9e7ed; --line-2: #d9d6e3; --line-3: #b5afc8; --hover: #eeebf7; --selected: #e7e1fc;
    --accent: #6c4cf1; --accent-ink: #5735ce; --accent-soft: #ece6ff; --accent-wash: #f5f2ff; --focus: #6c4cf1;
    --primary: #6c4cf1; --primary-hover: #5939d8; --on-primary: #fff; --good: #0f766e;
    --side-bg: linear-gradient(180deg, #20204a 0%, #25234f 100%);
    --side-ink: #f5f3ff; --side-muted: #c2bfd9; --side-hover: rgb(255 255 255 / 8%); --side-selected: #6c4cf1; --side-line: rgb(255 255 255 / 12%);
    --new-bg: rgb(255 255 255 / 9%); --new-ink: #fff; --new-border: 1px solid rgb(255 255 255 / 20%); --side-accent: #d2c7ff;
    --shadow: 0 2px 4px rgb(32 32 74 / 2%), 0 8px 24px rgb(32 32 74 / 5%);
    --card-shadow: var(--shadow);
  }
  :root[data-theme="buddy"] {
    --page: #f1f3ff; --surface: #fff; --raised: #fbfbff; --side: #eceffd; --bubble: #e6eaff;
    --ink: #14123b; --ink-2: #353366; --muted: #5b5a8a; --line: #e1e3f6; --line-2: #d1d4f0; --line-3: #b2b6e2; --hover: #e8ebfd; --selected: #dfe3fc;
    --accent: #5b3df5; --accent-ink: #4327d6; --accent-soft: #e5e0ff; --accent-wash: #f2efff; --focus: #5b3df5; --good: #0b8a63;
    --primary: #5b3df5; --primary-hover: #4a2fe0; --on-primary: #fff;
    --primary-bg: linear-gradient(135deg, #7c4dff 0%, #4f46e5 100%); --btn-lift: 0 6px 18px rgb(79 70 229 / 28%);
    --page-art: radial-gradient(900px 420px at 85% -10%, rgb(124 77 255 / 12%), transparent 70%), radial-gradient(700px 380px at 30% -15%, rgb(34 211 238 / 12%), transparent 70%);
    --head-art: linear-gradient(110deg, #ece6ff 0%, #e2ecff 55%, #d8f7ff 100%);
    --side-bg: linear-gradient(180deg, #281673 0%, #371d90 55%, #4a2ab2 100%);
    --side-ink: #fff; --side-muted: #c9bff5; --side-hover: rgb(255 255 255 / 9%); --side-selected: rgb(255 255 255 / 17%); --side-line: rgb(255 255 255 / 12%);
    --new-bg: rgb(255 255 255 / 94%); --new-ink: #3a1f96; --new-border: 0; --side-accent: #ddd2ff;
    --coach-bg: #fff; --card-shadow: 0 2px 4px rgb(20 18 59 / 4%), 0 16px 40px rgb(79 70 229 / 9%);
    --reward-bg: linear-gradient(90deg, #f0ebff, #e6f6ff); --hint-bg: #fff; --hint-border: #c9bdff;
    --say-bg: #fff; --say-ink: #2a1f7a;
  }
  :root[data-theme="explorer"] {
    --page: #e6f4ff; --surface: #fff; --raised: #fff; --side: #f2efff; --bubble: #eee8ff;
    --ink: #1d1a4f; --ink-2: #3b3770; --muted: #625f8c; --line: #ece8f7; --line-2: #ddd6f2; --line-3: #c3bbe8; --hover: #f3f0ff; --selected: #ebe4ff;
    --accent: #6d3df2; --accent-ink: #5226d6; --accent-soft: #ebe4ff; --accent-wash: #f6f2ff; --focus: #6d3df2; --good: #179a5b;
    --primary: #6d3df2; --primary-hover: #5b2be0; --on-primary: #fff;
    --primary-bg: linear-gradient(180deg, #8b5cf6 0%, #6d28d9 100%); --btn-lift: 0 5px 0 #4c1d95, 0 12px 22px rgb(76 29 149 / 22%);
    --page-art:
      radial-gradient(70px 26px at 22% 9%, #fff 92%, transparent), radial-gradient(54px 20px at 26% 7%, #fff 92%, transparent),
      radial-gradient(90px 30px at 64% 6%, rgb(255 255 255 / 90%) 92%, transparent), radial-gradient(60px 22px at 92% 14%, rgb(255 255 255 / 85%) 92%, transparent),
      radial-gradient(1400px 260px at 30% 108%, #b7e59a 60%, transparent 61%), radial-gradient(1200px 300px at 90% 112%, #a5dc86 60%, transparent 61%),
      linear-gradient(180deg, #bfe5ff 0%, #def1ff 42%, #eef9ea 78%, #def5c9 100%);
    --side-bg: rgb(255 255 255 / 90%); --side-ink: #1d1a4f; --side-muted: #6c6996; --side-hover: #f3f0ff; --side-selected: #ebe4ff; --side-line: #eeeaf8;
    --new-bg: linear-gradient(180deg, #8b5cf6 0%, #6d28d9 100%); --new-ink: #fff; --new-border: 0;
    --card-bg: #fffdf6; --card-border: 3px solid #ffd766; --card-radius: 28px; --card-shadow: 0 14px 36px rgb(76 29 149 / 10%);
    --coach-bg: rgb(255 255 255 / 96%); --coach-border: 3px solid #dccfff;
    --say-bg: #ffe9a3; --say-ink: #4a3500; --reward-bg: #fff3c7; --hint-bg: #fff1bf; --hint-border: #f3cf5b;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --studio-teal-panel: #115e59; --studio-teal-deep: #0b4143;
    --studio-teal-ink: #79d6c5; --studio-teal-wash: #173b3b;
    --studio-amber-ink: #efc26c; --studio-amber-wash: #3b301b;
    --studio-coral: #f18b80; --studio-amber: #eebe59;
  }
  :root[data-theme="studio"] {
    --page: #141421; --surface: #202033; --raised: #25253a; --side: #20204a; --bubble: #30304c;
    --ink: #f0edf9; --ink-2: #d0ccdf; --muted: #aaa5bd; --line: #343249; --line-2: #46415f; --line-3: #70678e; --hover: #302b47; --selected: #3b315a;
    --accent: #b6a3ff; --accent-ink: #d3c7ff; --accent-soft: #393052; --accent-wash: #2a243d; --focus: #b6a3ff;
    --primary: #b6a3ff; --primary-hover: #c8baff; --on-primary: #201936; --good: #79d6c5;
    --side-bg: linear-gradient(180deg, #19192f 0%, #20203f 100%); --side-ink: #f4f0ff; --side-muted: #bbb5d2; --side-hover: rgb(255 255 255 / 8%); --side-selected: #6948df; --side-line: rgb(255 255 255 / 12%);
    --new-bg: rgb(255 255 255 / 8%); --new-ink: #f4f0ff; --new-border: 1px solid rgb(255 255 255 / 20%); --side-accent: #d2c7ff;
    --shadow: 0 8px 24px rgb(0 0 0 / 12%); --card-shadow: var(--shadow);
  }
  :root[data-theme="buddy"] {
    --page: #0e0c25; --surface: #191740; --raised: #1c1a47; --side: #24215a; --bubble: #2c2870;
    --ink: #f0eeff; --ink-2: #cfcaf5; --muted: #a8a3d6; --line: #2d2a62; --line-2: #3a3678; --line-3: #554fa0; --hover: #25225c; --selected: #2e2a70;
    --accent: #a593ff; --accent-ink: #d3caff; --accent-soft: #2f2770; --accent-wash: #211d55; --focus: #a593ff; --good: #4fd1a5;
    --primary: #7c6cff; --primary-hover: #8f80ff; --on-primary: #fff;
    --primary-bg: linear-gradient(135deg, #8b5cf6 0%, #4f46e5 100%); --btn-lift: 0 6px 18px rgb(0 0 0 / 35%);
    --page-art: radial-gradient(900px 420px at 85% -10%, rgb(124 77 255 / 22%), transparent 70%), radial-gradient(700px 380px at 30% -15%, rgb(34 211 238 / 14%), transparent 70%);
    --head-art: linear-gradient(110deg, #261f63 0%, #1d2a66 55%, #133c5a 100%);
    --side-bg: linear-gradient(180deg, #150c45 0%, #1f1366 100%); --side-ink: #fff; --side-muted: #b3a8ea; --side-hover: rgb(255 255 255 / 7%); --side-selected: rgb(255 255 255 / 13%); --side-line: rgb(255 255 255 / 9%);
    --new-bg: rgb(255 255 255 / 92%); --new-ink: #2b1a7e; --new-border: 0;
    --reward-bg: linear-gradient(90deg, #261f63, #18305a); --hint-bg: var(--raised); --hint-border: #5a4fc0;
    --say-bg: #262163; --say-ink: #e6e0ff;
  }
  :root[data-theme="explorer"] {
    --page: #141238; --surface: #211e52; --raised: #24205a; --side: #2b2766; --bubble: #352f7a;
    --ink: #f5f3ff; --ink-2: #d8d3ff; --muted: #b0aadf; --line: #332e72; --line-2: #403a88; --line-3: #5d55b0; --hover: #2b2766; --selected: #352f7a;
    --accent: #b49cff; --accent-ink: #ddd2ff; --accent-soft: #352c80; --accent-wash: #261f62; --focus: #b49cff; --good: #5bd69a;
    --primary: #8b5cf6; --primary-hover: #9b70ff; --on-primary: #fff;
    --primary-bg: linear-gradient(180deg, #9b6dff 0%, #7038e8 100%); --btn-lift: 0 5px 0 #3b1784, 0 12px 22px rgb(0 0 0 / 35%);
    --page-art:
      radial-gradient(2px 2px at 12% 14%, #fff 99%, transparent), radial-gradient(2px 2px at 38% 8%, #fff 99%, transparent),
      radial-gradient(1.5px 1.5px at 66% 18%, #fff 99%, transparent), radial-gradient(2px 2px at 86% 9%, #fff 99%, transparent),
      radial-gradient(1400px 260px at 30% 108%, #1f4a3a 60%, transparent 61%), radial-gradient(1200px 300px at 90% 112%, #1a3f31 60%, transparent 61%),
      linear-gradient(180deg, #17134a 0%, #221c63 55%, #2a2470 100%);
    --side-bg: rgb(27 24 74 / 92%); --side-ink: #f5f3ff; --side-muted: #b0aadf; --side-hover: #2b2766; --side-selected: #352f7a; --side-line: #332e72;
    --new-bg: linear-gradient(180deg, #9b6dff 0%, #7038e8 100%); --new-ink: #fff; --new-border: 0;
    --card-bg: #221e55; --card-border: 3px solid #c9a227; --card-radius: 28px; --card-shadow: 0 14px 36px rgb(0 0 0 / 35%);
    --coach-bg: #1f1b50; --coach-border: 3px solid #4b3fa6;
    --say-bg: #ffe08a; --say-ink: #3d2b00; --reward-bg: #3a3218; --hint-bg: #3a3218; --hint-border: #b8932a;
  }
}

/* The younger looks: rounder, bolder and larger */
:root[data-theme="buddy"] { --card-radius: 22px; --btn-radius: 14px; --title-font: var(--sans); --title-weight: 750; --stage-size: 112px; --head-size: 56px; }
:root[data-theme="explorer"] { --btn-radius: 999px; --title-font: var(--sans); --title-weight: 800; --stage-size: 150px; --stage-overlap: 34px; --head-size: 72px;
  --q-size: clamp(1.55rem, 3.2vw, 2.15rem); }
:root[data-theme="explorer"] body { font-size: 17px; }

/* --- The page, the sidebar and buttons, for every view --- */
body { background: var(--page-art), var(--page); background-attachment: fixed; }
.sidebar { background: var(--side-bg); color: var(--side-ink);
  --ink: var(--side-ink); --ink-2: var(--side-ink); --muted: var(--side-muted); --hover: var(--side-hover); --selected: var(--side-selected); --line: var(--side-line); --line-2: var(--side-line);
  --accent: var(--side-accent); --accent-ink: var(--side-accent); --focus: var(--side-accent); }
.sidebar .new-question { border: var(--new-border); background: var(--new-bg); color: var(--new-ink); font-weight: 650; }
.sidebar .new-question:hover { filter: brightness(1.04); }
.sidebar .nav-item > svg { color: var(--side-muted); }
.sidebar .mark { background: var(--accent); color: #fff; }
.primary { border-radius: var(--btn-radius); background: var(--primary-bg); box-shadow: var(--btn-lift); }
.primary:hover:not(:disabled) { background: var(--primary-bg); filter: brightness(1.06); }
.primary:active:not(:disabled) { transform: translateY(1px); }
.secondary { border-radius: var(--btn-radius); }

:root[data-theme="explorer"] .primary { min-height: 50px; padding: 0 24px; font-size: 16px; font-weight: 750; }
:root[data-theme="explorer"] .primary:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 #4c1d95; }
:root[data-theme="explorer"] .secondary, :root[data-theme="explorer"] .chip { border-width: 2px; font-weight: 650; }
:root[data-theme="explorer"] .nav-item { min-height: 46px; font-size: 16px; font-weight: 600; border-radius: 14px; }
:root[data-theme="explorer"] .nav-item > svg { color: var(--accent); width: 22px; height: 22px; }
:root[data-theme="explorer"] .sidebar .new-question { min-height: 52px; border-radius: 16px; font-size: 16.5px; box-shadow: 0 4px 0 #4c1d95; }
:root[data-theme="buddy"] .nav-item { min-height: 44px; font-size: 15px; font-weight: 550; }
:root[data-theme="buddy"] .sidebar .new-question { min-height: 48px; border-radius: 14px; }
@media (min-width: 861px) {
  :root[data-theme="explorer"] .app { grid-template-columns: 288px minmax(0, 1fr); }
  :root[data-theme="explorer"] .sidebar { top: 12px; height: calc(100vh - 24px); margin: 12px 0 12px 12px; border: 0; border-radius: 26px;
    box-shadow: 0 12px 34px rgb(60 40 140 / 13%); backdrop-filter: blur(8px); }
}

/* --- Learn: the header, the age chip and rewards --- */
.learn-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.learn-top .learn-title { flex: 1 1 auto; font: var(--title-weight) clamp(1.6rem, 3.2vw, 2.3rem)/1.1 var(--title-font); letter-spacing: -.015em; }
:root[data-theme="buddy"] .learn-head, :root[data-theme="explorer"] .learn-head { padding: 18px 20px 6px; border-radius: 24px; }
:root[data-theme="buddy"] .learn-head { background: var(--head-art); }
:root[data-theme="explorer"] .learn-head { background: rgb(255 255 255 / 55%); backdrop-filter: blur(6px); }
@media (prefers-color-scheme: dark) { :root[data-theme="explorer"] .learn-head { background: rgb(33 30 82 / 70%); } }
.age-chip { display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border: 1px solid var(--accent-soft); border-radius: 999px;
  background: var(--accent-wash); color: var(--accent-ink); font-size: 13.5px; font-weight: 700; }
.age-chip:hover { border-color: var(--accent); }
.learn-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.prize { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink-2); font-size: 13.5px; font-weight: 600; box-shadow: 0 2px 8px rgb(30 20 90 / 6%); white-space: nowrap; }
.prize strong { color: var(--ink); font-size: 15px; font-weight: 800; }
.stat-icon { display: inline-grid; place-items: center; flex: none; }
.prize-star .stat-icon, .reward .stat-icon { color: var(--star); }
.prize-flame .stat-icon { color: var(--flame); }
.prize-badge .stat-icon { color: var(--accent); }
.reward { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; background: var(--reward-bg); color: var(--ink-2); font-size: 14.5px; font-weight: 600; }
.reward.earned { color: var(--ink); }
.reward.earned .stat-icon { animation: reward-spin .9s ease-out 1; }
:root[data-theme="studio"] .learn-stats, :root[data-theme="studio"] .reward { display: none; }
:root[data-theme="explorer"] .prize { height: 44px; font-size: 14.5px; }
:root[data-theme="explorer"] .prize strong { font-size: 17px; }

/* --- Learn: the steps, the question, the answer --- */
.step-mark { transition: background .2s, color .2s; }
:root[data-theme="explorer"] .stepper { gap: 8px; }
:root[data-theme="explorer"] .step { padding: 10px 12px 10px 10px; border-radius: 18px; background: rgb(255 255 255 / 70%); }
:root[data-theme="explorer"] .step::before { display: none; }
:root[data-theme="explorer"] .step.now { background: #fff; box-shadow: 0 0 0 3px var(--accent-soft), 0 6px 16px rgb(76 29 149 / 12%); }
:root[data-theme="explorer"] .step-mark { width: 32px; height: 32px; font-size: 14px; }
:root[data-theme="explorer"] .step-name { font-size: 15px; font-weight: 750; }
@media (prefers-color-scheme: dark) { :root[data-theme="explorer"] .step { background: rgb(43 39 102 / 70%); } :root[data-theme="explorer"] .step.now { background: var(--surface); } }
:root[data-theme="buddy"] .step.now::before { background: linear-gradient(90deg, #7c4dff, #22d3ee); }
:root[data-theme="buddy"] .step.now .step-mark { background: linear-gradient(135deg, #7c4dff, #4f46e5); }
.question-card { border: var(--card-border); border-radius: var(--card-radius); background: var(--card-bg); box-shadow: var(--card-shadow); }
.learn-view .practice-question { font-size: var(--q-size); }
:root[data-theme="explorer"] .learn-view .practice-question, :root[data-theme="buddy"] .learn-view .practice-question { font-weight: 500; }


.answer-keys button { min-width: 48px; height: 44px; border-radius: 12px; font-size: 17px; }
:root[data-theme="explorer"] .answer-keys button { min-width: 56px; height: 52px; border: 2px solid var(--line-2); border-radius: 16px; background: var(--surface); font-size: 20px; box-shadow: 0 3px 0 var(--line-2); }
:root[data-theme="buddy"] .answer-keys button { background: var(--surface); }
:root[data-theme="explorer"] .answer-input { min-height: 64px; border: 2px solid var(--line-2); border-radius: 18px; font-size: 24px; }
.check-button { min-height: 50px; padding: 0 26px; font-size: 16px; }
:root[data-theme="explorer"] .check-button { min-height: 60px; padding: 0 32px; font-size: 19px; }
:root[data-theme="explorer"] .practice-say, :root[data-theme="buddy"] .practice-say { border-radius: 18px; }

/* --- Learn: the tutor panel --- */
.learn-coach { border: var(--coach-border); border-radius: var(--card-radius); background: var(--coach-bg); }
:root[data-theme="buddy"] .learn-coach { border: 1.5px solid transparent;
  background: linear-gradient(var(--coach-bg), var(--coach-bg)) padding-box, linear-gradient(140deg, #7dd3fc, #a78bfa 55%, #c4b5fd) border-box;
  box-shadow: 0 16px 40px rgb(79 70 229 / 10%); }
.coach-head { display: flex; align-items: center; gap: 12px; }
.coach-words { display: grid; align-content: center; gap: 2px; min-width: 0; }
.coach-name { font: 750 1.2rem/1.2 var(--sans); letter-spacing: -.01em; }
:root[data-theme="explorer"] .coach-name { font-size: 1.45rem; }
:root[data-theme="explorer"] .chat-tutor .written, :root[data-theme="buddy"] .chat-tutor .written { border-radius: 20px 20px 20px 8px; }
:root[data-theme="explorer"] .chat-tutor .written { border: 2px solid var(--line); font-size: 16px; }
:root[data-theme="explorer"] .chat-student .bubble { background: var(--bubble); border-radius: 20px 20px 8px 20px; font-size: 16px; }
.help-actions .secondary { background: var(--hint-bg); border-color: var(--hint-border); }
:root[data-theme="explorer"] .help-actions { gap: 8px 12px; }

/* --- The mascot (decorative, aria-hidden) --- */
.mascot { pointer-events: none; }
.mascot img { display: block; width: 100%; height: 100%; object-fit: contain; }
.mascot-stage { position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; height: var(--stage-size); margin-bottom: calc(var(--stage-overlap) * -1); }
.mascot-stage img { flex: none; width: var(--stage-size); height: var(--stage-size); filter: drop-shadow(0 6px 10px rgb(40 20 100 / 18%)); }
.mascot-says { position: relative; max-width: 330px; margin: 0 0 var(--stage-overlap) 8px; padding: 10px 18px; border-radius: 18px; background: var(--say-bg); color: var(--say-ink);
  font-size: 15px; font-weight: 750; line-height: 1.35; box-shadow: 0 6px 16px rgb(60 40 140 / 12%); }
.mascot-says::before { content: ""; position: absolute; left: -9px; top: 50%; width: 18px; height: 18px; border-radius: 3px; background: inherit; transform: translateY(-50%) rotate(45deg); }
:root[data-theme="explorer"] .mascot-says { font-size: 17px; padding: 12px 22px; border-radius: 22px; }
:root[data-theme="buddy"] .mascot-stage { align-items: flex-end; }
:root[data-theme="buddy"] .mascot-says { margin-bottom: 18px; border: 1.5px solid #d9d0ff; }
.mascot-head { flex: none; width: var(--head-size); height: var(--head-size); }
:root[data-theme="studio"] .mascot-head { padding: 4px; border-radius: 14px; background: var(--accent-wash); }
.chat-tutor { gap: 8px; align-items: flex-start; }
.mascot-avatar { flex: none; width: 34px; height: 34px; margin-top: 2px; overflow: hidden; border-radius: 50%; background: var(--accent-wash); }
.mascot-avatar img { object-fit: cover; object-position: 50% 0; transform: scale(1.35); transform-origin: 50% 10%; }
:root[data-theme="studio"] .mascot-stage, :root[data-theme="studio"] .mascot-avatar { display: none; }
:root[data-mascot="off"] .mascot { display: none !important; }

@keyframes mascot-pop { from { opacity: .4; transform: translateY(6px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes mascot-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes mascot-cheer { 0%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-12px) rotate(-4deg); } 60% { transform: translateY(0) rotate(3deg); } }
@keyframes mascot-nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes reward-spin { from { transform: scale(.6) rotate(-90deg); } to { transform: none; } }
:root[data-mascot="on"] .mascot.is-new { animation: mascot-pop .35s ease-out; }
:root[data-mascot="on"]:not([data-theme="studio"]) .mascot-stage[data-state="idle"] img,
:root[data-mascot="on"]:not([data-theme="studio"]) .mascot-stage[data-state="thinking"] img { animation: mascot-bob 3.6s ease-in-out infinite; }
:root[data-mascot="on"] .mascot-stage[data-state="celebrating"] img, :root[data-mascot="on"] .mascot-head[data-state="celebrating"] img { animation: mascot-cheer .9s ease-out 2; }
:root[data-mascot="on"] .mascot-stage[data-state="correcting"] img { animation: mascot-nudge .5s ease-in-out 1; }
:root[data-mascot="still"] .reward.earned .stat-icon { animation: none; }

/* --- Settings: the look picker --- */
.theme-choices, .motion-choices { min-width: 0; margin: 0; padding: 0; border: 0; }
.theme-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.theme-choice { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 10px 14px; border: 1.5px solid var(--line-2); border-radius: 14px; background: var(--surface); }
.theme-choice:hover { border-color: var(--line-3); }
.theme-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.theme-choice:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.theme-choice input, .motion-choices input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.theme-swatch { flex: none; width: 44px; height: 44px; }
.theme-swatch { border-radius: 12px; background: conic-gradient(from 200deg, #ffd766, #8b5cf6, #22d3ee, #211c5e, #ffd766); }
.swatch-explorer { background: linear-gradient(140deg, #cdefff 50%, #ffd766 50%); }
.swatch-buddy { background: linear-gradient(140deg, #6c4cf1 50%, #22d3ee 50%); }
.swatch-studio { background: linear-gradient(140deg, #132553 50%, #e1e9ff 50%); }
.theme-choice > span:last-child { display: grid; gap: 1px; min-width: 0; }
.theme-choice small { color: var(--muted); font-size: 12.5px; }
.motion-choices { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.motion-choices legend { float: left; margin-right: 6px; font-size: .9rem; font-weight: 600; }
.motion-choices label { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-size: 14.5px; }

@media (max-width: 1000px) {
  :root[data-theme="explorer"] { --stage-size: 118px; --stage-overlap: 26px; }
  :root[data-theme="buddy"] { --stage-size: 92px; }
}
@media (max-width: 640px) {
  :root[data-theme="explorer"] { --stage-size: 96px; --stage-overlap: 20px; --head-size: 56px; }
  :root[data-theme="buddy"] { --stage-size: 78px; --head-size: 48px; }
  .mascot-says { font-size: 14px; padding: 8px 14px; }
  :root[data-theme="explorer"] .mascot-says { font-size: 15px; padding: 10px 16px; }
  :root[data-theme="buddy"] .learn-head, :root[data-theme="explorer"] .learn-head { padding: 14px 14px 4px; }
  .theme-choices { grid-template-columns: minmax(0, 1fr); }
  :root[data-theme="explorer"] .step { padding: 8px; }
}

/* Explorer reads like a picture book: the question in bold sans, the answer label large */
:root[data-theme="explorer"] .learn-view .practice-question { font-family: var(--sans); font-weight: 750; letter-spacing: -.015em; }
.question-card label.strong { font-size: 15px; font-weight: 700; }
:root[data-theme="explorer"] .question-card label.strong { font-size: 17px; font-weight: 800; }
/* Buddy's sidebar ends in a mountain range */
:root[data-theme="buddy"] .sidebar { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 260 90'%3E%3Cpath d='M0 90V60l40-30 30 22 40-38 40 36 30-14 40 26 40-22v50z' fill='%23a78bfa' fill-opacity='.35'/%3E%3Cpath d='M0 90V74l50-24 40 20 50-26 50 28 40-14 30 12v20z' fill='%23c4b5fd' fill-opacity='.3'/%3E%3C/svg%3E") bottom / 100% auto no-repeat, var(--side-bg); }
