:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1f24;
  --muted: #5b6370;
  --border: #dcd9d2;
  --accent: #1d5fa8;
  --accent-text: #ffffff;
  --right: #1f7a3d;
  --right-bg: #e7f4ea;
  --wrong: #a5301f;
  --wrong-bg: #fbeae6;
  --instr-bg: #fff6dc;
  --instr-border: #d9a520;
  --verify: #ffe08a;
  --code-bg: #f0eee8;
  --measure: 46rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --surface: #1c1f24;
    --text: #e8e6e1;
    --muted: #a3a9b3;
    --border: #353a42;
    --accent: #7fb2ec;
    --accent-text: #0d1117;
    --right: #7fd39a;
    --right-bg: #173323;
    --wrong: #f19a8a;
    --wrong-bg: #3a1d18;
    --instr-bg: #2e2714;
    --instr-border: #a07a1a;
    --verify: #6b5413;
    --code-bg: #252930;
  }
}
:root[data-theme="dark"] {
  --bg: #14161a;
  --surface: #1c1f24;
  --text: #e8e6e1;
  --muted: #a3a9b3;
  --border: #353a42;
  --accent: #7fb2ec;
  --accent-text: #0d1117;
  --right: #7fd39a;
  --right-bg: #173323;
  --wrong: #f19a8a;
  --wrong-bg: #3a1d18;
  --instr-bg: #2e2714;
  --instr-border: #a07a1a;
  --verify: #6b5413;
  --code-bg: #252930;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.2; }
code { background: var(--code-bg); padding: 0.1em 0.3em; border-radius: 4px; font-size: 0.92em; overflow-wrap: anywhere; }
mark.verify { background: var(--verify); color: inherit; padding: 0 0.2em; font-weight: 600; }
.small { font-size: 0.85rem; color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.78rem; color: var(--muted); margin: 0 0 0.3rem; }

.site-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem;
  padding: 0.75rem 16px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.site-header nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.site-header nav a { text-decoration: none; }
.badge { background: var(--instr-border); color: #000; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.85rem; }
.tools { margin-left: auto; display: flex; gap: 0.5rem; }

main { max-width: var(--measure); margin: 0 auto; padding: 1rem 16px 3rem; }
.site-footer { max-width: var(--measure); margin: 0 auto; padding: 1rem 16px 2rem; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--border); }

button {
  font: inherit; cursor: pointer; border-radius: 6px; padding: 0.45rem 0.9rem;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text);
}
button.secondary, .tools button { background: transparent; color: var(--accent); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin: 0.5rem 0 1rem; font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); }
th { font-weight: 600; }

