/* SchoolTutor: mobile-first styles. Logical properties (inline/block) keep RTL layouts possible. */
:root {
  --bg: #f5f4ff;
  --card: #ffffff;
  --ink: #1d1b3a;
  --muted: #625f80;
  --primary: #5b4cdb;
  --primary-ink: #ffffff;
  --primary-soft: #ecebff;
  --accent: #ffb020;
  --good: #137a53;
  --good-soft: #e3f6ee;
  --warm: #9a4d00;
  --warm-soft: #fff1df;
  --sim: #7a5b00;
  --sim-soft: #fff6cc;
  --line: #e2e0f2;
  /* Subject cards (ink text on each) */
  --subj-maths: #e4f0ff;
  --subj-science: #e3f6ee;
  --subj-english: #fff1df;
  --subj-social: #fde8f1;
  --subj-computer: #ecebff;
  --subj-other: #f1f0f7;
  --radius: 16px;
  --shadow: 0 2px 10px rgb(40 30 120 / 8%);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }
h1 { font-size: 1.35rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.error { color: #a12a2a; margin: .5rem 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::placeholder { color: var(--muted); opacity: 1; }
/* Keyboard users can jump past the top bar; the link shows only when focused. */
.skip-link { position: absolute; inset-inline-start: .5rem; inset-block-start: -3rem; z-index: 3; background: var(--primary); color: var(--primary-ink); padding: .5rem .8rem; border-radius: 10px; font-weight: 650; }
.skip-link:focus { inset-block-start: .5rem; outline: 3px solid var(--accent); }
main:focus { outline: none; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem; background: var(--card); border-block-end: 1px solid var(--line);
  position: sticky; inset-block-start: 0; z-index: 2;
}
.brand { display: flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--primary); }
.learner { font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav { margin-inline-start: auto; display: flex; gap: .25rem; flex-wrap: wrap; justify-content: flex-end; }
.ai-banner { margin: 0; padding: .3rem .75rem; font-size: .78rem; background: var(--primary-soft); color: var(--ink); }
.ai-banner .dev { color: var(--sim); }

main { padding: .6rem; max-width: 1100px; margin: 0 auto; }
.screen.narrow { max-width: 460px; margin: 1rem auto; }

/* Cards and controls */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .9rem; margin-block-end: .6rem;
}
label { display: block; font-size: .85rem; color: var(--muted); margin-block-end: .55rem; }
label > input, label > select, textarea {
  display: block; width: 100%; margin-block-start: .2rem; font: inherit; color: var(--ink);
  padding: .55rem .65rem; border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
}
label.check { display: flex; gap: .5rem; align-items: flex-start; color: var(--ink); }
label.check input { width: auto; margin-block-start: .25rem; }
input:focus, select:focus, textarea:focus, button:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 1px; border-color: var(--primary);
}

button { font: inherit; cursor: pointer; border-radius: 12px; border: 0; min-height: 44px; padding: .5rem .9rem; }
button:disabled { opacity: .55; cursor: progress; }
.primary { background: var(--primary); color: var(--primary-ink); font-weight: 650; }
.secondary { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.ghost { background: transparent; color: var(--primary); border: 1.5px dashed var(--primary); }
.link { background: none; color: var(--primary); min-height: 36px; padding: .25rem .4rem; text-decoration: underline; }
.wide { width: 100%; }
.icon { width: 44px; padding: 0; background: var(--bg); font-size: 1.15rem; }

/* Children */
.child-list { list-style: none; padding: 0; margin: 0 0 .75rem; display: grid; gap: .5rem; }
.child-list button { width: 100%; text-align: start; background: var(--primary-soft); color: var(--ink); font-weight: 600; font-size: 1.05rem; }
.inline-form { display: flex; gap: .5rem; align-items: flex-end; }
.inline-form label { flex: 1; margin: 0; }

/* Learning path (collapsible so the question stays near the top on phones) */
.path summary { cursor: pointer; list-style: none; display: flex; gap: .4rem; align-items: baseline; flex-wrap: wrap; }
.path summary::-webkit-details-marker { display: none; }
/* The arrow is decoration (the summary already says open or closed): empty alternative text where
   supported; browsers without the "/ alt" syntax keep the first declaration. */
.path summary::after { content: "▾"; content: "▾" / ""; margin-inline-start: auto; color: var(--primary); }
.path[open] summary::after { content: "▴"; content: "▴" / ""; }
.path-label { font-weight: 650; }
.path-summary { color: var(--muted); font-size: .88rem; }
.path-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .6rem; margin-block-start: .6rem; }
.span2 { grid-column: 1 / -1; }

