/* Layout: each slide is a 16:9 sheet of squared exercise paper ("kariertes Heft") on a desk.
   Ink is royal blue fountain-pen ink, key words get a yellow highlighter, prompts sit on dark terminal slips.
   Deck mode = one slide fitted to the window. Read mode = all slides stacked (phones, self-study). */

:root {
  --desk: #E3E7EE;
  --paper: #FBFCFD;
  --grid: rgba(34, 56, 184, 0.075);
  --ink: #141A2A;
  --ink-soft: #4A556C;
  --rule: #D2D8E3;
  --accent: #2238B8;          /* royal blue ink */
  --accent-soft: rgba(34, 56, 184, 0.11);
  --on-accent: #FFFFFF;
  --mark: #FFE14A;            /* highlighter */
  --mark-ink: #141A2A;
  --term: #0F1422;
  --term-edge: #0F1422;
  --term-ink: #E5E9F2;
  --term-dim: #8E98AD;
  --term-ok: #7DDDA3;
  --term-err: #FF9384;
  --term-cmd: #AFC0FF;
  --chrome: rgba(251, 252, 253, 0.92);
  --shadow: 0 1px 0 rgba(20, 26, 42, 0.05), 0 18px 40px -18px rgba(20, 26, 42, 0.32);

  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Type scale. cqw = 1% of the slide width, so a slide scales like a real slide.
     The px floor keeps text readable in read mode on a phone. */
  --fs-hero: max(34px, 5.6cqw);
  --fs-h2: max(26px, 3.5cqw);
  --fs-h3: max(19px, 1.9cqw);
  --fs-lead: max(17px, 1.85cqw);
  --fs-body: max(15px, 1.5cqw);
  --fs-small: max(13px, 1.2cqw);
  --fs-meta: max(11px, 0.95cqw);

  --notes-w: 0px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #070A10;
    --paper: #121827;
    --grid: rgba(142, 156, 255, 0.07);
    --ink: #E8ECF4;
    --ink-soft: #A3ACBF;
    --rule: #28314A;
    --accent: #93A1FF;
    --accent-soft: rgba(147, 161, 255, 0.15);
    --on-accent: #0B0F1A;
    --mark: #F3D63D;
    --mark-ink: #141A2A;
    --term: #090D16;
    --term-edge: #2A3450;
    --term-ink: #E5E9F2;
    --term-dim: #8E98AD;
    --term-ok: #7DDDA3;
    --term-err: #FF9384;
    --term-cmd: #AFC0FF;
    --chrome: rgba(18, 24, 39, 0.92);
    --shadow: 0 0 0 1px #1D2539, 0 18px 40px -18px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --desk: #070A10;
  --paper: #121827;
  --grid: rgba(142, 156, 255, 0.07);
  --ink: #E8ECF4;
  --ink-soft: #A3ACBF;
  --rule: #28314A;
  --accent: #93A1FF;
  --accent-soft: rgba(147, 161, 255, 0.15);
  --on-accent: #0B0F1A;
  --mark: #F3D63D;
  --mark-ink: #141A2A;
  --term: #090D16;
  --term-edge: #2A3450;
  --term-ink: #E5E9F2;
  --term-dim: #8E98AD;
  --term-ok: #7DDDA3;
  --term-err: #FF9384;
  --term-cmd: #AFC0FF;
  --chrome: rgba(18, 24, 39, 0.92);
  --shadow: 0 0 0 1px #1D2539, 0 18px 40px -18px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button { font: inherit; color: inherit; }

mark {
  background: linear-gradient(transparent 10%, var(--mark) 10%, var(--mark) 90%, transparent 90%);
  color: var(--mark-ink);
  padding: 0 0.18em;
  border-radius: 0.18em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ---------- Deck frame ---------- */

.deck {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr var(--notes-w);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.deck.notes-open { --notes-w: min(380px, 30vw); }

.stage-wrap { display: grid; place-items: center; min-width: 0; min-height: 0; padding-block: 16px; }

.stage {
  position: relative;
  width: min(100%, (100dvh - 112px) * 16 / 9);
  aspect-ratio: 16 / 9;
  container-type: size;
}

.slide {
  position: absolute;
  inset: 0;
  display: none;
  grid-template-rows: auto 1fr auto;
  gap: 1.6cqw;
  padding: 2.4cqw 3.6cqw 1.8cqw;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 2.4cqw 2.4cqw;
  background-position: -1px -1px;
  border-radius: 0.7cqw;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.slide.is-active { display: grid; }

@media (prefers-reduced-motion: no-preference) {
  .slide.is-active { animation: sheet-in 260ms ease-out; }
  @keyframes sheet-in { from { opacity: 0.4; transform: translateY(0.4cqw); } to { opacity: 1; transform: none; } }
}

.slide-head, .slide-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5cqw;
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.slide-head { border-bottom: 1px solid var(--rule); padding-bottom: 0.9cqw; }
.slide-head b, .slide-foot b { color: var(--accent); font-weight: 600; }
.slide-foot { text-transform: none; letter-spacing: 0.02em; }
.slide-foot .url { overflow-wrap: anywhere; }

.slide-body { min-height: 0; min-width: 0; }

/* ---------- Type ---------- */

.eyebrow {
  margin: 0 0 0.8cqw;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
h1 {
  font-size: var(--fs-hero);
  font-weight: 850;
  font-stretch: 125%;
  line-height: 0.98;
  letter-spacing: -0.015em;
}
h2 {
  font-size: var(--fs-h2);
  font-weight: 800;
  font-stretch: 118%;
  line-height: 1.04;
  letter-spacing: -0.01em;
}
h3 { font-size: var(--fs-h3); font-weight: 750; font-stretch: 108%; line-height: 1.15; }
.subtitle {
  margin: 0.8cqw 0 0;
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 500;
  font-stretch: 112%;
  color: var(--accent);
}
.lead { font-size: var(--fs-lead); line-height: 1.4; max-width: 34em; margin: 1.6cqw 0 0; text-wrap: pretty; }
p, li { font-size: var(--fs-body); }
.muted { color: var(--ink-soft); }

/* ---------- Title slide ---------- */

.title-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 2.2cqw 3.6cqw;
  height: 100%;
}
.title-main { align-self: center; min-width: 0; }

.result {
  display: inline-grid;
  gap: 0.2cqw;
  margin-top: 2.2cqw;
  padding: 1cqw 1.4cqw;
  border: 2px solid var(--accent);
  border-radius: 0.6cqw;
  background: var(--paper);
}
.result span { font-family: var(--font-mono); font-size: var(--fs-meta); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.result strong { font-size: var(--fs-lead); font-weight: 700; }

.day-plan { align-self: center; margin: 0; padding: 0; list-style: none; display: grid; gap: 0; border-top: 1px solid var(--rule); }
.day-plan li {
  display: grid;
  grid-template-columns: 5.4em 1fr;
  gap: 0.2cqw 1cqw;
  padding: 0.85cqw 0;
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-small);
}
.day-plan time { font-family: var(--font-mono); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.day-plan strong { font-size: var(--fs-body); }
.day-plan .what { grid-column: 2; color: var(--ink-soft); }
.day-plan li.now time { color: var(--accent); font-weight: 600; }
.day-plan li.now strong::after {
  content: "jetzt";
  margin-left: 0.6em;
  padding: 0.05em 0.45em;
  border-radius: 99px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-size: 0.72em;
  font-weight: 600;
  vertical-align: 0.15em;
}

.course-map {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.4cqw;
  padding-top: 1.2cqw;
  border-top: 1px solid var(--rule);
}
.week { display: grid; gap: 0.5cqw; min-width: 0; }
.week-label { font-size: var(--fs-meta); line-height: 1.3; color: var(--ink-soft); }
.week-label b { display: block; font-family: var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); font-weight: 600; }
.days { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4cqw; margin: 0; padding: 0; list-style: none; }
.days li {
  display: grid;
  place-items: center;
  aspect-ratio: 1.7;
  border: 1px solid var(--rule);
  border-radius: 0.35cqw;
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.days li.today { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.days li.final { border-style: dashed; border-color: var(--accent); color: var(--accent); }

/* ---------- Poll slide ---------- */

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.4cqw; align-items: start; }
.split-3-2 { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }

.intro-row { display: flex; justify-content: space-between; align-items: end; gap: 2cqw; margin-bottom: 1.8cqw; flex-wrap: wrap; }
.join {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--ink-soft);
  text-align: right;
}
.join b { display: block; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }

.poll {
  display: grid;
  gap: 1cqw;
  padding: 1.5cqw 1.6cqw 1.3cqw;
  border: 1px solid var(--rule);
  border-radius: 0.7cqw;
  background: var(--paper);
  min-width: 0;
}
.poll fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 0.6cqw; min-width: 0; }
.poll legend { padding: 0; margin-bottom: 0.4cqw; }
.poll legend small { display: block; margin-top: 0.3cqw; font-family: var(--font-body); font-size: var(--fs-small); font-weight: 400; color: var(--ink-soft); font-stretch: 100%; }

.opt {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9cqw;
  padding: 0.5cqw 1cqw;
  border: 1px solid var(--rule);
  border-radius: 0.5cqw;
  background: var(--paper);
  font-size: var(--fs-body);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 120ms;
}
.opt::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--accent-soft);
  z-index: -1;
  transition: width 600ms cubic-bezier(.2, .7, .2, 1);
}
.poll.show-results .opt::before { width: var(--pct, 0%); }
.opt:hover { border-color: var(--accent); }
.opt:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.opt input { width: 1.15em; height: 1.15em; margin: 0; accent-color: var(--accent); }
.opt .pct { font-family: var(--font-mono); font-size: var(--fs-small); font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; visibility: hidden; }
.poll.show-results .opt .pct { visibility: visible; }

.poll-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6cqw 1.2cqw; }
.poll-foot .total { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-small); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.poll-status { flex-basis: 100%; margin: 0; font-size: var(--fs-small); color: var(--ink-soft); }
.poll-status:empty { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.5em 1em;
  border: 2px solid var(--accent);
  border-radius: 99px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-small);
  font-weight: 700;
  cursor: pointer;
  transition: transform 80ms, background 120ms;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn-quiet { background: transparent; color: var(--accent); }

