/* ==========================================================================
   Wilderness First Aid — shared design system
   One stylesheet for the landing page, all 14 lessons, and the final exam.
   Light theme, responsive, printable, accessible.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  /* brand */
  --primary: #1B4F8A;
  --primary-strong: #143C69;
  --primary-contrast: #FFFFFF;
  --accent: #2C7BE5;
  --link: #1A5FC2;

  /* neutrals */
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-2: #EEF2F7;
  --surface-3: #E3E9F1;
  --text: #1E293B;
  --text-muted: #5A6B80;
  --text-faint: #8A97A8;
  --border: #D8E0EA;
  --border-strong: #B9C5D3;

  /* semantic */
  --danger: #B42318; --danger-bg: #FEF3F2; --danger-border: #F4B6B0;
  --warning: #B54708; --warning-bg: #FFF7ED; --warning-border: #F7C58C;
  --info: #1D4ED8; --info-bg: #EFF5FF; --info-border: #B6CCF5;
  --success: #157347; --success-bg: #EFFBF3; --success-border: #A9DFBE;

  /* type */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-base: 17px;
  --lh: 1.65;

  /* shape + motion */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 4px 16px rgba(16, 24, 40, 0.08);
  --ease: 160ms ease;

  /* layout */
  --content-w: 780px;
  --site-w: 1160px;
  --toc-w: 240px;
  --nav-h: 56px;
}


