/* ============================================================
   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);
  /* the three moves the interface makes (DESIGN.md): a press or a switch; a menu or a toast;
     a sheet or a screen. Going away takes the next step down. */
  --t-press: 120ms;
  --t-pop: 200ms;
  --t-move: 320ms;
  --bar: 0px;  /* the player along the bottom, when an episode is in it */
  --tabs: 0px;  /* the sections along the bottom, on narrow screens */
  --tx-band: 0px;  /* the transcript side's tabs, held under the top bar (body.tx-tabbed) */
  /* --spring-snappy has a touch of overshoot (damping 0.72), for presses, switches, menus and
     toasts; --ease where a browser has no linear(). --spring is with the screens' springs below. */
  --spring-snappy: var(--ease);
}
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring-snappy: linear(0, 0.011 1.6%, 0.057 3.7%, 0.139 6.1%, 0.249 8.8%, 0.375 11.6%, 0.506 14.6%, 0.632 17.7%, 0.744 20.9%, 0.838 24.2%, 0.913 27.6%, 0.967 31.1%, 1.004 34.7%, 1.026 38.3%, 1.036 42%, 1.038 45.8%, 1.035 49.7%, 1.03 53.6%, 1.023 57.6%, 1.016 61.6%, 1.01 65.7%, 1.006 69.8%, 1.003 74%, 1 78.2%, 0.999 82.5%, 0.999 86.8%, 0.999 91.2%, 0.999 95.6%, 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;
  }
}

/* ---------- springs: how screens and sheets move (DESIGN.md, principle 3) ----------
   Two spring curves, written once. Settled for the big moves, a sheet or a pushed screen (it
   comes to rest without a wobble to see: 0.15% past, damping 0.9); livelier for the small ones
   (1.5% past and back, damping 0.8). Where linear() is not understood, --ease stands in. A
   sheet or a screen comes in in --t-sheet and goes back a little faster; tabs cross-fade. */
:root {
  --spring: var(--ease);
  --spring-small: var(--ease);
  --t-sheet: 420ms;
  --t-sheet-out: 360ms;
  --t-fade: 150ms;
  /* the bars along the top and bottom: the page shows through them, blurred (iOS's glass) */
  --glass: rgba(13, 36, 44, 0.8);
  --glass-blur: saturate(180%) blur(20px);
}
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.0339, 0.1146, 0.2184, 0.3295, 0.4381, 0.5384, 0.6275, 0.7043, 0.7688, 0.8221, 0.8651, 0.8994, 0.9263, 0.947, 0.9628, 0.9746, 0.9833, 0.9895, 0.9939, 0.9969, 0.999, 1.0002, 1.001, 1.0014, 1.0015, 1.0015, 1.0014, 1.0013, 1.0011, 1);
    --spring-small: linear(0, 0.0625, 0.2019, 0.3665, 0.5259, 0.6646, 0.7765, 0.8615, 0.9225, 0.9638, 0.9899, 1.005, 1.0124, 1.015, 1.0147, 1.0129, 1.0104, 1.008, 1.0057, 1.0039, 1.0025, 1.0014, 1.0007, 1.0003, 1, 0.9998, 0.9998, 0.9998, 1);
  }
}
@media (prefers-color-scheme: light) {
  :root { --glass: rgba(219, 228, 231, 0.8); }
}

/* ---------- 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;
  padding-bottom: calc(var(--bar) + var(--tabs));
}

::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); }
/* A press shows as a step in ground or colour (below, with each control), never as the
   browser's grey flash. */
button, a, label, summary { -webkit-tap-highlight-color: transparent; }

.hidden { display: none !important; }
.boot-fail { position: fixed; z-index: 100; left: 16px; right: 16px; top: calc(var(--topbar) + env(safe-area-inset-top) + 16px); max-width: 520px; margin: 0 auto; padding: 18px 20px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--panel); box-shadow: var(--shadow-pop), inset 3px 0 0 var(--danger); }
.boot-fail[hidden] { display: none; }
.boot-fail h2 { font-size: 1.15rem; }
.boot-fail p { margin: 8px 0 14px; font: 12.5px/1.5 var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
.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(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  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(--muted); }
.context-line { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top-meta { min-width: 0; 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(--muted); max-width: min(36ch, 100%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* (each line holds its place before its words arrive, so the bar's text does not move) */
#top-date:empty::before, #top-status:empty::before { content: "\a0"; }
body.busy #top-status { color: var(--accent); }

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .topbar, .playbar, .tabbar { background: var(--rail); }
}

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

.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar)); }
/* The page reaches up under the top bar, so what shows through the bar is the page, also while
   it gives way behind a sheet (and the black behind it shows only around it). */
.shell { margin-top: calc(-1 * var(--topbar)); padding-top: var(--topbar); min-height: 100vh; background: var(--bg); }

.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); }

/* the sections: the red bar marks the one on screen, as it marks the active step below */
.nav { display: grid; gap: 2px; margin: 0 -10px 28px; }
.nav a {
  position: relative;
  display: grid; grid-template-columns: 18px 1fr auto; gap: 12px; align-items: center;
  height: 38px; padding: 0 10px;
  border-radius: var(--r); color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px;
  transition: background var(--t-press), color var(--t-press);
}
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.on { background: var(--panel); color: var(--text); }
.nav a.on::before { content: ""; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 2px 2px 0; background: var(--accent); }
.nav-count { font: 500 10.5px var(--font-mono); letter-spacing: 0.04em; color: var(--accent); }
.nav-count:empty { display: none; }
.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 var(--t-press), border-color var(--t-press); }
.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 var(--t-move) 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 var(--t-move) 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 var(--t-press), border-color var(--t-press), opacity var(--t-press);
}
a.btn { text-decoration: none; }
.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.ghost:active:not(:disabled) { background: var(--cell); 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.primary:active: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 var(--t-press), color var(--t-press);
}
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn:active:not(:disabled) { background: var(--cell); 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);
}
.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 .command-field { animation: refuse 1.6s linear; }
@keyframes refuse { from, 70% { border-color: var(--danger); } }
.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, .paste:active { 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 var(--t-press) 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 {
  position: relative; z-index: 0;
  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 var(--t-press), background var(--t-press), border-color var(--t-press);
}
.segmented label:hover span { color: var(--text); border-color: var(--line-strong); }
.segmented label:active span { color: var(--text); background: var(--panel-3); }
.segmented input:checked + span { color: var(--text); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
/* The option on is marked by a highlight of its own, so that choosing another slides it over
   from where it was (ui/motion.js sets where it starts) instead of jumping. */
.segmented input:checked + span::before, .mini-seg > button[aria-pressed="true"]::before {
  content: ""; position: absolute; z-index: -1; inset: -1px;
  border: 1px solid var(--teal); border-radius: inherit;
  background: color-mix(in srgb, var(--teal) 16%, var(--panel-2));
  transform-origin: 0 0;
  transform: translate(var(--seg-x, 0px), var(--seg-y, 0px)) scale(var(--seg-sx, 1), var(--seg-sy, 1));
  transition: transform 320ms var(--spring-snappy);
}
.segmented input:checked + span::before { box-shadow: inset 3px 0 0 var(--teal); }
.seg-from::before { transition: none !important; }
.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; }

.opener .chev { width: 14px; height: 14px; transition: transform var(--t-press) var(--ease); }
.opener[aria-expanded="true"] .chev { transform: rotate(180deg); }
.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;
  /* the square holds its place, framed, until the picture is in: never an empty gap */
  background: var(--panel-3); box-shadow: 0 0 0 1px var(--line-strong);
}
.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 { --sweep: var(--panel-3); --sweep-lit: var(--panel-2); }
/* The one loading placeholder: a band of light that sweeps across while something is being
   fetched or worked out (cover art, the transcript's first words, the waveform). */
.art.loading .art-fallback, .skeleton, .wave.loading::after {
  background: linear-gradient(110deg, var(--sweep) 30%, var(--sweep-lit) 50%, var(--sweep) 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; }

/* search across every transcript (ui/search.js): the way in at the top of Listen looks like a field */
.search-entry {
  margin: 0; height: 44px; padding: 0 14px 0 38px; max-width: 560px;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--panel);
  color: var(--faint); font-size: 15px; text-decoration: none;
}
.search-entry span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-key { margin-left: auto; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 2px; font: 11px/1.6 var(--font-mono); color: var(--faint); }
@media (hover: none) { .search-key { display: none; } }
@media (hover: hover) { .search-entry:hover { border-color: var(--teal); color: var(--muted); } }
.search-note { display: grid; gap: 12px; justify-items: start; padding-top: 14px; }
.search-note p { margin: 0; }
.hit-eps { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--line); transition: opacity var(--t-press); }
.hit-eps:empty { display: none; }
.hit-eps.stale { opacity: 0.55; }
.hit-ep { padding: 14px 0 10px; border-bottom: 1px solid var(--line); }
.hit-ep:last-child { border-bottom: 0; }
.hit-head { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; align-items: center; padding: 0 22px; }
.hit-head .art { --size: 44px; width: 44px; }
.hit-ep-main { min-width: 0; display: grid; gap: 2px; padding: 2px 0; border: 0; background: none; text-align: left; color: inherit; }
.hit-ep-title { font-weight: 600; font-size: 14.5px; line-height: 1.3; overflow-wrap: anywhere; }
.hit-list { list-style: none; margin: 8px 0 0; padding: 0; }
.hit { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; padding: 0 12px 0 16px; }
.hit-main { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 6px; padding: 9px 6px; border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); text-align: left; font-size: 14px; line-height: 1.5; }
@media (hover: hover) { .hit-main:hover { background: var(--panel-2); color: var(--text); } }
.hit-time { display: grid; align-content: start; font: 600 11px/2 var(--font-mono); color: var(--faint); }
/* where in the episode the hit is: the episode drawn to scale as a line the width of the
   column, and a tick at the sentence */
