/* Lesson, mathematics and assessment presentation. */
.math { font-family: var(--font-math); font-size: 1.08em; letter-spacing: .01em; }
/* Short expressions stay on one line; long ones may break at operator spaces on narrow screens. */
.math:not(:has(.frac)) { white-space: normal; }
.math-block { display: block; font-family: var(--font-math); font-size: 1.25rem; text-align: center; padding: var(--s3) var(--s4); background: var(--math-bg); border-radius: var(--radius-sm); overflow-x: auto; white-space: nowrap; }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 .15em; font-size: .95em; line-height: 1.15; }
.frac > span:first-child { border-bottom: 1.5px solid currentColor; padding: 0 .2em .08em; }
.frac > span:last-child { padding: .08em .2em 0; }

/* Lesson layout */
.lesson { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: var(--s8); align-items: start; }
.outline { position: sticky; top: var(--s6); display: grid; gap: var(--s3); }
.outline-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1px; max-height: calc(100dvh - 14rem); overflow-y: auto; }
.outline-list a { display: grid; grid-template-columns: 1.4rem 1fr; gap: var(--s2); align-items: start; padding: .45rem var(--s2); border-radius: var(--radius-sm); color: var(--ink-soft); text-decoration: none; font-size: var(--text-sm); line-height: 1.35; }
.outline-list a:hover { background: var(--surface-2); }
.outline-list a[aria-current="step"] { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.outline-stage { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: var(--s3) var(--s2) var(--s1); }
.check { width: 1.15rem; height: 1.15rem; border-radius: 50%; border: 1.5px solid var(--line-strong); display: inline-grid; place-items: center; margin-top: .1rem; }
.check[data-done="true"] { background: var(--good); border-color: var(--good); color: var(--surface); }
.check svg { width: .75rem; height: .75rem; }
.outline-mobile { display: none; }
.reading { max-width: var(--reading); min-width: 0; }
.section-head { margin-bottom: var(--s6); display: grid; gap: var(--s2); }
.section-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); font-size: 1.04rem; }
.section-body > * { min-width: 0; }
.section-body > .p { line-height: 1.7; }
.section-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3); margin-top: var(--s8); padding-top: var(--s5); border-top: 1px solid var(--line); }
.section-foot .btn-primary { margin-left: auto; }
@media (max-width: 1099px) {
  .lesson { grid-template-columns: minmax(0, 1fr); }
  .outline { display: none; }
  .outline-mobile { display: block; margin-bottom: var(--s5); }
  .outline-mobile summary { cursor: pointer; min-height: var(--touch); display: flex; align-items: center; justify-content: space-between; gap: var(--s3); font-weight: 650; }
  .outline-mobile .outline-list { max-height: 50vh; margin-top: var(--s2); }
}
@media (max-width: 599px) { .section-foot .btn { flex: 1 1 auto; } }

