/* ============================================================
   Transcriber: a control room for listening.
   Petrol-teal panels, one coral-red signal colour, slab titles,
   monospaced labels. Red only ever means "this one".
   ============================================================ */

@font-face {
  font-family: "Roboto Slab";
  src: url(fonts/roboto-slab.woff2) format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url(fonts/jetbrains-mono.woff2) format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-slab: "Roboto Slab", Rockwell, "Courier New", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #0a1d24;
  --rail: #0d242c;
  --panel: #10303a;
  --panel-2: #143843;
  --panel-3: #18414d;
  --cell: #1a4450;
  --cell-on: #5cc3d6;
  --line: rgba(150, 205, 218, 0.11);
  --line-strong: rgba(150, 205, 218, 0.22);
  --text: #e4f0f2;
  --muted: #98b5bd;
  --faint: #62848d;
  --accent: #ff3d5e;
  --accent-2: #ff6a82;
  --accent-soft: rgba(255, 61, 94, 0.16);
  --accent-ink: #ffffff;
  --teal: #56b6ca;
  --danger: #ff5a73;
  --ok: #4fd1a5;
  --shadow-pop: 0 18px 40px -16px rgba(0, 0, 0, 0.75);
  --wave-idle: rgba(150, 205, 218, 0.14);
  --wave-decoded: rgba(150, 205, 218, 0.34);
  --wave-draft: rgba(255, 61, 94, 0.4);
  --wave-done: #56b6ca;
  --wave-done-2: #56b6ca;
  --wave-head: #ff3d5e;

  /* speaker hues: teal family first, red is kept for selection */
  --spk-0: #56b6ca;
  --spk-1: #e7b35a;
  --spk-2: #9d8cf0;
  --spk-3: #6fd3a0;
  --spk-4: #f08fb5;
  --spk-5: #c7d86a;

  --r: 6px;
  --r-sm: 4px;
  --topbar: 64px;
  --rail-w: 232px;
  --stick: calc(var(--topbar) + 10px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #e3eaec;
    --rail: #dbe4e7;
    --panel: #f5f9fa;
    --panel-2: #ebf2f4;
    --panel-3: #e0eaed;
    --cell: #d6e3e7;
    --cell-on: #1f8aa3;
    --line: rgba(14, 50, 60, 0.12);
    --line-strong: rgba(14, 50, 60, 0.24);
    --text: #0d2a33;
    --muted: #46656e;
    --faint: #7a959c;
    --accent: #e0284a;
    --accent-2: #f04a66;
    --accent-soft: rgba(224, 40, 74, 0.11);
    --teal: #1f8aa3;
    --danger: #d0283f;
    --ok: #178a62;
    --shadow-pop: 0 18px 40px -18px rgba(13, 42, 51, 0.4);
    --wave-idle: rgba(14, 50, 60, 0.14);
    --wave-decoded: rgba(14, 50, 60, 0.32);
    --wave-draft: rgba(224, 40, 74, 0.35);
    --wave-done: #1f8aa3;
    --wave-done-2: #1f8aa3;
    --wave-head: #e0284a;
    --spk-0: #1f8aa3;
    --spk-1: #b27a14;
    --spk-2: #6a58d6;
    --spk-3: #1e9a64;
    --spk-4: #c2477a;
    --spk-5: #7b8a12;
  }
}

/* ---------- base ---------- */

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--stick) + 70px); overflow-x: hidden; overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-x: clip;
}

::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 17px; height: 17px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

code { font: 0.86em var(--font-mono); padding: 0.1em 0.35em; border-radius: var(--r-sm); background: var(--panel-3); }

/* mono micro-labels: "5 MIN CELLS · 10:00–11:15" */
.kicker, .crumb, .spine-label, .log-head, .map-corner, .map-scale, .map-label, .scope, .panel-sub,
.stat small, .spine-foot, .footer {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.kicker { margin: 0 0 6px; font-size: 10.5px; font-weight: 600; color: var(--muted); }
h1, h2 { font-family: var(--font-slab); font-weight: 700; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 1.35rem; line-height: 1.2; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar);
  display: grid; grid-template-columns: var(--rail-w) 1fr auto; align-items: center;
  padding-right: max(20px, env(safe-area-inset-right));
  background: var(--rail);
  border-bottom: 1px solid var(--line);
}

.brand {
  height: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px 0 max(18px, env(safe-area-inset-left));
  border-right: 1px solid var(--line);
  text-decoration: none;
}
.logo-box {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--panel);
}
.logo { width: 22px; height: 22px; color: var(--teal); }
.wordmark { font: 700 14px/1 var(--font-slab); letter-spacing: 0.14em; text-transform: uppercase; }

.context { min-width: 0; display: grid; gap: 3px; padding: 0 24px; }
.crumb { font-size: 10px; color: var(--faint); }
.context-line { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top-meta { display: grid; justify-items: end; gap: 3px; font: 500 11.5px/1.2 var(--font-mono); color: var(--muted); text-align: right; }
#top-date { color: var(--text); }
#top-status { color: var(--faint); max-width: 36ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.busy #top-status { color: var(--accent); }

/* ---------- shell: spine + main ---------- */

.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar)); }