.hit-where { position: relative; height: 7px; margin: 0 8px 0 0; background: linear-gradient(var(--line-strong), var(--line-strong)) 0 100% / 100% 1px no-repeat; }
.hit-where i { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--teal); }
.hit-text { overflow-wrap: anywhere; }
.hit-text b { font-weight: 700; color: var(--text); }
.hit.now .hit-main { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); color: var(--text); }
.hit.now .hit-time { color: var(--accent); }
.hit-read { margin-top: 4px; }
.hit-more { margin: 2px 0 0; padding: 0 22px 0 80px; font: 11px var(--font-mono); color: var(--faint); }
.seg.sought { background: var(--panel-3); box-shadow: 0 0 0 2px var(--panel-3); }
@media (max-width: 640px) {
  .search-entry { max-width: none; }
  .hit-head { padding: 0 16px; gap: 12px; }
  .hit { padding: 0 4px 0 10px; }
  .hit-main { grid-template-columns: 46px minmax(0, 1fr); }
  .hit-more { padding: 0 16px 0 68px; }
}
@media (hover: none) and (pointer: coarse) {
  .hit-read { width: 44px; height: 44px; margin-top: 0; }
  .hit-main:active, .hit-ep-main:active { opacity: 0.6; }
}

.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 var(--t-press);
}
.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 var(--t-press); }
.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 var(--t-press), color var(--t-press), border-color var(--t-press);
}
.play:active:not(:disabled) { background: var(--cell); }
.play.playing:active:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
.play .icon { width: 20px; height: 20px; }
/* (Play and pause share the cell while one turns into the other: ui/motion.js swapIcon.) */
.play > .icon { grid-area: 1 / 1; }
.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;
  --sweep: transparent; --sweep-lit: color-mix(in srgb, var(--teal) 30%, transparent);
  pointer-events: none;
}
.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 var(--t-press);
  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 var(--t-press);
}
.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, and renaming a voice ---------- */

.talk-hint { margin: 6px 0 0; }
.talk { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; max-width: 720px; }
.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 .who { grid-column: 1; justify-self: start; margin: 0; cursor: pointer; overflow: visible; white-space: normal; }
.talk .who-edit { grid-column: 1; }
.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: calc(var(--topbar) + max(10px, var(--tx-band))); z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 0; padding: 10px 22px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line); border-radius: var(--r) var(--r) 0 0;
  transition: top var(--t-move) 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 var(--t-press); flex: none; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 2px; background: var(--muted); transform-origin: 0 50%; transition: transform 300ms var(--spring-snappy), scale 220ms var(--spring-snappy), background var(--t-press); }
/* (Held, the knob widens toward where it would go, as an iPhone's does.) */
.switch[data-pressed] .knob { scale: 1.3 1; transition-duration: 300ms, 100ms, var(--t-press); }
@media (prefers-reduced-motion: reduce) { .switch[data-pressed] .knob { scale: none; } }
.switch input:checked ~ .track .knob { transform-origin: calc(100% + 14px) 50%; }
.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 var(--t-pop) 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);
  /* A menu unrolls from the edge it hangs from (the top, or the bottom when it opens above its
     button) and rolls back up into it. Open, the clip stands clear of the shadow. */
  -webkit-clip-path: inset(0 0 100% 0); clip-path: inset(0 0 100% 0);
  pointer-events: none; visibility: hidden;
  transition: -webkit-clip-path var(--t-press) var(--ease), clip-path var(--t-press) var(--ease), visibility 0s var(--t-press);
}
.menu-pop.up { -webkit-clip-path: inset(100% 0 0 0); clip-path: inset(100% 0 0 0); }
/* An episode's menu grows out of the button (or the row) that opened it, from the corner nearest
   it, on a spring, and shrinks back into it a step quicker (ui/dom.js openMenu). */
.menu-pop.floating, .menu-pop.floating.up {
  -webkit-clip-path: none; clip-path: none;
  transform-origin: var(--from-x, 100%) var(--from-y, 0);
  transform: scale(0.4); opacity: 0;
  transition: transform 180ms var(--ease), opacity 160ms var(--ease), visibility 0s 180ms;
}
.menu.open .menu-pop, .menu-pop.floating.open {
  -webkit-clip-path: inset(-12px -40px -60px -40px); clip-path: inset(-12px -40px -60px -40px);
  pointer-events: auto; visibility: visible;
  transition: -webkit-clip-path var(--t-pop) var(--ease), clip-path var(--t-pop) var(--ease);
}
.menu-pop.floating.open { -webkit-clip-path: none; clip-path: none; transform: none; opacity: 1; transition: transform 260ms var(--spring-snappy), opacity 120ms linear; }
.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 { transition: background var(--t-press); }
.menu-pop button:hover, .menu-pop button:focus-visible, .menu-pop button:active { 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; }
.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 var(--t-press), box-shadow var(--t-press); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.seg.draft { color: var(--muted); }
.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.plug p { color: var(--muted); }
.para.plug 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; --sweep: var(--panel-2); --sweep-lit: var(--panel-3); }
.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: 55%; border-radius: 1px; background: var(--accent); }
/* (still: the words arriving above are what shows the work going on) */
.tail-bars i:nth-child(2) { height: 100%; } .tail-bars i:nth-child(3) { height: 40%; } .tail-bars i:nth-child(4) { height: 75%; }

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

/* ---------- the transcript side's tabs ----------
   One part on screen at a time (app.js updateTabs): a segmented control held under the top
   bar, on a band of the page's ground so what scrolls under it is hidden. Switched at once. */

body.tx-tabbed { --tx-band: 68px; }
main > .tab-off { display: none !important; }
.tx-tabs {
  position: sticky; top: calc(var(--topbar) + 8px); z-index: 25;
  display: flex; gap: 3px; padding: 3px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--rail);
  box-shadow: 0 0 0 8px var(--bg);
}
.tx-tabs a {
  flex: 1 1 0; min-width: 0; min-height: 44px;
  display: flex; align-items: center; justify-content: center; padding: 0 10px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tx-tabs a:hover { color: var(--text); background: var(--panel-2); }
.tx-tabs a:active { color: var(--text); background: var(--panel-3); }
.tx-tabs a.on { 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); }
.tx-tabs a:focus-visible { outline-offset: -2px; }
/* (what floats over the transcript goes with it) */
body:not([data-tab="transcript"]) .jump, body:not([data-tab="transcript"]) .sel-pill { display: none !important; }

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

.library { padding: 0; }
#shelf:not(.hidden) + #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 var(--t-press);
}
@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: calc(26px + var(--bar) + var(--tabs)); transform: translateX(-50%); animation: pop var(--t-pop) var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 12px); } }
.jump .icon { color: var(--accent); }
.jump { white-space: nowrap; }

.toast {
  position: fixed; z-index: 95; left: calc(50% + var(--rail-w) / 2); bottom: calc(28px + var(--bar) + var(--tabs));
  display: flex; align-items: center; gap: 14px;
  transform: translate(-50%, calc(100% + 24px)); 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);
  /* up from the bottom on a spring, and back down a step quicker */
  transition: opacity 180ms var(--ease), transform 200ms var(--ease);
  pointer-events: none;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); transition: opacity 140ms linear, transform 260ms var(--spring-snappy); }
.toast.has-action.show { pointer-events: auto; }
#toast-action { position: relative; padding: 4px 2px; border: 0; background: none; color: var(--accent); font: 700 11.5px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }

.sel-pill { position: fixed; z-index: 50; left: calc(50% + var(--rail-w) / 2); bottom: calc(26px + var(--bar) + var(--tabs)); 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; }

