/* ===========================================================================
   engine.css - MCC201A Interactive Learning System
   All visual styling: design tokens, typography, layout, components, dark mode,
   and the formula-sheet print stylesheet. No shadows, no gradients, no glows.
   Calm interface; the math is the hard part.

   Fonts (Lora, Inter) load from Google Fonts via a <link> in each HTML file.
   If offline, the browser falls back to the system serif / sans stacks below -
   slightly less pretty, fully readable. Math fonts are local (katex.min.css).
   =========================================================================== */

/* --- 1. Design tokens ---------------------------------------------------- */

:root {
  /* Palette - light mode: warm paper, deep ink */
  --bg:          #FAF7F2;
  --bg-sunk:     #F3EEE5;   /* faint inset panels (playground, code) */
  --ink:         #2A2620;
  --muted:       #6B6358;
  --border-3:    rgba(42, 38, 32, 0.12);   /* tertiary - hairlines */
  --border-2:    rgba(42, 38, 32, 0.22);   /* secondary - inputs, cards */
  --accent:      #C9A86B;                  /* the 2px featured accent only */

  /* Story-card variants - light */
  --story-bg:    #E8F1ED;  --story-ink:   #1F4A3A;  --story-bd:   #7AA89A;
  --whycare-bg:  #EDE9F2;  --whycare-ink: #3A2F52;  --whycare-bd: #9586B0;
  --insight-bg:  #F5EBD8;  --insight-ink: #5C4318;  --insight-bd: #C9A86B;
  --warning-bg:  #F2E2DC;  --warning-ink: #5C2818;  --warning-bd: #C97A5C;

  /* Quiz feedback - light */
  --correct-bg:  #E4EFE4;  --correct-ink: #234A23;  --correct-bd: #74A074;
  --wrong-bg:    #F2E2DC;  --wrong-ink:   #5C2818;  --wrong-bd:   #C97A5C;

  /* Typography */
  --font-body: 'Lora', Georgia, 'Times New Roman', serif;
  --font-ui:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Rhythm */
  --radius-s: 8px;
  --radius-l: 12px;
  --wrap-chapter: 720px;
  --wrap-dash: 960px;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Palette - dark mode: warm charcoal, soft off-white. Re-tuned, not inverted. */
    --bg:        #1F1C18;
    --bg-sunk:   #272320;
    --ink:       #E8E3DA;
    --muted:     #9B948A;
    --border-3:  rgba(232, 227, 218, 0.13);
    --border-2:  rgba(232, 227, 218, 0.24);
    --accent:    #C9A86B;

    --story-bg:   #1B2C26;  --story-ink:   #A9D2C4;  --story-bd:   #3F6356;
    --whycare-bg: #272233;  --whycare-ink: #C7BBDD;  --whycare-bd: #5A4E73;
    --insight-bg: #322B1A;  --insight-ink: #D9BE88;  --insight-bd: #6E5C38;
    --warning-bg: #33231D;  --warning-ink: #E0A98F;  --warning-bd: #7A4E3C;

    --correct-bg: #1F2E1F;  --correct-ink: #A6CCA6;  --correct-bd: #3F623F;
    --wrong-bg:   #33231D;  --wrong-ink:   #E0A98F;  --wrong-bd:   #7A4E3C;
  }
}

/* --- 2. Reset & base ---------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-weight: 500; line-height: 1.3; color: var(--ink); }

p { margin: 0 0 1rem; }

a { color: var(--ink); text-decoration-color: var(--border-2); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--ink); }

strong { font-weight: 500; }
em { font-style: italic; }

ul, ol { margin: 0 0 1rem; padding-left: 1.4rem; }
li { margin: 0.35rem 0; }

button { font-family: var(--font-ui); cursor: pointer; }

::selection { background: rgba(201, 168, 107, 0.28); }

/* KaTeX math inherits body text colour - works in light and dark automatically. */
.katex { color: currentColor; font-size: 1.04em; }
.katex-display { margin: 1.1rem 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }

/* --- 3. Utilities ------------------------------------------------------- */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.is-hidden { display: none !important; }

/* --- 4. Chapter shell & header ----------------------------------------- */

.chapter-shell {
  max-width: var(--wrap-chapter);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.chapter-header { margin-bottom: 2rem; }

.chapter-meta {
  display: flex; align-items: center; gap: 0.75rem;
  font-family: var(--font-ui); font-size: 13px;
  margin-bottom: 1.1rem;
}
.back-link { color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--ink); }
.module-label {
  color: var(--muted);
  border-left: 0.5px solid var(--border-2);
  padding-left: 0.75rem;
}