/* Lessons in article mode */
.slide { padding: 1.25rem 0; border-bottom: 1px solid var(--border); }
.slide h2 { margin-top: 0; }
.title-slide h1 { margin: 0.2rem 0; }
.block { color: var(--muted); }
.big { font-size: 1.1rem; }
.where { color: var(--muted); }
.report { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
p.report code { display: block; padding: 0.6rem; font-size: 1.05rem; white-space: pre-wrap; }
textarea.report { width: 100%; font-size: 1rem; padding: 0.6rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; }
.options { list-style: none; padding-left: 0; }
.checks li { margin-bottom: 0.75rem; }
.checks p { margin: 0 0 0.25rem; }

details.reveal { margin: 0.75rem 0; }
details.reveal summary { cursor: pointer; color: var(--accent); font-weight: 600; width: max-content; }
details.reveal .answer { margin-top: 0.5rem; padding: 0.6rem 0.9rem; border-left: 4px solid var(--accent); background: var(--surface); }
.verdict { font-weight: 700; margin: 0 0 0.3rem; }
.verdict.right { color: var(--right); }
.verdict.wrong { color: var(--wrong); }
dl.key { margin: 0; }
dl.key dt { font-weight: 600; margin-top: 0.5rem; }
dl.key dd { margin: 0; }

.bins { border: 1px solid var(--border); border-radius: 6px; display: grid; gap: 0.3rem; }
.bins label { display: flex; gap: 0.5rem; align-items: baseline; }
.card.right .bins { border-color: var(--right); background: var(--right-bg); }
.card.wrong .bins { border-color: var(--wrong); background: var(--wrong-bg); }

/* Instructor material: always visibly marked */
.instr-note, .instr { background: var(--instr-bg); border-left: 4px solid var(--instr-border); padding: 0.6rem 1rem; margin: 0.75rem 0; border-radius: 0 6px 6px 0; }
.instr-notes > h2 { margin-top: 2rem; }
.instr h3 { margin-top: 0.25rem; }
.verify-box { border-left-color: var(--wrong); }

.pager { display: flex; justify-content: space-between; gap: 1rem; padding-top: 1.5rem; }

/* Home */
.lede { font-size: 1.1rem; color: var(--muted); }
.lesson-list li { margin: 0.2rem 0; }

/* Quizzes */
.quiz { padding-left: 1.4rem; }
.q { margin: 0 0 1.5rem; }
.q p { margin: 0 0 0.4rem; }
label.opt { display: flex; gap: 0.45rem; align-items: baseline; padding: 0.35rem 0.5rem; border-radius: 6px; cursor: pointer; }
label.opt:hover { background: var(--surface); }
label.opt.picked { background: var(--wrong-bg); box-shadow: inset 4px 0 var(--wrong); }
label.opt.correct { background: var(--right-bg); box-shadow: inset 4px 0 var(--right); }
.opt-tag { margin-left: auto; padding-left: 0.75rem; font-size: 0.8rem; font-weight: 700; white-space: nowrap; color: var(--wrong); }
label.opt.correct .opt-tag { color: var(--right); }
label.opt > span:not(.opt-tag) { flex: 1 1 0; min-width: 0; }
@media (max-width: 600px) {
  label.opt { flex-wrap: wrap; }
  .opt-tag { order: -1; flex-basis: 100%; margin-left: 0; padding-left: 0; }
}
.q.right .feedback { border-left: 4px solid var(--right); background: var(--right-bg); }
.q.wrong .feedback { border-left: 4px solid var(--wrong); background: var(--wrong-bg); }
.q { scroll-margin-top: 3rem; }
label.guess { display: inline-flex; gap: 0.4rem; align-items: center; margin: 0.3rem 0 0 0.5rem; font-size: 0.85rem; color: var(--muted); cursor: pointer; }
.q.guessed { background: var(--instr-bg); box-shadow: 0 0 0 8px var(--instr-bg); border-radius: 2px; }
.q.guessed label.guess { color: var(--text); font-weight: 700; }
.feedback { padding: 0.5rem 0.9rem; margin-top: 0.4rem; border-radius: 0 6px 6px 0; }
.cite { font-size: 0.85rem; color: var(--muted); }
.timer { position: sticky; top: 0; background: var(--bg); padding: 0.4rem 0; font-weight: 700; font-variant-numeric: tabular-nums; z-index: 1; }
.timer.low { color: var(--wrong); }
.mode-buttons { display: grid; gap: 0.5rem; }
.mode-buttons button { text-align: left; background: var(--surface); color: var(--text); border-color: var(--border); }
.mode-buttons button:hover { border-color: var(--accent); }
.run-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.result { margin-bottom: 1.5rem; }
.steps li { margin-bottom: 0.5rem; }
.steps h3 { margin-bottom: 0.25rem; }
.links li { margin: 0.3rem 0; }

/* Present mode: one full-viewport section at a time, readable from the back of a room */
body.presenting { overflow: hidden; }
body.presenting .site-header,
body.presenting .site-footer,
body.presenting .instr,
body.presenting .instr-notes,
body.presenting .instr-note,
body.presenting .pager { display: none; }
body.presenting main { max-width: none; padding: 0; }
body.presenting .slide { display: none; }
body.presenting .slide.current {
  display: flex; flex-direction: column; justify-content: center;
  height: 100vh; height: 100dvh; overflow-y: auto; padding: 4vh 6vw 8vh; border: 0;
  font-size: clamp(1.4rem, 2.6vw + 0.4rem, 3rem);
}
body.presenting .slide.current h1 { font-size: 2em; }
body.presenting .slide.current h2, body.presenting .slide.current h3 { font-size: 1.5em; margin-bottom: 0.5em; }
body.presenting .slide.current li { margin: 0.25em 0; }
body.presenting .slide.current .big { font-size: 1.1em; }
body.presenting .slide.current .eyebrow { font-size: 0.5em; }
body.presenting .slide.current table { font-size: 0.6em; }
body.presenting .slide.current p.report code { font-size: 1em; }
body.presenting .slide.current textarea.report { font-size: 0.7em; }
/* dvh is the height visible right now: on a phone, 100vh is the height with the address bar hidden, so a slide sized to it scrolls while the bar shows. */
#present-bar {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  height: 2.2rem; box-sizing: border-box; overflow: hidden; white-space: nowrap;
  padding: 0.4rem 1rem; font-size: 1rem; color: var(--muted); background: var(--bg);
}
#present-bar[hidden] { display: none; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .tools { margin-left: 0; }
}