.spine {
  position: sticky; top: var(--topbar); align-self: start;
  height: calc(100vh - var(--topbar)); height: calc(100dvh - var(--topbar));
  display: flex; flex-direction: column;
  padding: 26px 18px 22px 26px;
  background: var(--rail);
  border-right: 1px solid var(--line);
}
.spine-label { margin: 0 0 22px; font-size: 10px; font-weight: 600; color: var(--faint); }
.spine-foot { margin: auto 0 0; font-size: 10.5px; line-height: 1.7; color: var(--faint); white-space: pre-line; }

.steps { list-style: none; margin: 0; padding: 0; position: relative; }
.steps::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 1px; background: var(--line-strong); }
.steps li { position: relative; display: grid; grid-template-columns: 9px 1fr; column-gap: 14px; padding: 0 0 26px; color: var(--muted); }
.steps li:last-child { padding-bottom: 0; }
.steps i { grid-row: span 2; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--panel-3); border: 1px solid var(--line-strong); position: relative; z-index: 1; transition: background 0.3s, border-color 0.3s; }
.steps span { font-weight: 600; font-size: 14px; }
.steps .note { font: 500 10.5px/1.4 var(--font-mono); letter-spacing: 0.04em; color: var(--accent); text-transform: uppercase; min-height: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps .note:empty { display: none; }
.steps li.done { color: var(--text); }
.steps li.done i { background: var(--teal); border-color: var(--teal); }
.steps li.done .note { color: var(--muted); }
.steps li.active { color: var(--text); }
.steps li.active i { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
/* the red bar beside the active step, like the spine's marker */
.steps li.active::before { content: ""; position: absolute; left: -26px; top: 2px; bottom: 22px; width: 3px; border-radius: 0 2px 2px 0; background: var(--accent); }
.steps li.active:last-child::before { bottom: -2px; }
.steps.failed li.active { color: var(--danger); }
.steps.stopped li.active i, .steps.stopped li.active::before { background: var(--faint); border-color: var(--faint); box-shadow: none; }

main { min-width: 0; padding: 22px clamp(16px, 2.4vw, 32px) 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; max-width: 1180px; }
.spine, main > * { min-width: 0; }

/* ---------- mini player (appears when the session panel scrolls away) ---------- */

.mini {
  position: fixed; z-index: 35; right: 20px; top: calc(var(--topbar) + 10px);
  width: min(420px, calc(100% - 32px)); height: 54px;
  display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px;
  padding: 0 10px 0 8px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong); border-radius: var(--r);
  box-shadow: var(--shadow-pop);
  transform: translateY(calc(-100% - var(--topbar) - 20px));
  transition: transform 0.45s var(--ease);
  overflow: hidden;
}
body.show-mini .mini { transform: none; }
.mini .mini-art { --r: 4px; --size: 38px; width: 38px; }
.mini-text { min-width: 0; display: grid; line-height: 1.25; }
.mini-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-status { font: 11.5px var(--font-mono); color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line); }
.mini-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.4s var(--ease); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--r); border: 1px solid transparent;
  font: 600 14px/1 var(--font-ui);
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn.small .icon { width: 15px; height: 15px; }
.btn.ghost { background: var(--panel-2); border-color: var(--line-strong); color: var(--text); }
.btn.ghost:hover:not(:disabled) { background: var(--panel-3); border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.btn.primary { color: var(--accent-ink); background: var(--accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); }
.btn:disabled { opacity: 0.5; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border: 1px solid transparent; border-radius: var(--r); background: transparent; color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn.tiny { width: 28px; height: 28px; }
.icon-btn.tiny .icon { width: 15px; height: 15px; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--panel-3); color: var(--text);
  font-weight: 600; font-size: 13.5px;
  box-shadow: var(--shadow-pop);
}

/* ---------- panels ---------- */

.panel, .card {
  position: relative;
  padding: 20px 22px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel);
  animation: rise 0.45s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.panel-sub { margin: 6px 0 0; font-size: 10px; color: var(--faint); letter-spacing: 0.06em; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.eyebrow { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font: 600 10.5px/1.3 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.eyebrow .icon { width: 14px; height: 14px; }

/* ---------- hero ---------- */

.hero { padding: 26px 26px 22px; }
h1 { margin: 2px 0 18px; font-size: clamp(2rem, 1.4rem + 2.2vw, 2.9rem); line-height: 1.05; letter-spacing: -0.02em; }

.command { display: flex; gap: 8px; }
.command.shake { animation: shake 0.4s var(--ease); }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.command-field {
  flex: 1; min-width: 0;
  display: flex; align-items: center;
  height: 48px; padding: 0 6px 0 14px;
  background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: var(--r);
}
.command-field:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
.command-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 16px; }
.command-field input::placeholder { color: var(--faint); }
.paste { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-2); color: var(--muted); font: 600 10.5px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.paste:hover { color: var(--text); border-color: var(--line-strong); }
.btn.go { height: 48px; padding: 0 22px; font-size: 15px; }

.under { margin: 12px 0 0; font-size: 13.5px; color: var(--muted); }
.file-pick { position: relative; cursor: pointer; color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.file-pick:hover { text-decoration-color: var(--accent); }
.file-pick input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; font-size: 0; }
.file-pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* settings: a small spec sheet */
.settings { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.settings-toggle {
  display: none; align-items: center; gap: 6px;
  padding: 2px 0; border: 0; background: transparent;
  font: 600 10.5px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.settings-toggle:hover { color: var(--text); }
.settings-toggle .chev { width: 14px; height: 14px; transition: transform 0.25s var(--ease); }
.settings.open .settings-toggle .chev { transform: rotate(180deg); }
.settings-body { display: grid; gap: 14px; justify-items: start; }

.segmented { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0; padding: 0; border: 0; }
.segmented legend { float: left; width: 96px; padding: 0; font: 600 10.5px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: inline-block; padding: 6px 12px;
  font-size: 13.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel-2);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.segmented label:hover span { color: var(--text); border-color: var(--line-strong); }
.segmented input:checked + span { color: var(--text); border-color: var(--teal); background: color-mix(in srgb, var(--teal) 16%, var(--panel-2)); box-shadow: inset 3px 0 0 var(--teal); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.model { position: relative; }
.segmented .model input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; pointer-events: auto; }
.model .model-size { margin-left: 6px; font: 11px var(--font-mono); color: var(--faint); }

.check { display: inline-flex; align-items: center; gap: 8px; margin-left: 100px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.hint { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); max-width: 64ch; }
.hint:empty { display: none; }
.settings-body .hint, .settings-body .switch.setting, .advanced { margin-left: 100px; }

.advanced summary { cursor: pointer; font: 600 10.5px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.advanced summary:hover { color: var(--text); }
.field { display: grid; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.field textarea { font: 13.5px/1.5 var(--font-mono); color: var(--text); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 10px 12px; resize: vertical; min-height: 96px; min-width: min(460px, 100%); outline: none; }
.field textarea:focus, .field input:focus { border-color: var(--teal); }
.field input, .search-field input {
  height: 40px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--bg);
  outline: none;
  font-size: 15px;
}

/* Once a transcript is on screen the hero shrinks to its command bar. Returning visitors get
   settings folded into one line. */
body.has-session .hero { padding: 14px 16px; }
body.has-session .hero h1, body.has-session .hero .under, body.has-session .hero .kicker { display: none; }
body.has-session .settings { margin-top: 12px; padding-top: 10px; }
body.has-session .settings-toggle, .settings.collapsible .settings-toggle { display: inline-flex; }
body.has-session .settings:not(.open) .settings-body, .settings.collapsible:not(.open) .settings-body { display: none; }
.settings.open .settings-body { margin-top: 14px; }

/* ---------- artwork ---------- */

.art {
  --r: 4px;
  position: relative; flex: none;
  aspect-ratio: 1; width: 64px;
  border-radius: var(--r);
  isolation: isolate;
}
.art img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.art .art-img { position: relative; z-index: 1; box-shadow: 0 0 0 1px var(--line-strong); background: var(--panel-3); }
.art .art-glow { display: none; }
.art .art-fallback {
  position: absolute; inset: 0; z-index: 1;
  border-radius: inherit;
  display: grid; place-items: center;
  background: color-mix(in srgb, hsl(var(--h1) 40% 45%) 55%, var(--panel-3));
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: rgba(255, 255, 255, 0.92);
  font: 700 calc(var(--size, 64px) * 0.4)/1 var(--font-slab);
  overflow: hidden;
}
.art.loading .art-fallback {
  background: linear-gradient(110deg, var(--panel-3) 30%, var(--panel-2) 50%, var(--panel-3) 70%);
  background-size: 250% 100%;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -250% 0; } }

/* ---------- resume, error, episode picker ---------- */

.resume { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start; box-shadow: inset 3px 0 0 var(--accent); }
.resume-art { --size: 80px; width: 80px; }
.resume .eyebrow { color: var(--accent); }
.resume-text { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.meter { height: 4px; margin-top: 14px; border-radius: 2px; background: var(--cell); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--accent); }

.error { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: start; box-shadow: inset 3px 0 0 var(--danger); }
.error:focus { outline: none; }
.error-icon { width: 38px; height: 38px; border-radius: var(--r); display: grid; place-items: center; color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.error-icon .icon { width: 20px; height: 20px; }
.error h2 { font-size: 1.15rem; }
#error { margin: 6px 0 0; color: var(--muted); white-space: pre-line; font-size: 14px; line-height: 1.6; }
.error .close { margin: -6px -6px 0 0; }

.sheet-head { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.sheet-art { --size: 56px; width: 56px; }
.sheet-title { min-width: 0; }
.sheet-title h2 { overflow-wrap: anywhere; }
.episodes-note { margin: 14px 0 0; }
.search-field { position: relative; display: flex; align-items: center; margin-top: 16px; }
.search-field > .icon { position: absolute; left: 12px; color: var(--faint); width: 16px; height: 16px; pointer-events: none; }
.search-field input { width: 100%; padding-left: 38px; }
.search-field input:focus { border-color: var(--teal); }
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }

.episode-list { list-style: none; margin: 12px -22px -20px; padding: 0; max-height: min(62vh, 640px); overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--line); }
.episode-list li + li { border-top: 1px solid var(--line); }
.episode {
  width: 100%;
  display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center;
  padding: 10px 22px;
  border: 0; background: transparent;
  text-align: left;
  transition: background 0.15s;
}
.episode:focus-visible { background: var(--panel-2); outline-offset: -2px; }
@media (hover: hover) { .episode:hover { background: var(--panel-2); } }
.episode .art { --size: 40px; width: 40px; }
.ep-text { min-width: 0; }
.ep-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; font-size: 14px; line-height: 1.35; }
.ep-meta { display: block; margin-top: 3px; font: 11px var(--font-mono); color: var(--faint); letter-spacing: 0.03em; }
.ep-go { color: var(--faint); opacity: 0; transition: opacity 0.15s; }
.episode:hover .ep-go, .episode:focus-visible .ep-go { opacity: 1; color: var(--accent); }
.episode-empty { padding: 26px 22px; text-align: center; color: var(--faint); }

/* ---------- session: title, tiles, waveform, status ---------- */

.session { padding: 20px 22px; }
.session-top { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; }
.session-art { --size: 64px; width: 64px; }
.session-info { min-width: 0; }
.session-info .eyebrow { margin-bottom: 6px; min-height: 1em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; display: block; }
#episode-title {
  font-size: clamp(1.25rem, 1rem + 0.9vw, 1.6rem); line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.session-close { align-self: start; margin: -6px -8px 0 0; }

/* stat tiles: mono label over a big number, the first one marked red */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; margin-top: 18px; }
.tiles:empty { display: none; }
.stat {
  display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel-2);
  box-shadow: inset 2px 0 0 var(--line-strong);
  font: 600 1.15rem/1.1 var(--font-ui); color: var(--text);
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.stat small { font-size: 9.5px; font-weight: 600; color: var(--faint); }

.timeline { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin-top: 16px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); }
.play {
  width: 46px; height: 46px; border-radius: var(--r); border: 1px solid var(--line-strong);
  display: grid; place-items: center;
  background: var(--panel-3); color: var(--text);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.play .icon { width: 20px; height: 20px; }
.play:not(:disabled):hover { border-color: var(--teal); }
.play:disabled { color: var(--faint); background: var(--panel-2); }
.play.playing { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.wave { position: relative; height: 64px; touch-action: pan-y; }
.wave canvas { display: block; width: 100%; height: 100%; }
.wave.seekable { cursor: pointer; }
.wave.loading::after {
  content: ""; position: absolute; inset: 35% 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--teal) 30%, transparent), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  animation: sweep 1.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sweep { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.wave-tip {
  position: absolute; bottom: calc(100% + 8px); left: 0;
  transform: translateX(-50%);
  padding: 3px 7px; border-radius: var(--r-sm);
  font: 500 11px var(--font-mono); color: var(--text); background: var(--panel-3); border: 1px solid var(--line-strong);
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
  white-space: nowrap;
}
.wave.hovering .wave-tip { opacity: 1; }

.session-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 14px; }
.status-text { flex: 1 1 200px; min-width: 0; }
#stage { margin: 0; font: 700 1rem/1.3 var(--font-slab); }
#detail { margin: 2px 0 0; font: 12px/1.45 var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
body.busy #detail { color: var(--accent); }

.refine { display: flex; align-items: center; gap: 6px; }
.refine select {
  height: 32px; padding: 0 8px; font-size: 13px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--panel-2); color: var(--text);
}

/* ---------- speaker map ---------- */

.map-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.scope {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); border-radius: var(--r-sm);
  background: var(--accent-soft); color: var(--text);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em;
  box-shadow: inset 3px 0 0 var(--accent);
}
.map-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0;
  margin: 16px -22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.map-summary > div { padding: 10px 22px; border-left: 1px solid var(--line); min-width: 0; }