/* Teaching blocks */
.definition { border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; padding: var(--s4) var(--s5); box-shadow: var(--shadow-1); }
.definition dt { font-weight: 720; margin-bottom: var(--s1); }
.rule { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: var(--s4) var(--s5); }
.rule h3 { font-size: var(--text-md); margin-bottom: var(--s2); color: var(--primary); }
.procedure ol, .steps-block { counter-reset: step; list-style: none; padding: 0; display: grid; gap: var(--s3); }
.procedure li, .steps-block li { position: relative; padding-left: 2.4rem; }
.procedure li::before, .steps-block li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 1.7rem; height: 1.7rem; display: grid; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 750; font-size: var(--text-sm); }
.common-error { display: grid; gap: var(--s2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); background: var(--surface); }
.common-error .wrong { color: var(--bad); }
.common-error .right { color: var(--good); }
.common-error .tag { font-weight: 750; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .06em; margin-right: var(--s2); }
.terms { display: flex; flex-wrap: wrap; gap: var(--s2); }
.term { padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: var(--text-sm); }
.objectives { list-style: none; padding: 0; display: grid; gap: var(--s2); }
.objectives li { display: grid; grid-template-columns: auto 1fr; gap: var(--s3); align-items: baseline; }
.figure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); }
.figure figcaption { font-size: var(--text-sm); color: var(--muted); margin-top: var(--s2); }
.numberline { width: 100%; height: auto; color: var(--ink); }
.sets { display: grid; gap: var(--s2); }
.set-box { border: 2px solid var(--line-strong); border-radius: var(--radius); padding: var(--s3); display: grid; gap: var(--s2); }
.set-box > .set-name { font-weight: 700; font-size: var(--text-sm); }
.set-box .set-eg { font-family: var(--font-math); color: var(--muted); font-size: var(--text-sm); }
.set-real { border-color: var(--primary); }
.set-split { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s2); }
@media (max-width: 599px) { .set-split { grid-template-columns: 1fr; } }
.set-rational { border-color: var(--accent); }
.set-irrational { border-color: var(--warn); border-style: dashed; }
.demo { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.demo summary { padding: var(--s4) var(--s5); cursor: pointer; font-weight: 680; min-height: var(--touch); }
.demo ol { padding: 0 var(--s5) var(--s5) 2.6rem; display: grid; gap: var(--s2); }

/* Worked example */
.example { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-1); }
.example-head { padding: var(--s4) var(--s5); background: var(--surface-2); border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: center; justify-content: space-between; }
.example-body { padding: var(--s5); display: grid; gap: var(--s4); }
.example-problem { font-size: 1.06rem; }
.example-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s3); counter-reset: step; }
.example-steps li { display: grid; grid-template-columns: 2rem 1fr; gap: var(--s3); padding: var(--s3); border-radius: var(--radius-sm); background: var(--bg-elevated); border: 1px solid var(--line); }
.example-steps li::before { counter-increment: step; content: counter(step); width: 1.8rem; height: 1.8rem; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 750; font-size: var(--text-sm); }
.step-math { display: block; margin-top: var(--s1); font-family: var(--font-math); font-size: 1.15rem; overflow-x: auto; }
.example-result { padding: var(--s3) var(--s4); border-radius: var(--radius-sm); background: var(--good-soft); border: 1px solid color-mix(in srgb, var(--good) 30%, transparent); }
.example-result strong:first-child { color: var(--good); }
.example-check { font-size: var(--text-sm); color: var(--muted); }

/* Exercises and questions */
.exercise { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: var(--s5); display: grid; gap: var(--s4); box-shadow: var(--shadow-1); }
.exercise[data-state="solved"] { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.exercise-head { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; justify-content: space-between; }
.prompt { font-size: 1.08rem; line-height: 1.6; }
.prompt .math { font-size: 1.2em; }
.choices { display: grid; gap: var(--s2); border: 0; padding: 0; margin: 0; min-width: 0; }
.choice {
  display: flex; align-items: center; gap: var(--s3); min-height: 3rem; padding: var(--s2) var(--s4);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer;
  transition: border-color var(--dur), background var(--dur);
}
.choice:hover { border-color: var(--primary); }
.choice input { width: 1.15rem; height: 1.15rem; flex: none; accent-color: var(--primary); margin: 0; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice .choice-letter { font-weight: 750; color: var(--muted); width: 1.2rem; }
.choice .choice-text { font-family: var(--font-math); font-size: 1.1rem; }
.choice .choice-text.text { font-family: var(--font-ui); font-size: 1rem; }
.choice[data-result="correct"], .choice[data-result="correct"]:has(input:checked) { border-color: var(--good); background: var(--good-soft); }
.choice[data-result="wrong"], .choice[data-result="wrong"]:has(input:checked) { border-color: var(--bad); background: var(--bad-soft); }
.choice[aria-disabled="true"] { cursor: default; }
.feedback { border-radius: var(--radius); padding: var(--s4); display: grid; gap: var(--s3); }
.feedback[data-tone="good"] { background: var(--good-soft); border: 1px solid color-mix(in srgb, var(--good) 35%, transparent); }
.feedback[data-tone="bad"] { background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.feedback-title { font-weight: 750; }
.feedback[data-tone="good"] .feedback-title { color: var(--good); }
.feedback[data-tone="bad"] .feedback-title { color: var(--bad); }
.hints { display: grid; gap: var(--s2); }
.hint { padding: var(--s3) var(--s4); background: var(--warn-soft); border-radius: var(--radius-sm); font-size: var(--text-sm); }
.solution { border-top: 1px dashed var(--line-strong); padding-top: var(--s3); }
.solution summary { cursor: pointer; font-weight: 650; min-height: var(--touch); display: flex; align-items: center; }
.solution ol { padding-left: 1.3rem; display: grid; gap: var(--s2); }

/* Session (quiz) */
.session { max-width: 48rem; margin: 0 auto; display: grid; gap: var(--s5); }
.session-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); }
.timer { font-variant-numeric: tabular-nums; font-weight: 750; padding: .25rem .7rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.timer[data-warn="true"] { background: var(--bad-soft); color: var(--bad); }
.navigator { display: flex; flex-wrap: wrap; gap: var(--s1); }
.navigator button { width: 2.4rem; height: 2.4rem; border-radius: .45rem; border: 1px solid var(--line-strong); background: var(--surface); font-size: var(--text-sm); font-weight: 650; }
.navigator button[data-answered="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.navigator button[data-result="correct"] { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.navigator button[data-result="wrong"] { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.navigator button[aria-current="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.session-actions { display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: space-between; }

/* Results */
.score { display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap; }
.score-ring { --p: 0; width: 7rem; height: 7rem; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--ring, var(--accent)) calc(var(--p) * 1%), var(--surface-3) 0); flex: none; }
.score-ring > span { width: 5.6rem; height: 5.6rem; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: var(--text-2xl); font-weight: 800; font-variant-numeric: tabular-nums; }
.result-item { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); background: var(--surface); display: grid; gap: var(--s3); }
.result-item[data-correct="false"] { border-left: 4px solid var(--bad); }
.result-item[data-correct="true"] { border-left: 4px solid var(--good); }
.answer-line { display: grid; grid-template-columns: auto 1fr; gap: var(--s1) var(--s3); font-size: var(--text-sm); }