.join p { margin: 0; font-size: var(--fs-small); }
.join .privacy { margin-top: 0.5cqw; max-width: 30em; margin-left: auto; font-family: var(--font-body); }
.read .join .privacy { margin-left: 0; }

/* ---------- Concept slide: agent loop ---------- */

.formula {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4em 0.6em;
  margin: 1.4cqw 0 1.8cqw;
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 700;
  font-stretch: 112%;
}
.formula .op { color: var(--ink-soft); font-weight: 400; }

.formula-h { font-stretch: 112%; }
.formula-h .op { color: var(--ink-soft); font-weight: 400; }
.split-concept { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); margin-top: 1.8cqw; }
.versus { display: grid; gap: 0.9cqw; margin: 0; padding: 0; list-style: none; }
.versus li { display: grid; grid-template-columns: 6.2em 1fr; gap: 1cqw; align-items: baseline; }
.versus .tag { font-family: var(--font-mono); font-size: var(--fs-small); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.versus li.agent .tag { color: var(--accent); font-weight: 600; }

.loop {
  position: relative;
  --loop-top: 4.95cqw;
  --loop-bottom: 4.95cqw;
  margin: 1.4cqw 0 0;
  padding: 0 0 0 3.4cqw;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 0.55cqw;
}
/* The return arrow on the left: "not done yet, go round again" */
.loop::before {
  content: "";
  position: absolute;
  left: 0.9cqw;
  top: var(--loop-top);
  bottom: var(--loop-bottom);
  width: 1.6cqw;
  border: 2px solid var(--accent);
  border-right: 0;
  border-radius: 0.8cqw 0 0 0.8cqw;
}
.loop::after {
  content: "";
  position: absolute;
  left: 2.1cqw;
  top: calc(var(--loop-top) - 0.55cqw);
  border: 0.55cqw solid transparent;
  border-left: 0.75cqw solid var(--accent);
}
.loop li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.2em 1fr;
  gap: 0.8cqw;
  align-items: baseline;
  padding: 0.5cqw 0.9cqw;
  border: 1px solid var(--rule);
  border-radius: 0.5cqw;
  background: var(--paper);
  font-size: var(--fs-small);
  line-height: 1.45;
}
.loop li::before {
  content: counter(step);
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
}
.loop li.check { border-color: var(--accent); }
.loop li.done { border-style: dashed; }
.loop-wrap { position: relative; }
.loop-wrap .back-label {
  position: absolute;
  left: -0.4cqw;
  top: 52%;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--paper);
  padding: 0 0.4em;
  margin-left: 1.7cqw;
}

