:root {
  --paper: #f0eee6;
  --ink: #1f1e1d;
  --muted: #6b6a66;
  --clay: #d97757;
  --line: #d8d5ca;
  --editor: #1f1e1d;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
}

#deck { height: 100vh; height: 100dvh; }

.slide {
  height: 100vh;
  height: 100dvh;
  padding: 6vh 7vw;
  display: flex;
  flex-direction: column;
  animation: fade 0.25s ease;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

h1 {
  font-family: var(--serif);
  font-weight: normal;
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 1.1;
  margin: 0 0 0.4em;
  letter-spacing: -0.01em;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.05em 0.3em;
  border-radius: 4px;
}

a { color: var(--clay); }

.kicker {
  font-size: clamp(0.9rem, 1.4vw, 1.3rem);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--clay);
  margin: 0 0 0.8em;
  font-weight: 600;
}

/* ---------- title / section / statement ---------- */

.title-slide, .section-slide, .statement-slide {
  justify-content: center;
}

.title-slide h1 { font-size: clamp(3rem, 8vw, 7.5rem); }
.title-slide .subtitle {
  font-size: clamp(1.1rem, 2.2vw, 2rem);
  color: var(--muted);
  margin: 0;
}

.section-slide { background: var(--ink); color: var(--paper); }
.section-slide h1 { font-size: clamp(3rem, 7vw, 6.5rem); }
.section-slide .bullets { color: #bdbab0; }

.statement-slide h1 { font-size: clamp(2.5rem, 6vw, 5.5rem); max-width: 18ch; }
.statement-slide .body { font-size: clamp(1.1rem, 2.2vw, 2rem); color: var(--muted); max-width: 40ch; }
.statement-slide .body pre {
  font-family: var(--mono);
  font-size: 0.8em;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8em 1.1em;
  width: max-content;
}

/* ---------- bullets ---------- */

.bullets-slide { justify-content: center; }

.lead {
  font-size: clamp(1.2rem, 2.3vw, 2.1rem);
  color: var(--muted);
  margin: 0 0 0.8em;
  max-width: 45ch;
}

.bullets {
  font-size: clamp(1.1rem, 2.1vw, 1.9rem);
  line-height: 1.45;
  padding-left: 1.2em;
  margin: 0;
  max-width: 52ch;
}
.bullets li { margin: 0.25em 0; }
.bullets li::marker { color: var(--clay); }
.bullets .bullets { font-size: 0.8em; color: var(--muted); margin: 0.1em 0 0.3em; }

/* ---------- columns (50/50 split) ---------- */

/* Desktop: the boxes fill the space under the title, so the slide reads as a
   full 16:9 frame instead of a short strip of content. */
.columns-slide { justify-content: flex-start; }
.columns-slide h1 { margin-bottom: 0.8em; }
.columns {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3vw;
}
.column {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4vh 2.5vw;
  overflow: auto;
}
.column h2 {
  font-size: clamp(1.4rem, 2.8vw, 2.6rem);
  margin: 0 0 0.5em;
  padding-bottom: 0.3em;
  border-bottom: 3px solid var(--clay);
}
.column .body { font-size: clamp(1.1rem, 2.1vw, 1.9rem); line-height: 1.45; }
.column .body p { margin: 0 0 0.6em; }
.column .body .muted { color: var(--muted); }
.column .prompt { background: var(--paper); }
.column .bullets { max-width: none; }

.slide-footer {
  margin-top: 1.5em;
  color: var(--muted);
  font-size: clamp(0.9rem, 1.3vw, 1.2rem);
}

.prompt {
  font-family: var(--mono);
  font-size: 0.8em;
  background: white;
  border-left: 4px solid var(--clay);
  padding: 0.7em 1em;
  border-radius: 6px;
  display: block;
  line-height: 1.5;
}

/* ---------- code slides ---------- */

.code-slide { padding: 3vh 3vw 4vh; gap: 2vh; }

.code-slide header h1 { font-size: clamp(1.6rem, 3.2vw, 3rem); margin: 0; }
.code-slide header .kicker { margin-bottom: 0.3em; font-size: clamp(0.8rem, 1vw, 1rem); }
.code-slide .caption {
  margin: 0.3em 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.5rem);
}