/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
@media (max-width: 640px) { :root { --fs-base: 16px; } }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
p { margin: 0 0 1em; }
ul, ol { margin: 0.25em 0 1.1em 1.35em; padding: 0; }
li { margin-bottom: 0.4em; }
li > ul, li > ol { margin-top: 0.4em; margin-bottom: 0.4em; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }
img, svg, video { max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: calc(var(--nav-h) + 16px); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
.skip-link { position: absolute; left: 8px; top: -48px; background: var(--primary); color: var(--primary-contrast); padding: 8px 14px; border-radius: var(--radius-sm); z-index: 1000; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: var(--site-w); margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px;
  background: var(--primary); color: var(--primary-contrast);
  border: 1px solid transparent; border-radius: var(--radius);
  font-weight: 600; font-size: 0.95em; text-decoration: none; cursor: pointer;
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}
.btn:hover { background: var(--primary-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface); color: var(--primary); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 0.875em; }
.btn.lg { min-height: 52px; padding: 14px 26px; font-size: 1.05em; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Site navigation ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 200;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-nav .wrap { display: flex; align-items: center; gap: 16px; min-height: var(--nav-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; color: var(--text); text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand .brand-sub { font-weight: 500; color: var(--text-muted); font-size: 0.85em; }
.site-nav .nav-links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.site-nav .nav-links a { color: var(--text-muted); text-decoration: none; padding: 8px 12px; border-radius: var(--radius-sm); font-weight: 500; font-size: 0.95em; }
.site-nav .nav-links a:hover, .site-nav .nav-links a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.lesson-pos { color: var(--text-muted); font-size: 0.9em; white-space: nowrap; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--text-muted); text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn[aria-disabled="true"] { opacity: 0.35; pointer-events: none; }
@media (max-width: 640px) {
  .brand .brand-sub, .site-nav .nav-links .hide-sm, .lesson .lesson-pos { display: none; }
  .site-nav .wrap { gap: 8px; }
  .brand { min-width: 0; font-size: 0.95em; }
  .brand > span:first-of-type { overflow: hidden; text-overflow: ellipsis; }
  .site-nav .nav-links a { padding: 8px 8px; font-size: 0.9em; }
  .site-nav .nav-links { gap: 0; }
}

/* ---------- Footer ---------- */
.site-footer { margin-top: 64px; border-top: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: 0.9em; }
.site-footer .wrap { padding-top: 32px; padding-bottom: 32px; display: grid; gap: 12px; }
.site-footer a { color: var(--text-muted); }
.site-footer .foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer .foot-disclaimer { max-width: 70ch; }

/* ---------- Generic components ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin: 18px 0; box-shadow: var(--shadow-sm);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card h3, .card h4 { margin-top: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin: 18px 0; }
.card-grid .card { margin: 0; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78em; font-weight: 650; line-height: 1.6; vertical-align: middle; background: var(--surface-3); color: var(--text-muted); }
.badge-red, .tag-red { background: var(--danger-bg); color: var(--danger); }
.badge-green, .tag-green { background: var(--success-bg); color: var(--success); }
.badge-blue, .tag-blue { background: var(--info-bg); color: var(--info); }
.badge-orange, .tag-orange { background: var(--warning-bg); color: var(--warning); }

.alert { position: relative; border: 1px solid; border-left-width: 5px; border-radius: var(--radius); padding: 14px 18px; margin: 20px 0; background: var(--surface-2); border-color: var(--border); }
.alert > :last-child { margin-bottom: 0; }
.alert ul, .alert ol { margin-bottom: 0.4em; }
.alert-title { font-weight: 700; font-size: 0.82em; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.alert-danger { background: var(--danger-bg); border-color: var(--danger-border); border-left-color: var(--danger); }
.alert-danger .alert-title, .alert-danger > strong:first-child { color: var(--danger); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); border-left-color: var(--warning); }
.alert-warning .alert-title, .alert-warning > strong:first-child { color: var(--warning); }
.alert-info { background: var(--info-bg); border-color: var(--info-border); border-left-color: var(--info); }
.alert-info .alert-title, .alert-info > strong:first-child { color: var(--info); }
.alert-success { background: var(--success-bg); border-color: var(--success-border); border-left-color: var(--success); }
.alert-success .alert-title, .alert-success > strong:first-child { color: var(--success); }

.table-wrapper { overflow-x: auto; margin: 18px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table-wrapper table { margin: 0; border: 0; }
table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 0.92em; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
th { background: var(--surface-2); color: var(--text); font-weight: 650; text-align: left; padding: 11px 14px; border-bottom: 2px solid var(--border-strong); }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
@media (max-width: 720px) {
  .lesson-content table:not(.table-wrapper table) { display: block; overflow-x: auto; white-space: normal; }
}

/* ---------- Lesson content components ---------- */
.key-points { background: var(--primary); color: var(--primary-contrast); border-radius: var(--radius-lg); padding: 22px 24px; margin: 28px 0; }
.key-points h3, .key-points h4 { color: inherit; margin: 0 0 12px; font-size: 1.05em; text-transform: uppercase; letter-spacing: 0.06em; }
.key-points ul { margin: 0 0 0 1.2em; }
.key-points li { margin-bottom: 8px; }
.key-points a { color: inherit; }
.key-point { position: relative; padding: 6px 0 6px 28px; }
.key-point::before { content: "✓"; position: absolute; left: 4px; top: 6px; font-weight: 800; }
.key-points .key-point + .key-point { border-top: 1px solid color-mix(in srgb, var(--primary-contrast) 18%, transparent); }

.objective-list, .objectives ul { list-style: none; margin: 0 0 1em; padding: 0; }
.objective-list li, .objectives li { position: relative; padding: 10px 14px 10px 42px; border-radius: var(--radius-sm); background: var(--info-bg); border: 1px solid var(--info-border); margin-bottom: 8px; }
.objective-list li::before, .objectives li::before { content: "✓"; position: absolute; left: 14px; top: 10px; color: var(--info); font-weight: 800; }
.objectives { margin: 18px 0; }
.objectives h4 { margin-bottom: 10px; }

.mnemonic-box { background: var(--info-bg); border: 1px solid var(--info-border); border-radius: var(--radius); padding: 18px 20px; margin: 18px 0; }
.mnemonic-box h4, .mnemonic-box h3 { color: var(--info); margin-bottom: 12px; }
.mnemonic-row, .mnemonic-item { display: flex; gap: 12px; margin-bottom: 8px; align-items: flex-start; }
.mnemonic-letter { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--primary); color: var(--primary-contrast); font-weight: 800; font-size: 1.05em; }
.mnemonic-text { padding-top: 5px; }
.mnemonic-text strong { color: var(--primary); }
.mnemonic-item { padding-top: 0; line-height: 36px; }
.mnemonic-item .mnemonic-letter { line-height: 1; }

.glossary dt, .glossary .term { font-weight: 700; color: var(--primary); margin-top: 14px; }
.glossary dd, .glossary .definition { margin: 2px 0 0 0; color: var(--text); }
.glossary-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.glossary-item:last-child { border-bottom: 0; }
.glossary-item .term { font-weight: 700; color: var(--primary); margin: 0 0 2px; }
.glossary-item .definition { margin: 0; }
.glossary-term { padding: 12px 0; border-bottom: 1px solid var(--border); }
.glossary-term:last-child { border-bottom: 0; }
.glossary-term strong { color: var(--primary); }

/* Scenarios — two markup families exist:
   (a) .scenario-case > .scenario-header + .scenario-body   (card)
   (b) .scenario > .scenario-title + .scenario-case (text)  */
.scenario, .scenario-case { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin: 20px 0; box-shadow: var(--shadow-sm); overflow: hidden; }
.scenario { padding: 20px 22px; }
.scenario .scenario-case { background: var(--surface-2); border: 0; border-left: 4px solid var(--accent); border-radius: var(--radius-sm); padding: 14px 16px; margin: 0 0 14px; box-shadow: none; }
.scenario-title, .scenario-header { font-weight: 700; font-size: 1.05em; }
.scenario-title { color: var(--primary); margin: 0 0 12px; }
.scenario-header { background: var(--primary); color: var(--primary-contrast); padding: 12px 20px; }
.scenario-body { padding: 18px 20px; }
.scenario-body p { margin-bottom: 10px; }
.scenario-body > :last-child { margin-bottom: 0; }

.btn-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px; margin-top: 8px; background: var(--surface); color: var(--primary); border: 1px solid var(--border-strong); border-radius: var(--radius); font-weight: 600; font-size: 0.92em; cursor: pointer; transition: background var(--ease); }
.btn-toggle:hover { background: var(--surface-2); }
.btn-toggle::before { content: "▸"; transition: transform var(--ease); }
.btn-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.discussion { margin-top: 14px; padding: 16px 18px; background: var(--success-bg); border: 1px solid var(--success-border); border-left: 4px solid var(--success); border-radius: var(--radius-sm); }
.discussion > :last-child { margin-bottom: 0; }
.discussion ul, .discussion ol { margin-left: 1.2em !important; }

/* ---------- Lesson page layout ---------- */
.lesson-head { background: var(--surface); border-bottom: 1px solid var(--border); }
.lesson-head .wrap { padding-top: 36px; padding-bottom: 32px; }
.eyebrow { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; color: var(--text-muted); font-size: 0.88em; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; margin-bottom: 12px; }
.eyebrow .dot::before { content: "·"; margin-right: 14px; color: var(--text-faint); }
.lesson-head h1 { font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.5rem); margin-bottom: 10px; max-width: 26ch; }
.lesson-head .lead { font-size: 1.08em; color: var(--text-muted); max-width: 64ch; margin: 0; }
.lesson-head .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

.lesson-body { display: grid; grid-template-columns: var(--toc-w) minmax(0, 1fr); gap: 40px; align-items: start; padding-top: 32px; }
.lesson-toc { position: sticky; top: calc(var(--nav-h) + 16px); }
.lesson-toc .toc-label { font-size: 0.75em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); margin: 0 0 10px 12px; }
.tablist { display: flex; flex-direction: column; gap: 2px; }
.tab {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 12px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); font-weight: 500; font-size: 0.95em; cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--primary); font-weight: 650; border-color: var(--border); box-shadow: var(--shadow-sm); }
.tab .tab-n { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px; border-radius: 999px; font-size: 0.75em; font-weight: 700; background: var(--surface-3); color: var(--text-muted); }
.tab[aria-selected="true"] .tab-n { background: var(--primary); color: var(--primary-contrast); }
.tab.visited .tab-n { background: var(--success-bg); color: var(--success); }
.tab.visited[aria-selected="true"] .tab-n { background: var(--primary); color: var(--primary-contrast); }
.toc-progress { margin: 14px 12px 0; font-size: 0.8em; color: var(--text-faint); }
.toc-progress .bar { height: 4px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.toc-progress .bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 300ms ease; }