/* Question */
.q-meta { display: flex; gap: .35rem; flex-wrap: wrap; margin-block-end: .35rem; }
.chip { font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.chip.level { background: #fff4d6; color: #8a5a00; }
.chip.sim { background: var(--sim-soft); color: var(--sim); }
.q-text { font-size: 1.3rem; font-weight: 650; margin: .2rem 0 .7rem; white-space: pre-line; overflow-wrap: anywhere; }
.options { display: flex; gap: .5rem; flex-wrap: wrap; margin-block-end: .6rem; }
.options button { min-width: 56px; font-size: 1.2rem; background: var(--bg); border: 1.5px solid var(--line); font-weight: 650; }
.answer-row { display: flex; gap: .4rem; align-items: stretch; margin-block-end: .5rem; }
.answer-input, .answer-long {
  flex: 1; min-width: 0; font-size: 1.15rem; padding: .55rem .7rem; border: 2px solid var(--line); border-radius: 12px; font-family: inherit;
}
.answer-long { font-size: 1rem; margin: 0; }
.inputs { display: flex; gap: .3rem; }
.photo { border: 1.5px solid var(--line); border-radius: 14px; padding: .6rem .75rem; margin: 0 0 .6rem; display: grid; gap: .45rem; }
.photo h3 { font-size: 1rem; margin: 0; }
.photo p { margin: 0; }
.photo-warn { font-size: .9rem; background: var(--warm-soft); color: var(--warm); border-radius: 10px; padding: .4rem .6rem; }
.file-pick { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 12px; padding: .5rem .9rem; cursor: pointer; text-align: center; }
.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-pick:focus-within { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 1px; }
.photo-preview { display: block; max-width: 100%; max-height: 40vh; margin-inline: auto; border-radius: 10px; border: 1px solid var(--line); }
.photo-actions { display: flex; gap: .4rem; }
.photo-actions button { flex: 1; }
.photo .feedback { margin: 0; }
.q-meta .read-aloud { margin-inline-start: auto; }
.read-aloud[aria-pressed="true"] { outline: 2px solid var(--warm); }
.note { font-size: .85rem; background: var(--sim-soft); color: var(--sim); border-radius: 10px; padding: .4rem .6rem; margin: 0 0 .5rem; }

.feedback { border-radius: 12px; padding: .6rem .75rem; margin-block: .6rem; }
.feedback p { margin: .15rem 0; }
.feedback.good { background: var(--good-soft); color: var(--good); }
.feedback.warm { background: var(--warm-soft); color: var(--warm); }
/* New badge note: the same warm, tested colour pair; calm, no confetti, no countdown. */
.cheer { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; border-radius: 12px; padding: .5rem .75rem; margin-block: .5rem; background: var(--warm-soft); color: var(--warm); }
.cheer p { margin: 0; flex: 1 1 12rem; font-weight: 600; }
.cheer .cheer-icon { font-size: 1.5rem; }
.cheer .link { color: var(--warm); min-height: 44px; }
.feedback.info { background: var(--sim-soft); color: var(--sim); }
.feedback .mistake { margin-block-start: .4rem; padding-block-start: .4rem; border-block-start: 1px dashed currentColor; color: var(--ink); }
.feedback .mistake strong { display: block; }
.hints { margin: .4rem 0; padding-inline-start: 1.3rem; }
.hints li { margin-block-end: .3rem; background: var(--primary-soft); border-radius: 10px; padding: .35rem .55rem; }
.solution { background: var(--bg); border-radius: 12px; padding: .6rem .75rem; margin-block: .5rem; }
.solution p { margin: .2rem 0; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; margin-block-start: .6rem; }
.labels { display: flex; gap: .35rem; flex-wrap: wrap; margin-block-start: .6rem; }
.tag { font-size: .72rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .5rem; }
/* Working area: typed steps and the writing pad, on the question card */
.workspace { border: 1.5px solid var(--line); border-radius: 14px; padding: .6rem .7rem; margin-block: .6rem; display: grid; gap: .45rem; }
.workspace p { margin: 0; }
.work-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.work-head h3 { font-size: 1rem; margin: 0; }
.work-tabs { display: inline-flex; margin-inline-start: auto; background: var(--bg); border-radius: 12px; padding: 3px; }
.work-tabs button { min-height: 40px; background: transparent; color: var(--primary); font-weight: 600; padding: .3rem .9rem; }
.work-tabs button[aria-selected="true"] { background: var(--primary); color: var(--primary-ink); }
.work-panel { display: grid; gap: .45rem; }
.working-text { margin: 0; font-size: 1.05rem; font-family: ui-monospace, "Cascadia Mono", "Noto Sans Mono", monospace; line-height: 1.6; }
.work-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.step { display: grid; grid-template-columns: 1.6rem 1fr; align-items: baseline; border-radius: 10px; padding: .3rem .5rem; background: var(--bg); }
.step-mark { font-weight: 800; text-align: center; }
.step-text { font-family: ui-monospace, "Cascadia Mono", "Noto Sans Mono", monospace; overflow-wrap: anywhere; white-space: pre-wrap; } /* keeps column sums lined up */
.step-correct .step-mark { color: var(--good); }
.step-incorrect { background: var(--warm-soft); outline: 2px solid var(--warm); }
.step-incorrect .step-mark, .step-why { color: var(--warm); }
.step-unchecked .step-mark, .step-start .step-mark { color: var(--muted); }
.step-why { grid-column: 2; font-size: .9rem; margin-block-start: .2rem; }
.pad-tools { display: flex; gap: .3rem; flex-wrap: wrap; }
.tool { width: 44px; padding: 0; background: var(--bg); font-size: 1.1rem; border: 1.5px solid transparent; }
.tool[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
/* touch-action: none stops the page scrolling or zooming while the child writes. */
.pad {
  display: block; width: 100%; aspect-ratio: 4 / 3; max-height: 60vh; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; overscroll-behavior: contain; border: 1.5px solid var(--line); border-radius: 12px; cursor: crosshair;
  background: #fff repeating-linear-gradient(to bottom, transparent 0 31px, #e9e7f7 31px 32px);
}

/* Lesson */
.lesson-head { display: flex; gap: .5rem; align-items: center; margin-block-end: .4rem; }
.lesson-body p { margin: .35rem 0; }
.explain-form { display: flex; gap: .5rem; align-items: flex-end; margin-block-start: .5rem; }
.explain-form label { flex: 1; margin: 0; }

/* Follow-up chat with the AI tutor */
.chat-log { list-style: none; padding: 0; margin: .4rem 0; display: grid; gap: .4rem; }
.chat-log li { border-radius: 12px; padding: .4rem .6rem; max-width: 92%; overflow-wrap: anywhere; }
.chat-log li strong { display: block; font-size: .75rem; }
.chat-log .from-student { background: var(--primary-soft); justify-self: end; }
.chat-log .from-tutor { background: var(--bg); justify-self: start; }
.chat-log .from-info { background: var(--sim-soft); color: var(--sim); }
.chat-form { display: flex; gap: .4rem; }
.chat-form input { flex: 1; min-width: 0; margin: 0; }

/* Progress strip */
.strip { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; padding: .5rem .8rem; color: var(--muted); font-size: .9rem; }
.stars { color: #8a5a00; font-weight: 700; }
.badges { display: flex; gap: .3rem; flex-wrap: wrap; }
.badges span { background: #fff4d6; color: #8a5a00; border-radius: 999px; padding: .1rem .5rem; font-size: .78rem; }

/* Learning dashboard: tutor, goals, subject cards, learning map, badges */
.home { display: grid; gap: .55rem; }
.home-h { font-size: 1rem; margin: .4rem 0 0; }
.tutor { display: flex; gap: .7rem; align-items: center; }
.tutor-art { flex: none; filter: drop-shadow(0 4px 6px rgb(40 30 120 / 14%)); }
/* The drawings live in one hidden sprite and are shown with <use>. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
/* Each tutor tints the speech bubble (light tints only: ink text stays above 4.5:1). */
body { --bubble: var(--primary-soft); }
body[data-tutor="bipo"] { --bubble: #def7f3; }
body[data-tutor="tara"] { --bubble: #eceffd; }
body[data-tutor="nova"] { --bubble: #fff6d6; }
body[data-tutor="asha"] { --bubble: #ffeede; }
body[data-tutor="kai"] { --bubble: #e4eefc; }
.bubble { position: relative; flex: 1; background: var(--bubble); border-radius: 18px; padding: .6rem .8rem; }
.bubble::before { content: ""; position: absolute; inset-inline-start: -8px; inset-block-start: 1.2rem; border: 8px solid transparent; border-inline-start: 0; border-inline-end-color: var(--bubble); }
.bubble p, .bubble h2 { margin: 0; }
.greeting { font-size: 1.15rem; line-height: 1.3; }
.greeting:focus { outline: none; }
.hello { margin-block-start: .25rem !important; font-style: italic; }
.tutor-change { min-height: 36px; padding-inline: 0; margin-block-start: .2rem; }
/* Tutor picker: one card per character, the chosen one outlined. */
.tutor-picker { display: grid; gap: .45rem; border: 1.5px solid var(--line); border-radius: var(--radius); padding: .6rem .7rem; }
.tutor-picker .home-h { margin: 0; }
.tutor-picker .home-h:focus { outline: none; }
.pick-note { margin: 0; color: var(--muted); font-size: .85rem; }
.tutor-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .45rem; }
.tutor-option {
  display: grid; grid-template-columns: auto 1fr; gap: 0 .5rem; align-items: center; text-align: start;
  padding: .5rem; background: var(--bg); color: var(--ink); border: 2px solid transparent; font-weight: 400;
}
.tutor-thumb { grid-row: span 3; width: 56px; height: 56px; }
.tutor-name { font-weight: 700; }
.tutor-kind { font-size: .75rem; color: var(--muted); }
.tutor-about { font-size: .78rem; grid-column: 1 / -1; margin-block-start: .3rem; }
.tutor-option[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
/* 44 px so the expressions (run 27) can be read; always this size, so nothing on the card moves
   when one appears (run-27 review N8). */
.mini-tutor { flex: none; width: 44px; height: 44px; }
.mini-name { font-size: .75rem; font-weight: 650; color: var(--muted); }
/* Continue Learning: the main action on the dashboard. */
.hero-cta { font-size: 1.1rem; min-height: 54px; box-shadow: 0 4px 12px rgb(91 76 219 / 25%); }
.journey-wrap { display: grid; gap: .4rem; }
.journey-box summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: .2rem .6rem; cursor: pointer; min-height: 44px; list-style: none; }
.journey-box summary::-webkit-details-marker { display: none; }
.journey-box summary .home-h { margin: 0; }
.journey-open { color: var(--primary); font-weight: 650; font-size: .88rem; text-decoration: underline; }
.journey-box[open] .journey-open { display: none; }
.journey-box .journey { margin-block-start: .4rem; }
.tip { margin-block-start: .25rem !important; font-size: .92rem; }
.ai-note { margin-block-start: .3rem !important; font-size: .78rem; color: var(--primary); font-weight: 600; }
.goal { display: grid; grid-template-columns: auto 1fr; gap: .2rem .6rem; align-items: center; }
.goal-text { grid-column: 1 / -1; color: var(--muted); font-size: .88rem; }
.meter { width: 100%; height: 14px; appearance: none; border: 0; border-radius: 999px; background: var(--primary-soft); overflow: hidden; }
.meter::-webkit-progress-bar { background: var(--primary-soft); border-radius: 999px; }
.meter::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.meter::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.subject-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .45rem; }
.subject-card {
  display: grid; justify-items: center; gap: .2rem; padding: .6rem .3rem; min-height: 84px; color: var(--ink); font-weight: 650; font-size: .88rem;
  background: var(--subj-other); border: 2px solid transparent; text-align: center;
}
.subject-card[data-subject="maths"] { background: var(--subj-maths); }
.subject-card[data-subject="science"] { background: var(--subj-science); }
.subject-card[data-subject="english"] { background: var(--subj-english); }
.subject-card[data-subject="social-studies"] { background: var(--subj-social); }
.subject-card[data-subject="computer-science"] { background: var(--subj-computer); }
.subject-card[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
/* Subject worlds: a small scene on each card, the subject's and the world's name under it. */
.subject-art { display: block; width: 72px; height: 48px; border-radius: 10px; }
.subject-world { font-size: .72rem; font-weight: 600; color: var(--muted); }
/* The next mission: the world's scene, one suggestion and how much of the map is explored. */
.mission { display: grid; grid-template-columns: auto 1fr; gap: .4rem .7rem; align-items: center; border-radius: var(--radius); padding: .6rem .7rem; background: var(--bg); border: 1.5px solid var(--line); }
.mission-world { width: 96px; height: 64px; border-radius: 12px; }
.mission-body { display: grid; gap: .3rem; justify-items: start; }
.mission-body .home-h { margin: 0; }
.mission-text { margin: 0; font-weight: 600; }
.mission-progress, .mission-note { grid-column: 1 / -1; }
.mission-progress { display: grid; gap: .2rem; }
/* Run 28: the rest of the mission chain, quieter than the first. */
.mission-next-box { grid-column: 1 / -1; display: grid; gap: .25rem; }
.mission-next-title { margin: 0; font-size: .85rem; color: var(--muted); }
.mission-next { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.mission-next-go { width: 100%; text-align: start; }
/* Study overview (older students): one compact row per skill, plain numbers, revise first. */
.study { display: grid; gap: .4rem; }
.study-summary, .study-trend { margin: 0; font-size: .9rem; color: var(--ink); }
.study-trend { color: var(--good); font-weight: 650; }
.study-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.study-row { display: grid; grid-template-columns: 1fr auto; gap: .15rem .5rem; align-items: center; background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: .45rem .6rem; }
.study-skill { color: var(--ink); }
.study-status { font-size: .75rem; font-weight: 650; border-radius: 999px; padding: .1rem .5rem; background: var(--card); color: var(--primary); }
.study-strength .study-status { color: var(--good); }
.study-revise .study-status { color: var(--warm); }
.study-nums { grid-column: 1 / -1; font-size: .85rem; color: var(--muted); }
.study-row button { grid-column: 1 / -1; justify-self: start; }
/* The tutor's reaction and Help me, on the question card. */
.react { margin: .5rem 0 0; padding: .4rem .65rem; border-radius: 12px; background: var(--bubble); color: var(--ink); font-weight: 600; font-size: .92rem; }
.help-more { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-block: .3rem .5rem; }
.help-more p { margin: 0; flex: 1 1 100%; font-size: .88rem; color: var(--muted); }
.help-more button { flex: 1 1 10rem; }
.journey-note { margin: 0; color: var(--muted); font-size: .88rem; }
.journey { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.journey-chapter h4 { margin: 0 0 .3rem; font-size: .92rem; }
/* The path: stops joined by a dotted line, like a trail on a map. */
.stops { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; border-inline-start: 3px dotted var(--line); margin-inline-start: .9rem; padding-inline-start: .6rem; }
.stop button {
  width: 100%; display: grid; grid-template-columns: 1.8rem 1fr auto; align-items: center; gap: .4rem; text-align: start;
  background: var(--bg); color: var(--ink); border: 1.5px solid var(--line);
}
.stop-mark { font-size: 1.1rem; text-align: center; color: var(--muted); }
.stop-status { font-size: .75rem; font-weight: 650; border-radius: 999px; padding: .1rem .5rem; background: var(--card); color: var(--muted); }
.stop-strong button { background: var(--good-soft); border-color: transparent; }
.stop-strong .stop-status { color: var(--good); }
.stop-learning .stop-status { color: var(--primary); }
.stop-revise button { background: var(--warm-soft); border-color: transparent; }
.stop-revise .stop-status { color: var(--warm); }
/* "Let's fix these": warm, not red; a few items, each with its own practice button. */
.fix { display: grid; gap: .4rem; }
.fix-intro, .fix-done { margin: 0; color: var(--muted); font-size: .88rem; }
.fix-done { color: var(--good); font-weight: 650; }
.fix-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.fix-item { display: grid; gap: .25rem; background: var(--warm-soft); border-radius: 14px; padding: .6rem .7rem; }
.fix-skill { color: var(--ink); }
.fix-teach { color: var(--ink); font-size: .88rem; }
.fix-item button { justify-self: start; }
.journey-more { display: flex; gap: .4rem; flex-wrap: wrap; }
.journey-more button { flex: 1 1 10rem; }
.badge-shelf { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .4rem; }
.badge { display: grid; grid-template-columns: auto 1fr; gap: 0 .4rem; align-items: center; border-radius: 12px; padding: .4rem .55rem; }
.badge-icon { grid-row: span 2; font-size: 1.4rem; }
.badge-text { font-size: .8rem; }
.badge.earned { background: #fff4d6; color: #8a5a00; }
.badge.earned strong { color: var(--ink); }
.badge.next { background: var(--card); border: 1.5px dashed var(--line); color: var(--muted); }

/* Age-adaptive look (body[data-stage], from the selected class's stage in the curriculum data).
   Young children: bigger text and targets, rounder shapes. Older students: calmer and compact. */
body[data-stage="preschool"], body[data-stage="early"] { --radius: 22px; font-size: 1.08rem; }
body[data-stage="preschool"] button, body[data-stage="early"] button { min-height: 52px; border-radius: 16px; }
body[data-stage="preschool"] .subject-card, body[data-stage="early"] .subject-card { min-height: 104px; font-size: 1rem; }
body[data-stage="preschool"] .subject-art, body[data-stage="early"] .subject-art { width: 96px; height: 64px; }
body[data-stage="preschool"] .q-text, body[data-stage="early"] .q-text { font-size: 1.5rem; }
body[data-stage="preschool"] .greeting, body[data-stage="early"] .greeting { font-size: 1.3rem; }
body[data-stage="preschool"] .tutor-art, body[data-stage="early"] .tutor-art { width: 112px; height: 112px; }
body[data-stage="middle"] .tutor-art, body[data-stage="secondary"] .tutor-art { width: 60px; height: 60px; }
body[data-stage="secondary"] .hello { font-style: normal; }
body[data-stage="secondary"] { --radius: 12px; }
body[data-stage="secondary"] .greeting { font-size: 1.05rem; }
body[data-stage="secondary"] .subject-card { min-height: 70px; }
body[data-stage="secondary"] .subject-art { width: 56px; height: 37px; }
/* Older students (middle and secondary): a calmer, cooler, less childish look. Separate variables,
   so the contrast test checks these colours on their own (a11y.test.js). */
:root { --older-bg: #f3f5f9; --older-soft: #e8ebf7; --older-card-tint: #eef1f6; }
body[data-stage="middle"], body[data-stage="secondary"] { --bg: var(--older-bg); --primary-soft: var(--older-soft); }
body[data-stage="middle"] .subject-card, body[data-stage="secondary"] .subject-card { background: var(--older-card-tint); font-weight: 600; }
body[data-stage="middle"] .hero-cta, body[data-stage="secondary"] .hero-cta { box-shadow: none; }
body[data-stage="middle"] .subject-world, body[data-stage="secondary"] .subject-world,
body[data-stage="secondary"] .mission-world { display: none; }
body[data-stage="secondary"] .mission { grid-template-columns: 1fr; }
body[data-stage="secondary"] .react { font-weight: 500; }

/* Parent view */
.parent-pick { max-width: 260px; }
.report-section { margin-block: .9rem; }
.report-section h2 { margin-block-end: .35rem; }
.report-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.report-list li { background: var(--bg); border-radius: 10px; padding: .4rem .6rem; }
.report-list .meta { color: var(--muted); font-size: .82rem; display: block; }

/* Tablet and desktop: question and lesson side by side on the same screen */
@media (min-width: 900px) {
  main { padding: 1rem; }
  .classroom { display: grid; grid-template-columns: 3fr 2fr; gap: 0 1rem; align-items: start; }
  .classroom .path, .classroom .strip, .classroom .home, #class-empty { grid-column: 1 / -1; }
  .home { grid-template-columns: 1fr 1fr; gap: .6rem 1.2rem; align-items: start; }
  .home > .tutor, .home > .goal, .home > #home-continue, .home > .tutor-picker, .home > .mission { grid-column: 1 / -1; }
  .home > .study { grid-column: 1 / -1; }
  .study-list { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .journey .stops { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .classroom .chat { grid-column: 2; }
  .path-form { grid-template-columns: repeat(4, 1fr); }
  .path-form .span2 { grid-column: span 2; }
  .path-form button.span2 { grid-column: 1 / -1; }
  .q-text { font-size: 1.6rem; }
  .actions { grid-template-columns: repeat(4, 1fr); }
  .actions .span2 { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: no-preference) {
  .feedback.good { animation: pop .35s ease-out; }
  .cheer:not([hidden]) .cheer-icon { display: inline-block; animation: pop .5s ease-out; }
  @keyframes pop { from { transform: scale(.97); opacity: .4; } to { transform: none; opacity: 1; } }
  /* The tutor floats gently: calm, small, and off for reduced motion. */
  .tutor-art { animation: float 5s ease-in-out infinite; }
  @keyframes float { 0%, 100% { transform: none; } 50% { transform: translateY(-3px); } }
  .tutor-option { transition: transform .12s ease-out; }
  .tutor-option:active { transform: scale(.97); }
  /* The small tutor on the question card: a little hop for a right answer, a gentle nod for a
     hint; nothing for a wrong answer (calm). Not for older students, and off for reduced motion. */
  body:not([data-stage="middle"]):not([data-stage="secondary"]) .mini-tutor[data-mood="correct"] { animation: hop .6s ease-out; }
  body:not([data-stage="middle"]):not([data-stage="secondary"]) .mini-tutor[data-mood="hint"] { animation: nod .6s ease-out; }
  @keyframes hop { 0%, 100% { transform: none; } 40% { transform: translateY(-6px) scale(1.08); } }
  @keyframes nod { 0%, 100% { transform: none; } 50% { transform: rotate(-8deg); } }
  .subject-card, .stop button { transition: transform .12s ease-out; }
  .subject-card:active, .stop button:active { transform: scale(.97); }
}