.split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2vw;
}

.editor-pane, .preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(31, 30, 29, 0.15);
}

.editor-pane { background: var(--editor); }

.tabs {
  display: flex;
  gap: 2px;
  background: #141413;
  padding: 6px 6px 0;
  /* Five tabs can outgrow the bar: scroll the bar, never the pane. */
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex-shrink: 0; white-space: nowrap; }
.tabs button {
  font: 500 15px var(--mono);
  color: #a8a59b;
  background: transparent;
  border: 0;
  padding: 10px 16px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
}
.tabs button.on { background: var(--editor); color: white; }
.tabs .spacer { flex: 1; }
.tabs .reset { font-family: var(--sans); font-size: 13px; color: #6f6c64; position: sticky; right: 0; background: #141413; box-shadow: -12px 0 12px #141413; }
.tabs .reset:hover { color: white; }

.cm-host { flex: 1; min-height: 0; }
.cm-host .CodeMirror {
  height: 100%;
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.5;
  padding-top: 10px;
}
.cm-s-dracula.CodeMirror, .cm-s-dracula .CodeMirror-gutters { background: var(--editor) !important; }
.cm-s-dracula .CodeMirror-gutters { border-right: 0; }
.cm-s-dracula .CodeMirror-linenumber { color: #5c5a55; }

/* Added lines, like a diff: soft green row and a bar in the gutter. */
.CodeMirror .line-added { background: rgba(80, 250, 123, 0.12); }
.CodeMirror .line-added-gutter { box-shadow: inset 3px 0 #50fa7b; }
.CodeMirror .line-added-gutter .CodeMirror-linenumber { color: #50fa7b; }

.preview { background: white; border: 1px solid var(--line); }

.chrome {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #e9e6dc;
  border-bottom: 1px solid var(--line);
}
.dots { display: flex; gap: 6px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: #cfcbbf; display: block; }
.address {
  flex: 1;
  font: 15px var(--mono);
  background: white;
  border-radius: 999px;
  padding: 6px 14px;
  color: var(--muted);
}
.refresh {
  border: 0;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
}

.preview .viewport { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.preview iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; background: white; }

/* ---------- notes / help / progress ---------- */

#notes {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 45vh;
  overflow: auto;
  background: rgba(20, 20, 19, 0.96);
  color: #eee;
  padding: 1.2rem 3vw 2rem;
  z-index: 10;
  font-size: 1.15rem;
}
#notes h3 { margin: 0 0 0.4em; color: var(--clay); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.1em; }
#notes .bullets { font-size: 1.15rem; max-width: none; }
#notes .bullets .bullets { color: #bbb; }
#notes code { background: rgba(255, 255, 255, 0.1); }
#notes .empty { color: #888; margin: 0; }

#help {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
  z-index: 20;
}
#help[hidden], #notes[hidden] { display: none; }
.help-card { background: white; padding: 2rem 2.5rem; border-radius: 14px; width: min(34rem, 92vw); max-height: 90dvh; overflow: auto; }
.help-card h2 { margin-top: 0; font-family: var(--serif); font-weight: normal; }
.help-card dl { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.5rem; margin: 0; }
.help-card dt { font-family: var(--mono); font-size: 0.9rem; }
.help-card dd { margin: 0; color: var(--muted); }

#progress {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  z-index: 5;
}
#progress .bar { height: 100%; background: var(--clay); width: 0; transition: width 0.2s; }
#progress .count {
  position: fixed;
  right: 14px;
  bottom: 10px;
  font: 12px var(--mono);
  color: var(--muted);
  opacity: 0.6;
}

.bullets li:has(> .prompt) { list-style: none; margin-left: -1.2em; }

/* ---------- gallery slides (screenshots in browser chrome) ---------- */

.gallery-slide { padding: 3vh 3vw 4vh; gap: 2vh; }
.gallery-slide header h1 { font-size: clamp(1.6rem, 3.2vw, 3rem); margin: 0; }
.gallery-slide header .kicker { margin-bottom: 0.3em; font-size: clamp(0.8rem, 1vw, 1rem); }
.gallery-slide .caption { margin: 0.3em 0 0; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.5rem); }