.chapter-title { font-size: 1.95rem; margin: 0 0 0.6rem; }

.chapter-subhead {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem;
  font-family: var(--font-ui); font-size: 13px; color: var(--muted);
  margin-bottom: 1.4rem;
}
.co-badges { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; }
.co-badge {
  font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
  padding: 2px 7px; border-radius: 999px;
  border: 0.5px solid var(--border-2); color: var(--muted);
}
.co-badge.is-primary { border-color: var(--accent); color: var(--ink); }

/* Progress bar - a quiet open loop, not a scoreboard */
.progress-bar {
  display: flex; gap: 6px; align-items: center;
}
.progress-dot {
  height: 6px; flex: 1; border-radius: 999px;
  background: var(--border-3);
  transition: background 180ms ease;
}
.progress-dot.is-viewed { background: var(--border-2); }
.progress-dot.is-current { background: var(--accent); }

/* --- 5. Steps ----------------------------------------------------------- */

.lesson { min-height: 40vh; }

.step { display: none; }
.step.is-active { display: block; animation: step-in 180ms ease; }

@keyframes step-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step-title {
  font-size: 1.4rem;
  margin: 0 0 1.2rem;
  padding-bottom: 0.6rem;
  border-bottom: 0.5px solid var(--border-3);
}
.step-kicker {
  font-family: var(--font-ui); font-size: 12px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); display: block; margin-bottom: 0.3rem;
}

/* --- 6. Navigation ------------------------------------------------------ */

.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-top: 2.5rem;
  padding-top: 1.5rem; border-top: 0.5px solid var(--border-3);
}
.nav-btn {
  font-family: var(--font-ui); font-size: 14px; font-weight: 500;
  padding: 0.6rem 1.1rem; border-radius: var(--radius-s);
  border: 0.5px solid var(--border-2); background: var(--bg);
  color: var(--ink); transition: border-color 160ms ease, background 160ms ease;
}
.nav-btn:hover:not(:disabled) { border-color: var(--ink); }
.nav-btn:disabled { opacity: 0.35; cursor: default; }
.nav-next { border-color: var(--accent); border-width: 2px; }
.nav-next:hover:not(:disabled) { background: var(--bg-sunk); }
.nav-status {
  font-family: var(--font-ui); font-size: 13px; color: var(--muted);
  white-space: nowrap;
}

/* --- 7. Story cards ----------------------------------------------------- */