/* ---------- Terminal slip ---------- */

.term {
  margin: 0;
  border: 1px solid var(--term-edge);
  border-radius: 0.7cqw;
  background: var(--term);
  color: var(--term-ink);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  line-height: 1.55;
  overflow: hidden;
  min-width: 0;
}
.term-bar {
  display: flex;
  justify-content: space-between;
  gap: 1cqw;
  padding: 0.7cqw 1.2cqw;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--term-dim);
  font-size: var(--fs-meta);
  letter-spacing: 0.04em;
}
.term pre {
  margin: 0;
  padding: 1.1cqw 1.3cqw 1.3cqw;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.term .you { color: var(--term-cmd); }
.term .tool { color: var(--term-ink); }
.term .dim { color: var(--term-dim); }
.term .ok { color: var(--term-ok); }
.term .err { color: var(--term-err); }

/* ---------- Prompt cards ---------- */

.prompt {
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--term-edge);
  border-radius: 0.7cqw;
  background: var(--term);
  color: var(--term-ink);
  overflow: hidden;
  min-width: 0;
}
.prompt figcaption {
  display: flex;
  align-items: center;
  gap: 1cqw;
  padding: 0.6cqw 0.8cqw 0.6cqw 0.8cqw;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--term-dim);
}
.prompt figcaption .label { color: var(--term-ink); font-weight: 600; }
.prompt pre {
  margin: 0;
  padding: 1.2cqw 1.4cqw 1.4cqw;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.prompt .slot {
  color: var(--mark-ink);
  background: var(--mark);
  padding: 0 0.2em;
  border-radius: 0.15em;
}
.copy {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.35em 0.85em;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 99px;
  background: transparent;
  color: var(--term-ink);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.copy:hover { background: rgba(255, 255, 255, 0.08); }
.copy.is-done { border-color: var(--term-ok); color: var(--term-ok); }
.copy svg { width: 1em; height: 1em; }

.tabs { display: inline-flex; gap: 0.3cqw; flex-wrap: wrap; }
.tabs [role="tab"] {
  padding: 0.3em 0.8em;
  border: 1px solid transparent;
  border-radius: 99px;
  background: transparent;
  color: var(--term-dim);
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}
.tabs [role="tab"]:hover { color: var(--term-ink); }
.tabs [role="tab"][aria-selected="true"] { color: var(--term-ink); border-color: rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.06); font-weight: 600; }

.why { display: grid; gap: 1.2cqw; align-content: start; }
.why ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.9cqw; }
.why li { display: grid; grid-template-columns: 1.1em 1fr; gap: 0.6cqw; line-height: 1.4; }
.why li::before { content: "✓"; color: var(--accent); font-weight: 700; }
.stuck {
  padding: 1cqw 1.2cqw;
  border: 1px dashed var(--accent);
  border-radius: 0.6cqw;
  font-size: var(--fs-small);
  line-height: 1.45;
}
.stuck b { display: block; margin-bottom: 0.2em; font-family: var(--font-mono); font-size: var(--fs-meta); letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.05em 0.4em;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 0.3em;
  background: var(--paper);
}

