/* Presentice. A quiet rehearsal booth: the slide is the stage, the script reads like a teleprompter.
   Neutrals are cool graphite, dark by default. Presenter colors are the only hues in the interface. */

/* Dark is the default theme, whatever the system setting. theme.js stamps
   data-theme on <html>; light is the alternative behind the header toggle. */
:root {
  color-scheme: dark;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #0d0f13;
  --panel: #12151b;
  --panel-2: #171b22;
  --line: #232a33;
  --line-2: #3a4552;
  --muted: #9aa4b1;

  --surface: var(--panel);
  --sunken: var(--bg);
  --hover: var(--panel-2);
  --line-strong: var(--line-2);
  --field-line: #677382;
  --ink: #e8ecf1;
  --ink-2: var(--muted);
  --ink-3: #8b95a2;
  --on-ink: #0d0f13;
  --danger: #ff8f85;
  --focus: #e8ecf1;
  --backdrop: rgb(0 0 0 / 0.6);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.45);
  --shadow-slide: 0 1px 2px rgb(0 0 0 / 0.5), 0 14px 36px -10px rgb(0 0 0 / 0.75);
  --shadow-pop: 0 2px 6px rgb(0 0 0 / 0.45), 0 24px 56px -16px rgb(0 0 0 / 0.8);

  --p0: #f5a623;
  --p1: #5aa9e6;
  --p2: #4cc463;
  --p3: oklch(0.76 0.14 330);
  --p4: oklch(0.78 0.1 195);
  --p5: oklch(0.74 0.13 290);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --bar-h: 56px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: oklch(0.972 0.004 255);
  --panel: oklch(0.995 0.002 255);
  --panel-2: oklch(0.948 0.005 255);
  --line: oklch(0.885 0.006 255);
  --line-2: oklch(0.8 0.008 255);
  --muted: oklch(0.43 0.013 260);

  --sunken: var(--panel-2);
  --hover: var(--panel-2);
  --field-line: oklch(0.6 0.01 255);
  --ink: oklch(0.23 0.015 260);
  --ink-3: oklch(0.5 0.012 260);
  --on-ink: oklch(0.985 0.003 255);
  --danger: oklch(0.5 0.17 25);
  --focus: oklch(0.23 0.015 260);
  --backdrop: oklch(0.2 0.02 260 / 0.38);
  --shadow-sm: 0 1px 2px oklch(0.2 0.02 260 / 0.1);
  --shadow-slide: 0 1px 2px oklch(0.2 0.02 260 / 0.1), 0 12px 32px -8px oklch(0.2 0.02 260 / 0.22);
  --shadow-pop: 0 2px 6px oklch(0.2 0.02 260 / 0.08), 0 24px 56px -16px oklch(0.2 0.02 260 / 0.35);

  --p0: oklch(0.62 0.15 65);
  --p1: oklch(0.53 0.14 245);
  --p2: oklch(0.54 0.14 150);
  --p3: oklch(0.52 0.17 330);
  --p4: oklch(0.53 0.1 200);
  --p5: oklch(0.5 0.15 290);
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
h1, h2 { text-wrap: balance; }
p { text-wrap: pretty; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code { font-family: var(--mono); font-size: 0.875em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.muted { color: var(--ink-2); }
.noscript, .boot { padding: 24px; }
.pc-0 { --pc: var(--p0); } .pc-1 { --pc: var(--p1); } .pc-2 { --pc: var(--p2); }
.pc-3 { --pc: var(--p3); } .pc-4 { --pc: var(--p4); } .pc-5 { --pc: var(--p5); }
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--pc, var(--ink-3)); }