.lesson-content { max-width: var(--content-w); min-width: 0; }
.section { display: none; }
.section.active { display: block; animation: fade-in 220ms ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.section > h2:first-child, .section > .section-title:first-child { margin-top: 0; }
.lesson-content h2, .section-title { font-size: 1.65em; margin: 1.4em 0 0.6em; padding-bottom: 0.35em; border-bottom: 1px solid var(--border); color: var(--text); }
.lesson-content h3, .subsection-title { font-size: 1.25em; margin: 1.5em 0 0.5em; color: var(--text); }
.lesson-content h4 { font-size: 1em; margin: 1.3em 0 0.4em; color: var(--primary); text-transform: uppercase; letter-spacing: 0.05em; }
.section-title, .subsection-title { font-weight: 700; line-height: 1.25; }

.section-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); }
.section-nav .btn { flex: 1 1 auto; }
.section-nav .btn.next { justify-content: space-between; }

.lesson-footer-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin-top: 48px; padding: 18px 0; border-top: 1px solid var(--border); }
.lesson-footer-nav .next { justify-self: end; }
.lesson-footer-nav .home { color: var(--text-muted); text-decoration: none; font-weight: 500; }
.lesson-footer-nav .home:hover { color: var(--text); }
@media (max-width: 560px) {
  .lesson-footer-nav { grid-template-columns: 1fr; }
  .lesson-footer-nav .btn { width: 100%; justify-self: stretch; white-space: normal; text-align: center; }
  .lesson-footer-nav .home { text-align: center; order: 3; }
}

/* Tablet / mobile: TOC becomes a sticky horizontal strip under the nav */
@media (max-width: 900px) {
  .lesson-body { display: block; padding-top: 0; }
  .lesson-toc { position: sticky; top: var(--nav-h); z-index: 150; margin: 0 -24px 24px; padding: 8px 24px; background: var(--bg); border-bottom: 1px solid var(--border); }
  .lesson-toc .toc-label { display: none; }
  .tablist { flex-direction: row; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px; scroll-snap-type: x proximity; }
  .tablist::-webkit-scrollbar { display: none; }
  .tab { width: auto; flex: none; white-space: nowrap; padding: 7px 12px; border-radius: 999px; border-color: var(--border); background: var(--surface); scroll-snap-align: start; }
  .tab[aria-selected="true"] { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }
  .tab[aria-selected="true"] .tab-n { background: color-mix(in srgb, var(--primary-contrast) 22%, transparent); color: var(--primary-contrast); }
  .toc-progress { margin: 8px 2px 0; }
  .toc-progress .label { display: none; }
}
@media (max-width: 640px) {
  .lesson-toc { margin: 0 -16px 20px; padding: 8px 16px; }
  .lesson-head .wrap { padding-top: 24px; padding-bottom: 22px; }
}