/* ---------- Speaker notes (never shown in read mode) ---------- */

.notes { display: none; }
.notes-panel {
  display: none;
  min-width: 0;
  margin: 16px 0 16px 16px;
  padding: 18px 20px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--paper);
  overflow: auto;
}
.deck.notes-open .notes-panel { display: block; }
.notes-panel h2 { font-size: 13px; font-family: var(--font-mono); font-stretch: 100%; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.notes-panel p, .notes-panel li { font-size: 15px; line-height: 1.5; margin: 0 0 8px; }
.notes-panel ul { padding-left: 1.1em; margin: 0; }

/* ---------- Controls ---------- */

.controls {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--rule);
  border-radius: 99px;
  background: var(--chrome);
  backdrop-filter: blur(8px);
  font-size: 13px;
  z-index: 20;
  max-width: calc(100vw - 32px);
}
.controls button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 99px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.controls button:hover { background: var(--accent-soft); color: var(--ink); }
.controls button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.controls .count { min-width: 4.2em; text-align: center; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.controls .sep { width: 1px; height: 20px; background: var(--rule); margin: 0 4px; }
.controls kbd { font-size: 11px; padding: 0 5px; }

/* ---------- Read mode: slides stacked, page scrolls ---------- */

.deck.read {
  position: static;
  display: block;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}
.deck.read .stage-wrap { display: block; padding: 0; }
.deck.read .stage {
  width: min(100%, 1100px);
  aspect-ratio: auto;
  margin: 0 auto;
  container-type: normal;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}
.deck.read .slide {
  position: relative;
  inset: auto;
  display: grid;
  container-type: inline-size;
  min-width: 0;
  padding: max(18px, 3cqw) max(16px, 3.6cqw) max(14px, 2cqw);
  gap: max(14px, 1.8cqw);
  border-radius: 12px;
  animation: none;
}
.deck.read .notes-panel { display: none; }
.is-read .controls .notes-toggle, .is-read .controls .fs-toggle, .is-read .controls .nav-btn, .is-read .controls .count, .is-read .controls .nav-sep { display: none; }

/* Narrow slides (read mode on a phone): stack every multi-column layout. */
@container (max-width: 760px) {
  .read .title-grid, .read .split, .read .split-3-2 { grid-template-columns: minmax(0, 1fr); }
  .read .title-grid { grid-template-rows: auto; }
  .read .course-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .read .intro-row { align-items: start; }
  .read .join { text-align: left; }
  .read .slide-head { flex-direction: column; gap: 4px; }
  .read .loop::before, .read .loop::after, .read .loop-wrap .back-label { display: none; }
  .read .loop { padding-left: 0; }
  .read .loop-note { display: block; }
}
.loop-note { display: none; margin: 8px 0 0; font-size: var(--fs-small); color: var(--accent); }

@media print {
  body { background: #fff; }
  .controls, .notes-panel { display: none !important; }
  .deck { position: static; display: block; padding: 0; }
  .stage { width: 100%; aspect-ratio: auto; container-type: normal; }
  .slide { position: relative; display: grid; width: 100%; aspect-ratio: 16 / 9; container-type: size; break-after: page; box-shadow: none; border-radius: 0; }
}