.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, .nav { 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; }
  body.has-session:not(.busy):not(.cleaning) .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; overflow: hidden; }
  .crumb { display: none; }
  .context-line { font-size: 13.5px; }
  .hero { padding: 20px 16px 18px; }
  .command { flex-direction: column; }
  .command-field { flex: none; }
  body.has-session .command-field { flex: 1; }
  .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; }
  body:not(.busy) .tiles { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 12px; }
  body:not(.busy) .stat { flex-direction: row-reverse; align-items: baseline; gap: 7px; padding: 0; border: 0; background: none; box-shadow: none; font: 600 13.5px/1.4 var(--font-mono); }
  .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; }
  .card.reader { padding: 0; }
  .toolbar { position: static; flex-wrap: nowrap; gap: 4px; padding: 8px 12px; }
  .toolbar:has(.find.searching) { position: sticky; top: calc(var(--topbar) + var(--tx-band)); }
  .toolbar:has(.find.searching) > :not(.find) { display: none; }
  .tx-tabs a { padding: 0 6px; font-size: 13.5px; }
  .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 { gap: 4px; }
  .tool-actions .btn { width: 38px; height: 34px; padding: 0; }
  .tool-actions .btn > span, .tool-actions .btn .chev { 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%; }

  .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, .jump, .footer, .log-head, .tx-tabs, .pod, .playbar, .tabbar, .sheet-pane, .sheet-back { display: none !important; }
  .shell { display: block; }
  main > .tab-off.reader { display: block !important; }
  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-size: 0.92em; }

/* ============================================================
   Clean-up studio (ui/studio.js)
   ============================================================ */

.modes { margin: 0 0 12px; }
body.mode-clean .settings { display: none; }
body.has-session .modes { display: none; }
#steps-clean { display: none; }
body.cleaning #steps-clean { display: block; }
body.cleaning #steps { display: none; }
@media (max-width: 960px) { body.cleaning #steps-clean { display: flex; } }

.studio { padding: 20px 22px; }
.studio-status { display: grid; gap: 10px; margin-top: 16px; }
.studio-status h3 { margin: 0; font: 700 1rem/1.3 var(--font-slab); }
.studio-status p { margin: 2px 0 0; font: 12px/1.45 var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
body.busy .studio-status p { color: var(--accent); }
.studio-status .meter { margin-top: 0; }
.studio-body { display: grid; gap: 16px; margin-top: 16px; }

/* who is in the episode: one tile per voice */
.findings { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.finding {
  display: grid; gap: 3px; text-align: left;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel-2); box-shadow: inset 3px 0 0 var(--spk, var(--spk-0));
  transition: background var(--t-press), border-color var(--t-press);
}
.finding:hover { background: var(--panel-3); border-color: var(--line-strong); }
.finding b { font: 600 14px/1.3 var(--font-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finding small { font: 11px var(--font-mono); letter-spacing: 0.03em; color: var(--muted); }
[data-hue="1"] { --spk: var(--spk-1); } [data-hue="2"] { --spk: var(--spk-2); } [data-hue="3"] { --spk: var(--spk-3); }
[data-hue="4"] { --spk: var(--spk-4); } [data-hue="5"] { --spk: var(--spk-5); }

/* the preview: strip of the whole episode, then the transport */
.preview { padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); }
.preview .panel-sub { margin: 10px 0 0; }
.overview { position: relative; height: 72px; cursor: pointer; touch-action: pan-y; border-radius: 3px; }
.overview canvas { display: block; width: 100%; height: 100%; }
.overview:focus-visible { outline-offset: 3px; }
.overview.hovering .wave-tip { opacity: 1; }
.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px; }
.transport .play { width: 44px; height: 44px; }
.ab span { min-width: 84px; text-align: center; }
.pv-where { display: grid; line-height: 1.25; min-width: 0; }
.pv-where b { font: 600 14px var(--font-mono); font-variant-numeric: tabular-nums; }
.pv-where small { font: 11px var(--font-mono); letter-spacing: 0.03em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-nav { display: flex; gap: 2px; }
.pv-match { margin-left: auto; }
.pv-loud { font: 500 12px var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.pv-state { font: 600 10.5px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.pv-state:empty { display: none; }

/* voices as tabs; the selected one carries the red marker */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: -16px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 40px; padding: 0 14px; margin-bottom: -1px;
  border: 1px solid transparent; border-bottom: 0; border-radius: var(--r) var(--r) 0 0;
  background: transparent; color: var(--muted); font-weight: 600; font-size: 14px;
}
.tab::before { content: ""; width: 7px; height: 7px; border-radius: 1px; background: var(--spk, var(--faint)); }
.tab:not([data-hue])::before { background: transparent; border: 1px solid var(--faint); width: 5px; height: 5px; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); background: var(--panel-2); border-color: var(--line); box-shadow: inset 0 2px 0 var(--accent); }
.tab-count { font: 500 10.5px var(--font-mono); color: var(--faint); padding: 1px 6px; border: 1px solid var(--line); border-radius: 2px; }
.studio-panel { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r); background: var(--panel-2); }
.panel-note { margin: 0; font-size: 13.5px; color: var(--muted); max-width: 72ch; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.chips li { padding: 4px 9px; border: 1px solid var(--line-strong); border-radius: 2px; font: 500 11.5px var(--font-mono); color: var(--muted); background: var(--panel); }
.chips li.hot { color: var(--text); border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: inset 2px 0 0 var(--accent); }

.preset-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.presets { display: flex; flex-wrap: wrap; gap: 4px; }
.preset {
  padding: 6px 11px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel); color: var(--muted); font-size: 13px; font-weight: 500;
}
.preset:hover { color: var(--text); border-color: var(--line-strong); }
.preset[data-preset="suggested"] { color: var(--text); border-color: var(--teal); box-shadow: inset 3px 0 0 var(--teal); }
.bypass { margin-left: auto; padding: 0; }
.copy-all { justify-self: start; }

/* one card per module */
.mods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
.mods.bypassed { opacity: 0.45; pointer-events: none; }
.mods-group { grid-column: 1 / -1; margin: 6px 0 -2px; font: 600 10.5px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.mods-group:first-child { margin-top: 0; }
.mod { display: grid; gap: 12px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); transition: border-color var(--t-press), box-shadow var(--t-press); }
.mod.on { border-color: var(--line-strong); box-shadow: inset 2px 0 0 var(--teal); }
.mod-head { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.mod-switch { padding: 0; margin-top: 2px; }
.mod-text h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; font: 700 14.5px/1.3 var(--font-slab); }
.mod-text p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.badge { padding: 1px 6px; border: 1px solid var(--teal); border-radius: 2px; font: 600 9.5px/1.6 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--teal); }
.params { display: grid; gap: 10px; }
.mod:not(.on) .params { opacity: 0.55; }
.mod:not(.on) .params:hover, .mod:not(.on) .params:focus-within { opacity: 0.85; }
.param { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 4px 12px; align-items: center; }
.param.with-range { grid-template-columns: 112px minmax(0, 1fr) 76px; }
.param.with-range .mini-seg { grid-column: 2 / -1; }
.param.auto-param { grid-template-columns: 112px minmax(0, 1fr) 76px; }
.param.auto-param .mini-seg { grid-column: 2 / -1; }
.param.auto-param input[type="range"] { grid-column: 2; }
.param [hidden] { display: none; }
.param-label { font: 600 10.5px/1.3 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.param-value { font: 500 12.5px var(--font-mono); color: var(--text); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-seg { display: flex; flex-wrap: wrap; gap: 4px; }
.mini-seg button { position: relative; z-index: 0; padding: 4px 9px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-2); color: var(--muted); font-size: 12.5px; }
.mini-seg button:hover { color: var(--text); border-color: var(--line-strong); }
.mini-seg button[aria-pressed="true"] { color: var(--text); }

/* sliders: a flat track that fills in teal, a square thumb */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 26px; margin: 0; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--cell) var(--from, 0%), var(--teal) var(--from, 0%), var(--teal) var(--pct, 50%), var(--cell) var(--pct, 50%));
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--cell) var(--from, 0%), var(--teal) var(--from, 0%), var(--teal) var(--pct, 50%), var(--cell) var(--pct, 50%)); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; margin-top: -5px; border-radius: 3px;
  background: var(--text); border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line-strong);
}
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 3px; background: var(--text); border: 2px solid var(--panel); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--accent); }
input[type="range"]:disabled { cursor: default; opacity: 0.4; }