/* The prompt that made the thing, styled like the Ask AI prompt. */
.gallery-prompt {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(0.95rem, 1.5vw, 1.4rem);
  line-height: 1.5;
  background: white;
  border-left: 4px solid var(--clay);
  border-radius: 6px;
  padding: 0.6em 1em;
}

.shots {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 2vh 1.5vw;
}
.shots-1 { grid-template-columns: 1fr; }
.shots-2 { grid-template-columns: 1fr 1fr; }
.shots-3, .shots-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.shot {
  margin: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(31, 30, 29, 0.14);
}
.shots .chrome { padding: 6px 10px; gap: 8px; }
.shots .dots i { width: 9px; height: 9px; }
.shots .address { font-size: 12px; padding: 3px 10px; }
.shot-view { flex: 1; min-height: 0; }
.shot-view img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }

@media (max-width: 700px) {
  .gallery-slide { padding: 2.5vh 3vw calc(62px + env(safe-area-inset-bottom)); gap: 1.2vh; overflow-y: auto; }
  .gallery-slide header h1 { font-size: 1.4rem; }
  .gallery-slide header .kicker { font-size: 0.7rem; }
  .gallery-prompt { font-size: 0.85rem; }
  .shots { flex: none; grid-template-columns: 1fr; grid-template-rows: none; }
  .shot-view { flex: none; aspect-ratio: 16 / 10; }
}

/* ---------- video slides ---------- */

.video-slide { padding: 3vh 3vw 4vh; gap: 2vh; }
.video-slide header h1 { font-size: clamp(1.6rem, 3.2vw, 3rem); margin: 0; }
.video-slide header .kicker { margin-bottom: 0.3em; font-size: clamp(0.8rem, 1vw, 1rem); }
.video-slide .caption { margin: 0.3em 0 0; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.5rem); }

.video-frame {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  background: var(--ink);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(31, 30, 29, 0.15);
}
.video-frame video { width: 100%; height: 100%; object-fit: contain; background: black; }
.video-frame video[hidden], .video-missing[hidden] { display: none; }
.video-missing { color: #bdbab0; font-size: clamp(1rem, 1.8vw, 1.6rem); }
.video-missing code { background: rgba(255, 255, 255, 0.1); }

/* ---------- file-explorer slides ---------- */

.files-slide { padding: 3vh 3vw 4vh; gap: 2vh; }
.files-slide header h1 { font-size: clamp(1.6rem, 3.2vw, 3rem); margin: 0; }
.files-slide header .kicker { margin-bottom: 0.3em; font-size: clamp(0.8rem, 1vw, 1rem); }
.files-slide .caption { margin: 0.3em 0 0; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.5rem); }

.finder {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(31, 30, 29, 0.15);
  font-family: var(--sans);
}