.story-card {
  border: 0.5px solid var(--border-2);
  border-left-width: 2px;
  border-radius: var(--radius-l);
  padding: 1.1rem 1.3rem;
  margin: 1.5rem 0;
}
.story-card > :last-child { margin-bottom: 0; }
.story-card .card-tag {
  display: block;
  font-family: var(--font-ui); font-size: 11px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.story-card[data-variant="story"]    { background: var(--story-bg);   border-color: var(--story-bd);   color: var(--story-ink); }
.story-card[data-variant="why-care"] { background: var(--whycare-bg); border-color: var(--whycare-bd); color: var(--whycare-ink); }
.story-card[data-variant="insight"]  { background: var(--insight-bg); border-color: var(--insight-bd); color: var(--insight-ink); }
.story-card[data-variant="warning"]  { background: var(--warning-bg); border-color: var(--warning-bd); color: var(--warning-ink); }
.story-card .card-tag { color: inherit; opacity: 0.8; }
.story-card strong { color: inherit; }

/* --- 8. Formula block --------------------------------------------------- */

.formula-block {
  background: var(--bg-sunk);
  border: 0.5px solid var(--border-3);
  border-radius: var(--radius-l);
  padding: 1.2rem 1.4rem;
  margin: 1.5rem 0;
  text-align: center;
}
.formula-block .formula-label {
  font-family: var(--font-ui); font-size: 12px; color: var(--muted);
  margin-bottom: 0.4rem;
}
.formula-block .katex-display { margin: 0.3rem 0; }

/* --- 9. Reveal blocks --------------------------------------------------- */

.reveal-block, .reveal-block-scaffolded {
  border: 0.5px solid var(--border-2);
  border-radius: var(--radius-l);
  padding: 1.1rem 1.3rem;
  margin: 1.5rem 0;
}
.reveal-prompt { margin-bottom: 0.9rem; }
.reveal-prompt > :last-child { margin-bottom: 0; }

.reveal-btn {
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  padding: 0.5rem 0.95rem; border-radius: var(--radius-s);
  border: 0.5px solid var(--border-2); background: var(--bg);
  color: var(--ink); transition: border-color 160ms ease;
}
.reveal-btn:hover { border-color: var(--ink); }
.reveal-btn.is-spent { display: none; }

.reveal-content {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 0.5px solid var(--border-3);
  animation: step-in 180ms ease;
}
.reveal-content > :last-child { margin-bottom: 0; }
.reveal-content.is-hidden { display: none; }

/* Scaffolded reveal: a sequence of nested sub-steps */
.reveal-block-scaffolded > .reveal-prompt { margin-bottom: 1.1rem; }
.reveal-step {
  border: 0.5px solid var(--border-3);
  border-radius: var(--radius-s);
  padding: 0.9rem 1rem;
  margin-top: 0.8rem;
  background: var(--bg-sunk);
}
.reveal-substep-prompt { margin-bottom: 0.7rem; font-size: 0.97em; }
.reveal-substep-prompt > :last-child { margin-bottom: 0; }
.reveal-step .reveal-content { border-top-color: var(--border-2); }

/* --- 10. Quiz blocks ---------------------------------------------------- */

.quiz-block {
  border: 0.5px solid var(--border-2);
  border-radius: var(--radius-l);
  padding: 1.1rem 1.3rem;
  margin: 1.5rem 0;
}
.quiz-tag {
  display: block;
  font-family: var(--font-ui); font-size: 11px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 0.5rem;
}
.quiz-q { margin-bottom: 1rem; }
.quiz-q > :last-child { margin-bottom: 0; }

.quiz-options { display: flex; flex-direction: column; gap: 0.5rem; }
.quiz-opt {
  text-align: left; font-family: var(--font-body); font-size: 16px;
  line-height: 1.5; color: var(--ink);
  padding: 0.7rem 0.95rem; border-radius: var(--radius-s);
  border: 0.5px solid var(--border-2); background: var(--bg);
  transition: border-color 160ms ease, background 160ms ease;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--ink); }
.quiz-opt:disabled { cursor: default; }

/* Answered state: lock all, mark the chosen option and the correct one */
.quiz-block.is-answered .quiz-opt { opacity: 0.55; }
.quiz-block.is-answered .quiz-opt.is-correct-opt {
  opacity: 1; background: var(--correct-bg);
  border-color: var(--correct-bd); color: var(--correct-ink);
}
.quiz-block.is-answered .quiz-opt.is-chosen:not(.is-correct-opt) {
  opacity: 1; background: var(--wrong-bg);
  border-color: var(--wrong-bd); color: var(--wrong-ink);
}
.quiz-opt .opt-mark {
  font-family: var(--font-ui); font-size: 12px; font-weight: 500;
  float: right; margin-left: 0.6rem; opacity: 0; white-space: nowrap;
}
.quiz-block.is-answered .quiz-opt.is-correct-opt .opt-mark,
.quiz-block.is-answered .quiz-opt.is-chosen:not(.is-correct-opt) .opt-mark { opacity: 1; }

.quiz-feedback {
  margin-top: 0.95rem; padding: 0.8rem 1rem;
  border-radius: var(--radius-s);
  border: 0.5px solid var(--border-2);
  font-size: 0.97em;
  animation: step-in 180ms ease;
}
.quiz-feedback > :last-child { margin-bottom: 0; }
.quiz-feedback.is-correct { background: var(--correct-bg); border-color: var(--correct-bd); color: var(--correct-ink); }
.quiz-feedback.is-wrong   { background: var(--wrong-bg);   border-color: var(--wrong-bd);   color: var(--wrong-ink); }
.quiz-feedback .fb-label {
  font-family: var(--font-ui); font-size: 11px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  display: block; margin-bottom: 0.3rem; opacity: 0.85;
}

/* --- 11. Playground ----------------------------------------------------- */