.regen { display: grid; gap: 10px; padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); background: var(--panel); }
.regen-text h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; font: 700 14.5px/1.3 var(--font-slab); }
.regen-text p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); max-width: 80ch; }
.regen-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.regen-row .switch { padding: 0; }
.regen-state { font: 500 12px var(--font-mono); color: var(--accent); }
.key-field { height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--bg); font-size: 14px; outline: none; }
.key-field:focus { border-color: var(--teal); }
.regen-state.ok { color: var(--ok); }
.regen-state.bad { color: var(--danger); }
.export { display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.export h3 { margin: 0; font: 700 1rem/1.3 var(--font-slab); }
.export .kicker { margin-bottom: 4px; }
.export-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.export .meter { margin-top: 0; }
.export .hint { max-width: none; }

@media (max-width: 900px) {
  .mods { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .studio { padding: 16px; }
  .preview { padding: 10px; }
  .overview { height: 60px; }
  .transport { gap: 10px; }
  .pv-where { flex: 1 1 0; }
  .pv-match { margin-left: 0; }
  .pv-match .switch-label { display: inline; }
  .tab { padding: 0 11px; font-size: 13.5px; }
  .studio-panel { padding: 14px; }
  .param, .param.with-range { grid-template-columns: minmax(0, 1fr) auto; }
  .param .param-label { grid-column: 1; }
  .param.with-range input[type="range"] { grid-column: 1 / -1; grid-row: 2; }
  .param.with-range .param-value { grid-column: 2; grid-row: 1; }
  .param.with-range .mini-seg { grid-column: 1 / -1; }
  .param:not(.with-range) .mini-seg { grid-column: 1 / -1; }
  .bypass { margin-left: 0; }
  .bypass .switch-label { display: inline; }
  .export-row .btn.primary { flex: 1 1 100%; }
}
.segmented legend.sr-only { float: none; width: 1px; }

/* ============================================================
   Listening: the podcast screens (ui/pod.js) and the player
   (ui/playerui.js). Same panels and labels as the rest; teal
   marks what is new, red what is playing, amber where the ads are.
   ============================================================ */

/* one side on screen at a time */
body:not(.view-transcribe) main > :not(.pod) { display: none !important; }
body.view-transcribe .pod { display: none; }
body:not(.view-transcribe) .jump, body:not(.view-transcribe) .sel-pill,
body:not(.view-transcribe) .pipeline-label, body:not(.view-transcribe) .steps, body:not(.view-transcribe) .spine-foot { display: none !important; }
@media (max-width: 960px) { body:not(.view-transcribe) .spine { display: none; } }

body.has-player { --bar: 72px; }

.pod, .pod-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.pod-card { padding: 0; }
/* A screen changes at once: no rise, no fade (see DESIGN.md). */
.pod-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; padding: 20px 22px 14px; }
.pod-tools { display: flex; align-items: center; gap: 8px; }
.pod-card > .hint { margin: 0 22px 16px; }
.pod-card > .actions { margin: 0 22px 20px; }
.pod-card > .under { margin: 16px 22px 20px; }
.pod-none { margin: 0; padding: 4px 22px 22px; color: var(--muted); font-size: 14px; max-width: 70ch; }
.pod-empty { grid-column: 1 / -1; display: grid; gap: 14px; justify-items: start; padding: 2px 0 4px; color: var(--muted); }
.pod-empty p { margin: 0; max-width: 52ch; font-size: 14px; }
.more { margin: 14px 22px 20px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 14px -5px; font: 600 10.5px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.back-link { position: relative; }
.back-link:hover, .back-link:active { color: var(--text); }
.back-link .icon { width: 15px; height: 15px; }
.pod-card > .back-link { margin: 18px 0 -6px 17px; }
/* asking for what is new: the button rests until the answer is in (the line above it says so) */
.spinning { color: var(--faint); pointer-events: none; }

/* Pull to refresh, on Listen (ui/gestures.js): pulled down from the top, the page follows the
   finger with more and more give, and a spinner comes into the room it leaves, its spokes
   filling in and turning with the pull; let go past the mark, it holds there and turns until
   the new episodes are in, then the page settles back. */
#pod-home { position: relative; }
.pull { position: absolute; z-index: 0; top: 0; left: 50%; width: 28px; height: 28px; margin-left: -14px; color: var(--muted); opacity: 0; pointer-events: none; }
.pull svg { display: block; width: 100%; height: 100%; }
.pull line { stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; opacity: 0.15; }
.pull line.on { opacity: var(--o, 1); }
.pull.turning svg { animation: pull-turn 0.8s steps(8) infinite; }
@keyframes pull-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pull.turning svg { animation: none; } }

.tag {
  display: inline-block; margin-left: 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(--muted); white-space: nowrap;
}
.tag.hot { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }

/* ---------- an episode, as a row ---------- */

.ep-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ep {
  position: relative;
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 0 14px; align-items: center;
  padding: 10px 12px 10px 22px;
  border-bottom: 1px solid var(--line);
  transition: background var(--t-press);
}
.ep-list > .ep:last-child { border-bottom: 0; }
@media (hover: hover) { .ep:hover { background: var(--panel-2); } }
.ep.queued { grid-template-columns: 44px minmax(0, 1fr) auto auto auto; }
.ep .art { --size: 44px; width: 44px; }
.ep-main { min-width: 0; display: block; padding: 2px 0; border: 0; background: none; text-align: left; }
.ep-main:focus-visible { outline-offset: 4px; }
.ep .ep-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* (Where the line may wrap, it breaks between its parts, never inside one or before a dot.) */
.ep-meta .bit { white-space: nowrap; }
/* On a show's own page its cover is at the top: the rows go without. */
#show-list .ep { grid-template-columns: minmax(0, 1fr) auto auto; }
#show-list .ep > .art { display: none; }
.ep.is-new .ep-title::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; vertical-align: 1px; border-radius: 1px; background: var(--teal); }
.ep.is-done .ep-title { color: var(--muted); font-weight: 500; }
.ep.now { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }
.ep.now .ep-title::before { background: var(--accent); }
.ep-play { width: 38px; height: 38px; }
.ep-play .icon { width: 16px; height: 16px; }
.ep-order { display: inline-flex; }
.ep-order button:disabled { opacity: 0.3; }
.ep-bar { display: none; position: absolute; left: 80px; right: 0; bottom: -1px; height: 2px; }
.ep.is-started .ep-bar, .ep.now .ep-bar { display: block; }
.ep-bar span { display: block; height: 100%; background: var(--teal); }
/* An episode's played part draws in along its length, once, the first time its list shows
   (ui/pod.js); after that it changes as it is. */
.draw-in { transform-origin: 0 50%; animation: draw-in var(--t-move) linear both; }
@keyframes draw-in { from { transform: scaleX(0); } }
.ep.now .ep-bar span { background: var(--accent); }
.queue-now { padding-bottom: 6px; }
.queue-now .kicker { margin: 0 22px 8px; color: var(--accent); }
.queue-now + .ep-list, .queue-now + .pod-none { margin-top: 10px; }

/* ---------- home ---------- */

.tiles-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; padding: 0 22px 22px; }
.tile {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 12px 12px 15px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-2);
}
.tile.now { box-shadow: inset 3px 0 0 var(--accent); }
.tile .art { --size: 56px; width: 56px; }
.tile-main { min-width: 0; display: grid; gap: 2px; padding: 0; border: 0; background: none; text-align: left; }
.tile-show { font: 600 10px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; font-size: 14px; line-height: 1.3; }
.tile-left { font: 11px var(--font-mono); color: var(--muted); }
.tile .meter { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; margin: 0; border-radius: 0; }
.tile .meter span { background: var(--teal); }
.tile { transition: background var(--t-press); }
/* Swiped to the left, a tile shows what can be done with it (ui/gestures.js). */
/* It follows the finger and lets go on a spring (ui/gestures.js moves it: no transition of its
   own). Pulled far enough that letting go does the first action, that action widens to all the
   room behind, its word staying by the edge of the tile, as a mail app's delete does. */
.swipe { position: relative; overflow: hidden; border-radius: var(--r-sm); }
.swipe-front { position: relative; z-index: 1; touch-action: pan-y; }
.swipe-actions { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; justify-content: flex-end; }
.swipe:not(.open) .swipe-actions { visibility: hidden; }
/* (Each at least 84 px, and between them all the room the tile leaves, --dx being where it is.) */
.swipe-actions button { flex: none; width: max(84px, calc(var(--dx, 0px) * -1 / var(--n, 2))); min-height: 44px; padding: 0 8px; border: 0; font: 600 13px var(--font-ui); color: var(--text); background: var(--panel-3); white-space: nowrap; overflow: hidden; }
.swipe-actions button + button { background: var(--cell); }
.swipe-actions button:active { background: var(--line-strong); }
.swipe.full .swipe-actions button { transition: width 260ms var(--spring-snappy); }
.swipe.full .swipe-actions button:first-child { width: 100%; text-align: left; padding-left: max(16px, calc(100% + var(--dx, 0px) + 22px)); }
.swipe.full .swipe-actions button + button { width: 0; padding: 0; }
/* A row on its way out of a list closes up (ui/motion.js closeUp): nothing in it is there to
   touch any more. Rows moving to new places pass over each other opaque, the one moved on
   purpose on top. */
.leaving { pointer-events: none; }
.ep.moving { z-index: 1; transition: none; }
.ep.moving:not(.now) { background: var(--panel); }
.moving.lifted { z-index: 2; }
/* (A long press opens a menu: not the phone's own for text and links.) */
.tile, .ep { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.tile.now .meter span { background: var(--accent); }

.show-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 16px 14px; padding: 2px 22px 22px; }
.show-tile { position: relative; display: grid; gap: 8px; align-content: start; color: inherit; text-decoration: none; }
.show-tile .art { width: 100%; }
@media (hover: hover) { .show-tile:hover .art-img, .show-tile:hover .art-fallback { box-shadow: 0 0 0 1px var(--teal); } }
.show-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.show-count {
  position: absolute; z-index: 2; top: 6px; right: 6px;
  min-width: 22px; height: 20px; padding: 0 5px; display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 2px; background: var(--bg);
  font: 600 10.5px var(--font-mono); color: var(--text);
  box-shadow: inset 2px 0 0 var(--teal);
}