.map-summary > div:first-child { border-left: 0; box-shadow: inset 3px 0 0 var(--accent); }
.map-summary small { display: block; font: 600 9.5px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.map-summary b { display: block; margin-top: 3px; font: 600 13.5px/1.3 var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-summary b.hot { color: var(--accent); }

.map-wrap { margin-top: 16px; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.map { position: relative; display: grid; gap: 4px; --label: 150px; }
.map-ticks, .map-row { display: grid; grid-template-columns: var(--label) 1fr; align-items: center; gap: 12px; }
.map-corner { font-size: 9.5px; color: var(--faint); visibility: hidden; }
.map-scale { display: grid; grid-template-columns: repeat(var(--cols), 1fr); font-size: 10px; color: var(--muted); }
.map-scale span { white-space: nowrap; overflow: visible; }
.map-label { font-size: 10.5px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.map-label::before { content: ""; width: 6px; height: 6px; border-radius: 1px; flex: none; background: var(--spk, var(--teal)); }
.map-label[data-hue="1"] { --spk: var(--spk-1); } .map-label[data-hue="2"] { --spk: var(--spk-2); } .map-label[data-hue="3"] { --spk: var(--spk-3); }
.map-label[data-hue="4"] { --spk: var(--spk-4); } .map-label[data-hue="5"] { --spk: var(--spk-5); }
.map-label[data-hue="-2"] { --spk: var(--faint); } /* other voices: ads, clips */
.map-cells { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 3px; cursor: crosshair; }
.map-cells i {
  display: block; height: 34px; border-radius: 2px;
  background: color-mix(in srgb, var(--cell-on) calc(var(--v, 0) * 72%), var(--cell));
  transition: background 0.2s;
}
.map-cells i.in { background: color-mix(in srgb, var(--accent) calc(18% + var(--v, 0) * 82%), var(--cell)); }
@media (hover: hover) { .map-cells i:hover { outline: 1px solid var(--text); outline-offset: -1px; } }
.map-area { position: absolute; left: calc(var(--label) + 12px); right: 0; top: 20px; bottom: 0; pointer-events: none; }
.map-lasso {
  position: absolute; top: -5px; bottom: -5px;
  border: 2px solid var(--accent); border-radius: 10px;
  box-shadow: 0 0 0 4px var(--accent-soft);
  display: none;
}
.map.selecting .map-lasso { display: block; }
.map-head { position: absolute; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: var(--accent); }
.map-head::before { content: ""; position: absolute; top: -3px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ---------- talk time + names side by side ---------- */

.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 760px) { .duo { grid-template-columns: minmax(0, 1fr); } }
.duo:not(:has(> .card:not(.hidden))) { display: none; }
.talk { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; }
.talk li { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: baseline; }
.talk .who-name { font-size: 13.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talk .amount { font: 500 12px var(--font-mono); color: var(--muted); }
.talk .bar { grid-column: 1 / -1; height: 7px; border-radius: 1px; background: var(--cell); overflow: hidden; }
.talk .bar span { display: block; height: 100%; background: var(--teal); }
.talk li:first-child .bar span { background: var(--accent); }
.talk li:first-child .amount { color: var(--text); }

.names .hint { margin: 6px 0 12px; }
.names-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.names-list li { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.names-list li:first-child { border-top: 0; padding-top: 0; }
.names-list button {
  height: 30px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--panel-2); color: var(--text); font: 500 13px var(--font-ui);
}
.names-list button small { margin-left: 6px; font: 11px var(--font-mono); color: var(--faint); }
.names-list button.best { border-color: var(--teal); box-shadow: inset 3px 0 0 var(--teal); }
.names-list button:hover { background: var(--panel-3); }
.names-empty { font-size: 13.5px; color: var(--muted); border-top: 0 !important; }

/* ---------- the transcript, as a log ---------- */

.reader { padding: 0; }
.reader-head { padding: 20px 22px 0; }
.toolbar {
  position: sticky; top: var(--stick); z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 14px 0 0; padding: 10px 22px;
  background: var(--panel-2);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transition: top 0.45s var(--ease);
}
.find { flex: 1 1 220px; margin: 0; }
.find input { height: 34px; padding-right: 104px; background: var(--bg); font-size: 14px; }
.find-count { position: absolute; right: 62px; font: 11px var(--font-mono); color: var(--faint); }
#find-prev { position: absolute; right: 32px; }
#find-next { position: absolute; right: 4px; }
.find:not(.searching) .find-count, .find:not(.searching) .icon-btn { display: none; }
.find:not(.searching) input { padding-right: 12px; }

.switch { display: inline-flex; align-items: center; gap: 9px; padding: 0 6px; font: 600 10.5px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .ts-icon { display: none; width: 16px; height: 16px; }
.switch .track { width: 32px; height: 18px; border-radius: 3px; background: var(--cell); border: 1px solid var(--line-strong); position: relative; transition: background 0.25s; flex: none; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 2px; background: var(--muted); transition: transform 0.25s var(--ease), background 0.25s; }
.switch input:checked ~ .track { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked ~ .track .knob { transform: translateX(14px); background: var(--accent); }
.switch input:focus-visible ~ .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:checked ~ .ts-icon { color: var(--accent); }
.switch.setting { padding: 4px 0; font-size: 10.5px; }

.tool-actions { display: flex; gap: 6px; }
.menu { position: relative; }
.menu .chev { width: 13px; height: 13px; transition: transform 0.25s var(--ease); }
.menu.open .chev { transform: rotate(180deg); }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 220px; padding: 4px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--panel-2);
  box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-4px); pointer-events: none; visibility: hidden;
  transition: opacity 0.2s, transform 0.2s var(--ease), visibility 0s 0.2s;
}
.menu.open .menu-pop { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity 0.2s, transform 0.2s var(--ease); }
.menu-pop button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 9px 10px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: left;
  font-size: 13.5px;
}
.menu-pop button b { font-weight: 600; }
.menu-pop button span { font: 11px var(--font-mono); color: var(--faint); }
.menu-pop button:hover, .menu-pop button:focus-visible { background: var(--panel-3); }

.log-head {
  display: grid; grid-template-columns: 72px 168px minmax(0, 1fr); gap: 0 18px;
  padding: 10px 22px 8px;
  font-size: 9.5px; font-weight: 600; color: var(--faint);
  border-bottom: 1px solid var(--line);
}
.reader:not(.speakers) .log-head span:nth-child(2) { visibility: hidden; }

.transcript { outline: none; padding: 0 0 8px; }
.para {
  display: grid; grid-template-columns: 72px 168px minmax(0, 1fr); gap: 0 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}
.reader:not(.speakers) .para { grid-template-columns: 72px 0 minmax(0, 1fr); }
.para:has(+ .para.cont) { border-bottom: 0; padding-bottom: 2px; }
.para.cont { padding-top: 8px; }
.para-body { display: contents; }
.para > p, .para-body > p { grid-column: 3; }
.para.fresh { animation: rise 0.5s var(--ease) both; }
.ts {
  grid-column: 1; justify-self: start; align-self: start;
  height: max-content; margin-top: 3px; padding: 1px 0;
  border: 0; background: transparent;
  font: 500 12px var(--font-mono); color: var(--faint);
  font-variant-numeric: tabular-nums;
  user-select: none;
}
.ts:hover { color: var(--accent); }
.para p {
  margin: 0; max-width: 72ch;
  font: 400 1.02rem/1.72 var(--font-ui);
  color: var(--text);
  text-wrap: pretty;
  overflow-wrap: break-word;
}
.who {
  grid-column: 2; align-self: start;
  display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%;
  margin: 2px 0 0; padding: 0; border: 0; background: none;
  font: 700 13.5px/1.35 var(--font-ui); color: var(--text); text-align: left;
  cursor: text;
}
.who::before { content: ""; width: 7px; height: 7px; border-radius: 1px; background: var(--spk, var(--spk-0)); flex: none; }
.who:hover { color: var(--accent); }
.who[data-hue="1"] { --spk: var(--spk-1); } .who[data-hue="2"] { --spk: var(--spk-2); } .who[data-hue="3"] { --spk: var(--spk-3); }
.who[data-hue="4"] { --spk: var(--spk-4); } .who[data-hue="5"] { --spk: var(--spk-5); }
.who[data-hue="other"] { --spk: var(--faint); }
.who-edit { grid-column: 2; align-self: start; width: 100%; margin: 0; padding: 3px 6px; font: 700 13px/1.3 var(--font-ui); color: var(--text); background: var(--bg); border: 1px solid var(--accent); border-radius: var(--r-sm); outline: none; }

.seg { border-radius: 2px; transition: background 0.3s, box-shadow 0.3s; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.seg.draft { color: var(--muted); }
.seg.fresh { animation: ink 0.9s var(--ease) both; }
@keyframes ink { from { opacity: 0; } }
.transcript.playable .seg { cursor: pointer; }
@media (hover: hover) { .transcript.playable .seg:hover { background: var(--panel-3); box-shadow: 0 0 0 2px var(--panel-3); } }
.seg.playing { background: var(--accent-soft) !important; box-shadow: 0 0 0 2px var(--accent-soft) !important; }
.seg.refining { color: var(--muted); background: var(--panel-3); }

::highlight(search) { background-color: color-mix(in srgb, var(--teal) 45%, transparent); color: inherit; }
::highlight(search-current) { background-color: var(--accent); color: var(--accent-ink); }

/* sponsor reads */
.para.ad p { color: var(--muted); }
.para.ad p::before {
  content: "Ad"; display: inline-block; margin-right: 8px; padding: 0 5px; vertical-align: 1px;
  border: 1px solid var(--line-strong); border-radius: 2px;
  font: 600 9.5px/1.7 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
}

.empty { display: grid; gap: 12px; padding: 22px 22px 22px calc(22px + 72px + 18px); }
.empty p { margin: 0 0 4px; color: var(--muted); font: 12px var(--font-mono); letter-spacing: 0.04em; }
.skeleton { height: 12px; border-radius: 2px; background: linear-gradient(110deg, var(--panel-2) 30%, var(--panel-3) 50%, var(--panel-2) 70%); background-size: 250% 100%; animation: shimmer 1.8s linear infinite; }
.skeleton:nth-child(3) { width: 92%; } .skeleton:nth-child(4) { width: 97%; } .skeleton:nth-child(5) { width: 64%; }

.tail { display: flex; align-items: center; gap: 12px; padding: 14px 22px 18px calc(22px + 72px + 18px); font: 11.5px var(--font-mono); letter-spacing: 0.04em; color: var(--accent); }
.tail-bars { display: inline-flex; align-items: center; gap: 3px; height: 16px; }
.tail-bars i { width: 3px; height: 100%; border-radius: 1px; background: var(--accent); animation: eq 0.8s ease-in-out infinite alternate; transform-origin: center; }
@keyframes eq { from { transform: scaleY(0.4); } to { transform: scaleY(1.1); } }
.tail-bars i:nth-child(2) { animation-delay: -0.2s; } .tail-bars i:nth-child(3) { animation-delay: -0.5s; } .tail-bars i:nth-child(4) { animation-delay: -0.35s; }

.reader-foot { display: flex; justify-content: center; padding: 22px; }

/* ---------- library, as a table ---------- */

.library { padding: 0; }
#shelf + #library { margin-top: 16px; }
.shelf-now { margin: 0 22px 12px; font: 12px var(--font-mono); color: var(--muted); }
.library-head { padding: 20px 22px 12px; }
.lib-head { grid-template-columns: 40px minmax(0, 1fr) 88px 88px 34px; }
.library-list { list-style: none; margin: 0; padding: 0; }
.library-list li { border-bottom: 1px solid var(--line); }
.library-list li:last-child { border-bottom: 0; }
.entry {
  position: relative;
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 88px 88px 34px; gap: 0 18px; align-items: center;
  padding: 10px 22px;
  transition: background 0.15s;
}
@media (hover: hover) { .entry:hover { background: var(--panel-2); } }
.entry .art { --size: 40px; width: 40px; }
.entry-open { position: absolute; inset: 0; border: 0; background: transparent; z-index: 1; }
.entry-open:focus-visible { outline-offset: -2px; }
.entry-text { min-width: 0; }
.entry-title { display: block; font-weight: 600; font-size: 14px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-meta { display: block; margin-top: 2px; font: 11px var(--font-mono); letter-spacing: 0.03em; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-num { font: 500 12.5px var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.entry-delete { position: relative; z-index: 2; opacity: 0; }
.entry:hover .entry-delete, .entry-delete:focus-visible { opacity: 1; }
.entry-delete:hover { color: var(--danger); }

/* ---------- floating bits ---------- */

.jump { position: fixed; z-index: 30; left: calc(50% + var(--rail-w) / 2); bottom: 26px; transform: translateX(-50%); animation: pop 0.35s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 10px); } }
.jump .icon { color: var(--accent); }

.toast {
  position: fixed; z-index: 60; left: calc(50% + var(--rail-w) / 2); bottom: 28px;
  transform: translate(-50%, 20px); opacity: 0;
  padding: 10px 16px; border-radius: var(--r);
  background: var(--panel-3); color: var(--text); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop), inset 3px 0 0 var(--accent);
  font: 500 13px var(--font-mono);
  transition: opacity 0.25s, transform 0.35s var(--ease);
  pointer-events: none;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.sel-pill { position: fixed; z-index: 50; left: calc(50% + var(--rail-w) / 2); bottom: 26px; transform: translateX(-50%); padding: 0 6px 0 4px; gap: 4px; }
.sel-pill button { height: 38px; padding: 0 12px; border: 0; background: transparent; color: var(--accent); font: inherit; font-weight: 700; }
.sel-pill span { font: 11px var(--font-mono); color: var(--muted); padding-right: 8px; }

.dropzone {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
}
.dropzone[hidden] { display: none; }
.dropzone-inner {
  width: 100%; height: 100%;
  display: grid; place-content: center; justify-items: center; gap: 16px;
  border: 2px dashed var(--accent); border-radius: var(--r);
  background: var(--accent-soft);
  font: 700 1.5rem/1.2 var(--font-slab); color: var(--text);
  pointer-events: none;
}
.dropzone-inner .icon { width: 44px; height: 44px; color: var(--accent); stroke-width: 1.4; }
.dropzone-inner p { margin: 0; }

.dock { display: none; }

.footer { margin: 0; padding: 18px max(20px, env(safe-area-inset-left)) max(22px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--rail); font-size: 10px; line-height: 1.7; color: var(--faint); }
.footer p { margin: 0; }
.footer a { color: var(--muted); }

/* ---------- narrower screens: the spine folds into a strip ---------- */

@media (max-width: 960px) {
  :root { --rail-w: 0px; }
  .topbar { grid-template-columns: auto 1fr auto; }
  .brand { border-right: 0; padding-right: 8px; }
  .wordmark { display: none; }
  .context { padding: 0 12px 0 4px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .spine {
    position: static; height: auto;
    display: block; padding: 10px 16px;
    border-right: 0; border-bottom: 1px solid var(--line);
    overflow-x: auto; scrollbar-width: none;
  }
  .spine::-webkit-scrollbar { display: none; }
  .spine-label, .spine-foot { display: none; }
  .steps { display: flex; gap: 18px; }
  .steps::before { display: none; }
  .steps li { display: flex; align-items: center; gap: 7px; padding: 0; white-space: nowrap; }
  .steps li.active::before { display: none; }
  .steps i { margin: 0; }
  .steps span { font-size: 12.5px; }
  .steps .note { display: none; }
  .steps li.active .note:not(:empty) { display: inline; }
  body:not(.has-session) .spine { display: none; }
  main { padding: 16px 16px 40px; }
}

@media (max-width: 640px) {
  :root { --topbar: 56px; }
  body { font-size: 15px; }
  .top-meta #top-date { display: none; }
  .top-meta { max-width: 42vw; }
  .crumb { display: none; }
  .context-line { font-size: 13.5px; }
  .hero { padding: 20px 16px 18px; }
  .command { flex-direction: column; }
  .btn.go { width: 100%; }
  body.has-session .command { flex-direction: row; }
  body.has-session .btn.go { width: auto; padding: 0 16px; }
  .segmented legend { float: none; width: 100%; margin-bottom: 4px; }
  .check, .settings-body .hint, .settings-body .switch.setting, .advanced { margin-left: 0; }
  .panel, .card { padding: 16px; }
  .resume { grid-template-columns: 1fr; }
  .resume-art { display: none; }
  .error { grid-template-columns: auto 1fr; }
  .error .close { position: absolute; top: 10px; right: 10px; }
  .episode-list { margin: 12px -16px -16px; }
  .episode { grid-template-columns: 40px 1fr; padding: 10px 16px; }
  .ep-go { display: none; }
  .session { padding: 16px; }
  .session-top { grid-template-columns: auto 1fr; gap: 14px; }
  .session-art { --size: 52px; width: 52px; }
  .session-close { position: absolute; top: 8px; right: 8px; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat { padding: 8px 10px; font-size: 1rem; }
  .timeline { gap: 12px; padding: 10px; }
  .play { width: 42px; height: 42px; }
  .wave { height: 54px; }
  .map-summary { margin: 14px -16px 0; }
  .map-summary > div { padding: 8px 16px; }
  .map { --label: 78px; }
  .map-ticks, .map-row { gap: 8px; }
  .map-cells { gap: 2px; }
  .map-cells i { height: 28px; }
  .map-actions { width: 100%; }
  .reader-head { padding: 16px 16px 0; }
  .toolbar { position: static; flex-wrap: nowrap; gap: 4px; padding: 8px 12px; }
  .find { flex: 1 1 auto; min-width: 0; }
  .switch { padding: 0 4px; gap: 6px; }
  .switch .ts-icon { display: block; }
  .switch-label { display: none; }
  .switch.setting .switch-label { display: inline; }
  .tool-actions { display: none; }
  .log-head { display: none; }
  .para, .reader:not(.speakers) .para { display: block; padding: 12px 16px; }
  .para:has(+ .para.cont) { padding-bottom: 2px; }
  .para.cont { padding-top: 8px; }
  .ts { display: none; margin: 0 0 2px; }
  .transcript.show-ts .ts { display: block; }
  .who { margin: 0 0 4px; }
  .para p { font-size: 1rem; line-height: 1.68; }
  .empty, .tail { padding-left: 16px; }
  .library-head { padding: 16px 16px 10px; }
  .lib-head { display: none; }
  .entry { grid-template-columns: 40px minmax(0, 1fr) 34px; padding: 10px 16px; }
  .entry-num { display: none; }
  .entry-delete { opacity: 1; }
  .jump, .toast, .sel-pill { left: 50%; }

  body.reading { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  body.reading .dock {
    position: fixed; z-index: 45; left: 0; right: 0; bottom: 0;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: var(--rail);
    border-top: 1px solid var(--line-strong);
    animation: dock-in 0.4s var(--ease) both;
  }
  @keyframes dock-in { from { transform: translateY(100%); } }
  .dock-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    height: 46px; border-radius: var(--r);
    border: 1px solid var(--line-strong); background: var(--panel-2);
    font-size: 14.5px; font-weight: 600;
  }
  .dock-btn.primary { border-color: transparent; color: var(--accent-ink); background: var(--accent); }
  .dock-btn .icon { width: 18px; height: 18px; }
  body.reading .jump, body.reading .toast, body.reading .sel-pill { bottom: calc(82px + env(safe-area-inset-bottom)); }
  .mini { right: 8px; top: calc(var(--topbar) + 6px); width: calc(100% - 16px); }
}

/* Phones and tablets: no animation while a transcript is being made (memory and CPU go to
   the model; measured in WebKit on an iPhone profile). */
@media (hover: none), (max-width: 640px) {
  body.busy *, body.busy *::before, body.busy *::after { animation: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@media print {
  .topbar, .spine, .mini, .hero, .card:not(.reader), .toolbar, .tail, .reader-foot, .dock, .jump, .footer, .log-head, .duo { display: none !important; }
  .shell { display: block; }
  body, .card { background: #fff; color: #000; border: 0; }
  .para { display: block; border: 0; padding: 0 0 10px; }
  .para p, .who { color: #000; font-size: 11pt; }
}

/* "[Speech in Norwegian]": a note, not words anyone said */
.seg.foreign { color: var(--faint); font-style: italic; font-size: 0.92em; }