/* Course roadmap */
.unit { display: grid; gap: var(--s4); }
.unit-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2); padding-bottom: var(--s2); border-bottom: 1px solid var(--line); }
.lesson-card { display: grid; gap: var(--s3); position: relative; }
.lesson-num { font-family: var(--font-math); font-size: var(--text-xl); font-weight: 700; color: var(--accent); line-height: 1; }
.lesson-card[data-state="pending-content"] .lesson-num { color: var(--pending); }
.lesson-card[data-state="pending-content"] { background: var(--bg-elevated); box-shadow: none; }
.lesson-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s2) var(--s3); }
.lesson-card details summary { cursor: pointer; font-size: var(--text-sm); color: var(--muted); min-height: 32px; display: flex; align-items: center; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s2); align-items: end; height: 7rem; }
.bars > div { display: grid; gap: var(--s1); justify-items: center; align-content: end; height: 100%; font-size: var(--text-xs); color: var(--muted); }
.bars > div > span:first-child { width: 100%; max-width: 2.2rem; border-radius: .35rem .35rem 0 0; background: var(--accent); min-height: 2px; }
.notes textarea { min-height: 9rem; }

/* ── Phase 2 · mathematical input, visualizations, recovery, lab ───────────── */
.math-inline, .math-display { max-width: 100%; }
.math-display { display: block; overflow-x: auto; overflow-y: hidden; padding: var(--s1) 0; }
.math-fallback { font-family: var(--font-math); white-space: pre-wrap; overflow-wrap: anywhere; }
.katex { font-size: 1.08em; }
.katex-display { margin: 0; overflow-x: auto; overflow-y: hidden; }
.prompt .katex, .choice .katex { white-space: nowrap; }

.mathfield { display: grid; gap: var(--s2); min-width: 0; }
.mf-label { font-size: var(--text-sm); font-weight: 650; color: var(--ink-soft); }
.mf-row { display: flex; gap: var(--s2); align-items: stretch; flex-wrap: wrap; }
.mf-input { flex: 1 1 10rem; min-width: 0; min-height: 44px; font-family: var(--font-math); font-size: 1.15rem; }
.mf-kbd-toggle { min-width: 44px; min-height: 44px; font-size: 1.2rem; }
.mf-submit { min-height: 44px; }
.mf-preview { min-height: 2.2rem; padding: var(--s2) var(--s3); background: var(--math-bg); border-radius: var(--radius-sm); font-size: var(--text-sm); overflow-x: auto; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.mf-preview .mf-state { color: var(--muted); }
.mf-preview[data-state="invalid"], .mf-preview [data-state="invalid"] { color: var(--warn); }
.mathkbd { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s1); padding: var(--s2); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.mathkbd[hidden] { display: none; }
.kbd-key { min-height: 44px; min-width: 44px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--radius-sm); font-family: var(--font-math); font-size: 1.05rem; cursor: pointer; }
.kbd-key:hover { background: var(--primary-soft); }
.kbd-key:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.kbd-nav { background: var(--surface-3); font-family: var(--font-ui); }