.mark { flex: none; }
.mark .mark-screen { fill: var(--ink); }
.mark .mark-line { fill: var(--bg); }
.mark .mark-accent { fill: var(--p0); }
.mark .mark-stand { stroke: var(--ink); }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font-size: 0.875rem; font-weight: 550; white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn:disabled:hover { background: var(--surface); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.primary:hover { background: color-mix(in oklch, var(--ink) 85%, var(--bg)); }
.btn.primary:disabled:hover { background: var(--ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.small { height: 30px; padding: 0 10px; font-size: 0.8125rem; }
.btn.icon-only { width: 36px; padding: 0; font-weight: 700; }
/* Theme toggle: the sun switches to light, the moon back to dark. */
.theme-toggle { color: var(--ink-2); }
.theme-toggle:hover { color: var(--ink); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
.landing-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: clamp(36px, 8vh, 80px); }

.segmented {
  display: inline-flex; gap: 2px; padding: 2px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: 9px;
}
.seg {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px;
  border: 0; border-radius: 7px; background: transparent;
  color: var(--ink-2); font-size: 0.8125rem; font-weight: 550;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.seg:hover { color: var(--ink); }
.seg[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.seg:disabled { opacity: 0.4; cursor: not-allowed; }
.field-label { font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.input, select {
  height: 34px; padding: 0 10px;
  border: 1px solid var(--field-line); border-radius: 8px;
  background: var(--bg); color: var(--ink);
}
.error { color: var(--danger); font-weight: 550; margin: 12px 0 0; }
.hint { margin: 0; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font-weight: 550; }
kbd {
  display: inline-block; min-width: 1.9em; padding: 1px 6px;
  font-family: var(--font); font-size: 0.75rem; font-weight: 600; text-align: center;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px;
  background: var(--bg);
}

/* Bars */
.screen.script, .screen.practice { display: flex; flex-direction: column; height: 100dvh; }
.bar {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: var(--bar-h); padding: 0 12px 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
/* Only the deck name gives up space; the buttons never shrink under it. */
.bar-left { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; }
.bar-right { display: flex; align-items: center; justify-content: flex-end; gap: 4px; flex: none; }
.label-short { display: none; }
.wordmark { display: inline-flex; align-items: center; gap: 9px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
.wordmark.small { font-size: 0.875rem; color: var(--ink-2); flex: none; }
.deck-name {
  margin: 0; padding-left: 12px; border-left: 1px solid var(--line);
  font-size: 0.9375rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Landing */
.landing-inner { width: 100%; max-width: 1080px; margin: 0 auto; padding: clamp(28px, 7vh, 80px) 28px 40px; }
.landing .wordmark { font-size: 1rem; }
.landing h1 {
  max-width: 22ch; margin: 0 0 16px;
  font-size: clamp(2rem, 1.3rem + 2.6vw, 3.25rem); line-height: 1.07; letter-spacing: -0.03em; font-weight: 700;
}
.lede { max-width: 54ch; margin: 0 0 36px; font-size: 1.125rem; line-height: 1.55; color: var(--ink-2); }
.start-row { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.drop-host { min-width: 0; }
.dropzone { position: relative; height: 100%; }
.drop-button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 100%; min-height: 272px; padding: 32px;
  border: 1.5px dashed var(--line-strong); border-radius: 14px;
  background: var(--surface); text-align: center; cursor: pointer;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.drop-button:hover { border-color: var(--ink-3); }
.dropzone.is-over .drop-button { border-style: solid; border-color: var(--ink); background: var(--hover); }
.drop-button:disabled { cursor: progress; }
.drop-art { color: var(--ink-3); margin-bottom: 6px; }
.dropzone.is-over .drop-art { color: var(--ink); }
.drop-title { font-size: 1.25rem; font-weight: 650; letter-spacing: -0.015em; }
.drop-sub { max-width: 34ch; color: var(--ink-2); font-size: 0.875rem; }
.drop-progress { display: grid; gap: 10px; width: min(320px, 80%); color: var(--ink-2); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.track { height: 4px; border-radius: 2px; background: var(--sunken); overflow: hidden; }
.track-fill { display: block; width: 100%; height: 100%; background: var(--ink); transform: scaleX(0); transform-origin: left center; transition: transform 0.25s var(--ease); }
.modal .drop-button { min-height: 180px; }

.sample-card {
  display: flex; flex-direction: column; padding: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  text-align: left; cursor: pointer;
  transition: border-color 0.15s var(--ease), box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
.sample-card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-bottom: 1px solid var(--line); }
.sample-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-pop); transform: translateY(-1px); }
.sample-card:active { transform: translateY(0); }
.sample-text { display: grid; gap: 3px; padding: 14px 16px 16px; }
.sample-title { display: inline-flex; align-items: center; gap: 6px; font-size: 1rem; font-weight: 650; }
.sample-sub { color: var(--ink-2); font-size: 0.8125rem; }
.facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px;
  margin: 44px 0 0; padding: 24px 0 0; list-style: none;
  border-top: 1px solid var(--line); color: var(--ink-2); font-size: 0.875rem;
}
.facts strong { display: block; margin-bottom: 2px; color: var(--ink); font-weight: 600; }
.fineprint { margin: 36px 0 0; color: var(--ink-3); font-size: 0.8125rem; }
.fineprint a { color: var(--ink-2); }

/* Script step */
.script-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 1fr); }
.editor-col { display: flex; flex-direction: column; gap: 12px; min-height: 0; padding: 24px 28px 20px; overflow: auto; }
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.editor-head h1 { margin: 0; font-size: 1.375rem; letter-spacing: -0.015em; }
.editor-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.editor-sub { max-width: 68ch; margin: -4px 0 0; color: var(--ink-2); font-size: 0.875rem; }
#scriptText {
  flex: 1; width: 100%; min-height: 320px; padding: 16px 18px; resize: none;
  border: 1px solid var(--field-line); border-radius: 10px; background: var(--surface);
  font-size: 0.9375rem; line-height: 1.65;
}
/* The focus ring replaces the border instead of stacking on it. */
#scriptText:focus-visible { outline-offset: -1px; }
#scriptText::placeholder { color: var(--ink-3); }
.format-help { font-size: 0.8125rem; color: var(--ink-2); }
.format-help summary { cursor: pointer; font-weight: 600; width: max-content; }
.format-help p { max-width: 68ch; }
.format-help pre { margin: 8px 0 0; padding: 12px 14px; overflow-x: auto; border-radius: 8px; background: var(--sunken); font-family: var(--mono); font-size: 0.8125rem; line-height: 1.6; color: var(--ink); }

/* Presenters: how many, then one row each with a name, a voice and its sample. */
.presenters-block { display: grid; gap: 12px; padding: 14px 16px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.pb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.pb-head h2 { margin: 0; font-size: 0.9375rem; font-weight: 650; letter-spacing: -0.005em; }
.pb-count { display: flex; align-items: center; gap: 10px; }
.pb-rows { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pb-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) minmax(0, 1.15fr) 34px; align-items: center; gap: 4px 10px; }
.pb-name, .pb-voice { width: 100%; min-width: 0; }
.pb-name::placeholder { color: var(--ink-3); }
.pb-play { width: 34px; height: 34px; padding: 0; color: var(--ink-2); }
.pb-play:hover { color: var(--ink); }
.pb-play.is-playing, .pb-play.is-playing:hover { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.pb-meta, .pb-problem { grid-column: 2 / -1; margin: 0; font-size: 0.75rem; }
.pb-meta { color: var(--ink-3); }
.pb-problem { color: var(--danger); font-weight: 550; }
.pb-problem.is-note { color: var(--ink-2); font-weight: 400; }
.pb-note { margin: 0; color: var(--ink-2); font-size: 0.8125rem; }
/* One presenter: no color, since there is nobody to tell apart. */
.presenters-block.is-single .pb-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) 34px; }
.presenters-block.is-single .pb-row > .dot { display: none; }
.presenters-block.is-single .pb-meta, .presenters-block.is-single .pb-problem { grid-column: 1 / -1; }

/* Voice quality: the same control on the Script step and in the Presenters panel. */
.pb-quality { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 4px 10px; }
.pb-quality .quality-note { grid-column: 1 / -1; margin: 0; color: var(--ink-3); font-size: 0.75rem; }
.sheet-quality { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

.ai-panel { display: grid; gap: 14px; padding: 16px 18px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
/* The second path: a key of your own, under the chat steps that need none. */
.ai-write { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.ai-write-title { margin: 0; font-size: 0.875rem; font-weight: 650; }
.ai-write-note { margin: 0; max-width: 68ch; color: var(--ink-2); font-size: 0.8125rem; }
.ai-key-row { display: flex; align-items: center; gap: 8px; }
.ai-key-row .input { flex: 1; min-width: 0; max-width: 360px; font-family: var(--mono); font-size: 0.8125rem; }
.ai-write-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-write-row .copy-status { margin-left: 0; }
#aiWrite[aria-busy="true"] { cursor: progress; }
.ai-for { margin: 0; color: var(--ink-2); font-size: 0.875rem; }
.ai-steps { display: grid; gap: 10px; margin: 0; padding-left: 1.3em; font-size: 0.875rem; }
.ai-steps li { padding-left: 4px; }
.ai-steps li::marker { color: var(--ink-3); font-weight: 600; }
.copy-status { margin-left: 6px; color: var(--ink-2); font-size: 0.8125rem; }
.prompt-fallback { display: grid; gap: 6px; font-size: 0.8125rem; color: var(--ink-2); }
.prompt-fallback textarea { width: 100%; padding: 10px; border: 1px solid var(--field-line); border-radius: 8px; background: var(--bg); font-family: var(--mono); font-size: 0.75rem; resize: vertical; }

.preview-col { min-height: 0; padding: 24px 24px 32px; overflow: auto; background: var(--sunken); border-left: 1px solid var(--line); }
.preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.preview-head h2 { margin: 0; font-size: 1rem; }
.preview-summary { margin: 0; color: var(--ink-2); font-size: 0.8125rem; text-align: right; }
.warnings { display: grid; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.warnings li, .pv-warn {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 0.8125rem; color: var(--ink);
}
.warnings li { padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.warn-mark {
  flex: none; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  background: var(--ink); color: var(--on-ink); font-size: 0.6875rem; font-weight: 800; transform: translateY(2px);
}
.preview-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.pv-slide { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.pv-thumb { display: block; width: 112px; height: auto; border-radius: 4px; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.pv-num { margin: 0 0 6px; font-size: 0.75rem; font-weight: 650; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pv-para { margin: 0 0 8px; font-size: 0.875rem; line-height: 1.5; overflow-wrap: anywhere; }
.pv-para:last-child { margin-bottom: 0; }
.pv-warn { margin: 0; color: var(--ink-2); }
/* A slide without lines is a normal state: a quiet ring, not an alarm. */
.pv-warn .warn-mark { background: transparent; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--ink-3); font-weight: 700; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; margin-right: 6px; padding: 1px 8px 1px 7px;
  border-radius: 999px; background: color-mix(in oklch, var(--pc) 15%, var(--surface));
  font-size: 0.75rem; font-weight: 650; vertical-align: 1px; white-space: nowrap;
}

/* Practice */
.practice-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(340px, 1fr); }
.stage-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--sunken); }
.stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 28px 32px 16px; }
.stage canvas, .stage-fallback { grid-area: 1 / 1; display: block; border-radius: 6px; background: #fff; box-shadow: var(--shadow-slide); }
.stage canvas { opacity: 0; transition: opacity 0.18s var(--ease); }
.stage canvas.is-ready { opacity: 1; }
.strip { flex: none; display: flex; gap: 10px; padding: 8px 32px 18px; overflow-x: auto; scrollbar-width: thin; }
/* Centered under the slide, and still scrollable from the first thumbnail when it overflows. */
.strip > :first-child { margin-left: auto; }
.strip > :last-child { margin-right: auto; }
.thumb { position: relative; flex: none; width: 104px; padding: 0; border: 0; border-radius: 6px; background: none; cursor: pointer; }
.thumb img { display: block; width: 100%; aspect-ratio: var(--aspect, 16 / 9); object-fit: contain; border-radius: 5px; background: #fff; box-shadow: 0 0 0 1px var(--line); transform: scale(0.94); transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), filter 0.15s var(--ease); }
.thumb:hover img { transform: scale(0.97); box-shadow: 0 0 0 1px var(--field-line); }
.thumb[aria-current="true"] img { transform: none; box-shadow: 0 0 0 2px var(--ink); }
/* No lines for the chosen presenter: grayed, still readable. */
.thumb.is-quiet img { filter: grayscale(1) contrast(0.8); }
.thumb .num {
  position: absolute; left: 5px; bottom: 5px; padding: 0 5px; border-radius: 4px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm);
  font-size: 0.6875rem; font-weight: 650; font-variant-numeric: tabular-nums;
}

.transcript { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--line); }
.transcript-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 16px 28px 4px; }
.transcript-head h2 { margin: 0; font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.transcript-body { flex: 1; min-height: 0; padding: 8px 28px 28px; overflow-y: auto; }
.para { margin: 0 0 22px; }
.speaker { display: flex; align-items: center; gap: 7px; margin: 0 0 6px; font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); }
.para-text { max-width: 34em; margin: 0; font-size: 1.3125rem; line-height: 1.6; letter-spacing: -0.006em; color: var(--ink-2); }
.sentence {
  margin: 0 -0.12em; padding: 0.05em 0.12em; border-radius: 6px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), opacity 0.2s var(--ease);
}
.sentence:hover { color: var(--ink); background-color: color-mix(in oklch, var(--pc) 8%, transparent); }
.sentence:focus-visible { outline-offset: 1px; }
.sentence.is-current { color: var(--ink); background-color: color-mix(in oklch, var(--pc) 14%, transparent); }
.transcript.is-focused .sentence { color: var(--ink); }
/* The other presenter's lines: quieter, but readable cue context (AA contrast). */
.transcript.is-focused .sentence.is-skipped,
.transcript.is-focused .sentence.is-skipped:hover { color: var(--ink-3); background-color: transparent; }
.sentence.is-reading .w { color: var(--ink-2); }
.sentence.is-reading .w.is-spoken { color: var(--ink); }
.w { border-radius: 4px; transition: background-color 0.08s linear, color 0.08s linear; }
.sentence.is-reading .w.is-now { color: var(--ink); background-color: color-mix(in oklch, var(--pc) 36%, transparent); }
.sentence.is-gap {
  background-image: linear-gradient(var(--pc), var(--pc));
  background-repeat: no-repeat; background-position: 0 100%; background-size: 100% 3px;
}
.sentence.is-gap.is-draining { background-size: 0% 3px; transition: background-size var(--gap-ms, 2s) linear; }
/* Shadow mode: the cue sits right where the reader is looking. */
.sentence.is-gap::after {
  content: "Your turn"; display: inline-block; margin-left: 0.5em; padding: 0 0.6em;
  border-radius: 999px; background: color-mix(in oklch, var(--pc) 16%, var(--surface)); color: var(--ink);
  font-size: 0.75rem; font-weight: 650; line-height: 1.7; letter-spacing: 0; vertical-align: 0.2em;
  animation: appear 0.2s both;
}
.sentence.is-waiting::after {
  content: ""; display: inline-block; width: 0.62em; height: 0.62em; margin-left: 0.4em;
  border: 2px solid color-mix(in oklch, var(--pc) 30%, transparent); border-top-color: var(--pc); border-radius: 50%;
  vertical-align: -0.02em;
  animation: spin 0.8s linear infinite, appear 0.2s 0.25s both;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
.empty-note { max-width: 34em; margin: 4px 0 0; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--ink-2); }
.transcript-foot { flex: none; display: grid; gap: 6px; padding: 10px 28px 12px; border-top: 1px solid var(--line); }
.note { margin: 0; color: var(--ink-2); font-size: 0.8125rem; }

.transport {
  flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 22px;
  min-height: 68px; padding: 10px 20px;
  background: var(--surface); border-top: 1px solid var(--line);
}
.t-group { display: flex; align-items: center; gap: 4px; }
/* Wide screens: the extras sit in the transport row. Phones: one scrollable row under the buttons. */
.t-extras { display: contents; }
.t-focus, .t-speed { gap: 8px; }
.t-modes { gap: 6px; }
.tbtn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 0; border-radius: 9px; background: transparent; color: var(--ink); cursor: pointer;
  transition: background-color 0.15s var(--ease), transform 0.1s;
}
.tbtn:hover { background: var(--hover); }
.tbtn:active { transform: scale(0.96); }
.tbtn.play { width: 48px; height: 48px; margin: 0 4px; border-radius: 12px; background: var(--ink); color: var(--on-ink); }
.tbtn.play:hover { background: color-mix(in oklch, var(--ink) 85%, var(--bg)); }
.toggle {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 10px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
  font-size: 0.8125rem; font-weight: 600; cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.toggle:hover { background: var(--hover); }
.toggle[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.voice-status { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 30px; color: var(--ink-2); font-size: 0.8125rem; }
.vs-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.vs-bar { flex: none; width: 72px; height: 3px; border-radius: 2px; background: var(--sunken); overflow: hidden; }
.vs-fill { display: block; width: 100%; height: 100%; background: var(--ink-2); transform: scaleX(0); transform-origin: left center; transition: transform 0.3s var(--ease); }
.voice-status.is-done .vs-bar { display: none; }
.voice-status.is-error { align-items: flex-start; flex-wrap: wrap; color: var(--danger); }
.voice-status.is-error .vs-text { white-space: normal; padding-top: 5px; }

/* Dialogs */
dialog {
  max-width: min(560px, calc(100vw - 32px)); padding: 22px 24px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop);
}
dialog::backdrop { background: var(--backdrop); }
dialog h2 { margin: 0 0 6px; font-size: 1.125rem; letter-spacing: -0.01em; }
dialog p { margin: 0 0 14px; }
.modal { width: min(560px, calc(100vw - 32px)); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.sheet {
  width: min(420px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  margin: 0 0 0 auto; border-width: 0 0 0 1px; border-radius: 0; padding: 20px 22px;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.sheet-head h2 { margin: 0; }
.presenter-list { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.presenter { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.presenter-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.presenter-name { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 650; }
.presenter-count { color: var(--ink-3); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.voice-row { display: flex; gap: 8px; }
.voice-row select { flex: 1; min-width: 0; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; margin: 14px 0 0; }
.keys div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.keys dt { order: 2; white-space: nowrap; }
.keys dd { margin: 0; color: var(--ink-2); font-size: 0.875rem; }

.tour {
  position: fixed; z-index: 50; width: min(320px, calc(100vw - 32px)); padding: 16px 18px;
  border-radius: 12px; background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-pop);
  animation: tour-in 0.22s var(--ease) both;
}
@keyframes tour-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.tour h2 { margin: 2px 0 6px; font-size: 1rem; }
.tour p { margin: 0; font-size: 0.875rem; line-height: 1.5; }
.tour .tour-count { font-size: 0.75rem; opacity: 0.72; font-variant-numeric: tabular-nums; }
.tour-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }
.tour .btn.ghost { color: var(--on-ink); }
.tour .btn.ghost:hover { background: color-mix(in oklch, var(--on-ink) 14%, transparent); }
.tour .btn.primary { background: var(--on-ink); border-color: var(--on-ink); color: var(--ink); }
.tour .btn.primary:hover { background: color-mix(in oklch, var(--on-ink) 88%, var(--ink)); }
.tour :focus-visible { outline-color: var(--on-ink); }
.tour-target { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 10px; }
.tour-target.tour-target-large { outline-offset: -6px; }

.toast {
  position: fixed; left: 50%; bottom: 92px; z-index: 60; transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px;
  background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-pop); font-size: 0.875rem;
}

/* Smaller screens: stack, never break */
@media (max-width: 1180px) {
  .transport { gap: 10px 14px; padding: 10px 14px; }
  .t-focus, .t-speed { gap: 6px; }
  .t-speed .field-label { display: none; }
  .seg { padding: 0 9px; }
}
@media (max-width: 900px) {
  .start-row, .facts { grid-template-columns: 1fr; }
  .facts { gap: 14px; }
  .script-layout { grid-template-columns: 1fr; grid-auto-rows: auto; align-content: start; overflow: auto; }
  .editor-col, .preview-col { overflow: visible; }
  .editor-col { min-height: auto; }
  .transport { justify-content: center; }
  .preview-col { border-left: 0; border-top: 1px solid var(--line); }
  .practice-layout { grid-template-columns: 1fr; grid-template-rows: minmax(220px, 42vh) minmax(0, 1fr); }
  .transcript { border-left: 0; border-top: 1px solid var(--line); }
  .para-text { font-size: 1.1875rem; }
  .bar { padding: 0 8px 0 14px; }
  .bar .wordmark span { display: none; }
}
@media (max-width: 640px) {
  .label-long { display: none; }
  .label-short { display: inline; }
}
@media (max-width: 560px) {
  .bar-right .btn { padding: 0 8px; }
  .keys { grid-template-columns: 1fr; }
  .stage { padding: 14px; }
  .strip { padding: 4px 14px 12px; }
  .transcript-head, .transcript-body, .transcript-foot { padding-left: 18px; padding-right: 18px; }
  .bar { gap: 8px; }
  /* The script screen has three actions: the deck name makes room for them. */
  .screen.script .deck-name { display: none; }
  #scriptText { min-height: 240px; max-height: 50vh; }
  .presenters-block { padding: 12px 12px 14px; }
  .pb-row { grid-template-columns: 8px minmax(0, 1fr) 34px; }
  .pb-name { grid-column: 2 / -1; }
  .pb-voice { grid-column: 2; }
  .presenters-block.is-single .pb-row { grid-template-columns: minmax(0, 1fr) 34px; }
  .presenters-block.is-single .pb-name { grid-column: 1 / -1; }
  .presenters-block.is-single .pb-voice { grid-column: 1; }
  .practice-layout { grid-template-rows: minmax(160px, 30vh) minmax(0, 1fr); }
  .transport { flex-direction: column; flex-wrap: nowrap; gap: 8px; padding: 8px 0 10px; }
  .t-extras {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 0 14px 2px; overflow-x: auto; scrollbar-width: none;
  }
  .t-extras > * { flex: none; }
  .t-extras > :first-child { margin-left: auto; }
  .t-extras > :last-child { margin-right: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .sentence.is-gap.is-draining { background-size: 100% 3px; }
}