/* ---------- Quiz ---------- */
.quiz-intro { color: var(--text-muted); }
.quiz-question { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin: 18px 0; box-shadow: var(--shadow-sm); }
.quiz-question .q-text { font-weight: 650; font-size: 1.02em; margin: 0 0 14px; }
.quiz-question .q-text .q-n { color: var(--text-faint); margin-right: 6px; }
.quiz-options { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.quiz-option {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 0.97em; cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
}
.quiz-option .opt-l { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 999px; background: var(--surface-2); font-weight: 700; font-size: 0.8em; color: var(--text-muted); }
.quiz-option:hover:not([disabled]) { border-color: var(--accent); background: var(--info-bg); }
.quiz-option[disabled] { cursor: default; }
.quiz-option.correct { border-color: var(--success); background: var(--success-bg); }
.quiz-option.correct .opt-l { background: var(--success); color: #fff; }
.quiz-option.incorrect { border-color: var(--danger); background: var(--danger-bg); }
.quiz-option.incorrect .opt-l { background: var(--danger); color: #fff; }
.quiz-option[disabled]:not(.correct):not(.incorrect) { opacity: 0.6; }
.explanation { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 0.94em; border-left: 4px solid; }
.explanation.correct-exp { background: var(--success-bg); border-color: var(--success); color: var(--text); }
.explanation.incorrect-exp { background: var(--danger-bg); border-color: var(--danger); color: var(--text); }
.explanation strong { font-weight: 700; }
.score-banner { text-align: center; padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin: 24px 0; box-shadow: var(--shadow-sm); }
.score-banner h3 { font-size: 2em; margin: 0 0 4px; color: var(--primary); }
.score-banner p { color: var(--text-muted); margin: 0; }
.score-banner .actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }

/* ---------- Landing page ---------- */
.hero { position: relative; overflow: hidden; background: linear-gradient(160deg, var(--primary-strong) 0%, var(--primary) 55%, var(--accent) 130%); color: #fff; }
.hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 80% at 85% 20%, rgba(255,255,255,0.12), transparent 60%); pointer-events: none; }
.hero .wrap { position: relative; z-index: 1; padding-top: 64px; padding-bottom: 196px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); gap: 48px; align-items: center; }
.hero .pill { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.25); padding: 4px 14px; border-radius: 4px; font-family: var(--font-pixel); font-size: 1.02em; font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 20px; }
.hero h1 { font-size: clamp(2.2rem, 1.4rem + 3vw, 3.2rem); line-height: 1.08; letter-spacing: -0.02em; margin-bottom: 18px; color: #fff; text-wrap: balance; max-width: 18ch; }
.hero .lead { font-size: 1.15em; opacity: 0.92; max-width: 56ch; margin-bottom: 28px; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero .btn { background: #fff; color: var(--primary-strong); border-color: #fff; }
.hero .btn:hover { background: #EAF1FB; }
.hero .btn.secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,0.55); }
.hero .btn.secondary:hover { background: rgba(255,255,255,0.12); }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hero-stats .stat { background: rgba(9, 24, 44, 0.35); border: 2px solid rgba(255,255,255,0.28); border-radius: 4px; padding: 14px 18px 12px; }
.hero-stats .stat .px { width: 18px; height: 18px; color: #7EE787; margin-bottom: 8px; display: block; }
.hero-stats .stat-num { display: block; font-family: var(--font-pixel); font-size: 2.5em; font-weight: 400; line-height: 0.95; letter-spacing: 0.01em; }
.hero-stats .stat-label { font-family: var(--font-pixel); font-size: 1.0em; opacity: 0.8; letter-spacing: 0.08em; text-transform: uppercase; }
@media (max-width: 900px) { .hero .wrap { grid-template-columns: 1fr; gap: 32px; padding-top: 48px; padding-bottom: 168px; } }
@media (max-width: 480px) { .hero-stats { grid-template-columns: 1fr 1fr; gap: 10px; } .hero-stats .stat { padding: 12px 14px; } }

.section-block { padding: 56px 0 0; }
.section-block h2 { font-size: 1.75em; margin-bottom: 6px; }
.section-block .sub { color: var(--text-muted); margin-bottom: 28px; max-width: 64ch; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.step .n { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 999px; background: var(--primary); color: var(--primary-contrast); font-weight: 800; margin-bottom: 12px; }
.step h3 { font-size: 1.05em; margin-bottom: 6px; }
.step p { color: var(--text-muted); margin: 0; font-size: 0.95em; }

.progress-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px 26px; margin-top: -36px; position: relative; z-index: 2; box-shadow: var(--shadow); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; }
.progress-card h2 { font-size: 1.15em; margin-bottom: 4px; }
.progress-card p { color: var(--text-muted); margin: 0 0 12px; font-size: 0.95em; }
.progress-bar-container { background: var(--surface-3); border-radius: 999px; height: 10px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--success)); border-radius: 999px; transition: width 500ms ease; }
.progress-label { font-size: 0.85em; color: var(--text-muted); margin-top: 8px; }
@media (max-width: 640px) { .progress-card { grid-template-columns: 1fr; margin-top: 0; } .progress-card .btn { width: 100%; } }

.group-head { display: flex; align-items: baseline; gap: 12px; margin: 32px 0 14px; }
.group-head h3 { font-size: 1.1em; margin: 0; }
.group-head span { color: var(--text-faint); font-size: 0.88em; }
.group-head:first-of-type { margin-top: 0; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.lesson-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: inherit; overflow: hidden; transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease); }
.lesson-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); text-decoration: none; }
.card-top { display: flex; gap: 14px; padding: 18px 18px 12px; align-items: flex-start; }
.card-num { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: var(--radius-sm); background: var(--primary); color: var(--primary-contrast); font-weight: 750; }
.card-meta h3 { font-size: 1em; margin-bottom: 3px; }
.card-meta p { font-size: 0.88em; color: var(--text-muted); margin: 0; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 14px; }
.card-tags .tag { font-size: 0.72em; font-weight: 650; padding: 2px 8px; border-radius: 999px; }
.card-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 18px; background: var(--surface-2); border-top: 1px solid var(--border); font-size: 0.82em; color: var(--text-muted); }
.card-arrow { color: var(--accent); font-weight: 700; font-size: 1.1em; }
.card-completed { border-color: var(--success-border); }
.card-completed .card-num { background: var(--success); color: #fff; }
.card-score { font-weight: 700; color: var(--success); background: var(--success-bg); padding: 2px 8px; border-radius: 999px; }

.exam-cta { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px 30px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; box-shadow: var(--shadow-sm); }
.exam-cta h2 { font-size: 1.4em; margin-bottom: 6px; }
.exam-cta p { color: var(--text-muted); margin: 0; }
.exam-cta .status { margin-top: 8px; font-weight: 650; color: var(--success); }
@media (max-width: 640px) { .exam-cta { grid-template-columns: 1fr; } .exam-cta .btn { width: 100%; } }

.mnemonic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.mnemonic-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.mnemonic-card h3 { font-size: 1.1em; color: var(--primary); margin-bottom: 8px; letter-spacing: 0.02em; }
.mnemonic-card dl { margin: 0; font-size: 0.88em; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }
.mnemonic-card dt { font-weight: 800; color: var(--text); }
.mnemonic-card dd { margin: 0; color: var(--text-muted); }

.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 20px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 650; padding: 16px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 400; color: var(--text-faint); font-size: 1.3em; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { color: var(--text-muted); margin: 0 0 16px; }

.notice { display: flex; gap: 14px; align-items: flex-start; background: var(--warning-bg); border: 1px solid var(--warning-border); border-radius: var(--radius); padding: 14px 18px; color: var(--text); }
.notice strong { color: var(--warning); }
.notice p { margin: 0; font-size: 0.95em; }

/* ---------- Exam page ---------- */
.exam-main { max-width: 868px; }
body.exam .lesson-head .wrap { max-width: 868px; }
.exam-q { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin: 16px 0; box-shadow: var(--shadow-sm); }
.exam-q .stem { font-weight: 650; margin-bottom: 12px; }
.exam-q .stem .qnum { color: var(--text-faint); margin-right: 4px; }
.section-divider { margin: 34px 0 6px; font-size: 0.78em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.exam-q .opt { margin-bottom: 8px;  display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); transition: border-color var(--ease), background var(--ease); }
.exam-q .opt:hover { border-color: var(--accent); background: var(--info-bg); }
.exam-q .opt:has(input:checked) { border-color: var(--primary); background: var(--info-bg); }
.exam-q input[type="radio"] { margin-top: 4px; accent-color: var(--primary); flex: none; }
.name-row label { display: block; font-weight: 650; margin-bottom: 8px; }
.name-row input[type="text"] { width: 100%; max-width: 420px; font: inherit; padding: 10px 14px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.name-row input[type="text"]:focus { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 0; }
.name-error { display: none; color: var(--danger); font-size: 0.9em; margin-top: 8px; font-weight: 600; }
.name-row.error .name-error { display: block; }
.name-row.error input[type="text"] { border-color: var(--danger); }
.submit-bar { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; }
.status { font-weight: 700; font-size: 1.1em; margin-top: 6px; }
.status.pass { color: var(--success); }
.status.fail { color: var(--danger); }
.missed-list { margin: 0; padding-left: 1.2em; }
.missed-list li { margin-bottom: 10px; }
.missed-list .why { display: block; color: var(--text-muted); font-size: 0.92em; margin-top: 3px; }
.prev-banner { display: none; background: var(--info-bg); border: 1px solid var(--info-border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; }
.prev-banner.show { display: block; }
.prev-banner .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

.record { background: var(--surface); border: 2px solid var(--primary); border-radius: var(--radius-lg); padding: 36px 32px; margin: 24px 0; text-align: center; position: relative; }
.record-badge { display: inline-block; background: var(--primary); color: var(--primary-contrast); padding: 4px 14px; border-radius: 999px; font-size: 0.75em; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 18px; }
.record h2 { font-size: 1.6em; margin-bottom: 4px; }
.record-sub { color: var(--text-muted); margin-bottom: 22px; }
.record-name { font-size: 1.6em; font-weight: 750; color: var(--primary); margin: 0 0 20px; padding: 0 0 16px; border-bottom: 1px solid var(--border); }
.record-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.record .fact-label { font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); font-weight: 700; }
.record .fact-value { font-size: 1.15em; font-weight: 700; margin-top: 2px; }
.record-note { font-size: 0.88em; color: var(--text-muted); max-width: 60ch; margin: 0 auto; }
@media (max-width: 520px) { .record-facts { grid-template-columns: 1fr; } .record { padding: 26px 18px; } }

/* ---------- Print ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f3f3f3; --surface-3: #e8e8e8; --text: #000; --text-muted: #333; --border: #bbb; }
  body { font-size: 11.5pt; }
  .site-nav, .site-footer, .lesson-toc, .section-nav, .lesson-footer-nav, .no-print, .skip-link, .btn-toggle { display: none !important; }
  .lesson-body { display: block; }
  .section { display: block !important; page-break-before: always; animation: none; }
  .section:first-of-type { page-break-before: auto; }
  .discussion { display: block !important; }
  .card, .scenario, .scenario-case, .quiz-question, table { box-shadow: none; break-inside: avoid; }
  .key-points { background: #eee !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
  .record { break-inside: avoid; }
  body.exam * { visibility: hidden; }
  body.exam #record-block, body.exam #record-block * { visibility: visible; }
  body.exam #record-block { position: absolute; left: 0; top: 0; width: 100%; margin: 0; border-radius: 0; }
}

/* ---------- Pixel type (self-hosted VT323, SIL OFL — see assets/fonts/) ---------- */
@font-face {
  font-family: "VT323";
  src: url(../fonts/vt323-latin.woff2) format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
:root { --font-pixel: "VT323", "Courier New", ui-monospace, monospace; }
.duck { image-rendering: pixelated; display: block; flex: none; }

/* ---------- Pixel flair (Oregon Trail accents) ---------- */
.px { display: inline-block; width: 20px; height: 20px; flex: none; background: currentColor;
  -webkit-mask: var(--px-src) center / contain no-repeat; mask: var(--px-src) center / contain no-repeat; }
.px-mountains { --px-src: url(../img/pixel/mountains.svg); }
.px-snowflake { --px-src: url(../img/pixel/snowflake.svg); }
.px-canoe     { --px-src: url(../img/pixel/canoe.svg); }
.px-wheel     { --px-src: url(../img/pixel/wheel.svg); }
.px-campfire  { --px-src: url(../img/pixel/campfire.svg); }
.px-flask     { --px-src: url(../img/pixel/flask.svg); }
.px-wagon     { --px-src: url(../img/pixel/wagon.svg); }
.px-cross     { --px-src: url(../img/pixel/cross.svg); }
.px-barn      { --px-src: url(../img/pixel/barn.svg); }
.px-flag      { --px-src: url(../img/pixel/flag.svg); }
.px-heart     { --px-src: url(../img/pixel/heart.svg); }

#for-you h3 { display: flex; align-items: center; gap: 9px; }
#for-you h3 .px { width: 17px; height: 17px; color: var(--primary); }
#for-you h2 .px { width: 26px; height: 26px; color: var(--primary); vertical-align: -4px; margin-right: 10px; }
.eyebrow .px { width: 19px; height: 19px; color: var(--primary); }

.trail-divider { height: 30px; margin: 26px 0 6px; color: var(--border-strong); background: currentColor;
  -webkit-mask: url(../img/pixel/caravan.svg) left bottom / auto 100% repeat-x;
  mask: url(../img/pixel/caravan.svg) left bottom / auto 100% repeat-x; }

/* ---------- CRT panel (practice scenarios) ---------- */
.crt-panel { position: relative; overflow: hidden; background: #0E1B30; border: 2px solid #2C4A73; border-radius: 6px;
  padding: 26px 30px 24px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.crt-panel::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(140, 190, 255, 0.03) 2px 4px); }
.crt-status { font-family: var(--font-pixel); font-size: 1.02em; letter-spacing: 0.09em; color: #7EE787;
  display: flex; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 14px; text-transform: uppercase; }
.crt-status span::before { content: "▸ "; opacity: 0.7; }
.crt-panel h2 { color: #fff; font-size: 1.4em; margin-bottom: 6px; }
.crt-panel p { color: #AFC3DE; margin: 0; }
.crt-badge { font-size: 0.72em; vertical-align: middle; font-family: var(--font-pixel); letter-spacing: 0.1em;
  color: #7EE787; border: 1px solid #2E5A41; background: rgba(126, 231, 135, 0.08); padding: 2px 10px; border-radius: 3px; }
.crt-panel .btn { background: #7EE787; border-color: #7EE787; color: #08240F; font-family: var(--font-pixel); font-size: 1.3em; letter-spacing: 0.03em; }
.crt-panel .btn:hover { background: #99F0A5; border-color: #99F0A5; }
.crt-hint { font-family: var(--font-pixel); font-size: 1.05em; color: #6B87AC; margin-top: 12px !important; }
@media (max-width: 640px) { .crt-panel { grid-template-columns: 1fr; } .crt-panel .btn { width: 100%; text-align: center; } }

/* ---------- Sim console (niche pages) ---------- */
.sim-console { position: relative; overflow: hidden; background: #0E1B30; border: 2px solid #2C4A73;
  border-radius: 6px; padding: 20px 24px 14px; margin-top: 28px; }
.sim-console::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(140, 190, 255, 0.03) 2px 4px); }
.sim-console-head { display: flex; gap: 18px; align-items: center; margin-bottom: 4px; }
.sim-console-head .duck { width: 54px; height: auto; }
.sim-console h3 { font-family: var(--font-pixel); font-weight: 400; font-size: 1.55em; letter-spacing: 0.04em;
  color: #7EE787; margin: 0 0 2px; text-transform: uppercase; }
.sim-console-head p { color: #AFC3DE; font-size: 0.92em; margin: 0; }
.sim-console .simrow { margin: 10px 0 0; }
.sim-console .simrow li { border-bottom: 1px solid #22354F; padding: 9px 0; }
.sim-console .simrow li:last-child { border-bottom: 0; }
.sim-console .simrow li::before { content: "▸"; color: #7EE787; opacity: 0.65; margin-right: 11px; }
.sim-console .simrow a { color: #7EE787; font-family: var(--font-pixel); font-size: 1.24em; letter-spacing: 0.02em; text-decoration: none; }
.sim-console .simrow a:hover { text-decoration: underline; }
.sim-console .simrow .hook { color: #6B87AC; }
.crt-side { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.crt-side .duck { width: 76px; height: auto; }
@media (max-width: 640px) { .sim-console-head { flex-direction: column; align-items: flex-start; gap: 10px; } }

/* ---------- Hero scene (pixel landscape + wagon train) ---------- */
.hero-scene { position: absolute; left: 0; right: 0; bottom: 0; height: 152px; pointer-events: none; }
.hero-scene > div { position: absolute; background: currentColor; }
.scene-skyline { left: 0; right: 0; bottom: 42px; height: 66px; color: rgba(8, 20, 38, 0.30);
  -webkit-mask: url(../img/pixel/skyline.svg) left bottom / 384px 66px repeat-x;
  mask: url(../img/pixel/skyline.svg) left bottom / 384px 66px repeat-x; }
.scene-pines { left: 0; right: 0; bottom: 0; height: 66px; color: #0A1930;
  -webkit-mask: url(../img/pixel/pines.svg) left bottom / 384px 66px repeat-x;
  mask: url(../img/pixel/pines.svg) left bottom / 384px 66px repeat-x; }
.scene-train { left: 0; width: calc(100% + 384px); bottom: 0; height: 66px; color: #0A1930;
  -webkit-mask: url(../img/pixel/train.svg) left bottom / 384px 66px repeat-x;
  mask: url(../img/pixel/train.svg) left bottom / 384px 66px repeat-x;
  animation: trail-march 40s linear infinite; }
@keyframes trail-march { from { transform: translateX(0); } to { transform: translateX(-384px); } }
.hero-sky { position: absolute; inset: 0; pointer-events: none; }
.hero-sky > div { position: absolute; background: currentColor; color: rgba(255,255,255,0.14); }
.sky-sun { top: 42px; right: 37%; width: 84px; height: 74px; color: rgba(255,255,255,0.12);
  -webkit-mask: url(../img/pixel/sun.svg) center / contain no-repeat;
  mask: url(../img/pixel/sun.svg) center / contain no-repeat; }
.sky-cloud { width: 96px; height: 24px;
  -webkit-mask: url(../img/pixel/cloud.svg) center / contain no-repeat;
  mask: url(../img/pixel/cloud.svg) center / contain no-repeat; }
.sky-cloud.c1 { top: 24px; left: 42%; color: rgba(255,255,255,0.13); }
.sky-cloud.c2 { bottom: 200px; right: 6%; color: rgba(255,255,255,0.10); }
@media (max-width: 640px) { .sky-sun { right: 6%; top: 100px; } .sky-cloud.c2 { display: none; } }
.px-manual    { --px-src: url(../img/pixel/manual.svg); }
.px-hourglass { --px-src: url(../img/pixel/hourglass.svg); }
.px-question  { --px-src: url(../img/pixel/question.svg); }

/* ============================================================================
   LESSONS — Oregon Trail treatment
   Same rule as the sims: the game skin goes on CHROME (wayfinding, labels,
   numerals, score surfaces) and never on medical body copy. Palette hexes are
   lifted from the scene generators (tools/niche_pixel.py, scene_pixel.py) so a
   lesson page and a hero illustration read as the same world.
   Per-lesson icons key off body[data-lesson-id] — no per-file HTML needed.
   ============================================================================ */
:root {
  --trail:      #E9DFC6;   /* trail fill    */
  --trail-edge: #CDBD97;   /* trail edge    */
  --trail-post: #6B4E32;   /* signpost wood */
  --trail-deep: #3E4F39;   /* pine dark     */
  --trail-rust: #A34E3B;   /* wagon red     */
}

/* ---- lesson header: topic icon + pixel eyebrow ---- */
body.lesson { --lesson-icon: url(../img/pixel/manual.svg);
  --toc-w: 276px;   /* the wagon marker needs room; keeps labels on one line */ }
body.lesson[data-lesson-id="01"] { --lesson-icon: url(../img/pixel/helmet.svg); }
body.lesson[data-lesson-id="02"] { --lesson-icon: url(../img/pixel/manual.svg); }
body.lesson[data-lesson-id="03"] { --lesson-icon: url(../img/pixel/breath.svg); }
body.lesson[data-lesson-id="04"] { --lesson-icon: url(../img/pixel/drop.svg); }
body.lesson[data-lesson-id="05"] { --lesson-icon: url(../img/pixel/heart.svg); }
body.lesson[data-lesson-id="06"] { --lesson-icon: url(../img/pixel/bone.svg); }
body.lesson[data-lesson-id="07"] { --lesson-icon: url(../img/pixel/spine.svg); }
body.lesson[data-lesson-id="08"] { --lesson-icon: url(../img/pixel/sun.svg); }
body.lesson[data-lesson-id="09"] { --lesson-icon: url(../img/pixel/snowflake.svg); }
body.lesson[data-lesson-id="10"] { --lesson-icon: url(../img/pixel/injector.svg); }
body.lesson[data-lesson-id="11"] { --lesson-icon: url(../img/pixel/flask.svg); }
body.lesson[data-lesson-id="12"] { --lesson-icon: url(../img/pixel/bee.svg); }
body.lesson[data-lesson-id="13"] { --lesson-icon: url(../img/pixel/wagon.svg); }
body.lesson[data-lesson-id="14"] { --lesson-icon: url(../img/pixel/bolt.svg); }
body.lesson[data-lesson-id="15"] { --lesson-icon: url(../img/pixel/pack.svg); }

body.lesson .lesson-head .eyebrow::before {
  content: ""; display: inline-block; flex: none; width: 22px; height: 22px;
  background: var(--primary);
  -webkit-mask: var(--lesson-icon) center / contain no-repeat;
  mask: var(--lesson-icon) center / contain no-repeat;
}
body.lesson .lesson-head .eyebrow {
  font-family: var(--font-pixel); font-weight: 400; font-size: 1.16em;
  letter-spacing: 0.08em; color: var(--text-muted);
}
body.lesson .lesson-head .tags .badge {
  font-family: var(--font-pixel); font-weight: 400; font-size: 1.02em;
  letter-spacing: 0.07em; border-radius: 3px;
}

/* ---- table of contents as a trail map ----
   The dotted line threads the section markers; the current section carries the
   wagon. Marker states: unvisited (empty post), visited (filled), current. */
body.lesson .lesson-toc .toc-label {
  font-family: var(--font-pixel); font-size: 1.12em; font-weight: 400;
  letter-spacing: 0.14em; color: var(--trail-post);
}
body.lesson .tablist { position: relative; }
body.lesson .tablist::before {          /* the trail itself */
  content: ""; position: absolute; left: 22px; top: 18px; bottom: 18px; width: 2px;
  background: repeating-linear-gradient(to bottom,
    var(--trail-edge) 0 3px, transparent 3px 7px);
}
body.lesson .tab .tab-n {
  position: relative; z-index: 1; border-radius: 2px;
  font-family: var(--font-pixel); font-weight: 400; font-size: 1.16em;
  background: var(--surface); color: var(--text-faint);
  box-shadow: inset 0 0 0 2px var(--trail-edge);
}
body.lesson .tab.visited .tab-n {
  background: var(--trail-edge); color: var(--trail-post);
  box-shadow: inset 0 0 0 2px var(--trail-edge);
}
body.lesson .tab[aria-selected="true"] .tab-n,
body.lesson .tab.visited[aria-selected="true"] .tab-n {
  background: var(--primary); color: var(--primary-contrast);
  box-shadow: inset 0 0 0 2px var(--primary), 0 0 0 3px rgba(27, 79, 138, 0.14);
}
body.lesson .tab { position: relative; padding-right: 36px; }
body.lesson .tab[aria-selected="true"]::after {   /* you are here */
  content: ""; position: absolute; right: 10px; top: 50%; margin-top: -8px;
  width: 22px; height: 16px; background: var(--trail-rust);
  -webkit-mask: url(../img/pixel/wagon.svg) center / contain no-repeat;
  mask: url(../img/pixel/wagon.svg) center / contain no-repeat;
}
body.lesson .tab[aria-selected="true"] { border-color: var(--trail-edge); }

/* ---- progress: a supply-gauge, not a hairline ---- */
body.lesson .toc-progress {
  font-family: var(--font-pixel); font-size: 1.08em; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--trail-post);
}
body.lesson .toc-progress .bar {
  height: 10px; border-radius: 2px; background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--trail-edge); padding: 2px; overflow: hidden;
}
body.lesson .toc-progress .bar > span {
  background: var(--trail-deep);
  -webkit-mask: repeating-linear-gradient(to right, #000 0 4px, transparent 4px 6px);
  mask: repeating-linear-gradient(to right, #000 0 4px, transparent 4px 6px);
}

/* ---- mnemonic letters as game tiles ---- */
body.lesson .mnemonic-letter {
  font-family: var(--font-pixel); font-weight: 400; font-size: 1.62em;
  border-radius: 3px; box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.22);
}

/* ---- alerts: pixel sigil + pixel label ---- */
body.lesson .alert-title {
  font-family: var(--font-pixel); font-weight: 400; font-size: 1.28em;
  letter-spacing: 0.09em; display: flex; align-items: center; gap: 7px;
}
body.lesson .alert-title::before {
  content: ""; flex: none; width: 16px; height: 16px; background: currentColor;
  -webkit-mask: var(--alert-icon) center / contain no-repeat;
  mask: var(--alert-icon) center / contain no-repeat;
}
body.lesson .alert > strong:first-child {
  font-family: var(--font-pixel); font-weight: 400; font-size: 1.22em;
  letter-spacing: 0.06em;
}
body.lesson .alert > strong:first-child::before {
  content: ""; display: inline-block; vertical-align: -2px; margin-right: 6px;
  width: 15px; height: 15px; background: currentColor;
  -webkit-mask: var(--alert-icon) center / contain no-repeat;
  mask: var(--alert-icon) center / contain no-repeat;
}
body.lesson .alert          { --alert-icon: url(../img/pixel/manual.svg); }
body.lesson .alert-danger   { --alert-icon: url(../img/pixel/bolt.svg); }
body.lesson .alert-warning  { --alert-icon: url(../img/pixel/flag.svg); }
body.lesson .alert-info     { --alert-icon: url(../img/pixel/manual.svg); }
body.lesson .alert-success  { --alert-icon: url(../img/pixel/heart.svg); }

/* ---- key points: each one a flag planted ---- */
body.lesson .key-points h3, body.lesson .key-points h4 {
  font-family: var(--font-pixel); font-weight: 400; font-size: 1.5em;
  letter-spacing: 0.12em;
  /* .lesson-content h3 (later in this file, equal specificity) was winning and
     painting this heading --text on the blue panel — about 1.5:1. Pin it. */
  color: var(--primary-contrast);
}
body.lesson .key-points .key-point::before {
  content: ""; top: 11px; left: 2px; width: 13px; height: 13px;
  background: currentColor;
  -webkit-mask: url(../img/pixel/flag.svg) center / contain no-repeat;
  mask: url(../img/pixel/flag.svg) center / contain no-repeat;
}

/* ---- scenarios: field dispatches ---- */
body.lesson .scenario-header {
  font-family: var(--font-pixel); font-weight: 400; font-size: 1.34em;
  letter-spacing: 0.08em;
}
body.lesson .scenario-title {
  font-family: var(--font-pixel); font-weight: 400; font-size: 1.4em;
  letter-spacing: 0.06em;
}

/* ---- quiz: the one true game surface in a lesson ---- */
body.lesson .quiz-question .q-n {
  font-family: var(--font-pixel); font-size: 1.3em; color: var(--trail-post);
}
body.lesson .quiz-option .opt-l {     /* same tile vocabulary as the mnemonics */
  font-family: var(--font-pixel); font-weight: 400; font-size: 1.16em;
  border-radius: 3px;
}
/* Scoped away from the answered states: .quiz-option.correct/.incorrect .opt-l
   paint their own white-on-green/red, and a background here would erase the
   letter (this selector outranks them). */
body.lesson .quiz-option:not(.correct):not(.incorrect) .opt-l {
  background: var(--surface); box-shadow: inset 0 0 0 2px var(--trail-edge);
}
body.lesson .score-banner h3 {
  font-family: var(--font-pixel); font-weight: 400; font-size: 3.2em;
  letter-spacing: 0.04em; line-height: 1;
}

/* ---- footer: back on the trail ---- */
body.lesson .lesson-footer-nav .btn.next::before {
  content: ""; flex: none; width: 22px; height: 16px; background: currentColor;
  -webkit-mask: url(../img/pixel/wagon.svg) center / contain no-repeat;
  mask: url(../img/pixel/wagon.svg) center / contain no-repeat;
}

@media (max-width: 640px) {   /* VT323 runs wide; keep the eyebrow on one line */
  body.lesson .lesson-head .eyebrow { font-size: 1.04em; gap: 6px 10px; }
}

/* Horizontal TOC strip on tablet/mobile: the trail line would cut through the
   pills, so it is dropped and the markers carry the state on their own. */
@media (max-width: 900px) {
  body.lesson .tablist::before { display: none; }
  body.lesson .tab[aria-selected="true"]::after { display: none; }
  body.lesson .tab[aria-selected="true"] .tab-n {
    background: color-mix(in srgb, var(--primary-contrast) 22%, transparent);
    box-shadow: none; color: var(--primary-contrast);
  }
}