.playground {
  background: var(--bg-sunk);
  border: 0.5px solid var(--border-2);
  border-radius: var(--radius-l);
  padding: 1.2rem 1.3rem;
  margin: 1.5rem 0;
}
.playground-title {
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 0.9rem;
}
.playground-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
  font-family: var(--font-ui); font-size: 14px;
  margin-bottom: 1rem;
}
.playground-controls label { color: var(--muted); }
.playground select, .playground input {
  font-family: var(--font-ui); font-size: 14px;
  color: var(--ink); background: var(--bg);
  border: 0.5px solid var(--border-2); border-radius: var(--radius-s);
  padding: 0.45rem 0.6rem; max-width: 100%;
}
.playground-output { margin: 0.4rem 0; }
.playground-verdict {
  margin-top: 0.9rem; padding: 0.7rem 1rem;
  border-radius: var(--radius-s); border: 0.5px solid var(--border-2);
  font-family: var(--font-ui); font-size: 14px;
}
.playground-verdict.is-yes { background: var(--correct-bg); border-color: var(--correct-bd); color: var(--correct-ink); }
.playground-verdict.is-no  { background: var(--wrong-bg);   border-color: var(--wrong-bd);   color: var(--wrong-ink); }
.playground-verdict.is-mixed { background: var(--insight-bg); border-color: var(--insight-bd); color: var(--insight-ink); }

/* Derivative table used by the CR-checker playground */
.cr-table { width: 100%; border-collapse: collapse; font-size: 0.95em; }
.cr-table th, .cr-table td {
  text-align: left; padding: 0.45rem 0.6rem;
  border-bottom: 0.5px solid var(--border-3);
}
.cr-table th {
  font-family: var(--font-ui); font-size: 12px; font-weight: 500;
  color: var(--muted);
}
.cr-table .rule-pass { color: var(--correct-ink); }
.cr-table .rule-fail { color: var(--wrong-ink); }
.cr-table-wrap { overflow-x: auto; }

/* --- 12. Summary list --------------------------------------------------- */

.summary-list {
  list-style: none; padding: 0; margin: 1.5rem 0; counter-reset: sum;
}
.summary-list li {
  position: relative; padding: 0.6rem 0 0.6rem 2.2rem;
  border-bottom: 0.5px solid var(--border-3); counter-increment: sum;
}
.summary-list li:last-child { border-bottom: 0; }
.summary-list li::before {
  content: counter(sum);
  position: absolute; left: 0; top: 0.6rem;
  font-family: var(--font-ui); font-size: 12px; font-weight: 500;
  width: 1.5rem; height: 1.5rem; line-height: 1.5rem; text-align: center;
  border-radius: 999px; border: 0.5px solid var(--border-2); color: var(--muted);
}

/* --- 13. Dashboard ------------------------------------------------------ */

.dashboard { max-width: var(--wrap-dash); margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }

.dash-top {
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 1rem;
}
.dash-title { font-size: 1.8rem; margin: 0 0 0.3rem; }
.dash-sub { font-family: var(--font-ui); font-size: 14px; color: var(--muted); }
.formula-link {
  font-family: var(--font-ui); font-size: 14px; font-weight: 500;
  text-decoration: none; color: var(--ink);
  border-bottom: 0.5px solid var(--accent); padding-bottom: 2px;
}

.dash-metrics {
  font-family: var(--font-ui); font-size: 14px; color: var(--muted);
  margin: 1.4rem 0 0;
}
.dash-firstrun {
  font-family: var(--font-ui); font-size: 14px; color: var(--muted);
  margin: 1.4rem 0 0;
}

.continue-cta {
  display: block; margin: 1.4rem 0 0; padding: 0.9rem 1.1rem;
  border: 2px solid var(--accent); border-radius: var(--radius-l);
  font-family: var(--font-ui); font-size: 14px; font-weight: 500;
  text-decoration: none; color: var(--ink);
}
.continue-cta .cta-sub { display: block; color: var(--muted); font-weight: 400; font-size: 13px; margin-top: 2px; }

/* Chapter grid */
.chapter-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem; margin: 1.8rem 0;
}
.chapter-card {
  display: block; text-decoration: none; color: var(--ink);
  border: 0.5px solid var(--border-2); border-radius: var(--radius-l);
  padding: 1.1rem 1.2rem;
  transition: border-color 160ms ease;
}
.chapter-card:hover { border-color: var(--ink); }
.chapter-card.is-current { border-left: 2px solid var(--accent); }
.chapter-card.is-complete { opacity: 0.72; }
.chapter-card.is-coming {
  cursor: default; opacity: 0.55;
}
.chapter-card.is-coming:hover { border-color: var(--border-2); }

.card-num {
  font-family: var(--font-ui); font-size: 12px; font-weight: 500;
  color: var(--muted); letter-spacing: 0.04em;
}
.card-title { font-size: 1.12rem; margin: 0.25rem 0 0.4rem; }
.card-teaser { font-size: 0.95rem; color: var(--muted); margin: 0 0 0.8rem; }
.card-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.6rem; flex-wrap: wrap;
}
.card-status { font-family: var(--font-ui); font-size: 12px; color: var(--muted); }
.card-status.is-done { color: var(--story-ink); }
.card-cos { display: inline-flex; gap: 0.3rem; }