.explorer { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: var(--s4); display: grid; gap: var(--s3); min-width: 0; }
.explorer h3 { font-size: 1rem; }
.ex-body { display: grid; gap: var(--s3); min-width: 0; }
.ex-control { display: grid; gap: var(--s1); font-size: var(--text-sm); }
.ex-control input[type="range"] { width: 100%; min-height: 32px; accent-color: var(--primary); }
.ex-text { font-size: var(--text-sm); }

.graph { width: 100%; max-width: 420px; height: auto; color: var(--ink); display: block; margin-inline: auto; border-radius: var(--radius-sm); }
.graph-legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); font-size: var(--text-sm); margin-top: var(--s2); padding: 0; list-style: none; }
.swatch { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; vertical-align: middle; margin-right: .35rem; }
.graph-table { font-size: var(--text-sm); }

.checkpoint { border: 1px dashed var(--line-strong); border-left: 4px solid var(--info); background: var(--info-soft); border-radius: var(--radius); padding: var(--s4); display: grid; gap: var(--s3); min-width: 0; }
.checkpoint[data-state="solved"] { border-left-color: var(--good); background: var(--good-soft); }
.step-history { margin: 0; padding-left: 1.4rem; display: grid; gap: var(--s2); font-family: var(--font-math); font-size: 1.1rem; overflow-x: auto; }
.error-pattern { border-left: 3px solid var(--warn); padding-left: var(--s3); }
.recovery-steps { margin: 0; padding-left: 1.2rem; display: grid; gap: var(--s2); }
.recovery-skill[data-recovered="true"] { border-color: var(--good); }
.lab-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.lab-fixture code { overflow-wrap: anywhere; font-size: .75rem; }
.answer-line > span { min-width: 0; overflow-x: auto; }
.kbd-key.kbd-word { font-family: var(--font-ui); font-size: .82rem; padding: 0 2px; }
.kbd-key.kbd-wide { grid-column: 1 / -1; font-family: var(--font-ui); font-size: .9rem; }
.kbd-key.kbd-digit { background: var(--surface); font-weight: 600; }
.kbd-key { min-width: 0; }