/* ---------- moving between screens (ui/pod.js screenChange) ----------
   As an iPhone's navigation: going deeper pushes the new screen in from the right over the old,
   which moves a third of the way left and dims; going back pops it the other way, a little
   faster. Between the sections along the bottom, a quick cross-fade. The bars along the top and
   bottom stay where they are (their words cross-fade), and a show's cover travels from its tile
   to its place on the show's page and back. (View transitions; where there are none, or motion
   is turned down, the screen changes at once.) */
.topbar { view-transition-name: topbar; }
.tabbar { view-transition-name: tabbar; }
.playbar { view-transition-name: playbar; }
.toast { view-transition-name: toast; }
@media (min-width: 961px) { .spine { view-transition-name: spine; } }
html.vt-push::view-transition, html.vt-pop::view-transition { background: #000; }
html.vt-push::view-transition-group(*), html.vt-push::view-transition-old(*), html.vt-push::view-transition-new(*) { animation-duration: var(--t-sheet); animation-timing-function: var(--spring); }
html.vt-pop::view-transition-group(*), html.vt-pop::view-transition-old(*), html.vt-pop::view-transition-new(*) { animation-duration: var(--t-sheet-out); animation-timing-function: var(--spring); }
html.vt-tab::view-transition-group(*), html.vt-tab::view-transition-old(*), html.vt-tab::view-transition-new(*) { animation-duration: var(--t-fade); animation-timing-function: linear; }
html.vt-push::view-transition-old(root) { animation: vt-under var(--t-sheet) var(--spring) both; mix-blend-mode: normal; }
html.vt-push::view-transition-new(root) { animation: vt-over var(--t-sheet) var(--spring) both; mix-blend-mode: normal; box-shadow: -10px 0 30px rgba(0, 0, 0, 0.22); }
html.vt-pop::view-transition-old(root) { animation: vt-off var(--t-sheet-out) var(--spring) both; mix-blend-mode: normal; z-index: 1; box-shadow: -10px 0 30px rgba(0, 0, 0, 0.22); }
html.vt-pop::view-transition-new(root) { animation: vt-up var(--t-sheet-out) var(--spring) both; mix-blend-mode: normal; }
@keyframes vt-under { to { transform: translateX(-30%); opacity: 0.86; } }
@keyframes vt-over { from { transform: translateX(100%); } }
@keyframes vt-off { to { transform: translateX(100%); } }
@keyframes vt-up { from { transform: translateX(-30%); opacity: 0.86; } }
/* the cover: the picture that arrives (the push) or the one that leaves (the pop), moving and
   growing between the two places; never two at once */
html.vt-push::view-transition-old(cover), html.vt-pop::view-transition-new(cover) { display: none; }
html.vt-push::view-transition-new(cover), html.vt-pop::view-transition-old(cover) { animation: none; mix-blend-mode: normal; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

.link-form { display: grid; gap: 16px; padding: 20px 22px; box-shadow: inset 3px 0 0 var(--accent); }
.link-form .hint { margin-top: 8px; }
.link-form .command-field input { font-size: 15px; }
.link-form .btn { height: 48px; padding: 0 20px; }

/* ---------- a show ---------- */

.show-head { padding: 18px 22px 20px; }
/* the cover beside the name; under the name, two lines about the show, its buttons in one row,
   and the button to its own settings (the last row takes what the cover leaves over) */
.show-top { display: grid; grid-template-columns: 128px minmax(0, 1fr); grid-template-rows: auto auto auto 1fr; column-gap: 22px; align-items: start; }
.show-art { --size: 128px; width: 128px; }
.show-top > .show-art { grid-row: 1 / -1; }
.show-top > :not(.show-art) { grid-column: 2; min-width: 0; }
.show-title { margin: 0; font-size: clamp(1.45rem, 1.1rem + 1.3vw, 2.05rem); line-height: 1.12; overflow-wrap: anywhere; }
.show-about { margin: 8px 0 0; max-width: 72ch; font-size: 14px; line-height: 1.6; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.show-about[role="button"] { cursor: pointer; }
.show-about.open { display: block; }
.show-actions { flex-wrap: nowrap; margin-top: 14px; }
.show-opts { display: grid; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
/* the show's own settings: behind this button, in a sheet (ui/pod.js showSettings) */
.show-settings { display: flex; width: min(100%, 440px); margin-top: 10px; justify-content: flex-start; }
.show-settings > span { flex: none; }
.show-settings > small { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.show-sheet { display: grid; gap: 4px; }
.show-sheet h2 { margin: 0; font-size: 1.2rem; }
.show-opts .switch { padding: 0; justify-self: start; }
.show-opts .segmented legend { width: auto; margin-right: 12px; }
.hint.warn { margin-top: 12px; color: var(--danger); }
.show-search { margin: 0; flex: 0 1 280px; }
.show-search input { height: 36px; font-size: 14px; }
.btn .chev { width: 13px; height: 13px; }

/* ---------- finding a show ---------- */

.search-field.big { margin: 0 22px; }
.search-field.big input { height: 48px; font-size: 16px; }
.pod-card > .search-field.big + .pod-none { padding-top: 14px; }
.found-list { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--line); }
.found-list:empty { display: none; }
.found { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 22px; border-bottom: 1px solid var(--line); }
.found .art { --size: 56px; width: 56px; }
@media (hover: hover) { .found:hover { background: var(--panel-2); } }

/* ---------- settings ---------- */

#pod-settings .settings-body { padding: 0 22px 22px; }
.setting-row { display: grid; gap: 4px; }
.pod-card > .setting-row { margin: 0 22px 20px; }
/* a screen's tabs (Settings, Up next) and an episode's (chapters, notes): one segmented control,
   the tab in the address for a screen; a tab changes at once, as a screen does */
.view-tabs, .sheet-tabs { flex-wrap: nowrap; }
.view-tabs { justify-self: start; }
.view-tabs label, .sheet-tabs label { flex: 1 1 auto; min-width: 0; }
.view-tabs span, .sheet-tabs span { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 6px 14px; white-space: nowrap; }
.seg-count { font: 500 11px var(--font-mono); color: var(--faint); }
.sheet-tabs { padding-top: 16px; border-top: 1px solid var(--line); }
.ep-sheet.tabbed .chapters-box, .ep-sheet.tabbed .notes-box { padding-top: 0; border-top: 0; }
.ep-sheet.tabbed .chapters-box h3 { display: none; }
.link-box { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 20px; align-items: start; padding: 4px 22px 22px; }
.link-box h3 { margin: 0 0 6px; font: 700 14.5px/1.3 var(--font-slab); }
.link-box .actions { margin-top: 12px; }
.qr { width: 148px; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: #fff; }
.qr svg { display: block; width: 100%; height: 100%; }
.notify-body { display: grid; gap: 10px; justify-items: start; padding: 0 22px 22px; }
.notify-body .switch { padding: 0; }
/* (two lines held while the device is checked, so the cards below stay where they are) */
.notify-body .hint { min-height: 3em; }
.pod-head .invisible { visibility: hidden; }

/* ---------- the menu behind a row's three dots ---------- */

.menu-pop.floating { position: fixed; z-index: 90; left: 0; top: 0; right: auto; min-width: 232px; max-width: calc(100vw - 16px); }
.menu-pop button.danger b { color: var(--danger); }

/* ---------- the sheet: an episode, or the player opened up ---------- */

/* In from the edge it lives at (the right; the bottom on a phone) on the settled spring, and back
   to it a little faster; a finger moves it, and ui/dom.js times the rest of the way from the
   finger's speed. Under it a shade, faded with it. */
.sheet-back {
  position: fixed; inset: 0; z-index: 70; touch-action: none;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  opacity: 0; transition: opacity var(--t-sheet-out) var(--spring);
}
.sheet-back.open { opacity: 1; transition-duration: var(--t-sheet); }
.sheet-pane {
  position: fixed; z-index: 71; top: 0; right: 0; bottom: 0; width: min(470px, 100%);
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 18px 22px calc(28px + env(safe-area-inset-bottom));
  background: var(--panel); border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop);
  outline: none;
  transform: translateX(100%);
  transition: transform var(--t-sheet-out) var(--spring);
}
.sheet-pane.open { transform: none; transition-duration: var(--t-sheet); }
.sheet-pane.closing, .sheet-back.closing { pointer-events: none; }
body.sheet-open { overflow: hidden; }

/* On a phone, the page behind a sheet gives way as an iPhone's does behind a card: smaller (each
   piece scaled about the middle of the top of the screen, ui/dom.js giveWay), its top corners
   rounded, dimmed by the shade, with black around it. Transform only, so it runs on the
   compositor; it goes back as the sheet goes down. */
.topbar, .shell, .footer, .playbar, .tabbar { transition: transform var(--t-sheet-out) var(--spring); }
body.receding :is(.topbar, .shell, .footer, .playbar, .tabbar) { will-change: transform; }
body.receded :is(.topbar, .shell, .footer, .playbar, .tabbar) { transform: translateY(6px) scale(0.94); transition-duration: var(--t-sheet); }
body.receded .topbar { border-radius: 10px 10px 0 0; }
body.receding::after { content: ""; position: fixed; inset: 0; z-index: -1; background: #000; pointer-events: none; }
.sheet-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-top .kicker { margin: 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-top .icon-btn { margin: -6px -8px -6px 0; }
a.sheet-show { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a.sheet-show:hover { color: var(--text); }

.ep-sheet { display: grid; gap: 16px; }
.sheet-head { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 16px; align-items: start; }
.sheet-art { --size: 88px; width: 88px; }
.sheet-head h2 { font-size: 1.2rem; overflow-wrap: anywhere; }
.sheet-meta { margin: 8px 0 0; font: 11.5px var(--font-mono); letter-spacing: 0.03em; color: var(--muted); }
/* where the server is with this episode's transcript (lib/serverjob.js) */
.sheet-job { margin: 0; padding: 10px 12px; border-left: 2px solid var(--teal); background: var(--panel-2); border-radius: var(--r-sm); font-size: 13.5px; line-height: 1.45; color: var(--text); }
.sheet-actions { margin-top: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sheet-actions .btn { height: 44px; min-width: 0; padding: 0 12px; justify-content: flex-start; }
.sheet-actions .btn > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sheet-actions .btn.primary, .sheet-actions .btn.wide { grid-column: 1 / -1; }
.sheet-actions .btn.primary { justify-content: center; height: 48px; font-size: 15px; }
.btn > small { margin-left: auto; padding-left: 8px; font: 11px var(--font-mono); letter-spacing: 0.03em; color: var(--faint); }
.notes-box { padding-top: 16px; border-top: 1px solid var(--line); }
.notes-box .pod-none { padding: 0; }
.notes { font-size: 14.5px; line-height: 1.65; overflow-wrap: anywhere; }
.notes > :first-child { margin-top: 0; }
.notes p { margin: 0 0 12px; }
.notes ul, .notes ol { margin: 0 0 12px; padding-left: 20px; }
.notes h4 { margin: 16px 0 6px; font: 700 14px/1.3 var(--font-slab); }
.notes a { color: var(--teal); }
.notes blockquote { margin: 0 0 12px; padding-left: 12px; border-left: 2px solid var(--line-strong); color: var(--muted); }
.note-time { padding: 0 5px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--panel-2); font: 500 12px var(--font-mono); color: var(--teal); }
.note-time:hover { border-color: var(--teal); }
.chapters-box { display: grid; gap: 6px; padding-top: 16px; border-top: 1px solid var(--line); }
.chapters-box h3 { margin: 0 0 2px; font: 700 14.5px/1.3 var(--font-slab); }
.chapter-list { list-style: none; margin: 0 -8px; padding: 0; display: grid; }
.chapter { width: 100%; min-height: 44px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 11px 8px; border: 0; border-radius: var(--r-sm); background: none; text-align: left; font-size: 14px; line-height: 1.4; }
.chapter-time { min-width: 5ch; font: 500 12px var(--font-mono); color: var(--teal); font-variant-numeric: tabular-nums; }
.chapter-list.hours .chapter-time { min-width: 7ch; }
.chapter-title { overflow-wrap: anywhere; }
.chapter[aria-current="true"] { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }
.chapter[aria-current="true"] .chapter-title { font-weight: 600; }
@media (hover: hover) { .chapter:hover { background: var(--panel-2); } }
.chapter-more { justify-self: start; }
.ext { display: inline-flex; align-items: center; gap: 6px; justify-self: start; font-size: 13px; color: var(--muted); }

/* (One column, never wider than the sheet: a grid's own column grows to its widest piece's
   least width, and the line under the score, kept to one line, would make that a long chapter
   name's whole length, pushing everything off to the right.) */
.np { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.np-art { --size: 232px; width: min(232px, 62vw); justify-self: center; margin: 2px 0 4px; }
.np-show { margin: 0; text-align: center; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-title { text-align: center; font-size: 1.22rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
/* the score, the line under it (who is speaking, which chapter, and the way to the one before
   and after) and the clock: one block, spaced as the mock-up it was picked from */
.np-score { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); margin-top: 32px; }
.np-strip { --score-bg: var(--panel); }
.np-now { display: flex; align-items: center; gap: 8px; height: 18px; margin-top: 12px; }
.np-now-text { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; line-height: 18px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.np-now-words { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.np-now-who { font-weight: 500; color: var(--text); }
.np-now-sw { flex: none; width: 3px; height: 12px; border-radius: 1px; background: var(--spk, var(--spk-0)); }
.np-now-sw[data-hue="other"] { --spk: var(--faint); }
.np-now-sw.hatch { width: 7px; border-radius: 0; background: repeating-linear-gradient(-45deg, var(--faint) 0 1px, transparent 1px 3px); box-shadow: inset 0 0 0 1px var(--faint); }
.np-chapter { flex: none; display: flex; margin-right: -10px; }
.np-chapter .icon-btn { width: 40px; height: 44px; margin: -13px 0; color: var(--muted); }
.np-chapter .icon-btn .icon { width: 18px; height: 18px; }
.np-chapter .icon-btn:disabled { opacity: 0.3; background: none; }
.np-clock { display: flex; justify-content: space-between; margin-top: 8px; font: 500 12px var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.np-transport { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 2px 0 4px; }
.np-transport .play { width: 64px; height: 64px; }
.np-transport .play .icon { width: 26px; height: 26px; }
.np-transport .jump-btn { width: 52px; height: 52px; }
.np-transport .jump-btn .icon { width: 36px; height: 36px; }
.np-transport .jump-btn b { font-size: 10px; }
.np-jump { justify-self: center; }
/* under the transport, one row: each button says where its control stands (marked, as a
   switched-on chip is, when that is other than the usual) and opens it in the panel under the
   row, one at a time, at once. Its second tap, or the panel's own button, puts it away. */
.np-tools { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.np-tool {
  min-width: 0; min-height: 48px; display: grid; align-content: center; justify-items: center; gap: 3px; padding: 6px 4px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--panel-2); color: var(--muted);
  transition: background var(--t-press), border-color var(--t-press), color var(--t-press);
}
.np-tool-label, .np-tool-value { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-tool-label { font: 600 9.5px/1.2 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.np-tool-value { font: 500 13px/1.2 var(--font-mono); font-variant-numeric: tabular-nums; }
/* A value that changes slides: the old one up and away, the new one up from below (ui/motion.js
   swapText), inside the line it is on. */
.np-tool { position: relative; }
.np-tool-value > .text-in, .text-out > span { display: block; overflow: hidden; text-overflow: ellipsis; }
.text-out { position: absolute !important; margin: 0; overflow: hidden; text-align: center; pointer-events: none; }
.np-tool.on { color: var(--text); box-shadow: inset 3px 0 0 var(--teal); }
.np-tool[aria-expanded="true"] { color: var(--text); background: var(--panel-3); border-color: var(--teal); }
@media (hover: hover) { .np-tool:hover { color: var(--text); border-color: color-mix(in srgb, var(--text) 30%, transparent); } }
.np-tool:active { color: var(--text); background: var(--cell); }
.np-panel { display: grid; gap: 10px; }
.np.panel-open .np-actions { display: none; }
.np-state { margin: 0; font: 500 12px var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.np-next-all { justify-self: start; font-size: 13px; color: var(--muted); }
.np-speeds { display: flex; align-items: center; gap: 6px; }
.np-speeds .mini-seg { flex: 1; justify-content: space-between; flex-wrap: nowrap; }
.np-speeds .mini-seg button { flex: 1; padding: 6px 0; }
.np-sleeps button, .np-trims button { padding: 6px 10px; }
.np-trim-save { justify-self: start; }
.sign { font: 600 19px/1 var(--font-ui); }
.np .switch { padding: 0; justify-self: start; }
.np-skips.off { opacity: 0.6; }
.np-volume { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; color: var(--muted); }
.np-next { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; counter-reset: next; }
.np-next li { display: grid; gap: 1px; min-width: 0; }
.np-next li.empty { font-size: 13.5px; color: var(--muted); }
.np-next-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-next-show { font: 11px var(--font-mono); color: var(--faint); }
/* the transcript, the notes, taking it out: side by side, a word or two a line */
.np-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.np-actions .btn { height: auto; min-height: 48px; min-width: 0; padding: 6px 8px; gap: 6px; white-space: normal; text-align: center; font-size: 13px; line-height: 1.25; }
.np-actions .btn .icon { flex: none; width: 16px; height: 16px; }

/* ---------- the score: the position control, drawn as the whole episode (ui/score.js) ----------
   Bars, colours, the sponsor read, the chapter ticks and the position are drawn on the canvas;
   the magnifier opens above while a finger is on it. The whole strip takes the finger, so the
   page and the sheet's pull-down leave it alone (touch-action, and ui/dom.js). */

.score { position: relative; --score-bg: var(--panel); }
.score-strip { position: relative; height: 80px; margin: 0 -4px; padding: 0 4px; touch-action: none; cursor: pointer; outline: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.score-strip:focus-visible { box-shadow: 0 0 0 2px var(--accent); border-radius: var(--r-sm); }
.score-strip[aria-disabled="true"] { cursor: default; }
.score-cv { display: block; width: 100%; height: 100%; }
.score-loupe {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: calc(100% + 10px);
  padding: 10px 12px 8px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--panel-2);
  opacity: 0; transform: translateY(6px); visibility: hidden; pointer-events: none;
  transition: opacity 0.16s var(--ease), transform 0.16s var(--ease), visibility 0s 0.16s;
}
.score.scrubbing .score-loupe { opacity: 1; transform: none; visibility: visible; transition: opacity 0.16s var(--ease), transform 0.16s var(--ease), visibility 0s; }
.score-loupe-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.score-loupe-name { min-width: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-loupe-time { font: 600 15px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text); }
.score-loupe-cv { display: block; width: 100%; height: 64px; }
.score-loupe-foot { display: flex; justify-content: space-between; margin-top: 5px; font: 500 10.5px var(--font-mono); color: var(--faint); font-variant-numeric: tabular-nums; }
/* in the player bar: lower, on the bar's own colour, its magnifier clear of the bar */
.pb-score { --score-bg: var(--rail); }
.pb-score .score-strip { height: 44px; }
.pb-score .score-loupe { bottom: calc(100% + 18px); }
.pb-score .score-loupe-cv { height: 48px; }
@media (prefers-reduced-motion: reduce) {
  .score-loupe, .score.scrubbing .score-loupe { transition: none; transform: none; }
}

/* ---------- the player, along the bottom ---------- */

.playbar {
  position: fixed; z-index: 44; left: var(--rail-w); right: 0; bottom: 0; height: 72px;
  display: grid; grid-template-columns: minmax(170px, 1.1fr) auto minmax(200px, 2fr) auto; gap: 18px; align-items: center;
  padding: 0 max(18px, env(safe-area-inset-right)) 0 10px;
  background: var(--glass); border-top: 1px solid var(--line-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  /* (backwards, not both: once in, the bar's transform is free for the page giving way) */
  animation: bar-in var(--t-sheet) var(--spring) backwards;
}
@keyframes bar-in { from { transform: translateY(100%); } }
.pb-line { display: none; }
.pb-now { min-width: 0; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; padding: 6px; border: 0; border-radius: var(--r); background: none; text-align: left; }
@media (hover: hover) { .pb-now:hover { background: var(--panel); } }
.pb-art { --size: 44px; width: 44px; }
.pb-text { min-width: 0; display: grid; line-height: 1.3; }
.pb-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-sub { font: 11px var(--font-mono); letter-spacing: 0.03em; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-transport { display: flex; align-items: center; gap: 6px; }
.pb-transport .play { width: 44px; height: 44px; }
.jump-btn { position: relative; width: 40px; height: 40px; color: var(--text); }
.jump-btn .icon { width: 28px; height: 28px; stroke-width: 1.4; }
.jump-btn b { position: absolute; inset: 0; display: grid; place-items: center; padding-top: 3px; font: 600 8.5px var(--font-mono); pointer-events: none; }
.pb-scrub { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.pb-time { min-width: 5.5ch; font: 500 11.5px var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
#pb-left { text-align: right; }
.pb-tools { display: flex; align-items: center; gap: 6px; }
.chip-btn { height: 32px; min-width: 50px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--panel-2); color: var(--muted); font: 600 12px var(--font-mono); font-variant-numeric: tabular-nums; }
.chip-btn:hover { color: var(--text); }
.chip-btn.on { color: var(--text); border-color: var(--teal); box-shadow: inset 3px 0 0 var(--teal); }
.play.waiting .icon { opacity: 0.45; }

/* ---------- the sections, along the bottom on narrow screens ---------- */

.tabbar { display: none; }

@media (max-width: 960px) {
  :root { --tabs: calc(56px + env(safe-area-inset-bottom)); }
  body.has-player { --bar: 62px; }
  .tabbar {
    position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; height: var(--tabs);
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--glass); border-top: 1px solid var(--line-strong);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }
  .tabbar a {
    position: relative; display: grid; justify-items: center; align-content: center; gap: 4px;
    color: var(--muted); text-decoration: none;
    font: 600 9.5px var(--font-mono); letter-spacing: 0.07em; text-transform: uppercase;
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar a .icon { width: 21px; height: 21px; }
  .tabbar a.on { color: var(--text); }
  .tabbar a.on::before { content: ""; position: absolute; top: -1px; left: 24%; right: 24%; height: 2px; background: var(--accent); }
  .tabbar .nav-count { position: absolute; top: 5px; left: calc(50% + 9px); padding: 0 4px; border-radius: 2px; background: var(--bg); border: 1px solid var(--line-strong); font-size: 9.5px; line-height: 1.5; }

  .playbar { left: 0; bottom: var(--tabs); height: 62px; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; padding: 0 8px 0 4px; }
  .pb-line { display: block; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--line); }
  .pb-line span { display: block; height: 100%; width: 0; background: var(--accent); }
  .pb-scrub, #pb-back, .pb-tools > :not(#pb-jump) { display: none; }
  .pb-art { --size: 42px; width: 42px; }
  .pb-now { grid-template-columns: 42px minmax(0, 1fr); gap: 10px; }
}

@media (max-width: 640px) {
  .pod-head { padding: 16px 16px 12px; }
  .pod-none { padding: 4px 16px 18px; }
  .pod-card > .hint { margin: 0 16px 14px; }
  .pod-card > .actions { margin: 0 16px 18px; }
  .pod-card > .under { margin: 14px 16px 18px; }
  .pod-card > .back-link { margin: 14px 0 -4px 11px; }
  .more { margin: 12px 16px 16px; }
  .ep { grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 0 10px; padding: 10px 4px 10px 16px; }
  .ep.queued { grid-template-columns: 44px minmax(0, 1fr) auto auto; }
  .ep.queued .ep-play { display: none; }
  .ep-bar { left: 70px; }
  .ep .ep-meta { white-space: normal; }
  .queue-now .kicker { margin: 0 16px 8px; }
  .tiles-row { grid-template-columns: minmax(0, 1fr); padding: 0 16px 18px; }
  .tile:nth-child(n+4) { display: none; }
  /* a strip to flick through, so the new episodes stay near the top */
  .show-grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 76px; gap: 12px; padding: 2px 16px 18px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; scroll-padding-left: 16px; }
  .show-grid::-webkit-scrollbar { display: none; }
  .show-grid:has(.pod-empty) { grid-auto-flow: row; grid-auto-columns: auto; }
  .show-head { padding: 12px 16px 16px; }
  .show-head > .back-link { margin-bottom: 8px; }
  /* the small cover beside the name; the rest across the card under them */
  .show-top { grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: none; column-gap: 14px; }
  .show-top > .show-art { grid-row: 1; }
  .show-top > .show-id { align-self: center; }
  .show-top > :not(.show-art, .show-id) { grid-column: 1 / -1; }
  .show-art { --size: 64px; width: 64px; }
  .show-id .kicker { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .show-title { font-size: 1.3rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .show-about { margin-top: 10px; }
  .show-actions { margin-top: 12px; }
  .show-actions .btn { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
  .show-actions .btn .icon { width: 15px; height: 15px; }
  /* the episodes' count and the search on one line (the heading is there for a screen reader) */
  .show-list-head { flex-wrap: nowrap; align-items: center; }
  .show-list-head > :first-child { flex: none; }
  .show-list-head .kicker { margin: 0; }
  .show-list-head h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .show-search { flex: 1 1 auto; min-width: 0; }
  .show-search input { min-width: 0; }
  .search-field.big { margin: 0 16px; }
  .found { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; padding: 10px 16px; }
  .found .art { --size: 48px; width: 48px; }
  #pod-settings .settings-body { padding: 0 16px 18px; }
  .pod-card > .setting-row { margin: 0 16px 18px; }
  .view-tabs { justify-self: stretch; }
  .view-tabs span { padding: 6px 8px; }
  .show-settings { width: 100%; }
  /* (three side by side: a word or two a line, no room for the icons) */
  .np-actions .btn .icon { display: none; }
  .notify-body { padding: 0 16px 18px; }
  .link-box { grid-template-columns: minmax(0, 1fr); padding: 4px 16px 18px; }
  .link-form { padding: 16px; }
  /* a card from the bottom, under the status bar and the page's top edge; the panel goes on
     under the screen's bottom edge, for when it is pulled up past the top and springs back */
  .sheet-pane {
    top: calc(env(safe-area-inset-top) + 18px); left: 0; width: 100%; border-left: 0; border-radius: 10px 10px 0 0;
    padding: 10px 18px calc(26px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    box-shadow: 0 -10px 30px -14px rgba(0, 0, 0, 0.45), 0 140px 0 var(--panel);
  }
  .sheet-back { background: rgba(0, 0, 0, 0.32); }
  /* (As large as the screen's height leaves room for: on a short one the cover gives way, so
     the play button under the strip is never pushed off the bottom.) */
  .np-art { --size: 280px; width: min(300px, 72vw, max(120px, calc(100vh - 430px))); width: min(300px, 72vw, max(120px, calc(100svh - 430px))); margin: 0; }
  /* (closer together, so the cover can stay as large as it can: ui/playerui.js fit) */
  .np { gap: 12px; }
  .np > .sheet-top { margin-bottom: 4px; }
  .np-tools { padding-top: 12px; }
}

/* ============================================================
   On a phone, which is where this is mostly used
   ============================================================ */

button, a, label, select, summary, input[type="range"] { touch-action: manipulation; }
.nav, .tabbar, .playbar, .play, .icon-btn, .tile, .show-tile, .ep-play, .sheet-top { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* A press: what is under the finger gives way at once (ui/motion.js: 0.96, a wide row 0.98, on
   the way down 100 ms, springing back in 220 ms) and takes a step in ground or colour. A row or
   a tile in a list that scrolls is marked data-pressed a moment late, as iOS does, so a finger
   that starts a scroll leaves none pressed. (Buttons take :active, which an iPhone shows only on
   a page that listens for touches: ui/dom.js does.) */
.ep[data-pressed], .found[data-pressed] { background: var(--panel-2); }
.ep.now[data-pressed] { background: var(--panel-3); }
.tile[data-pressed] { background: var(--panel-3); }
.show-tile[data-pressed] .art-img, .show-tile[data-pressed] .art-fallback { box-shadow: 0 0 0 1px var(--teal); }
.show-tile[data-pressed] .show-name { color: var(--text); }
.pb-now:active { background: var(--panel); }
.hit-main:active { background: var(--panel-2); color: var(--text); }
.hit-ep-main:active .hit-ep-title, .show-about:active { color: var(--muted); }
.chapter { transition: background var(--t-press); }
.chapter:active { background: var(--panel-2); }
.tabbar a:active, .nav a:active { color: var(--text); }
.search-entry:active { border-color: var(--teal); color: var(--muted); }
.chip-btn:active, .mini-seg button:active, .names-list button:active, .preset:active, .tab:active { color: var(--text); background: var(--panel-3); }
.note-time:active { border-color: var(--teal); }
a.sheet-show:active { color: var(--text); }

/* iOS zooms the page into any field set smaller than this */
@media (hover: none) and (pointer: coarse) {
  input[type="text"], input[type="search"], input:not([type]), textarea, select { font-size: 16px !important; }
}

/* Made for a thumb: whatever is touched is at least 44 px both ways. Where the drawn control is
   smaller and has room around it, its reach is widened into that room (the ::after below), so
   the page keeps its spacing; where controls sit closer than that, they are made 44. */
@media (pointer: coarse) {
  .ep-play, .ep-more, #latest-refresh, .back-link, .note-time, a.ext, .file-pick, .paste,
  #pod .btn, .ep-sheet .btn.small, #pod .segmented label, .sheet-pane .segmented label, #toast-action { position: relative; }
  .ep-play::after, .ep-more::after, #latest-refresh::after, .back-link::after, .note-time::after, a.ext::after,
  .file-pick::after, .paste::after, #pod .btn::after, .ep-sheet .btn.small::after, #pod .segmented label::after, .sheet-pane .segmented label::after, #toast-action::after {
    content: ""; position: absolute;
    top: min(0px, calc(50% - 22px)); bottom: min(0px, calc(50% - 22px));
    left: min(0px, calc(50% - 22px)); right: min(0px, calc(50% - 22px));
  }
  /* (the show's name above an episode clips what overflows it: reached by its padding) */
  a.sheet-show { padding: 14px 0; margin: -14px 0; }
  .back-link { z-index: 2; }
  .under .file-pick { display: inline-block; white-space: nowrap; }
  .tile .play { width: 44px; height: 44px; }
  /* (two rows of options: a thumb's height each with a little to spare, so one row's reach
     never meets the next whatever a browser rounds to) */
  #pod .segmented, .sheet-pane .segmented { row-gap: 12px; }
  #pod .segmented span, .sheet-pane .segmented span { min-width: 44px; text-align: center; }
  .view-tabs span, .sheet-tabs span { min-height: 44px; }
  .show-settings { height: 44px; }
  #pod .actions, .ep-sheet .actions { row-gap: 12px; }
  .ep-main, .found .ep-main, .hit-ep-main { min-height: 44px; }
  .hit-ep-main { align-content: center; }
  .ep-order .icon-btn.tiny { width: 44px; height: 44px; }
  .ep-more { width: 34px; height: 44px; }
  .menu-pop button { min-height: 44px; }
  .sheet-top .icon-btn { width: 44px; height: 44px; margin: -11px -13px -11px 0; }
  .pb-transport .jump-btn { width: 44px; height: 44px; }
  .show-search input { height: 44px; }
  /* switches one under another: a row each, the air inside it */
  #pod .switch.setting, .sheet-pane .switch.setting { min-height: 44px; }
  /* the now-playing sheet's own controls: a thumb's width and height each. Seven speeds do not
     fit at that width, so the two at the ends are left to the minus and plus beside them. */
  .np-speeds .icon-btn { width: 44px; height: 44px; }
  .np-speeds .mini-seg button { min-height: 44px; }
  .np-speeds .mini-seg button:first-child, .np-speeds .mini-seg button:last-child { display: none; }
  .np-sleeps button, .np-trims button { min-height: 44px; min-width: 44px; }
  .np-sleeps, .np-trims { gap: 8px; }
  .np .switch.setting { min-height: 44px; }
  .np-next-all { padding: 12px 0; margin: -12px 0; }
  .show-opts { gap: 0; }
  .show-opts .segmented { margin: 4px 0; }
  .notify-body { gap: 4px; }

  /* the transcript side: a new transcript, the library, the reader, the speakers */
  main > [data-pane] .btn, #resume-card .btn, #error-card .btn, #hero .segmented label, .entry-delete, .talk .who { position: relative; }
  main > [data-pane] .btn::after, #resume-card .btn::after, #error-card .btn::after, #hero .segmented label::after, .entry-delete::after, .talk .who::after {
    content: ""; position: absolute;
    top: min(0px, calc(50% - 22px)); bottom: min(0px, calc(50% - 22px));
    left: min(0px, calc(50% - 22px)); right: min(0px, calc(50% - 22px));
  }
  #hero .segmented { row-gap: 12px; }
  #hero .segmented span { min-width: 44px; text-align: center; }
  .settings-toggle, #hero .switch.setting { min-height: 44px; }
  .session-close, .error .close, .sheet-head .icon-btn { width: 44px; height: 44px; }
  .timeline .play { width: 44px; height: 44px; }
  .refine select { height: 44px; }
  .session-status { row-gap: 12px; }
  .find input { height: 44px; }
  .find .icon-btn.tiny { width: 44px; height: 44px; }
  .find input { padding-right: 132px; }
  .find-count { right: 92px; }
  #find-prev { right: 44px; }
  #find-next { right: 0; }
  .toolbar .switch { min-height: 44px; }
  .tool-actions .btn { width: 44px; height: 44px; }
  .names-list button { min-height: 44px; }
  .names-list { gap: 12px; }
  .names-list li { gap: 8px; }
  .map-actions { row-gap: 12px; }
  .talk { gap: 16px; }
}

/* From the home screen the page runs under the status bar, whose text is always white there:
   it gets the dark rail behind it in either theme. */
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); }
  body::before { content: ""; position: fixed; z-index: 80; top: 0; left: 0; right: 0; height: env(safe-area-inset-top); background: #0d242c; transition: background-color var(--t-sheet-out); }
  body.receded::before { background: #000; transition-duration: var(--t-sheet); }
  .topbar { top: env(safe-area-inset-top); }
  .toolbar { top: calc(var(--topbar) + max(10px, var(--tx-band)) + env(safe-area-inset-top)); }
  .tx-tabs { top: calc(var(--topbar) + env(safe-area-inset-top) + 8px); }
  .mini { top: calc(var(--topbar) + env(safe-area-inset-top) + 10px); }
}

@media (max-width: 640px) {
  #home-shows .pod-head { align-items: center; padding-bottom: 12px; }
  #home-shows .kicker { display: none; }
  #home-shows h2 { font-size: 1.1rem; }
  .show-grid { grid-auto-columns: 68px; }
  .show-name { font-size: 11.5px; font-weight: 500; color: var(--muted); }
  .ep { gap: 0 8px; padding: 10px 2px 10px 14px; }
  .ep .ep-meta { font-size: 10.5px; letter-spacing: 0.01em; line-height: 1.6; }
  .ep-play { width: 40px; height: 40px; }
  .ep.queued .ep-more { display: none; }
  .ep.queued { padding-right: 6px; }
  .tag { margin-left: 6px; }
  .show-opts .segmented legend { width: 100%; margin: 0 0 4px; }
  .sheet-pane::before { content: ""; display: block; width: 38px; height: 4px; margin: 0 auto 12px; border-radius: 2px; background: var(--line-strong); }
  .np-speeds .mini-seg button { font-size: 12px; }
}
@media (max-width: 640px) and (display-mode: standalone) {
  .toolbar, .toolbar:has(.find.searching) { top: calc(var(--topbar) + var(--tx-band) + env(safe-area-inset-top)); }
  .mini { top: calc(var(--topbar) + env(safe-area-inset-top) + 6px); }
}