/* Print: drills come out as clean handouts, answers stay hidden unless revealed */
@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --muted: #333; --border: #999; }
  .site-header, .site-footer, .pager, #present-bar, button, details.reveal:not([open]), .tools, textarea { display: none !important; }
  main { max-width: none; padding: 0; }
  .slide { break-inside: avoid; border-bottom: 1px solid #ccc; padding: 0.6rem 0; }
  a { color: #000; text-decoration: none; }
  .instr, .instr-note, .instr-notes { background: none; border: 1px solid #999; }
}

body.presenting .slide.current .table-wrap table { font-size: 0.75em; }

/* ---------- Slides and the presenter deck (deck.js), shared by every course ---------- */
/* Courses set --mod and --mod-deep for their accent color. */
.content-slide .why {
  margin: 0 0 0.6rem; padding: 0.45rem 0.8rem; border-left: 4px solid var(--mod);
  background: color-mix(in srgb, var(--mod) 9%, transparent); border-radius: 0 6px 6px 0;
}
.why-tag { font-weight: 700; color: var(--mod); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8em; margin-right: 0.3em; }
.bullets .num { font-weight: 700; color: var(--mod); white-space: nowrap; }
.bullets .lead { font-weight: 650; }
.slide-body { display: grid; gap: 1rem; }
.story-slide .story-text { font-size: 1.35em; line-height: 1.4; max-width: 38em; }
.story-recall { color: var(--muted); font-style: italic; border-left: 3px solid var(--border); padding-left: 0.8rem; }
.question { font-size: 1.15em; font-style: italic; }
body.deck-mode main { max-width: none; padding: 0; }
body.deck-mode .slide { display: none; }
body.deck-mode .deck-notes { display: none; }
body.deck-mode .slide.current {
  display: flex; flex-direction: column; justify-content: center;
  height: calc(100vh - 2.2rem); height: calc(100dvh - 2.2rem); overflow-y: auto; padding: 3vh 5vw 3vh; border: 0;
  font-size: clamp(1.1rem, 1.6vw + 0.4rem, 2.6rem);
}
body.deck-mode .slide.current h1 { font-size: 2.4em; margin: 0.1em 0; }
body.deck-mode .slide.current h2 { font-size: 1.6em; margin: 0.15em 0 0.4em; }
body.deck-mode .slide.current h3 { font-size: 1.3em; }
body.deck-mode .slide.current .eyebrow { font-size: 0.55em; }
body.deck-mode .slide.current table { font-size: 0.6em; }
body.deck-mode .slide.current li { margin: 0.25em 0; }
body.deck-mode .bullets li { transition: opacity 0.25s, transform 0.25s; }
body.deck-mode:not(.presenter-view) .bullets li.pending { opacity: 0; transform: translateY(0.4em); }
body.presenter-view .bullets li.pending { opacity: 0.35; }
body.deck-mode .content-slide.current { justify-content: flex-start; padding-top: 4vh; border-top: 0.6vh solid var(--mod); }
/* A closed answer keeps its space, just invisible: the slide is centered as it looks with every answer open, and nothing moves when one opens. */
body.deck-mode details.reveal::details-content { content-visibility: visible; visibility: hidden; }
body.deck-mode details.reveal[open]::details-content { visibility: visible; }
body.deck-mode .slide.current .checks { font-size: 0.75em; }
body.deck-mode .title-slide.current,
body.deck-mode .chapter-slide.current,
body.deck-mode .story-slide.hook.current {
  background: linear-gradient(135deg, var(--mod-deep), var(--mod)); color: #fff;
}
body.deck-mode .title-slide.current .eyebrow,
body.deck-mode .chapter-slide.current .eyebrow,
body.deck-mode .story-slide.hook.current .eyebrow,
body.deck-mode .title-slide.current .block { color: rgba(255, 255, 255, 0.8); }
body.deck-mode .title-slide.current a { color: #fff; }
body.deck-mode .chapter-slide.current h2 { font-size: 2.6em; }
body.deck-mode .story-slide.hook .story-text { font-size: 1.9em; }
.button-link { display: inline-block; padding: 0.4em 0.9em; border: 2px solid currentColor; border-radius: 8px; text-decoration: none; font-weight: 700; }
body.blank::after { content: ""; position: fixed; inset: 0; background: #000; z-index: 50; }
/* Presenter window: the live slide on the left, next slide and notes on the right. */
body.presenter-view main { display: grid; grid-template-columns: minmax(0, 62fr) minmax(0, 38fr); height: calc(100vh - 2.2rem); height: calc(100dvh - 2.2rem); }
body.presenter-view .deck { grid-column: 1; overflow: hidden; }
body.presenter-view .slide.current { height: calc(100vh - 2.2rem); height: calc(100dvh - 2.2rem); font-size: clamp(0.9rem, 1vw + 0.35rem, 1.8rem); }
body.presenter-view .instr-note { display: none; }
.presenter-panel { grid-column: 2; grid-row: 1; height: 100%; overflow-y: auto; border-left: 2px solid var(--border); padding: 0.8rem 1rem; display: grid; grid-auto-rows: min-content; gap: 0.8rem; font-size: 0.95rem; background: var(--bg); }
.presenter-panel[hidden] { display: none; }
.pp-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1rem; }
.pp-clock { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pp-sched { color: var(--muted); }
.pp-jump { margin-left: auto; font-size: 0.85rem; }
.pp-next > div { border: 2px solid var(--border); border-radius: 8px; padding: 0.5rem 0.7rem; max-height: 14rem; overflow: hidden; font-size: 0.7rem; pointer-events: none; background: var(--surface); }
.pp-next .slide { display: block !important; height: auto !important; padding: 0 !important; border: 0 !important; background: none !important; color: inherit !important; font-size: inherit !important; }
.pp-next .bullets li.pending { opacity: 1; transform: none; }
.pp-next .visual svg { max-height: 7rem; width: auto; }
.pp-notes .instr-note { display: block !important; }
body.deck-mode .pp-notes .deck-notes { display: block; }
body.deck-mode .pp-notes .deck-notes[hidden] { display: none; }
.pp-notes .instr { display: block !important; font-size: 0.9rem; }
.pp-notes .instr h3 { margin: 0 0 0.3rem; font-size: 1rem; }