/* Activity heat-map */
.heatmap-section { margin: 2.4rem 0 0; }
.heatmap-label {
  font-family: var(--font-ui); font-size: 12px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 0.7rem;
}
.heatmap {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr);
  gap: 4px; width: max-content; max-width: 100%;
}
.heatmap-day {
  width: 14px; height: 14px; border-radius: 3px;
  background: var(--border-3);
}
.heatmap-day[data-level="1"] { background: rgba(201, 168, 107, 0.35); }
.heatmap-day[data-level="2"] { background: rgba(201, 168, 107, 0.6); }
.heatmap-day[data-level="3"] { background: rgba(201, 168, 107, 0.9); }
.heatmap-legend {
  font-family: var(--font-ui); font-size: 12px; color: var(--muted);
  margin-top: 0.6rem;
}

.dash-footer {
  font-family: var(--font-ui); font-size: 13px; color: var(--muted);
  margin-top: 2.6rem; padding-top: 1.2rem;
  border-top: 0.5px solid var(--border-3);
}

/* --- 14. Formula sheet -------------------------------------------------- */

.formula-sheet { max-width: var(--wrap-chapter); margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }
.fs-title { font-size: 1.6rem; margin: 0 0 0.3rem; }
.fs-sub { font-family: var(--font-ui); font-size: 14px; color: var(--muted); margin-bottom: 1.8rem; }
.fs-back {
  font-family: var(--font-ui); font-size: 13px; color: var(--muted);
  text-decoration: none; display: inline-block; margin-bottom: 1.2rem;
}
.fs-back:hover { color: var(--ink); }

.formula-row {
  border: 0.5px solid var(--border-3);
  border-radius: var(--radius-l);
  padding: 1rem 1.2rem; margin-bottom: 0.9rem;
}
.formula-row .fr-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 0.8rem; margin-bottom: 0.6rem;
}
.formula-row .fr-title {
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  color: var(--ink);
}
.formula-row .fr-list { margin: 0; padding-left: 1.2rem; font-size: 0.97em; }
.formula-row .fr-list li { margin: 0.3rem 0; }

.formula-row.is-locked .fr-body { display: none; }
.formula-row.is-locked { opacity: 0.4; }
.formula-row.is-locked.is-revealed { opacity: 1; }
.formula-row.is-locked.is-revealed .fr-body { display: block; }

.fr-lock-note {
  font-family: var(--font-ui); font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 0.7rem;
}
.formula-row:not(.is-locked) .fr-lock-note,
.formula-row.is-revealed .fr-lock-note { display: none; }
.show-anyway {
  font-family: var(--font-ui); font-size: 12px;
  background: none; border: 0.5px solid var(--border-2);
  border-radius: var(--radius-s); padding: 0.25rem 0.6rem; color: var(--ink);
}
.show-anyway:hover { border-color: var(--ink); }

/* --- 15. Print: formula sheet on A4 ------------------------------------ */

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body { background: #fff; color: #000; font-size: 10pt; line-height: 1.4; }
  .katex { font-size: 9pt; }
  .fs-back, .show-anyway, .fs-sub, .nav, .dash-footer { display: none !important; }
  .formula-sheet { max-width: none; padding: 0; }
  .fs-title { font-size: 14pt; margin-bottom: 8pt; }
  .formula-row {
    border: 0.5px solid #999; border-radius: 4px;
    padding: 6pt 9pt; margin-bottom: 6pt;
    break-inside: avoid;
  }
  .formula-row .fr-list li { margin: 2pt 0; }
  /* Locked rows the student has not chosen to reveal are omitted from print. */
  .formula-row.is-locked:not(.is-revealed) { display: none !important; }
  .formula-row.is-locked.is-revealed { opacity: 1; }
  .fr-lock-note { display: none !important; }
}

/* --- 16. Responsive: single column on narrow screens ------------------- */

@media (max-width: 640px) {
  body { font-size: 16px; }
  .chapter-shell, .dashboard, .formula-sheet { padding-left: 1rem; padding-right: 1rem; }
  .chapter-title { font-size: 1.6rem; }
  .chapter-grid { grid-template-columns: 1fr; }
  .dash-top { flex-direction: column; }
  .nav { flex-wrap: wrap; }
  .nav-status { order: -1; width: 100%; text-align: center; }
}