/* ── Immersive classroom (focus mode) · experience contract V2 ─────────────── */
:root[data-focus="on"] .sidebar, :root[data-focus="on"] .topbar, :root[data-focus="on"] .bottom-nav { display: none !important; }
:root[data-focus="on"] .app { display: block; }
:root[data-focus="on"] .main { margin: 0; padding: 0; }
:root[data-focus="on"] .view { max-width: 44rem; margin-inline: auto; padding: 0 16px; padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
.learn { min-height: 100vh; display: flex; flex-direction: column; }
.learn-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; background: var(--bg); }
.learn-exit, .learn-index > summary { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; list-style: none; }
.learn-index > summary::-webkit-details-marker { display: none; }
.learn-progress { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.learn-progress > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .25s ease; }
.learn-index { position: relative; }
.learn-index-panel { position: absolute; right: 0; top: calc(100% + 6px); width: min(22rem, calc(100vw - 32px)); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: var(--s4); z-index: 10; }
.learn-index-panel ol { display: grid; gap: 2px; }
.learn-index-panel a { display: flex; gap: var(--s2); align-items: center; min-height: 40px; padding: var(--s1) var(--s2); border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-size: var(--text-sm); }
.learn-index-panel a[aria-current] { background: var(--primary-soft); font-weight: 650; }
.learn-stage { flex: 1; padding-top: var(--s4); }
.learn-eyebrow { margin-bottom: var(--s3); }
.learn-card { display: grid; gap: var(--s4); font-size: 1.05rem; min-width: 0; }
.learn-card > .exercise, .learn-card > .example { box-shadow: none; }
.learn-card.enter { animation: learn-in .22s ease-out; }
@keyframes learn-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .learn-card.enter { animation: none; } .learn-progress > span { transition: none; } }
:root[data-motion="reduce"] .learn-card.enter { animation: none; }
.learn-title { font-size: 1.5rem; }
.learn-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: var(--s2); align-items: center; justify-content: flex-end; padding: var(--s3) max(16px, calc((100vw - 44rem) / 2 + 16px)); padding-bottom: calc(var(--s3) + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); border-top: 1px solid var(--line); backdrop-filter: blur(6px); }
.learn-actions .learn-back { margin-right: auto; min-width: 44px; }
.learn-primary { min-height: 48px; min-width: 9rem; justify-content: center; }
.learn-secondary { min-height: 48px; }
/* The main action lives in the bottom bar: hide duplicated inline check buttons. */
.learn-card .mf-submit, .learn-card [data-action="guided-check"], .learn-card [data-action="checkpoint-check"], .learn-card .example .row:last-child { display: none; }
.learn-summary { display: grid; gap: var(--s3); justify-items: center; text-align: center; padding: var(--s6, 2rem) 0; }
.learn-ok { width: 4rem; height: 4rem; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; animation: learn-pop .35s ease-out; }
.learn-ok svg { width: 2rem; height: 2rem; }
@keyframes learn-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .learn-ok { animation: none; } }
:root[data-motion="reduce"] .learn-ok { animation: none; }
.learn-entry { display: flex; gap: var(--s4); align-items: center; justify-content: space-between; flex-wrap: wrap; }
@media (max-width: 420px) { .learn-primary { min-width: 0; flex: 1; } .learn-actions { gap: var(--s1); } }
.manip { width: 100%; max-width: 420px; height: auto; display: block; margin-inline: auto; color: var(--ink); }
.ex-drag { touch-action: none; cursor: grab; }
.ex-drag:active { cursor: grabbing; }
.machine { display: flex; align-items: center; justify-content: center; gap: var(--s2); flex-wrap: wrap; padding: var(--s3) 0; }
.machine-box { border: 2px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); padding: var(--s3) var(--s4); font-size: 1.15rem; }
.machine-io { font-family: var(--font-math); font-size: 1.6rem; font-weight: 700; min-width: 2.5rem; text-align: center; }
.machine-io[data-ok="false"] { color: var(--bad); }
.machine-arrow { font-size: 1.4rem; color: var(--muted); }
.predict { display: grid; gap: var(--s3); }
.predict-options { display: grid; gap: var(--s2); }
.predict-option { min-height: 48px; text-align: left; padding: var(--s3) var(--s4); border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; transition: border-color .15s, background .15s, transform .1s; }
.predict-option:hover { border-color: var(--primary); }
.predict-option:active { transform: scale(.99); }
.predict-option[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.predict-option[data-result="correct"] { border-color: var(--good); background: var(--good-soft); }
.predict-option[data-result="wrong"] { border-color: var(--warn); background: var(--warn-soft); }
.spot { display: grid; gap: var(--s3); }
.demo-steps ol { display: grid; gap: var(--s2); padding-left: 1.3rem; }
@media (prefers-reduced-motion: reduce) { .predict-option { transition: none; } }
.classify-num { font-family: var(--font-math); font-size: 2rem; font-weight: 700; text-align: center; }
.nest { border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm); padding: var(--s2); display: grid; gap: var(--s2); opacity: .55; transition: background .2s, opacity .2s, border-color .2s; min-width: 0; }
.nest > span { font-size: var(--text-sm); font-weight: 650; }
.nest[data-on="true"] { border-style: solid; border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 70%, transparent); opacity: 1; }
.nest-row { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s2); }
@media (max-width: 420px) { .nest-row { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .nest { transition: none; } }
/* the main action never shrinks below its label; secondary actions give way */
.learn-primary { flex: 0 0 auto; white-space: nowrap; }
.learn-secondary { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) { .learn-primary { flex: 1 0 auto; } }
@media (max-width: 360px) { .mathkbd { padding: 4px; gap: 3px; } .checkpoint, .learn-card .exercise { padding-inline: var(--s3); } }

/* Lazy Miggy accompanying moments (official icon asset; never redrawn) */
.mascot { display: flex; align-items: center; gap: var(--s3, .9rem); padding: .75rem 1rem; border-radius: 1rem; background: var(--surface-2); border: 1px solid var(--line); text-align: start; max-width: 36rem; margin-inline: auto; margin-block-end: var(--s3, .9rem); }
.mascot img { width: 3.5rem; height: 3.5rem; border-radius: .9rem; flex: none; animation: learn-pop .35s ease-out; }
.mascot p { margin: 0; font-weight: 600; }
.mascot[data-mood="approved"] { border-color: var(--good); background: var(--good-soft, var(--surface-2)); }
.mascot[data-mood="recovery"] { border-color: var(--info, var(--line)); }
@media (prefers-reduced-motion: reduce) { .mascot img { animation: none; } }
:root[data-motion="reduce"] .mascot img { animation: none; }