.finder-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 16px;
  background: #f3f2ee;
  border-bottom: 1px solid var(--line);
  font-size: clamp(14px, 1.3vw, 19px);
  font-weight: 600;
}
.lights { display: flex; gap: 8px; }
.lights i { width: 13px; height: 13px; border-radius: 50%; display: block; }
.lights i:nth-child(1) { background: #ff5f57; }
.lights i:nth-child(2) { background: #febc2e; }
.lights i:nth-child(3) { background: #28c840; }
.finder-arrows { color: #b5b2a8; font-size: 1.5em; line-height: 1; font-weight: normal; }
.finder-title { display: flex; align-items: center; gap: 8px; }

.folder-icon {
  display: inline-block;
  width: 1.1em;
  height: 0.8em;
  background: #5aa9e6;
  border-radius: 2px 3px 3px 3px;
  position: relative;
  margin-top: 0.15em;
}
.folder-icon::before {
  content: '';
  position: absolute;
  left: 0;
  top: -0.18em;
  width: 45%;
  height: 0.25em;
  background: #5aa9e6;
  border-radius: 2px 2px 0 0;
}

.finder-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(150px, 17%) 1fr;
}
.finder-side {
  background: #f7f6f2;
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  font-size: clamp(13px, 1.1vw, 17px);
  color: var(--ink);
}
.finder-side p { margin: 0 0 6px 8px; font-size: 0.8em; font-weight: 600; color: var(--muted); }
.finder-side ul { list-style: none; margin: 0; padding: 0; }
.finder-side li { padding: 5px 8px; border-radius: 6px; }

.finder-grid {
  padding: 4vh 3vw;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 3vh 2.5vw;
  overflow: auto;
}

.file {
  width: clamp(110px, 11vw, 180px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.file .icon {
  width: 100%;
  height: clamp(80px, 9vw, 140px);
  display: grid;
  place-items: center;
  border-radius: 8px;
  padding: 6px;
}
.file .name {
  font-size: clamp(13px, 1.2vw, 18px);
  padding: 2px 8px;
  border-radius: 5px;
  text-align: center;
  overflow-wrap: anywhere;
}

/* Page icon with a folded corner. drop-shadow follows the clipped shape. */
.doc {
  height: 100%;
  aspect-ratio: 0.78;
  position: relative;
  background: white;
  clip-path: polygon(0 0, 72% 0, 100% 22%, 100% 100%, 0 100%);
}
.icon:has(.doc) { filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.45)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.12)); }
.doc::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 28%;
  height: 22%;
  background: #dedbd1;
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}
.doc b {
  position: absolute;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  font: 700 clamp(10px, 0.9vw, 14px) var(--mono);
  padding: 2px 6px;
  border-radius: 3px;
  color: white;
  background: var(--muted);
}
.doc-html b { background: #e34c26; }
.doc-css b { background: #2965f1; }
.doc-js b { background: #f0db4f; color: var(--ink); }

.thumb { width: 100%; height: 100%; min-width: 0; min-height: 0; display: grid; place-items: center; }
.thumb img {
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  border: 3px solid white;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* The new file pops in, then Finder selects it. */
.file.new { animation: file-in 0.45s 0.5s both cubic-bezier(0.2, 0.9, 0.3, 1.3); }
.file.new .icon { animation: icon-select 0.01s 1s both; }
.file.new .name { animation: name-select 0.01s 1s both; }
@keyframes file-in { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: none; } }
@keyframes icon-select { from { background: transparent; } to { background: rgba(0, 0, 0, 0.08); } }
@keyframes name-select { from { background: transparent; color: inherit; } to { background: #2f6fde; color: white; } }

.finder-path {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  background: #f7f6f2;
  color: var(--muted);
  font-size: clamp(12px, 1vw, 15px);
}

/* ---------- step reveals ---------- */

[data-at] { transition: opacity 0.35s ease, transform 0.35s ease; }
[data-at]:not(.shown) { opacity: 0; transform: translateY(6px); }

/* ---------- flow slides (boxes and arrows) ---------- */

.flow-slide { padding: 3vh 3vw 4vh; gap: 2vh; }
.flow-slide header h1 { font-size: clamp(1.6rem, 3.2vw, 3rem); margin: 0; }
.flow-slide header .kicker { margin-bottom: 0.3em; font-size: clamp(0.8rem, 1vw, 1rem); }
.flow-slide .caption { margin: 0.3em 0 0; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.5rem); max-width: 60ch; }

/* Hub layout: the first box fills the left column, and each other box gets a
   row on the right with its arrows in front of it. */
.flow {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.5fr);
  align-content: center;
  column-gap: 0;
  row-gap: 3vh;
}
.branch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  align-items: center;
  gap: 1vw;
}

/* The hub box stretches the full height so both rows of arrows meet it. */
.node.hub { display: flex; flex-direction: column; }
.node.hub .node-body { flex: 1; display: flex; flex-direction: column; }

.node {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 2.5vh 1.4vw;
  box-shadow: 0 10px 30px rgba(31, 30, 29, 0.12);
  text-align: center;
}
.node h2 {
  font-family: var(--serif);
  font-weight: normal;
  font-size: clamp(1.3rem, 2.4vw, 2.3rem);
  margin: 0;
}
.node-sub { margin: 0.2em 0 0; color: var(--muted); font-size: clamp(0.9rem, 1.3vw, 1.25rem); }
.node-body { margin-top: 2vh; font-size: clamp(0.8rem, 1.1vw, 1.05rem); text-align: left; }

/* One arrow: a numbered label above a line with a head on one end. */
.link { display: flex; flex-direction: column; gap: 4vh; }
.msg { display: flex; flex-direction: column; gap: 8px; }
.msg-text {
  font-size: clamp(0.85rem, 1.3vw, 1.25rem);
  line-height: 1.3;
  text-align: center;
}
.msg .num {
  display: inline-grid;
  place-items: center;
  width: 1.5em;
  height: 1.5em;
  margin-right: 0.4em;
  border-radius: 50%;
  background: var(--clay);
  color: white;
  font: 700 0.8em var(--sans);
  vertical-align: 0.1em;
}
.arrow { position: relative; display: block; height: 3px; background: var(--clay); margin: 0 6px; }
.arrow::after {
  content: '';
  position: absolute;
  top: 50%;
  border: 9px solid transparent;
  transform: translateY(-50%);
}
.msg-right .arrow::after { right: -12px; border-left: 13px solid var(--clay); border-right-width: 0; }
.msg-left .arrow::after { left: -12px; border-right: 13px solid var(--clay); border-left-width: 0; }

/* DNS: one row of the phone book. The address fills in, then the row lights. */
.phonebook {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
  font-family: var(--mono);
  padding: 0.6em 0.8em;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: background 0.35s, border-color 0.35s;
}
.phonebook.lit { background: #fbe9e2; border-color: var(--clay); }
.phonebook .ip { color: var(--clay); font-weight: 700; }
.phonebook .ip::before { content: '\2192  '; color: var(--muted); font-weight: normal; }

/* Web server: its address, matching the phone-book row. Lights up with it. */
.server-ip {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0 0.8em;
  margin-bottom: 0.8em;
  padding: 0.5em 0.8em;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: background 0.35s, border-color 0.35s;
}
.server-ip span { color: var(--muted); font-size: 0.9em; }
.server-ip b { font-family: var(--mono); color: var(--clay); }
.server-ip.lit { background: #fbe9e2; border-color: var(--clay); }

/* Browser: a node drawn as a browser window, in the same chrome as the
   code-slide previews but a size smaller. The label sits above the window,
   and the window fills the rest of the column so the arrows meet it. The
   page shows up once the files arrive. */
.node-browser { background: none; border: 0; box-shadow: none; padding: 0; gap: 1.2vh; }
.node-browser h2 { font-size: clamp(1.1rem, 1.9vw, 1.8rem); }
.browser-window {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(31, 30, 29, 0.15);
  text-align: left;
}
.browser-window .chrome { padding: 7px 10px; gap: 8px; }
.browser-window .dots { gap: 5px; }
.browser-window .dots i { width: 9px; height: 9px; }
.browser-window .address { font-size: clamp(11px, 1vw, 14px); padding: 4px 10px; color: var(--ink); }
.browser-window .refresh { font-size: 15px; cursor: default; }
.browser-view { flex: 1; background: var(--paper); font-size: clamp(0.8rem, 1.1vw, 1.05rem); }
.mini-page { padding: 0.8em 1em; font-family: var(--serif); }
.mini-page b { display: block; color: var(--clay); font-size: 1.6em; font-weight: bold; }
.mini-page p { margin: 0.3em 0 0; }

/* Web server: the site's files. The ones that get sent light up. */
.mini-files { list-style: none; margin: 0; padding: 0; font-family: var(--mono); }
.mini-files li {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.2em 0.4em;
  border-radius: 5px;
  white-space: nowrap;
  transition: background 0.35s;
}
.mini-files li.lit { background: #fbe9e2; }
.mini-files .ext {
  flex: none;
  width: 3.4em;
  text-align: center;
  font-size: 0.75em;
  font-weight: 700;
  color: white;
  background: var(--muted);
  border-radius: 3px;
  padding: 1px 0;
}
.mini-files .ext-html { background: #e34c26; }
.mini-files .ext-css { background: #2965f1; }
.mini-files .ext-js { background: #f0db4f; color: var(--ink); }

/* ---------- touch nav (phones and tablets) ---------- */

#touch-nav { display: none; }

@media (hover: none), (max-width: 700px) {
  #touch-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
    pointer-events: none;
  }
  #touch-nav button {
    pointer-events: auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.85);
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  }
  #touch-nav button:disabled { opacity: 0.3; }
  #touch-nav .touch-count {
    font: 12px var(--mono);
    color: var(--muted);
    background: rgba(240, 238, 230, 0.85);
    padding: 3px 8px;
    border-radius: 999px;
  }
  #progress .count { display: none; }
}

/* ---------- phones in portrait ---------- */

@media (max-width: 700px) {
  .slide {
    padding: 7vh 6vw calc(70px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Text slides: start at the top so long ones scroll instead of clipping. */
  .bullets-slide, .statement-slide, .title-slide, .section-slide, .columns-slide { justify-content: flex-start; padding-top: 12vh; }
  .columns { flex: none; grid-template-columns: 1fr; gap: 1.2rem; }
  .column { padding: 1.2rem 1.2rem 0.6rem; overflow: visible; }
  .columns-slide h1 { margin-bottom: 0.6em; }
  .column h2 { font-size: 1.4rem; }
  .column .body { font-size: 1.1rem; }

  h1 { font-size: 2rem; }
  .title-slide h1 { font-size: 2.8rem; }
  .section-slide h1 { font-size: 2.8rem; }
  .statement-slide h1 { font-size: 2.3rem; }
  .title-slide .subtitle, .statement-slide .body, .lead { font-size: 1.1rem; }
  .bullets { font-size: 1.1rem; line-height: 1.4; max-width: none; }
  .bullets .bullets { font-size: 0.9em; }
  .slide-footer { font-size: 0.9rem; }
  .statement-slide .body pre { font-size: 0.85rem; width: auto; }
  .prompt { font-size: 0.85rem; }

  /* Code slides: editor on top, preview below, both live. */
  .code-slide, .video-slide {
    padding: 2.5vh 3vw calc(62px + env(safe-area-inset-bottom));
    gap: 1.2vh;
    overflow: hidden;
  }
  .code-slide header h1, .video-slide header h1 { font-size: 1.4rem; }
  .code-slide header .kicker, .video-slide header .kicker { font-size: 0.7rem; }
  .code-slide .caption, .video-slide .caption { font-size: 0.9rem; }

  .split {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 1.2vh;
  }
  .editor-pane, .preview { border-radius: 10px; }

  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { font-size: 12px; padding: 8px 10px; white-space: nowrap; }
  .tabs .reset { font-size: 11px; }
  .cm-host .CodeMirror { padding-top: 4px; }

  .chrome { padding: 6px 8px; gap: 8px; }
  .dots { display: none; }
  .address { font-size: 12px; padding: 4px 10px; }

  .video-frame { border-radius: 10px; }

  /* File explorer: no sidebar, three icons per row. */
  .files-slide { padding: 2.5vh 3vw calc(62px + env(safe-area-inset-bottom)); gap: 1.2vh; overflow: hidden; }
  .files-slide header h1 { font-size: 1.4rem; }
  .files-slide header .kicker { font-size: 0.7rem; }
  .finder { border-radius: 10px; }
  .finder-body { grid-template-columns: 1fr; }
  .finder-side { display: none; }
  .finder-grid { padding: 20px 10px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 6px; }
  .file { width: auto; min-width: 0; }
  .file .icon { height: 72px; }
  .file .name { font-size: 12px; }
  .finder-path { font-size: 11px; flex-wrap: wrap; }

  #notes { font-size: 1rem; max-height: 60dvh; padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  #notes .bullets { font-size: 1rem; }
  .help-card { padding: 1.4rem; }
  .help-card dl { grid-template-columns: 1fr; gap: 0.15rem; }
  .help-card dd { margin-bottom: 0.5rem; }
}

/* Flow slides on phones: the browser goes on top, the other boxes sit side
   by side below it, and the arrows turn vertical (right becomes down, left
   becomes up). */
@media (max-width: 700px) {
  .flow-slide { padding: 2.5vh 4vw calc(70px + env(safe-area-inset-bottom)); gap: 1.2vh; overflow-y: auto; }
  .flow-slide header h1 { font-size: 1.4rem; }
  .flow-slide header .kicker { font-size: 0.7rem; }
  .flow-slide .caption { font-size: 0.9rem; }
  .flow { flex: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-content: start; gap: 0.6rem; }
  .node.hub { grid-row: auto !important; grid-column: 1 / -1; }
  .node-browser .browser-view { min-height: 5em; }
  .branch { display: flex; flex-direction: column; gap: 0.4rem; }
  .node { padding: 0.7rem; }
  .node h2 { font-size: 1.15rem; }
  .node-sub { font-size: 0.8rem; }
  .node-body { margin-top: 0.5rem; font-size: 0.72rem; }
  .mini-files li { white-space: normal; overflow-wrap: anywhere; padding: 0.15em 0.2em; }
  .link { gap: 1rem; padding: 0.3rem 0 0.5rem 0.6rem; }
  .msg { flex-direction: row; align-items: center; gap: 0.6rem; }
  .msg-text { font-size: 0.75rem; text-align: left; order: 2; }
  .arrow { order: 1; flex: none; width: 3px; height: 26px; margin: 6px 0; }
  .msg-right .arrow::after { right: auto; left: 50%; top: auto; bottom: -12px; transform: translateX(-50%); border: 7px solid transparent; border-top: 12px solid var(--clay); border-bottom-width: 0; }
  .msg-left .arrow::after { left: 50%; top: -12px; transform: translateX(-50%); border: 7px solid transparent; border-bottom: 12px solid var(--clay); border-top-width: 0; }
}

@media (max-width: 700px) {
  .video-slide { justify-content: flex-start; }
  .video-frame { flex: none; aspect-ratio: 16 / 9; }
  .video-missing { font-size: 0.9rem; padding: 0 1rem; text-align: center; }
}

/* ---------- follow-along (hosted) ---------- */

body.viewer .presenter-only { display: none !important; }

#live {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  right: 12px;
  z-index: 7;
  font: 12px var(--mono);
}
#live[hidden], #live [hidden] { display: none !important; }
#live .live-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(240, 238, 230, 0.85);
  border: 1px solid var(--line);
  color: var(--muted);
}
#live .live-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b8b5ab;
}
#live.on .live-status::before { background: var(--clay); }
#live.warn .live-status { color: #9a3b1f; }
#live .live-follow {
  font: 600 13px var(--sans);
  padding: 7px 14px;
  border-radius: 999px;
  border: none;
  background: var(--clay);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

/* QR code on the title slide, for scanning off the TV. */
.title-slide { position: relative; }
.title-slide .qr {
  position: absolute;
  right: 7vw;
  bottom: 8vh;
  margin: 0;
  text-align: center;
}
.title-slide .qr img {
  display: block;
  width: clamp(120px, 15vw, 240px);
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.title-slide .qr figcaption {
  margin-top: 0.5em;
  font: clamp(0.75rem, 1vw, 1rem) var(--mono);
  color: var(--muted);
}

@media (max-width: 700px) {
  .title-slide .qr { position: static; margin-top: 2rem; align-self: flex-start; }
  .title-slide .qr img { width: 140px; }
}
