/* Speech setup + live shell — light theme redesign.
   Visual target: Desktop/export speech-setup / speech-live mocks.
   Every conflicting rule is scoped to html[data-kouli-theme='light']. */

/* Compact slide timing — lives on As Delivered reverse (no progress bars). */
html[data-kouli-theme='light'] .speech-slide-timing--compact {
  margin: 14px 0 4px;
  padding: 10px 0 0;
  border-top: 1px solid var(--sp-border, #E8E3DC);
}
html[data-kouli-theme='light'] .speech-slide-timing-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sp-muted, #6B6762);
}
html[data-kouli-theme='light'] .speech-slide-timing-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
html[data-kouli-theme='light'] .speech-slide-timing-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--sp-muted, #6B6762);
}
html[data-kouli-theme='light'] .speech-slide-timing-label {
  flex: none;
  font-weight: 600;
  color: var(--sp-text, #1E2224);
}
html[data-kouli-theme='light'] .speech-slide-timing-sec {
  text-align: right;
  min-width: 0;
}
/* Legacy standalone card — keep hidden if anything still mounts it */
html[data-kouli-theme='light'] .speech-slide-timing-card {
  display: none !important;
}

html[data-kouli-theme='light'] {
  --sp-bg: #F4F0EB;
  --sp-surface: #FAF8F5;
  --sp-white: #FFFFFF;
  --sp-border: #E8E3DC;
  --sp-border-strong: #DDD7CF;
  --sp-track: #E2DCD3;
  --sp-placeholder: #E5E0D8;
  --sp-self: #CFC8BE;
  --sp-text: #1E2224;
  --sp-muted: #6B6762;
  --sp-soft: #4A4743;
  --sp-faint: #9A958F;
  --sp-fainter: #8A857E;
  --sp-teal: #0F6B5C;
  --sp-teal-hover: #0A4F44;
  --sp-teal-soft: rgba(15, 107, 92, 0.12);
  --sp-teal-shadow: rgba(15, 107, 92, 0.22);
  --sp-rec: #C2554D;
  --sp-rec-halo: rgba(194, 85, 77, 0.18);
  --sp-sans: Inter, system-ui, -apple-system, sans-serif;
  --sp-serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
}

/* -------------------------------------------------------------------------- */
/* 1. Speech flow chrome — hide bottom nav, full-viewport paper               */
/* -------------------------------------------------------------------------- */

html[data-kouli-theme='light'] body.kouli-speech-active .bottom-nav {
  display: none !important;
}

/* Mobile results: restore bottom nav so Home / Profile stay reachable */
@media (max-width: 1023px) {
  html[data-kouli-theme='light'] body.kouli-speech-active.kouli-speech-results .bottom-nav {
    display: flex !important;
  }

  html[data-kouli-theme='light'] body.kouli-speech-active.kouli-speech-results #ted-results-container {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Home lives in bottom nav on phone — hide the desktop results Home control */
  html[data-kouli-theme='light'] body.kouli-speech-active.kouli-speech-results .kouli-results-home {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  html[data-kouli-theme='light'] body.kouli-speech-active.kouli-speech-results .kouli-results-home {
    display: inline-flex;
  }
}

html[data-kouli-theme='light'] body.kouli-speech-active #ted-mode-page {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  background: var(--sp-bg);
  color: var(--sp-text);
  font-family: var(--sp-sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  z-index: 40;
}

/* Results: same fixed shell, but the page must scroll */
html[data-kouli-theme='light'] body.kouli-speech-active.kouli-speech-results #ted-mode-page {
  overflow-x: hidden !important;
  overflow-y: scroll !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  height: 100% !important;
  height: 100dvh !important;
}

html[data-kouli-theme='light'] body.kouli-speech-active.kouli-speech-results {
  overflow: hidden !important; /* scroll lives on #ted-mode-page */
  position: relative !important;
  height: 100% !important;
  height: 100dvh !important;
  touch-action: pan-y;
}

html[data-kouli-theme='light'] body.kouli-speech-active.kouli-speech-results #main-content {
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

/* Recording shell must not intercept scroll after results are shown */
html[data-kouli-theme='light'] body.kouli-speech-active.kouli-speech-results #ted-recording-area {
  display: none !important;
  pointer-events: none !important;
}

html[data-kouli-theme='light'] body.kouli-speech-active.kouli-speech-results #ted-results-container {
  overflow: visible !important;
  max-height: none !important;
  height: auto !important;
  flex: none !important;
  min-height: 0 !important;
  padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
}

html[data-kouli-theme='light'] body.kouli-speech-active {
  background: var(--sp-bg) !important;
  color: var(--sp-text);
}

/* Hide legacy multi-step prep when v2 redesign is active */
html[data-kouli-theme='light'] body.kouli-speech-v2 #ted-transcript-card,
html[data-kouli-theme='light'] body.kouli-speech-v2 #ted-prep-card,
html[data-kouli-theme='light'] body.kouli-speech-v2 #ted-mode-setup:not(.speech-setup) {
  display: none !important;
}

/* -------------------------------------------------------------------------- */
/* 2. Setup shell (.speech-setup)                                             */
/* -------------------------------------------------------------------------- */

html[data-kouli-theme='light'] .speech-setup {
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: var(--sp-bg);
  color: var(--sp-text);
  font-family: var(--sp-sans);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

html[data-kouli-theme='light'] .speech-setup *,
html[data-kouli-theme='light'] .speech-setup *::before,
html[data-kouli-theme='light'] .speech-setup *::after {
  box-sizing: border-box;
}

html[data-kouli-theme='light'] .speech-setup-topbar {
  height: 76px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
}

html[data-kouli-theme='light'] .speech-setup-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  border: 1px solid var(--sp-border);
  background: var(--sp-surface);
  color: var(--sp-text);
  font-family: var(--sp-sans);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  appearance: none;
}

html[data-kouli-theme='light'] .speech-setup-home:hover,
html[data-kouli-theme='light'] .speech-setup-home:focus-visible {
  border-color: var(--sp-border-strong);
  background: var(--sp-white);
  outline: none;
}

html[data-kouli-theme='light'] .speech-setup-home svg {
  flex: none;
  stroke: var(--sp-text);
}

html[data-kouli-theme='light'] .speech-setup-mode {
  font-size: 14px;
  font-weight: 600;
  color: var(--sp-muted);
}

html[data-kouli-theme='light'] .speech-setup-topbar-spacer {
  width: 90px;
  flex: none;
}

html[data-kouli-theme='light'] .speech-setup-main {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 0;
  overflow: auto;
}

html[data-kouli-theme='light'] .speech-setup-hero {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: none;
}

html[data-kouli-theme='light'] .speech-setup-title {
  margin: 0;
  font-family: var(--sp-serif);
  font-weight: 500;
  font-size: 48px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--sp-text);
  background: none;
  -webkit-text-fill-color: currentColor;
}

html[data-kouli-theme='light'] .speech-setup-subtitle {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
  color: var(--sp-soft);
}

html[data-kouli-theme='light'] .speech-setup-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 24px;
  min-height: 0;
}

/* --- Script card ---------------------------------------------------------- */

html[data-kouli-theme='light'] .speech-setup-script {
  padding: 24px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

html[data-kouli-theme='light'] .speech-setup-script-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

html[data-kouli-theme='light'] .speech-setup-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--sp-text);
}

html[data-kouli-theme='light'] .speech-setup-upload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--sp-border);
  background: var(--sp-white);
  color: var(--sp-text);
  font-family: var(--sp-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  text-decoration: none;
  white-space: nowrap;
}

/* Compact mobile labels — hidden on desktop / tablet setup. */
html[data-kouli-theme='light'] .speech-setup-upload-label-short,
html[data-kouli-theme='light'] .speech-setup-clear-header,
html[data-kouli-theme='light'] .speech-setup-script-meta,
html[data-kouli-theme='light'] .speech-setup-camera-hint-short,
html[data-kouli-theme='light'] .speech-setup-start-note-short {
  display: none;
}

html[data-kouli-theme='light'] .speech-setup-script-actions {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}

html[data-kouli-theme='light'] .speech-setup-upload:hover,
html[data-kouli-theme='light'] .speech-setup-upload:focus-visible {
  border-color: var(--sp-border-strong);
  outline: none;
}

html[data-kouli-theme='light'] .speech-setup-script-body {
  flex: 1 1 auto;
  min-height: 280px;
  border-radius: 16px;
  background: var(--sp-white);
  border: 1px solid var(--sp-border);
  padding: 18px 20px;
  font-family: var(--sp-serif);
  font-size: 19px;
  line-height: 1.5;
  color: var(--sp-text);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  resize: none;
  outline: none;
}

html[data-kouli-theme='light'] .speech-setup-script-editor {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  font-family: var(--sp-serif);
  font-size: 19px;
  line-height: 1.5;
  color: var(--sp-text);
  overflow: auto;
  resize: none;
  outline: none;
  box-shadow: none;
}

/* Beats overlay must fill the script card — not sit in a 320px strip. */
html[data-kouli-theme='light'] #ted-mode-setup .ted-script-beats-view {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  height: auto;
  padding: 0;
  overflow: auto;
  font-family: var(--sp-serif);
  font-size: 19px;
  line-height: 1.5;
  color: var(--sp-text);
}

html[data-kouli-theme='light'] .speech-setup-script-editor::placeholder,
html[data-kouli-theme='light'] .speech-setup-script-body .is-placeholder {
  color: var(--sp-fainter);
}

html[data-kouli-theme='light'] .speech-setup-script-editor:focus,
html[data-kouli-theme='light'] .speech-setup-script-body:focus-within {
  border-color: var(--sp-teal);
  box-shadow: 0 0 0 3px var(--sp-teal-soft);
}

html[data-kouli-theme='light'] .speech-setup-toggles {
  display: flex;
  gap: 10px;
}

html[data-kouli-theme='light'] .speech-setup-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--sp-border);
  background: var(--sp-white);
  text-align: left;
  cursor: pointer;
  appearance: none;
  font-family: var(--sp-sans);
  color: var(--sp-text);
}

html[data-kouli-theme='light'] .speech-setup-toggle-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

html[data-kouli-theme='light'] .speech-setup-toggle-label {
  font-size: 14px;
  font-weight: 600;
}

html[data-kouli-theme='light'] .speech-setup-toggle-hint {
  font-size: 12px;
  color: var(--sp-muted);
}

html[data-kouli-theme='light'] .speech-setup-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 72px;
  height: 32px;
  padding: 0 10px 0 4px;
  border-radius: 999px;
  border: 1px solid var(--sp-border);
  background: #DDD7CF;
  flex: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--sp-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--sp-soft);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

html[data-kouli-theme='light'] .speech-setup-switch-knob {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(30, 34, 36, 0.18);
  flex: none;
  transition: transform 0.15s ease;
}

html[data-kouli-theme='light'] .speech-setup-switch-state {
  min-width: 22px;
  text-align: left;
}

html[data-kouli-theme='light'] .speech-setup-switch.is-on,
html[data-kouli-theme='light'] .speech-setup-toggle.is-on .speech-setup-switch,
html[data-kouli-theme='light'] .speech-setup-toggle[aria-checked='true'] .speech-setup-switch,
html[data-kouli-theme='light'] .speech-setup-camera .speech-setup-switch.is-on {
  background: var(--sp-teal);
  border-color: var(--sp-teal);
  color: #fff;
  flex-direction: row-reverse;
  padding: 0 4px 0 10px;
}

html[data-kouli-theme='light'] .speech-setup-toggle .speech-setup-switch {
  width: 40px;
  min-width: 40px;
  height: 24px;
  padding: 0;
  gap: 0;
  border: 0;
}

html[data-kouli-theme='light'] .speech-setup-toggle .speech-setup-switch-knob {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
}

html[data-kouli-theme='light'] .speech-setup-toggle .speech-setup-switch-state {
  display: none;
}

html[data-kouli-theme='light'] .speech-setup-toggle .speech-setup-switch.is-on .speech-setup-switch-knob,
html[data-kouli-theme='light'] .speech-setup-toggle[aria-checked='true'] .speech-setup-switch .speech-setup-switch-knob {
  transform: translateX(16px);
}

/* Reshape change bullets — show what actually moved when Revised differs. */
html[data-kouli-theme='light'] #ted-mode-setup #ted-arc-changes[hidden],
html[data-kouli-theme='light'] body.kouli-speech-v2 #ted-arc-changes[hidden] {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-mode-setup #ted-arc-changes:not([hidden]),
html[data-kouli-theme='light'] body.kouli-speech-v2 #ted-arc-changes:not([hidden]) {
  display: block !important;
  margin: 8px 0 0;
  padding: 0 0 0 1.1em;
  list-style: disc;
  color: var(--sp-muted, #6B6560);
  font-size: 12.5px;
  line-height: 1.45;
}

html[data-kouli-theme='light'] #ted-mode-setup #ted-arc-changes .ted-arc-change-beat {
  font-weight: 700;
  color: #0F6B5C;
  margin-right: 4px;
}

/* Original / Revised tabs — visible once Reshape has a draft */
html[data-kouli-theme='light'] #ted-mode-setup .ted-script-version-tabs[hidden] {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-mode-setup .ted-script-version-tabs:not([hidden]) {
  display: flex !important;
  gap: 6px;
  margin: 8px 0 0;
  align-items: center;
}

/* One prep status under the script (Reshape + Beats). Flashlight while working. */
html[data-kouli-theme='light'] #ted-mode-setup #ted-script-surface-status {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-prep-status,
html[data-kouli-theme='light'] #ted-mode-setup #ted-script-prep-status {
  margin: 0;
  min-height: 1.35em;
  font-family: var(--sp-sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--sp-muted);
  text-align: left;
}

html[data-kouli-theme='light'] #ted-mode-setup #ted-script-prep-status[hidden] {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-mode-setup #ted-script-prep-status.is-error {
  color: #8A5A1E;
  font-weight: 500;
}

html[data-kouli-theme='light'] #ted-mode-setup #ted-script-prep-status.ted-label-flashlight,
html[data-kouli-theme='light'] #ted-mode-setup #ted-script-prep-status.is-flashlight {
  color: var(--sp-soft);
  background-image: linear-gradient(
    100deg,
    rgba(70, 75, 80, 0.55) 0%,
    rgba(70, 75, 80, 0.55) 36%,
    var(--sp-text) 46%,
    var(--sp-teal) 50%,
    var(--sp-text) 54%,
    rgba(70, 75, 80, 0.55) 64%,
    rgba(70, 75, 80, 0.55) 100%
  );
  background-size: 240% 100%;
  background-repeat: no-repeat;
  background-position: 140% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: tedLabelFlashlight 2.8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  html[data-kouli-theme='light'] #ted-mode-setup #ted-script-prep-status.ted-label-flashlight,
  html[data-kouli-theme='light'] #ted-mode-setup #ted-script-prep-status.is-flashlight {
    animation: none;
    background-image: none;
    color: var(--sp-soft);
    -webkit-text-fill-color: var(--sp-soft);
  }
}

/* --- Side column: length / slides / camera / start ------------------------ */

html[data-kouli-theme='light'] .speech-setup-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

html[data-kouli-theme='light'] .speech-setup-length,
html[data-kouli-theme='light'] .speech-setup-slides {
  padding: 20px 22px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

html[data-kouli-theme='light'] .speech-setup-slides-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

html[data-kouli-theme='light'] .speech-setup-desktop-only {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--sp-muted);
  text-transform: uppercase;
}

html[data-kouli-theme='light'] .speech-setup-segment,
html[data-kouli-theme='light'] .speech-setup-chips {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 3px;
  border-radius: 14px;
  border: 1px solid var(--sp-border);
  background: #F0EBE4;
}

html[data-kouli-theme='light'] .speech-setup-chip {
  flex: 1 1 0;
  min-width: 0;
  height: 42px;
  padding: 4px 2px;
  border-radius: 11px;
  border: 0;
  background: transparent;
  color: var(--sp-muted);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-family: var(--sp-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  appearance: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

html[data-kouli-theme='light'] .speech-setup-chip span {
  font-size: 10px;
  font-weight: 500;
  line-height: 1.1;
  opacity: 0.75;
}

html[data-kouli-theme='light'] .speech-setup-chip:hover,
html[data-kouli-theme='light'] .speech-setup-chip:focus-visible {
  color: var(--sp-text);
  outline: none;
}

html[data-kouli-theme='light'] .speech-setup-chip.is-selected,
html[data-kouli-theme='light'] .speech-setup-chip.is-on,
html[data-kouli-theme='light'] .speech-setup-chip[aria-pressed='true'],
html[data-kouli-theme='light'] .speech-setup-chip[aria-checked='true'] {
  border-color: transparent;
  background: var(--sp-white);
  color: var(--sp-text);
  box-shadow: 0 1px 3px rgba(30, 34, 36, 0.1);
}

html[data-kouli-theme='light'] .speech-setup-chip.is-selected span,
html[data-kouli-theme='light'] .speech-setup-chip.is-on span,
html[data-kouli-theme='light'] .speech-setup-chip[aria-pressed='true'] span {
  opacity: 0.55;
}

html[data-kouli-theme='light'] .speech-setup-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--sp-muted);
}

html[data-kouli-theme='light'] .speech-setup-slides-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 1.4em;
}

html[data-kouli-theme='light'] .speech-setup-slides-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(30, 34, 36, 0.14);
  border-top-color: rgba(30, 34, 36, 0.55);
  flex: none;
  animation: speech-setup-slides-spin 0.7s linear infinite;
}

html[data-kouli-theme='light'] .speech-setup-slides-spinner[hidden] {
  display: none !important;
}

@keyframes speech-setup-slides-spin {
  to { transform: rotate(360deg); }
}

html[data-kouli-theme='light'] .speech-setup-slides.is-busy .speech-setup-upload,
html[data-kouli-theme='light'] .speech-setup-slides.is-busy .speech-setup-slides-empty,
html[data-kouli-theme='light'] .speech-setup-slides.is-busy .speech-file-row-remove {
  opacity: 0.55;
  pointer-events: none;
  cursor: wait;
}

/* File row (slides) */
html[data-kouli-theme='light'] .speech-setup-file-row,
html[data-kouli-theme='light'] .speech-file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 14px;
  background: var(--sp-white);
  border: 1px solid var(--sp-border);
}

html[data-kouli-theme='light'] .speech-setup-file-thumb,
html[data-kouli-theme='light'] .speech-file-row-thumb {
  width: 72px;
  height: 44px;
  border-radius: 6px;
  background: var(--sp-placeholder);
  flex: none;
  object-fit: cover;
  overflow: hidden;
}

html[data-kouli-theme='light'] .speech-setup-file-meta,
html[data-kouli-theme='light'] .speech-file-row-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

html[data-kouli-theme='light'] .speech-setup-file-name,
html[data-kouli-theme='light'] .speech-file-row-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--sp-text);
}

html[data-kouli-theme='light'] .speech-setup-file-detail,
html[data-kouli-theme='light'] .speech-file-row-detail {
  font-size: 12px;
  color: var(--sp-muted);
}

html[data-kouli-theme='light'] .speech-setup-file-remove,
html[data-kouli-theme='light'] .speech-file-row-remove {
  flex: none;
  border: 0;
  background: transparent;
  padding: 0;
  font-family: var(--sp-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--sp-muted);
  cursor: pointer;
}

html[data-kouli-theme='light'] .speech-setup-file-remove:hover,
html[data-kouli-theme='light'] .speech-file-row-remove:hover {
  color: var(--sp-text);
}

html[data-kouli-theme='light'] .speech-setup-slides-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 68px;
  border-radius: 14px;
  border: 1px dashed var(--sp-border-strong);
  background: var(--sp-white);
  color: var(--sp-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

html[data-kouli-theme='light'] .speech-setup-slides-empty:hover {
  border-color: var(--sp-teal);
  color: var(--sp-teal);
}

/* Camera row — same switch chrome as Reshape / Beats */
html[data-kouli-theme='light'] .speech-setup-camera {
  padding: 16px 22px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

html[data-kouli-theme='light'] .speech-setup-camera-switch,
html[data-kouli-theme='light'] .speech-setup-camera .ted-beat-sheet-switch {
  flex: none;
  width: auto !important;
  max-width: none !important;
  margin: 0;
  align-self: center;
}

html[data-kouli-theme='light'] .speech-setup-camera-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

html[data-kouli-theme='light'] .speech-setup-camera-title {
  font-size: 15px;
  font-weight: 600;
}

html[data-kouli-theme='light'] .speech-setup-camera-hint {
  font-size: 12px;
  color: var(--sp-muted);
}

html[data-kouli-theme='light'] .speech-setup-camera-hint a,
html[data-kouli-theme='light'] .speech-setup-privacy-link {
  color: var(--sp-teal);
  font-weight: 600;
  text-decoration: none;
}

html[data-kouli-theme='light'] .speech-setup-camera-hint a:hover,
html[data-kouli-theme='light'] .speech-setup-privacy-link:hover {
  color: var(--sp-teal-hover);
}

/* Start CTA */
html[data-kouli-theme='light'] .speech-setup-start {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

html[data-kouli-theme='light'] .speech-setup-cta,
html[data-kouli-theme='light'] .speech-setup .ted-start-cta,
html[data-kouli-theme='light'] .speech-setup #ted-start-btn {
  height: 56px;
  min-height: 56px;
  border: 0;
  border-radius: 999px;
  background: var(--sp-teal);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--sp-sans);
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 10px 24px var(--sp-teal-shadow);
  cursor: pointer;
  appearance: none;
  width: 100%;
  text-decoration: none;
}

html[data-kouli-theme='light'] .speech-setup-cta:hover,
html[data-kouli-theme='light'] .speech-setup .ted-start-cta:hover,
html[data-kouli-theme='light'] .speech-setup #ted-start-btn:hover {
  background: var(--sp-teal-hover);
  box-shadow: 0 12px 28px var(--sp-teal-shadow);
}

html[data-kouli-theme='light'] .speech-setup-cta:disabled,
html[data-kouli-theme='light'] .speech-setup .ted-start-cta:disabled,
html[data-kouli-theme='light'] .speech-setup #ted-start-btn:disabled {
  background: var(--sp-border-strong);
  color: var(--sp-muted);
  box-shadow: none;
  cursor: not-allowed;
}

html[data-kouli-theme='light'] .speech-setup-start-note {
  margin: 0;
  font-size: 12px;
  color: var(--sp-muted);
  text-align: center;
}

html[data-kouli-theme='light'] .speech-setup-cache-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 4px 0 8px;
}

html[data-kouli-theme='light'] .speech-setup-clear-all {
  appearance: none;
  border: 1px solid var(--sp-border);
  background: transparent;
  color: var(--sp-muted);
  font-family: var(--sp-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}

html[data-kouli-theme='light'] .speech-setup-clear-all:hover,
html[data-kouli-theme='light'] .speech-setup-clear-all:focus-visible {
  color: var(--sp-text);
  border-color: var(--sp-border-strong);
  outline: none;
}

/* Setup mobile */
@media (max-width: 1023px) {
  /* Mobile = one scrolling column. Do not reuse desktop flex/grid heights. */
  html[data-kouli-theme='light'] body.kouli-speech-active #ted-mode-page {
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
    text-align: left;
  }

  html[data-kouli-theme='light'] body.kouli-speech-active #ted-mode-setup.speech-setup {
    text-align: left;
  }

  html[data-kouli-theme='light'] .speech-setup {
    height: auto;
    min-height: 100%;
    min-height: 100dvh;
    overflow: visible;
  }

  html[data-kouli-theme='light'] .speech-setup-topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    height: 56px;
    padding: 0 16px;
    background: var(--sp-bg);
    justify-content: flex-start;
    gap: 12px;
  }

  /* Beat global mobile `button { width: 100% }` from index.html. */
  html[data-kouli-theme='light'] .speech-setup-home,
  html[data-kouli-theme='light'] #speech-setup-home {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: max-content !important;
    min-width: 0;
    padding: 0 12px 0 8px;
    height: 34px;
  }

  html[data-kouli-theme='light'] .speech-setup-mode {
    margin-left: auto;
    flex: 0 0 auto;
    padding-right: 2px;
  }

  html[data-kouli-theme='light'] .speech-setup-topbar-spacer {
    display: none;
  }

  html[data-kouli-theme='light'] .speech-setup-main {
    flex: none;
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 8px 16px 32px;
    gap: 16px;
  }

  html[data-kouli-theme='light'] .speech-setup-title {
    font-size: 34px;
  }

  html[data-kouli-theme='light'] .speech-setup-subtitle {
    font-size: 15px;
  }

  html[data-kouli-theme='light'] .speech-setup-grid {
    display: flex;
    flex-direction: column;
    flex: none;
    height: auto;
    min-height: 0;
    gap: 14px;
  }

  html[data-kouli-theme='light'] .speech-setup-script,
  html[data-kouli-theme='light'] .speech-setup-side,
  html[data-kouli-theme='light'] .speech-setup-length,
  html[data-kouli-theme='light'] .speech-setup-camera,
  html[data-kouli-theme='light'] .speech-setup-start {
    position: relative;
    flex: none;
    height: auto;
    min-height: 0;
    overflow: visible;
    margin-top: 0;
  }

  html[data-kouli-theme='light'] .speech-setup-script {
    padding: 16px;
    gap: 12px;
  }

  html[data-kouli-theme='light'] .speech-setup-script-head {
    flex-wrap: wrap;
  }

  html[data-kouli-theme='light'] .speech-setup-upload {
    font-size: 12px;
    padding: 0 10px;
  }

  html[data-kouli-theme='light'] .speech-setup-script-body,
  html[data-kouli-theme='light'] .speech-setup-script-editor {
    flex: none;
    min-height: 140px;
    max-height: 220px;
    height: 180px;
  }

  html[data-kouli-theme='light'] .speech-setup-script-body textarea.speech-setup-script-editor {
    min-height: 140px !important;
    height: 100%;
    max-height: none;
  }

  html[data-kouli-theme='light'] .speech-setup-toggles {
    flex-direction: column;
    gap: 8px;
  }

  html[data-kouli-theme='light'] .speech-setup-toggle {
    width: 100%;
    position: relative;
    z-index: 1;
    overflow: visible;
  }

  html[data-kouli-theme='light'] .speech-setup-toggle .ted-beat-sheet-switch {
    position: relative;
    flex: none;
    margin: 0;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .ted-script-version-tabs,
  html[data-kouli-theme='light'] #ted-mode-setup .ted-script-prep-status,
  html[data-kouli-theme='light'] #ted-mode-setup .ted-beat-sheet-legend {
    position: relative;
    z-index: 0;
  }

  html[data-kouli-theme='light'] .speech-setup-slides {
    display: none !important;
  }

  html[data-kouli-theme='light'] .speech-setup-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  html[data-kouli-theme='light'] .speech-setup-length {
    padding: 16px;
  }

  html[data-kouli-theme='light'] .speech-setup-segment,
  html[data-kouli-theme='light'] .speech-setup-chips {
    width: 100%;
  }

  html[data-kouli-theme='light'] .speech-setup-chip span {
    display: none;
  }

  html[data-kouli-theme='light'] .speech-setup-camera {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
  }

  html[data-kouli-theme='light'] .speech-setup-camera-copy {
    flex: 1 1 auto;
    min-width: 0;
  }

  html[data-kouli-theme='light'] .speech-setup-camera-hint {
    line-height: 1.35;
  }

  html[data-kouli-theme='light'] .speech-setup-camera-switch,
  html[data-kouli-theme='light'] .speech-setup-camera .ted-beat-sheet-switch {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    margin: 0;
  }

  html[data-kouli-theme='light'] .speech-setup-upload,
  html[data-kouli-theme='light'] .speech-setup-chip,
  html[data-kouli-theme='light'] .speech-setup-toggle {
    width: auto !important;
    max-width: none;
  }

  html[data-kouli-theme='light'] .speech-setup-toggle {
    width: 100% !important;
  }

  html[data-kouli-theme='light'] .speech-setup-chip {
    flex: 1 1 0 !important;
    min-width: 0 !important;
  }

  html[data-kouli-theme='light'] .speech-setup-start {
    margin-top: 4px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  html[data-kouli-theme='light'] .speech-setup-cta {
    width: 100%;
  }
}

@media (max-width: 560px) {
  html[data-kouli-theme='light'] .speech-setup-title {
    font-size: 30px;
  }

  html[data-kouli-theme='light'] .speech-setup-chip {
    font-size: 14px;
  }

  html[data-kouli-theme='light'] .speech-setup-home span {
    /* keep Home label */
  }
}

/* -------------------------------------------------------------------------- */
/* 3. Live shell (.speech-live / #ted-recording-area.speech-live-shell)        */
/* -------------------------------------------------------------------------- */

html[data-kouli-theme='light'] .speech-live,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.ted-recording-immersive,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.stage-mode {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  z-index: 9999;
  background: var(--sp-bg) !important;
  color: var(--sp-text);
  font-family: var(--sp-sans);
  overflow: hidden;
  display: grid;
  grid-template-rows: 64px 1fr 76px;
  align-items: stretch;
  justify-content: stretch;
  box-sizing: border-box;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell::before,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.stage-mode::before {
  display: none !important;
  content: none !important;
}

html[data-kouli-theme='light'] .speech-live *,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell *,
html[data-kouli-theme='light'] .speech-live *::before,
html[data-kouli-theme='light'] .speech-live *::after {
  box-sizing: border-box;
}

/* Neutralize legacy dark / floating chrome inside the new shell */
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-exit-btn,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-live-label,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #ted-recording-live-label,
html[data-kouli-theme='light'] .speech-live .ted-recording-live-label {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-mist-stage,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-waveform-wrap,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-fullscreen-exit,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-fullscreen-toggle,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-self-view-header,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-pause {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-active,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-stage-top-bar,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-stage-bottom-dock,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-controls {
  position: static;
  inset: auto;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: contents;
}

/* Framing guide off by default */
/* Bottom bar owns PACE/FILLERS/VOICE — hide the old tile hub. */
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-self-view-coach-hud {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-live-no-slides .speech-live-deck,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-live-deck,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-live-next-slide {
  display: none !important;
}

/* Auto-advance only makes sense with a deck */
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) #speech-tp-auto-slides {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-live-script-panel {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 48px));
  max-height: min(42%, 320px);
  z-index: 4;
  background: rgba(250, 248, 245, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 20px;
  border: 1px solid rgba(232, 227, 220, 0.9);
  box-shadow: 0 12px 32px rgba(30, 34, 36, 0.12);
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-line--prev,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-line--next,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-word {
  color: #6B6560;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-line--current,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-word.is-read {
  color: #1E2224;
}

html[data-kouli-theme='light'] .speech-self-view-coach-guide,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-self-view-coach-guide {
  display: none !important;
}

html[data-kouli-theme='light'] .speech-framing-guide-on .speech-self-view-coach-guide,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-framing-guide-on .speech-self-view-coach-guide,
html[data-kouli-theme='light'] .speech-live.speech-framing-guide-on .speech-self-view-coach-guide {
  display: block !important;
}

/* --- Top bar -------------------------------------------------------------- */

html[data-kouli-theme='light'] .speech-live-top,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px;
  min-height: 64px;
  background: transparent;
  color: var(--sp-text);
}

html[data-kouli-theme='light'] .speech-live-top-center {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
}

html[data-kouli-theme='light'] .speech-live-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

html[data-kouli-theme='light'] .speech-live-nav-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--sp-border);
  background: var(--sp-white);
  color: var(--sp-soft);
  font-family: var(--sp-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  width: auto;
}

html[data-kouli-theme='light'] .speech-live-nav-btn:hover {
  border-color: var(--sp-border-strong);
  color: var(--sp-text);
}

html[data-kouli-theme='light'] .speech-live-timer-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

html[data-kouli-theme='light'] .speech-live-rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sp-rec);
  box-shadow: 0 0 0 4px var(--sp-rec-halo);
  flex: none;
}

html[data-kouli-theme='light'] .speech-live-timer,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-timer,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #ted-recording-timer {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  color: var(--sp-text);
  text-shadow: none;
  line-height: 1;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-timer.urgent {
  color: var(--sp-rec);
}

html[data-kouli-theme='light'] .speech-live-of {
  font-size: 12px;
  color: var(--sp-muted);
}

html[data-kouli-theme='light'] .speech-live-progress {
  flex: 1;
  max-width: 420px;
  height: 4px;
  border-radius: 2px;
  background: var(--sp-track);
  margin: 0;
  overflow: hidden;
}

html[data-kouli-theme='light'] .speech-live-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--sp-teal);
  border-radius: inherit;
  transition: width 0.25s linear;
}

html[data-kouli-theme='light'] .speech-live-top-meta {
  font-size: 13px;
  color: var(--sp-muted);
  white-space: nowrap;
}

html[data-kouli-theme='light'] .speech-live-top-meta.is-over {
  color: #8A5A1E;
}

html[data-kouli-theme='light'] .speech-live-fullscreen-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--sp-border);
  background: var(--sp-surface);
  color: var(--sp-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--sp-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  flex: none;
}

html[data-kouli-theme='light'] .speech-live-fullscreen-icon {
  display: none;
  flex: none;
}

html[data-kouli-theme='light'] .speech-live-fullscreen-btn:hover,
html[data-kouli-theme='light'] .speech-live-fullscreen-btn:focus-visible {
  border-color: var(--sp-border-strong);
  background: var(--sp-white);
  outline: none;
}

/* --- Main stage ----------------------------------------------------------- */

html[data-kouli-theme='light'] .speech-live-main {
  min-height: 0;
  padding: 0 24px;
  display: grid;
  gap: 16px;
}

/* With slides */
html[data-kouli-theme='light'] .speech-live.has-slides .speech-live-main,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-live-main,
html[data-kouli-theme='light'] .speech-live-main--slides {
  grid-template-columns: minmax(0, 1fr) 380px;
}

html[data-kouli-theme='light'] .speech-live-slides-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

html[data-kouli-theme='light'] .speech-live-slide-stage {
  flex: 1;
  min-height: 0;
  border-radius: 12px;
  background: #F4F0EB;
  border: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sp-muted);
  font-size: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

html[data-kouli-theme='light'] .speech-live-slide-stage img,
html[data-kouli-theme='light'] .speech-live-slide-stage canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: transparent;
}

html[data-kouli-theme='light'] .speech-live-thumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 64px;
  flex: none;
}

html[data-kouli-theme='light'] .speech-live-thumb-nav {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #E8E3DC;
  background: #FAF8F5;
  color: var(--sp-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  appearance: none;
  flex: none;
  padding: 0;
}

html[data-kouli-theme='light'] .speech-live-thumb-nav.is-next,
html[data-kouli-theme='light'] .speech-live-thumb-nav--next {
  border: 1px solid #E8E3DC;
  background: #FAF8F5;
  color: var(--sp-text);
}

html[data-kouli-theme='light'] .speech-live-thumb-nav--next.is-ready {
  border-color: transparent;
  background: var(--sp-teal);
  color: #fff;
}

html[data-kouli-theme='light'] .speech-live-thumb-strip {
  flex: 1;
  display: flex;
  gap: 8px;
  overflow: hidden;
  min-width: 0;
}

html[data-kouli-theme='light'] .speech-live-thumb {
  width: 96px;
  height: 56px;
  border-radius: 8px;
  background: var(--sp-placeholder);
  flex: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  opacity: 0.6;
  overflow: hidden;
  appearance: none;
}

html[data-kouli-theme='light'] .speech-live-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

html[data-kouli-theme='light'] .speech-live-thumb.is-active,
html[data-kouli-theme='light'] .speech-live-thumb[aria-current='true'] {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--sp-teal);
}

html[data-kouli-theme='light'] .speech-live-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

html[data-kouli-theme='light'] .speech-live-self-view,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .ted-recording-self-view,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides #ted-recording-self-view-tile {
  position: relative;
  display: block !important;
  height: auto;
  min-height: 0;
  flex: none;
  border-radius: 20px;
  background: var(--sp-self);
  overflow: hidden;
  border: 0;
  box-shadow: none;
  width: 100%;
  inset: auto;
  aspect-ratio: 4 / 3;
  visibility: visible !important;
  opacity: 1 !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides #ted-recording-self-view-video {
  object-fit: cover !important;
  object-position: center 30% !important;
  transform: scaleX(-1);
}

html[data-kouli-theme='light'] .speech-live-next-slide {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 72px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--sp-border);
  background: var(--sp-surface);
  flex: none;
  min-width: 0;
}

html[data-kouli-theme='light'] .speech-live-next-slide[hidden] {
  display: none !important;
}

html[data-kouli-theme='light'] .speech-live-next-thumb {
  width: 96px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--sp-placeholder);
  flex: none;
}

html[data-kouli-theme='light'] .speech-live-next-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  text-align: left;
}

html[data-kouli-theme='light'] .speech-live-next-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sp-muted);
}

html[data-kouli-theme='light'] .speech-live-next-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides #speech-live-fullscreen-pill,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-live-fullscreen-btn {
  display: none !important;
}

/* Kill legacy fullscreen expansion when slides are showing — it put the
   teleprompter over the deck and swallowed the self-view tile. */
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides.is-stage-fullscreen .ted-recording-self-view,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides.is-stage-fullscreen #ted-recording-self-view-tile {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 4 / 3 !important;
  border-radius: 20px !important;
  z-index: 1 !important;
}

/* Full screen must never hide/empty the script mount on the light shell
   (legacy TED fullscreen hid mist + remounted HUD into self-view). */
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.is-stage-fullscreen #ted-recording-mist-stage,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides #ted-recording-mist-stage,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.is-stage-fullscreen .speech-live-script-mount {
  display: flex !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.is-stage-fullscreen .speech-live-script-panel {
  display: flex !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.is-stage-fullscreen .speech-teleprompter,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.is-stage-fullscreen .speech-teleprompter--card,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.is-stage-fullscreen .speech-teleprompter--hud {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: 100% !important;
  transform: none !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-self-view,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #ted-recording-self-view-tile {
  max-width: none !important;
  width: 100% !important;
}

/* Keep teleprompter inside the script panel — never absolute over the deck. */
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-script-panel {
  position: relative;
  z-index: 2;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #ted-recording-mist-stage,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-script-mount {
  position: relative !important;
  display: flex !important;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  inset: auto !important;
  width: auto !important;
  height: auto !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter--card,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter--hud {
  position: relative !important;
  inset: auto !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  transform: none !important;
  z-index: 1;
  pointer-events: auto;
  color: var(--sp-text);
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-surface {
  height: 100%;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 4px 0 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  overflow: hidden;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-teleprompter-surface {
  /* Pin the current line near 33% down the panel (prev sits just above). */
  padding-top: max(8px, calc(33% - 2.4em));
  justify-content: flex-start;
  gap: 6px;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-teleprompter-line--prev {
  font-size: 15px;
  line-height: 1.4;
  color: #9A958F;
  min-height: 0;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-teleprompter-line--prev[hidden],
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-teleprompter-line--next[hidden] {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-teleprompter-line--current {
  font-size: 21px;
  line-height: 1.35;
  font-weight: 600;
  color: #1E2224;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-teleprompter-line--next {
  font-size: 17px;
  line-height: 1.4;
  font-weight: 400;
  color: #6B6762;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-nexts {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-next-slide-chip {
  align-self: flex-start;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #E8E3DC;
  background: #FAF8F5;
  font-size: 12px;
  font-weight: 600;
  color: var(--sp-text);
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-next-slide-chip[hidden] {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line {
  text-align: left;
  text-shadow: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-word,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-word.is-read,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-word--emphasis-strong,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-word--emphasis-soft {
  color: inherit;
  text-shadow: none;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-word {
  color: #9A958F;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-word.is-read {
  color: #1E2224;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line--prev,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line--next {
  font-size: 15px;
  line-height: 1.45;
  color: #9A958F;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-teleprompter-line--current {
  font-size: 21px;
  line-height: 1.35;
  font-weight: 600;
  color: #1E2224;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-line--current {
  font-size: 26px;
  line-height: 1.3;
  font-weight: 600;
  color: #1E2224;
  text-align: center;
}

html[data-kouli-theme='light'] .speech-live-you-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #fff;
  background: rgba(30, 34, 36, 0.5);
  padding: 4px 8px;
  border-radius: 999px;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #ted-recording-self-view-video,
html[data-kouli-theme='light'] .speech-live #ted-recording-self-view-video,
html[data-kouli-theme='light'] .speech-live-self-view video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  border-radius: inherit;
}

/* Script panel (with slides) */
html[data-kouli-theme='light'] .speech-live-script,
html[data-kouli-theme='light'] .speech-live-script-panel {
  flex: 1;
  min-height: 0;
  padding: 18px 20px;
  border-radius: 20px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

html[data-kouli-theme='light'] .speech-live-script-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

html[data-kouli-theme='light'] .speech-live-script-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--sp-muted);
  text-transform: uppercase;
}

/* A− / A+ only in Teleprompter ▾ — never on the script head or bottom dock.
   Class rules must not override [hidden]; force-hide the legacy mounts. */
html[data-kouli-theme='light'] #speech-live-type-scale,
html[data-kouli-theme='light'] #speech-live-type-scale-dock,
html[data-kouli-theme='light'] .speech-live-type-scale,
html[data-kouli-theme='light'] .speech-live-type-scale-dock {
  display: none !important;
}

/* A− / A+ type scale pill (legacy class kept for any non-live surfaces) */
html[data-kouli-theme='light'] .speech-type-scale:not(.speech-live-type-scale) {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--sp-border);
  border-radius: 999px;
  padding: 2px;
  background: transparent;
}

html[data-kouli-theme='light'] .speech-type-scale-btn,
html[data-kouli-theme='light'] .speech-live-type-scale button {
  width: 28px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--sp-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sp-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  padding: 0;
}

html[data-kouli-theme='light'] .speech-type-scale-btn--plus,
html[data-kouli-theme='light'] .speech-live-type-scale button:last-child {
  font-size: 14px;
}

html[data-kouli-theme='light'] .speech-type-scale-btn:hover,
html[data-kouli-theme='light'] .speech-type-scale-btn:focus-visible,
html[data-kouli-theme='light'] .speech-live-type-scale button:hover,
html[data-kouli-theme='light'] .speech-live-type-scale button:focus-visible {
  background: rgba(30, 34, 36, 0.06);
  outline: none;
}

html[data-kouli-theme='light'] .speech-type-scale-btn:disabled,
html[data-kouli-theme='light'] .speech-live-type-scale button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Without slides — camera fills the stage; script as glass card on top */
html[data-kouli-theme='light'] .speech-live:not(.has-slides) .speech-live-main,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-live-main,
html[data-kouli-theme='light'] .speech-live-main--solo {
  position: relative;
  display: block;
  height: 100%;
  min-height: 0;
  margin: 0 24px;
  padding: 0;
  border-radius: 24px;
  background: var(--sp-self);
  overflow: hidden;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-live-side,
html[data-kouli-theme='light'] .speech-live:not(.has-slides) .speech-live-side,
html[data-kouli-theme='light'] .speech-live-main--solo .speech-live-side {
  position: absolute;
  inset: 0;
  display: block;
  gap: 0;
  min-height: 0;
}

html[data-kouli-theme='light'] .speech-live:not(.has-slides) .speech-live-self-view,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .ted-recording-self-view,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) #ted-recording-self-view-tile,
html[data-kouli-theme='light'] .speech-live-main--solo .speech-live-self-view {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  border-radius: 24px !important;
  z-index: 1;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) #ted-recording-self-view-video,
html[data-kouli-theme='light'] .speech-live:not(.has-slides) #ted-recording-self-view-video {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

html[data-kouli-theme='light'] .speech-live-script-overlay {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 48px));
  max-height: calc(100% - 32px);
  height: max-content;
  padding: 18px 24px;
  border-radius: 20px;
  background: rgba(250, 248, 245, 0.86);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  overflow: auto;
  z-index: 3;
}

html[data-kouli-theme='light'] .speech-live.is-script-hidden .speech-live-script,
html[data-kouli-theme='light'] .speech-live.is-script-hidden .speech-live-script-panel,
html[data-kouli-theme='light'] .speech-live.is-script-hidden .speech-live-script-overlay,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.is-script-hidden .speech-live-script,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.is-script-hidden .speech-live-script-overlay {
  display: none !important;
}

/* --- Teleprompter lines --------------------------------------------------- */

html[data-kouli-theme='light'] .speech-live-line,
html[data-kouli-theme='light'] .speech-live .speech-teleprompter-line,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line {
  margin: 0;
  font-family: var(--sp-serif);
  text-shadow: none;
}

html[data-kouli-theme='light'] .speech-live-line--prev,
html[data-kouli-theme='light'] .speech-live-line--next,
html[data-kouli-theme='light'] .speech-live .speech-teleprompter-line--prev,
html[data-kouli-theme='light'] .speech-live .speech-teleprompter-line--next,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line--prev,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line--next {
  font-size: 15px;
  line-height: 1.45;
  font-weight: 400;
  color: var(--sp-faint);
}

html[data-kouli-theme='light'] .speech-live.has-slides .speech-live-line--current,
html[data-kouli-theme='light'] .speech-live-script .speech-live-line--current,
html[data-kouli-theme='light'] .speech-live.has-slides .speech-teleprompter-line--current,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-teleprompter-line--current {
  font-size: 21px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--sp-text);
}

html[data-kouli-theme='light'] .speech-live:not(.has-slides) .speech-live-line--current,
html[data-kouli-theme='light'] .speech-live-script-overlay .speech-live-line--current,
html[data-kouli-theme='light'] .speech-live:not(.has-slides) .speech-teleprompter-line--current,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-line--current {
  font-size: 26px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--sp-text);
}

html[data-kouli-theme='light'] .speech-live-phrase,
html[data-kouli-theme='light'] .speech-live .speech-teleprompter-word.is-current,
html[data-kouli-theme='light'] .speech-live .speech-teleprompter-word.is-active,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-word.is-current,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell mark.speech-live-phrase {
  background: var(--sp-teal-soft);
  border-radius: 4px;
  padding: 0 3px;
  color: inherit;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

html[data-kouli-theme='light'] .speech-live .speech-teleprompter,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transform: none !important;
}

html[data-kouli-theme='light'] .speech-live .speech-teleprompter-surface,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-surface {
  border: 0;
  background: transparent;
  box-shadow: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  min-width: 0;
}

html[data-kouli-theme='light'] .speech-live-script-overlay .speech-teleprompter-surface {
  align-items: center;
  gap: 8px;
}

html[data-kouli-theme='light'] .speech-live .speech-teleprompter-footer,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-footer {
  display: none;
}

/* --- Bottom bar ----------------------------------------------------------- */

html[data-kouli-theme='light'] .speech-live-bottom,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  min-height: 76px;
  border-top: 1px solid var(--sp-border);
  background: var(--sp-surface);
  position: relative;
}

/* Cues HUD — heads-up on the self-view tile (not the bottom bar). */
html[data-kouli-theme='light'] #ted-recording-self-view-tile .speech-live-cue,
html[data-kouli-theme='light'] .speech-live-cue {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 20px);
  height: 34px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(12, 19, 24, 0.78);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 8;
  pointer-events: none;
}

html[data-kouli-theme='light'] .speech-live-cue[hidden] {
  display: none !important;
}

html[data-kouli-theme='light'] .speech-live-cue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #E5A000;
  flex: none;
}

html[data-kouli-theme='light'] .speech-live-cue-text {
  font-size: 13px;
  font-weight: 600;
  color: #F7F3EE;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-kouli-theme='light'] .speech-live-cues-toggle {
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #E8E3DC;
  background: #fff;
  color: #1E2224;
  font-family: var(--sp-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

html[data-kouli-theme='light'] .speech-live-cues-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sp-teal);
  flex: none;
}

html[data-kouli-theme='light'] .speech-live-cues-toggle.is-off {
  background: #fff;
  color: #1E2224;
  border: 1px solid #E8E3DC;
  border-style: solid;
}

html[data-kouli-theme='light'] .speech-live-cues-toggle.is-off .speech-live-cues-dot {
  background: #C8C2BA;
}

/* Force-hide live cues when the toggle is off */
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-cues-off .speech-live-cue {
  display: none !important;
}

/* A− / A+ actually scale teleprompter type (JS sets --sp-script-scale + data-script-size) */
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell {
  --sp-script-scale: 1;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line--prev,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line--next {
  font-size: calc(15px * var(--sp-script-scale, 1)) !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-teleprompter-line--next {
  font-size: calc(17px * var(--sp-script-scale, 1)) !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-teleprompter-line--current {
  font-size: calc(21px * var(--sp-script-scale, 1)) !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-line--current {
  font-size: calc(26px * var(--sp-script-scale, 1)) !important;
}

html[data-kouli-theme='light'] .speech-live:not(.has-slides) .speech-live-bottom,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-live-bottom {
  border-top: 0;
  background: transparent;
}

html[data-kouli-theme='light'] .speech-live-stats {
  display: flex;
  gap: 28px;
  align-items: flex-end;
  min-width: 0;
}

html[data-kouli-theme='light'] .speech-live-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

html[data-kouli-theme='light'] .speech-live-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--sp-muted);
  text-transform: uppercase;
}

html[data-kouli-theme='light'] .speech-live-stat-value {
  font-size: 17px;
  font-weight: 600;
  color: var(--sp-text);
  font-variant-numeric: tabular-nums;
}

html[data-kouli-theme='light'] .speech-live-stat-note {
  font-size: 12px;
  font-weight: 500;
  color: var(--sp-teal);
}

html[data-kouli-theme='light'] .speech-live-voice-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
}

html[data-kouli-theme='light'] .speech-live-voice-bars span {
  width: 4px;
  border-radius: 2px;
  background: var(--sp-border-strong);
  display: block;
}

html[data-kouli-theme='light'] .speech-live-voice-bars span.is-active {
  background: var(--sp-teal);
}

html[data-kouli-theme='light'] .speech-live-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: none;
}

html[data-kouli-theme='light'] .speech-live-hide-script {
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--sp-border);
  background: var(--sp-white);
  color: var(--sp-text);
  display: inline-flex;
  align-items: center;
  font-family: var(--sp-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
}

html[data-kouli-theme='light'] .speech-live:not(.has-slides) .speech-live-hide-script {
  background: var(--sp-surface);
}

html[data-kouli-theme='light'] .speech-live-hide-script:hover,
html[data-kouli-theme='light'] .speech-live-hide-script:focus-visible {
  border-color: var(--sp-border-strong);
  outline: none;
}

html[data-kouli-theme='light'] .speech-live-end,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-end,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-end.speech-live-end {
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 0;
  background: var(--sp-text);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sp-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  box-shadow: none;
  position: static;
  inset: auto;
  width: auto;
  min-width: 0;
}

html[data-kouli-theme='light'] .speech-live-end:hover,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-end:hover {
  background: #000;
}

html[data-kouli-theme='light'] .speech-live-end-stop {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #fff;
  flex: none;
  display: inline-block;
}

/* Armed / starting: hide End until the clock is running */
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-live-armed .speech-live-end,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-live-armed .ted-recording-end.speech-live-end,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-live-starting .speech-live-end,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-live-starting .ted-recording-end.speech-live-end {
  visibility: hidden;
  pointer-events: none;
}

/* In-layout Start — sits between self-view and script (right column) */
html[data-kouli-theme='light'] .speech-live-start-slot {
  flex: none;
  display: flex;
  justify-content: stretch;
  width: 100%;
}

html[data-kouli-theme='light'] .speech-live-start-slot[hidden] {
  display: none !important;
}

html[data-kouli-theme='light'] .speech-live-stage-start {
  width: 100%;
  height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--sp-teal);
  color: #fff;
  font-family: var(--sp-sans);
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 10px 24px var(--sp-teal-shadow);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

html[data-kouli-theme='light'] .speech-live-stage-start:hover {
  background: var(--sp-teal-hover);
}

html[data-kouli-theme='light'] .speech-live-stage-start:disabled {
  background: var(--sp-border-strong);
  color: var(--sp-muted);
  box-shadow: none;
  cursor: not-allowed;
}

/* No-slides: keep Start on-page below the script glass, not a full-screen veil */
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-live-start-slot {
  position: absolute;
  left: 50%;
  top: calc(16px + min(42%, 320px) + 20px);
  transform: translateX(-50%);
  width: min(280px, calc(100% - 48px));
  z-index: 5;
}

/* Fixed full-viewport countdown — never in page flow, never shifts layout.
   Never use display:!important here: it defeats inline display:none and can
   leave a full-screen click trap if cleanup misses the overlay class. */
html[data-kouli-theme='light'] #ted-recording-countdown.speech-live-countdown-overlay,
html[data-kouli-theme='light'] .ted-recording-countdown.speech-live-countdown-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 100000 !important;
  margin: 0 !important;
  padding: 0 !important;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: grid;
  place-items: center;
  background: rgba(244, 240, 235, 0.25);
  color: rgba(30, 34, 36, 0.28);
  font-family: var(--sp-serif, 'Newsreader', Georgia, serif);
  font-size: 240px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  text-shadow: none;
  box-shadow: none !important;
  border-radius: 0 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  /* Capture clicks so Start / End underneath cannot fire mid 3-2-1. */
  pointer-events: auto;
  transform: none;
  animation: none;
  cursor: default;
}

html[data-kouli-theme='light'] #ted-recording-countdown.speech-live-countdown-overlay[style*="display: none"],
html[data-kouli-theme='light'] .ted-recording-countdown.speech-live-countdown-overlay[style*="display: none"],
html[data-kouli-theme='light'] #ted-recording-countdown:not(.speech-live-countdown-overlay),
html[data-kouli-theme='light'] .ted-recording-countdown:not(.speech-live-countdown-overlay) {
  display: none !important;
  pointer-events: none !important;
}

html[data-kouli-theme='light'] #ted-recording-countdown.speech-live-countdown-overlay.is-tick,
html[data-kouli-theme='light'] .ted-recording-countdown.speech-live-countdown-overlay.is-tick {
  animation: speech-countdown-tick 150ms ease-out;
}

@keyframes speech-countdown-tick {
  from {
    opacity: 0;
    transform: scale(1.15);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-live-armed .speech-live-rec-dot {
  background: var(--sp-border-strong);
  box-shadow: none;
  opacity: 0.55;
  animation: none;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.speech-live-armed):not(.speech-live-starting) .speech-live-rec-dot {
  animation: speech-rec-pulse 1.2s ease-in-out infinite;
}

@keyframes speech-rec-pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--sp-rec-halo); opacity: 1; }
  50% { box-shadow: 0 0 0 5px rgba(194, 85, 77, 0.1); opacity: 0.85; }
}

/* Live mobile — one script, fixed viewport (desktop ≥1024 unchanged) */
@media (max-width: 1023px) {
  /* Only lock scroll while the live shell is actually showing — Setup must still scroll. */
  html[data-kouli-theme='light'] body.kouli-speech-active:not(.kouli-speech-results):has(#ted-recording-area.speech-live-shell:not([style*='display: none']):not([style*='display:none'])) {
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  html[data-kouli-theme='light'] .speech-live.has-slides .speech-live-main,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-live-main,
  html[data-kouli-theme='light'] .speech-live-main--slides {
    grid-template-columns: 1fr;
  }

  /* Mobile: no slide deck / no per-slide teleprompter chrome */
  html[data-kouli-theme='light'] .speech-live-slides-col,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-slides-col,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-next-slide,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-next-slide-chip,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell [data-teleprompter-next-slide],
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #speech-tp-auto-slides,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-me-tile-meta {
    display: none !important;
  }

  /* --- Shell: top | stage | toolbar, no page scroll ---
     CRITICAL: never force display when the shell has inline display:none —
     !important would resurrect a blank cream overlay over Setup (same class
     of bug as the mobile Home cream blank). */
  html[data-kouli-theme='light'] .speech-live:not([style*='display: none']):not([style*='display:none']),
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not([style*='display: none']):not([style*='display:none']) {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    grid-template-rows: none !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-active,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-top,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-main,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-bottom,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-side,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-actions,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-stats,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-menu-wrap {
    min-width: 0;
    max-width: 100%;
  }

  /* --- Top bar --- */
  html[data-kouli-theme='light'] .speech-live-top,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-top {
    flex: none;
    padding: calc(env(safe-area-inset-top, 0px) + 8px) 16px 8px;
    gap: 8px;
    min-height: 0;
    align-items: center;
  }

  html[data-kouli-theme='light'] .speech-live-nav {
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    height: 40px;
    border: 1px solid #E2DCD3;
    border-radius: 999px;
    background: #FAF8F5;
    overflow: hidden;
    flex: none;
  }

  html[data-kouli-theme='light'] .speech-live-nav-btn {
    height: 40px;
    min-width: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #1E2224;
    font-family: var(--sp-sans);
    font-size: 14px;
    font-weight: 600;
  }

  html[data-kouli-theme='light'] .speech-live-nav-btn + .speech-live-nav-btn {
    border-left: 1px solid #E2DCD3;
  }

  html[data-kouli-theme='light'] .speech-live-nav-btn:hover {
    border-color: transparent;
    color: #1E2224;
    background: rgba(30, 34, 36, 0.04);
  }

  html[data-kouli-theme='light'] .speech-live-top-center {
    display: inline-flex;
    flex: 0 1 auto;
    min-width: 0;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
  }

  html[data-kouli-theme='light'] .speech-live-timer-group {
    gap: 6px;
    align-items: center;
  }

  html[data-kouli-theme='light'] .speech-live-rec-dot {
    width: 8px;
    height: 8px;
    box-shadow: 0 0 0 3px var(--sp-rec-halo, rgba(194, 85, 77, 0.22));
  }

  /* Pre-start: hide grey placeholder dot */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-live-armed .speech-live-rec-dot,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-live-starting .speech-live-rec-dot {
    display: none !important;
  }

  html[data-kouli-theme='light'] .speech-live-timer,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-timer,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #ted-recording-timer {
    font-family: var(--sp-sans);
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1;
    line-height: 1;
  }

  html[data-kouli-theme='light'] .speech-live-of,
  html[data-kouli-theme='light'] #speech-live-of {
    font-family: var(--sp-sans);
    font-size: 13px;
    font-weight: 400;
    color: #6B6762;
    margin-left: 4px;
  }

  html[data-kouli-theme='light'] .speech-live-progress,
  html[data-kouli-theme='light'] .speech-live-top-meta {
    display: none;
  }

  /* Full screen self-view is a desktop/legacy standing-rep control — hide on mobile. */
  html[data-kouli-theme='light'] .speech-live-fullscreen-btn,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-fullscreen-btn,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #speech-live-fullscreen-pill {
    display: none !important;
  }

  /* --- Stage: flex column — script above, self-view + Start below --- */
  html[data-kouli-theme='light'] .speech-live-main,
  html[data-kouli-theme='light'] .speech-live:not(.has-slides) .speech-live-main,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-main,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-live-main,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-live-main,
  html[data-kouli-theme='light'] .speech-live-main--solo,
  html[data-kouli-theme='light'] .speech-live-main--slides {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 16px !important;
    padding: 0 !important;
    gap: 12px !important;
    width: auto !important;
    max-width: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-side,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-live-side,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-live-side,
  html[data-kouli-theme='light'] .speech-live:not(.has-slides) .speech-live-side,
  html[data-kouli-theme='light'] .speech-live-main--solo .speech-live-side {
    position: relative !important;
    inset: auto !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    width: 100% !important;
    gap: 12px !important;
    overflow: hidden !important;
  }

  /* Script panel — same size before and during take (fills stage above camera). */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-script-panel,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-live-script-panel,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-live-script-panel,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-live-armed .speech-live-script-panel,
  html[data-kouli-theme='light'] .speech-live-script-panel {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    height: auto !important;
    flex: 1 1 0 !important;
    min-height: 0 !important;
    order: 1 !important;
    z-index: 2 !important;
    padding: 14px 16px !important;
    gap: 10px !important;
    border-radius: 16px !important;
    background: #FAF8F5 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid #E8E3DC !important;
    box-shadow: none !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    text-align: left !important;
    pointer-events: auto !important;
    box-sizing: border-box !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-script-head {
    flex: none;
    align-self: stretch;
    width: 100%;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-script-kicker {
    font-family: var(--sp-sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: #6B6762;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #ted-recording-mist-stage,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-script-mount,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) #ted-recording-mist-stage,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-live-script-mount,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides #ted-recording-mist-stage {
    position: relative !important;
    inset: auto !important;
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: auto !important;
    width: 100% !important;
    max-width: none !important;
    overflow: hidden !important;
    margin: 0 !important;
    -webkit-mask-image: linear-gradient(transparent, #000 32px, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(transparent, #000 32px, #000 calc(100% - 24px), transparent);
  }

  /* Keep the driven card teleprompter in-flow — never absolute over the stage */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter--card,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter--hud {
    position: relative !important;
    inset: auto !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
    z-index: 1 !important;
    pointer-events: auto !important;
    color: #1E2224 !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-surface {
    height: 100% !important;
    width: 100% !important;
    max-width: none !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    /* Bias current line toward top; allow finger scroll / drag-scrub before Start. */
    padding: 8px 0 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    gap: 8px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    min-height: 0 !important;
    cursor: grab;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-surface:active {
    cursor: grabbing;
  }

  /* Soft edge mask fights full-script reading — drop it while browsing. */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:has(.speech-teleprompter--preview) .speech-live-script-mount,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:has(.speech-teleprompter--preview) #ted-recording-mist-stage {
    -webkit-mask-image: none !important;
    mask-image: none !important;
  }

  /* Pre-Start: full script browse — scroll lives on the browse list, not slot scrub. */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter--preview .speech-teleprompter-surface {
    overflow: hidden !important;
    cursor: default !important;
    gap: 0 !important;
    padding: 0 !important;
    touch-action: pan-y;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter--preview .speech-teleprompter-surface:active {
    cursor: default !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-browse {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    width: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 8px 0 28px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    pointer-events: auto !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line--preview {
    margin: 0 !important;
    flex: 0 0 auto !important;
    font-family: var(--sp-serif) !important;
    font-size: 20px !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    color: #1E2224 !important;
    text-align: left !important;
    opacity: 1 !important;
    filter: none !important;
    mask-image: none !important;
    -webkit-mask-image: none !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line--current,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-line--current,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .speech-teleprompter-line--current {
    font-family: var(--sp-serif) !important;
    font-size: 20px !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    color: #1E2224 !important;
    text-align: left !important;
    text-wrap: pretty;
    text-shadow: none !important;
  }

  /* Upcoming / default words: full-strength ink */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line--prev,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line--next,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-word,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-line--prev,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-line--next,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-word {
    font-family: var(--sp-serif) !important;
    font-size: 20px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    color: #1E2224 !important;
    text-align: left !important;
    text-wrap: pretty;
    text-shadow: none !important;
    text-decoration: none !important;
  }

  /* Spoken words: muted, never line-through (strike is for fillers elsewhere) */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-word.is-read,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-word.is-read {
    color: #9A948D !important;
    background: transparent !important;
    text-decoration: none !important;
  }

  /* Current word */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-word.is-current,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-word.is-active,
  html[data-kouli-theme='light'] .speech-live .speech-teleprompter-word.is-current,
  html[data-kouli-theme='light'] .speech-live .speech-teleprompter-word.is-active {
    color: #1E2224 !important;
    background: #EDE8E1 !important;
    border-radius: 3px !important;
    padding: 0 2px !important;
    text-decoration: none !important;
    box-shadow: none !important;
  }

  /* Upcoming words on the current line (no is-read / is-current) stay ink */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line--current .speech-teleprompter-word:not(.is-read):not(.is-current):not(.is-active),
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-line--current .speech-teleprompter-word:not(.is-read):not(.is-current):not(.is-active) {
    color: #1E2224 !important;
  }

  /* Self-view — fixed band under script; fills with script so no cream gap */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-self-view,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .ted-recording-self-view,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #ted-recording-self-view-tile,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-live-self-view,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .ted-recording-self-view,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) #ted-recording-self-view-tile,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides .ted-recording-self-view,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.has-slides #ted-recording-self-view-tile,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-live-armed .speech-live-self-view,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-live-armed .ted-recording-self-view,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-live-armed #ted-recording-self-view-tile {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    flex: 0 0 30% !important;
    flex-basis: 30% !important;
    width: 100% !important;
    height: auto !important;
    min-height: 120px !important;
    max-height: 220px !important;
    aspect-ratio: auto !important;
    border-radius: 16px !important;
    border: 1px solid #E8E3DC !important;
    overflow: hidden !important;
    order: 2 !important;
    z-index: 1 !important;
    background: #11181E !important;
    box-sizing: border-box !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.is-script-hidden .speech-live-self-view,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.is-script-hidden #ted-recording-self-view-tile,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-script-hidden .speech-live-self-view,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-script-hidden #ted-recording-self-view-tile {
    flex: 1 1 auto !important;
    flex-basis: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #ted-recording-self-view-video,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) #ted-recording-self-view-video {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center 30% !important;
  }

  /* Camera overlay Start is unused on mobile — primary toolbar owns Start */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-start-slot,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-live-start-slot {
    display: none !important;
  }

  /* --- Bottom toolbar: stats → primary → chips (≤160px + safe area) --- */
  html[data-kouli-theme='light'] .speech-live-bottom,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-bottom,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-live-bottom {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
    padding: 8px 16px calc(env(safe-area-inset-bottom, 0px) + 8px);
    background: #F4F0EB;
    border-top: 1px solid #E8E3DC;
    max-height: calc(160px + env(safe-area-inset-bottom, 0px)) !important;
    overflow: visible !important;
    box-sizing: border-box;
    z-index: 6;
  }

  html[data-kouli-theme='light'] .speech-live-stats {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 24px;
    width: 100%;
    min-width: 0;
    height: 28px;
    flex: none;
  }

  html[data-kouli-theme='light'] .speech-live-stat {
    display: inline-flex;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    flex: 0 0 auto;
    min-width: 0;
  }

  html[data-kouli-theme='light'] .speech-live-stat-label {
    font-family: var(--sp-sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: #6B6762;
    white-space: nowrap;
  }

  html[data-kouli-theme='light'] .speech-live-stat-value,
  html[data-kouli-theme='light'] #speech-live-pace {
    font-family: var(--sp-sans);
    font-size: 15px;
    font-weight: 600;
    color: #1E2224;
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1;
    white-space: nowrap;
    min-width: 56px;
  }

  html[data-kouli-theme='light'] #speech-live-pace:is(:empty),
  html[data-kouli-theme='light'] #speech-live-pace {
    color: #1E2224;
  }

  html[data-kouli-theme='light'] .speech-live-stat:nth-child(3) {
    display: none;
  }

  /* Shared Start / End slot */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-primary {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    flex: none;
    min-height: 52px;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-primary .speech-live-stage-start,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-primary .speech-live-end,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-primary .ted-recording-end.speech-live-end {
    width: 100% !important;
    min-width: 0 !important;
    height: 52px !important;
    padding: 0 20px !important;
    border-radius: 999px !important;
    border: 0 !important;
    font-family: var(--sp-sans) !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: none !important;
    box-sizing: border-box;
    flex-shrink: 0;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-live-armed .speech-live-primary .speech-live-stage-start,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-live-starting .speech-live-primary .speech-live-stage-start {
    display: inline-flex !important;
    background: #0F6B5C !important;
    color: #fff !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.speech-live-armed):not(.speech-live-starting) .speech-live-primary .speech-live-end,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.speech-live-armed):not(.speech-live-starting) .speech-live-primary .ted-recording-end.speech-live-end {
    display: inline-flex !important;
    background: #1E2224 !important;
    color: #fff !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-primary .speech-live-end-stop {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: #fff;
    flex: none;
  }

  html[data-kouli-theme='light'] .speech-live-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    align-items: stretch;
    flex: none;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-menu-wrap,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-cues-toggle,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-hide-script {
    width: 100%;
    min-width: 0;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-menu-btn,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-cues-toggle,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-hide-script {
    width: 100%;
    height: 44px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid #E2DCD3;
    background: #FAF8F5;
    color: #1E2224;
    font-family: var(--sp-sans);
    font-size: 14px;
    font-weight: 600;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-menu-btn.is-open {
    background: #EDE8E1;
    border-color: #D6CFC5;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-cues-dot {
    background: #0F6B5C;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-cues-toggle.is-off .speech-live-cues-dot {
    background: #B9B2A9;
  }

  /* End never sits in the chips row on mobile (moved to primary) */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-actions .speech-live-end,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-actions .ted-recording-end.speech-live-end {
    display: none !important;
  }

  /* --- Teleprompter popover --- */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-menu-wrap:has(#speech-tp-popover:not([hidden]))::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 28;
    background: rgba(30, 34, 36, 0.2);
    pointer-events: none;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-popover {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 168px);
    width: auto;
    max-width: none;
    z-index: 30;
    padding: 16px;
    border-radius: 20px;
    background: #FAF8F5;
    border: 1px solid #E8E3DC;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    gap: 14px;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-mode {
    height: 40px;
    padding: 3px;
    background: #EDE8E1;
    border: 0;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-mode-btn {
    height: 34px;
    font-size: 14px;
    font-weight: 600;
    color: #4A4743;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-mode-btn.is-on {
    background: #fff;
    color: #1E2224;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-scroll-controls,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-pop-row {
    margin: 0;
    padding: 14px 0 0;
    border: 0;
    border-top: 1px solid #EFEAE3;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-wpm-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #E2DCD3;
    background: #FAF8F5;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-wpm-label {
    font-size: 15px;
    font-weight: 600;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-pop-row-controls .speech-tp-setting {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid #E2DCD3;
    background: #FAF8F5;
    color: #1E2224;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #speech-tp-mirror-text[hidden] {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    height: auto;
    min-height: 44px;
    margin: 0;
    padding: 14px 0 0;
    border: 0;
    border-top: 1px solid #EFEAE3;
    border-radius: 0;
    background: transparent;
    color: #1E2224;
    font-family: var(--sp-sans);
    font-size: 14px;
    font-weight: 600;
    box-shadow: none;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #speech-tp-mirror-text::after {
    content: '';
    flex: none;
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: #D6CFC5;
    box-shadow: inset 0 0 0 1px rgba(30, 34, 36, 0.06);
    background-image: radial-gradient(circle at 13px 50%, #fff 0 10px, transparent 11px);
    transition: background-color 120ms ease;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #speech-tp-mirror-text.is-on::after,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #speech-tp-mirror-text[aria-pressed='true']::after {
    background-color: #1E2224;
    background-image: radial-gradient(circle at 31px 50%, #fff 0 10px, transparent 11px);
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #speech-tp-mirror-text.is-on,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell #speech-tp-mirror-text[aria-pressed='true'] {
    color: #1E2224;
    border-color: #EFEAE3;
    background: transparent;
  }
}

@media (max-width: 560px) {
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-teleprompter-line--current,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.has-slides) .speech-teleprompter-line--current {
    font-size: 18px !important;
  }
}

/* -------------------------------------------------------------------------- */
/* 4. Privacy sheet + End confirm                                             */
/* -------------------------------------------------------------------------- */

html[data-kouli-theme='light'] .speech-privacy-sheet,
html[data-kouli-theme='light'] .speech-privacy-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(30, 34, 36, 0.36);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

html[data-kouli-theme='light'] .speech-notes-choice {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(30, 34, 36, 0.22);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

html[data-kouli-theme='light'] .speech-notes-choice-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: transparent;
}

html[data-kouli-theme='light'] .speech-privacy-sheet[hidden],
html[data-kouli-theme='light'] .speech-privacy-backdrop[hidden],
html[data-kouli-theme='light'] .speech-notes-choice[hidden],
html[data-kouli-theme='light'] .speech-end-confirm[hidden] {
  display: none !important;
}

html[data-kouli-theme='light'] .speech-notes-choice-panel {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  margin: 0;
  border-radius: 24px 24px 0 0;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-bottom: 0;
  box-shadow: 0 -18px 40px rgba(30, 34, 36, 0.12);
  padding: 12px 24px 28px;
  color: var(--sp-text);
  font-family: var(--sp-sans);
}

html[data-kouli-theme='light'] .speech-notes-choice-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

html[data-kouli-theme='light'] .speech-notes-choice-primary,
html[data-kouli-theme='light'] .speech-notes-choice-secondary {
  height: 48px;
  width: 100%;
  border-radius: 999px;
  font-family: var(--sp-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
}

html[data-kouli-theme='light'] .speech-notes-choice-primary {
  border: 0;
  background: var(--sp-teal, #00c4a0);
  color: #fff;
}

html[data-kouli-theme='light'] .speech-notes-choice-primary:hover {
  filter: brightness(1.05);
}

html[data-kouli-theme='light'] .speech-notes-choice-secondary {
  border: 1px solid var(--sp-border-strong);
  background: var(--sp-white, #fff);
  color: var(--sp-text);
}

html[data-kouli-theme='light'] .speech-notes-choice-secondary:hover {
  background: var(--sp-surface);
}

html[data-kouli-theme='light'] .speech-privacy-panel {
  width: min(480px, 100%);
  max-height: min(78vh, 640px);
  margin: 0;
  border-radius: 24px 24px 0 0;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-bottom: 0;
  box-shadow: 0 -18px 40px rgba(30, 34, 36, 0.12);
  padding: 12px 24px 28px;
  color: var(--sp-text);
  font-family: var(--sp-sans);
  overflow: auto;
}

html[data-kouli-theme='light'] .speech-privacy-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--sp-border-strong);
  margin: 4px auto 16px;
}

html[data-kouli-theme='light'] .speech-privacy-title {
  margin: 0 0 8px;
  font-family: var(--sp-serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.15;
  color: var(--sp-text);
}

html[data-kouli-theme='light'] .speech-privacy-body {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--sp-soft);
}

html[data-kouli-theme='light'] .speech-privacy-list {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

html[data-kouli-theme='light'] .speech-privacy-list li {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--sp-border);
  background: var(--sp-white);
  font-size: 14px;
  line-height: 1.45;
  color: var(--sp-text);
}

html[data-kouli-theme='light'] .speech-privacy-list strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 600;
}

html[data-kouli-theme='light'] .speech-privacy-list span {
  color: var(--sp-muted);
  font-size: 13px;
}

html[data-kouli-theme='light'] .speech-privacy-close {
  height: 48px;
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: var(--sp-text);
  color: #fff;
  font-family: var(--sp-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
}

html[data-kouli-theme='light'] .speech-privacy-close:hover {
  background: #000;
}

@media (min-width: 720px) {
  html[data-kouli-theme='light'] .speech-privacy-sheet,
  html[data-kouli-theme='light'] .speech-privacy-backdrop,
  html[data-kouli-theme='light'] .speech-notes-choice {
    align-items: center;
    padding: 24px;
  }

  html[data-kouli-theme='light'] .speech-privacy-panel,
  html[data-kouli-theme='light'] .speech-notes-choice-panel {
    border-radius: 24px;
    border-bottom: 1px solid var(--sp-border);
    padding: 28px;
  }

  html[data-kouli-theme='light'] .speech-privacy-handle {
    display: none;
  }
}

/* End confirm popover */
html[data-kouli-theme='light'] .speech-end-confirm {
  position: absolute;
  right: 24px;
  bottom: calc(76px + 10px);
  z-index: 10060;
  width: min(320px, calc(100vw - 32px));
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  box-shadow: 0 16px 36px rgba(30, 34, 36, 0.16);
  color: var(--sp-text);
  font-family: var(--sp-sans);
}

html[data-kouli-theme='light'] .speech-end-confirm-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
}

html[data-kouli-theme='light'] .speech-end-confirm-body {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--sp-muted);
}

html[data-kouli-theme='light'] .speech-end-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

html[data-kouli-theme='light'] .speech-end-confirm-cancel {
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--sp-border);
  background: var(--sp-white);
  color: var(--sp-text);
  font-family: var(--sp-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
}

html[data-kouli-theme='light'] .speech-end-confirm-yes {
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 0;
  background: var(--sp-rec);
  color: #fff;
  font-family: var(--sp-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
}

html[data-kouli-theme='light'] .speech-end-confirm-yes:hover {
  filter: brightness(0.95);
}

/* -------------------------------------------------------------------------- */
/* Mirror layout v1 — gated by .speech-mirror-v1 (desktop ≥1024)              */
/* Rollback: set SPEECH_MIRROR_V1=false in speech-setup-live.js               */
/* -------------------------------------------------------------------------- */

/* Mirror-only chrome stays inert when the gate is off */
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.speech-mirror-v1) .speech-live-mirror-fade,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.speech-mirror-v1) .speech-live-focus-chip,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.speech-mirror-v1) .speech-live-ready-title,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.speech-mirror-v1) .speech-live-ready-key,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.speech-mirror-v1) .speech-live-ready-hint,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.speech-mirror-v1) .speech-live-me-tile-meta,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.speech-mirror-v1) .speech-live-type-scale-dock {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.speech-mirror-v1) .speech-live-thumbs > .speech-live-next-slide {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell:not(.speech-mirror-v1) .speech-live-ready {
  display: contents;
}

@media (min-width: 1024px) {
  /* Equal-column split (default with slides) */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides .speech-live-main,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='split'] .speech-live-main {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    padding: 0 24px;
    min-height: 0;
    transition: grid-template-columns 200ms ease;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='me'] .speech-live-main {
    display: block;
    position: relative;
    padding: 0;
    min-height: 0;
    height: 100%;
    box-sizing: border-box;
    overflow: visible;
  }

  /* Deck — split: slide top-aligned with mirror; Next row pinned to bottom */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='split'] .speech-live-deck {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    height: 100%;
    align-self: stretch;
    position: relative;
    z-index: 1;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='split'] .speech-live-slide-stage {
    flex: none;
    width: 100%;
    align-self: stretch;
    display: block;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    min-height: 0;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='split'] .speech-live-slide-stage img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: none;
    object-fit: contain;
    display: block;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    background: #E5E0D8;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='split'] .speech-live-thumbs {
    height: 64px;
    gap: 10px;
    margin-top: auto;
    flex: none;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='split'] .speech-live-thumb-strip {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='split'] .speech-live-next-slide {
    flex: 1;
    display: flex !important;
    align-items: center;
    gap: 12px;
    height: auto;
    min-height: 0;
    padding: 8px 12px 8px 8px;
    border-radius: 14px;
    background: #FAF8F5;
    border: 1px solid #E8E3DC;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='split'] .speech-live-next-slide[hidden] {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='split'] .speech-live-next-thumb {
    width: 80px;
    height: 45px;
    border-radius: 6px;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-me-tile-meta {
    display: none;
  }

  /* Deck — me: floating bottom-right tile (16px inset, never clipped) */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='me'] .speech-live-deck {
    position: absolute;
    right: 16px;
    bottom: 16px;
    left: auto;
    top: auto;
    width: min(300px, calc(100% - 32px));
    max-height: calc(100% - 32px);
    z-index: 8;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 8px;
    padding: 8px;
    border-radius: 14px;
    background: #FAF8F5;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
    min-height: 0;
    align-items: center;
    overflow: visible;
    box-sizing: border-box;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='me'] .speech-live-slide-stage {
    grid-column: 1 / -1;
    flex: none;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: none;
    background: #E5E0D8;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='me'] .speech-live-slide-stage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: none;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='me'] .speech-live-thumb-strip,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='me'] .speech-live-next-slide {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='me'] .speech-live-me-tile-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px 2px;
    min-width: 0;
    grid-column: 1;
    grid-row: 2;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='me'] .speech-live-me-tile-meta[hidden] {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='me'] .speech-live-thumbs {
    height: auto;
    padding: 0 4px 2px 0;
    gap: 4px;
    justify-content: flex-end;
    width: auto;
    grid-column: 2;
    grid-row: 2;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='me'] .speech-live-thumb-nav {
    width: 28px;
    height: 28px;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='me'] .speech-live-me-tile-next {
    font-size: 12px;
    color: #6B6762;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
  }

  /* Mirror panel — video must fill the cell; no grey letterboxing */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-side,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-mirror {
    position: relative;
    display: block;
    gap: 0;
    min-height: 0;
    height: 100%;
    border-radius: 24px;
    background: #1E2224;
    overflow: hidden;
    transition: width 200ms ease, inset 200ms ease;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='me'] .speech-live-mirror {
    position: relative;
    inset: auto;
    width: 100%;
    height: 100%;
    border-radius: 24px;
    z-index: 1;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1:not(.has-slides) .speech-live-main {
    position: relative;
    display: block;
    margin: 0;
    padding: 0 24px;
    border-radius: 0;
    overflow: visible;
    min-height: 0;
    height: 100%;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1:not(.has-slides) .speech-live-mirror {
    position: relative;
    inset: auto;
    width: 100%;
    height: 100%;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.speech-mirror-camera-off .speech-live-mirror {
    background: #FAF8F5;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .ted-recording-self-view,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 #ted-recording-self-view-tile,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides .ted-recording-self-view,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides #ted-recording-self-view-tile,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1:not(.has-slides) .ted-recording-self-view,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1:not(.has-slides) #ted-recording-self-view-tile {
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    min-height: 0 !important;
    min-width: 0 !important;
    aspect-ratio: unset !important;
    border-radius: 0 !important;
    background: transparent !important;
    z-index: 1;
    flex: none !important;
    overflow: hidden;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 #ted-recording-self-view-video,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides #ted-recording-self-view-video,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1:not(.has-slides) #ted-recording-self-view-video,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .ted-recording-self-view-video {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    aspect-ratio: unset !important;
    object-fit: cover !important;
    object-position: 50% 35% !important;
    transform: scaleX(-1) !important;
    border-radius: 0 !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-soft-light-veil {
    /* Soft light scale(1.02) left grey edges — keep veil but don't shrink the fill. */
    border-radius: 0;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-you-badge {
    display: none !important;
  }

  /* Fade band */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-mirror-fade {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 40%;
    max-height: 40%;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(
      to bottom,
      rgba(250, 248, 245, 0.94) 0%,
      rgba(250, 248, 245, 0.86) 55%,
      rgba(250, 248, 245, 0) 100%
    );
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1[data-mirror-focus='me'] .speech-live-mirror-fade {
    height: 40%;
    max-height: 40%;
    background: linear-gradient(
      to bottom,
      rgba(250, 248, 245, 0.94) 0%,
      rgba(250, 248, 245, 0.86) 55%,
      rgba(250, 248, 245, 0) 100%
    );
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.speech-mirror-camera-off .speech-live-mirror-fade,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.is-script-hidden .speech-live-mirror-fade,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.speech-script-hidden .speech-live-mirror-fade {
    display: none !important;
  }

  /* Script column stays inside the fade band (≤40% of panel height) */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-script-panel,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-mirror-script {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: auto;
    z-index: 3;
    height: 40%;
    max-height: 40%;
    padding: 10px 28px 18px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    overflow: hidden;
    flex: none;
    min-height: 0;
    pointer-events: none;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-script-panel .speech-live-script-mount,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-script-panel .speech-teleprompter--mirror,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-script-panel .speech-tp-viewport {
    pointer-events: auto;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1[data-mirror-focus='me'] .speech-live-script-panel {
    height: 40%;
    max-height: 40%;
    padding: 14px 40px 8px;
    gap: 10px;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1:not(.has-slides) .speech-live-script-panel {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    width: auto !important;
    max-height: 38%;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  /* Pre-start: no teal word highlight */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.speech-live-armed .speech-teleprompter-word.is-current,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.speech-live-starting .speech-teleprompter-word.is-current,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.speech-live-armed .speech-teleprompter-word.is-read,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.speech-live-starting .speech-teleprompter-word.is-read {
    background: transparent !important;
    color: inherit !important;
    padding: 0 !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.speech-live-armed .speech-teleprompter-line--current .speech-teleprompter-word,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.speech-live-starting .speech-teleprompter-line--current .speech-teleprompter-word {
    color: #1E2224 !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.is-script-hidden .speech-live-script-panel,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.speech-script-hidden .speech-live-script-panel,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.is-script-hidden .speech-live-mirror-script,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.speech-script-hidden .speech-live-mirror-script {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-script-head {
    align-self: stretch;
    width: 100%;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1[data-mirror-focus='me'] .speech-live-script-head {
    display: none;
  }

  /* A− / A+ only in Teleprompter popover — never on script head or bottom dock. */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-type-scale,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-type-scale-dock {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 #ted-recording-mist-stage,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-script-mount {
    position: relative !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: 600px;
    height: 100% !important;
    min-height: 160px !important;
    overflow: hidden !important;
    margin: 0 auto;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1[data-mirror-focus='me'] #ted-recording-mist-stage,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1:not(.has-slides) #ted-recording-mist-stage {
    max-width: 820px;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-surface {
    padding: 0 !important;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
    height: auto;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-line {
    text-align: center;
    max-width: 600px;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1[data-mirror-focus='me'] .speech-teleprompter-line,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1:not(.has-slides) .speech-teleprompter-line {
    max-width: 820px;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-line--prev {
    font-size: calc(15px * var(--sp-script-scale, 1)) !important;
    line-height: 1.4;
    color: #8A857E !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1[data-mirror-focus='me'] .speech-teleprompter-line--prev,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1:not(.has-slides) .speech-teleprompter-line--prev {
    font-size: calc(16px * var(--sp-script-scale, 1)) !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='split'] .speech-teleprompter-line--current {
    font-size: calc(24px * var(--sp-script-scale, 1)) !important;
    line-height: 1.3;
    font-weight: 600;
    color: #1E2224 !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1[data-mirror-focus='me'] .speech-teleprompter-line--current,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1:not(.has-slides) .speech-teleprompter-line--current {
    font-size: calc(30px * var(--sp-script-scale, 1)) !important;
    line-height: 1.28;
    font-weight: 600;
    color: #1E2224 !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-line--next {
    font-size: calc(17px * var(--sp-script-scale, 1)) !important;
    line-height: 1.4;
    color: #4A4743 !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1[data-mirror-focus='me'] .speech-teleprompter-line--next,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1:not(.has-slides) .speech-teleprompter-line--next {
    font-size: calc(19px * var(--sp-script-scale, 1)) !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-word {
    color: #8A857E;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-word.is-read,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-word.is-current {
    color: #1E2224;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-word.is-current {
    background: rgba(15, 107, 92, 0.14);
    border-radius: 4px;
    padding: 0 3px;
  }

  /* Beats on mirror teleprompter: bold = land it, underline = lean in */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-word--emphasis-strong {
    font-weight: 800 !important;
    color: #0F6B5C !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-word--emphasis-soft {
    text-decoration: underline !important;
    text-decoration-color: rgba(15, 107, 92, 0.7) !important;
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-line .speech-teleprompter-pause {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    margin: 8px 0 2px;
    border-radius: 999px;
    background: rgba(15, 107, 92, 0.12);
    border: 1px solid rgba(15, 107, 92, 0.35);
    color: #0F6B5C;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
    padding: 4px 10px;
    text-transform: uppercase;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-line.is-current .speech-teleprompter-pause,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-line.is-prev .speech-teleprompter-pause {
    background: rgba(15, 107, 92, 0.18);
    border-color: rgba(15, 107, 92, 0.5);
  }

  /* Override the older mirror-only “dot” pause styles */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-pause {
    font-size: 11px !important;
    line-height: 1 !important;
    color: #0F6B5C !important;
    width: auto !important;
    height: auto !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-line--next-2,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-line--next-3,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-next-slide-chip,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-footer,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-speed {
    display: none !important;
  }

  /* Classic teleprompter pause row (non-mirror) — keep compact */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter-line--beat {
    min-height: 0;
    margin: 0;
  }

  /* Focus chip */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-focus-chip {
    position: absolute;
    z-index: 6;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 0;
    background: rgba(250, 248, 245, 0.88);
    color: #1E2224;
    font-family: var(--sp-sans);
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    appearance: none;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1[data-mirror-focus='split'] .speech-live-focus-chip {
    bottom: 14px;
    right: 14px;
    left: auto;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1[data-mirror-focus='me'] .speech-live-focus-chip {
    bottom: 16px;
    left: 16px;
    right: auto;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-focus-chip[hidden] {
    display: none !important;
  }

  /* Pre-start glass pill — bottom-centre, below the chin / script band */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-start-slot {
    position: absolute;
    left: 50%;
    right: auto;
    top: auto;
    bottom: 20px;
    transform: translateX(-50%);
    z-index: 7;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    background: transparent;
    pointer-events: none;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1[data-mirror-focus='me'] .speech-live-start-slot,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1:not(.has-slides) .speech-live-start-slot {
    bottom: 20px;
    top: auto;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-start-slot[hidden] {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-ready {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    text-align: left;
    padding: 8px 8px 8px 20px;
    border-radius: 999px;
    background: rgba(250, 248, 245, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-height: 60px;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-ready-title {
    margin: 0;
    font-family: var(--sp-sans);
    font-size: 15px;
    font-weight: 600;
    color: #1E2224;
    white-space: nowrap;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-ready-hint {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--sp-sans);
    font-size: 13px;
    font-weight: 500;
    color: #4A4743;
    white-space: nowrap;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-ready-key {
    margin: 0;
    font-family: var(--sp-sans);
    font-size: 12px;
    font-weight: 600;
    font-style: normal;
    color: #4A4743;
    border: 1px solid #DDD7CF;
    border-radius: 6px;
    padding: 2px 6px;
    background: transparent;
    line-height: 1.2;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-stage-start {
    width: auto;
    min-width: 0;
    height: 44px;
    padding: 0 22px;
    font-size: 15px;
    flex: none;
  }

  /* During 3-2-1 the pre-start pill hides — countdown is a fixed overlay */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.speech-live-starting .speech-live-start-slot {
    opacity: 0;
    pointer-events: none;
  }

  /* Top bar: Setup left · timer+progress centre-left · slide meta right */
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 #speech-live-back-home {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-top {
    justify-content: space-between;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-top-center {
    flex: 1;
    max-width: none;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-progress {
    flex: 1;
    max-width: 420px;
    margin: 0;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-live-top-meta {
    margin-left: auto;
    flex: none;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='split'] .speech-live-next-copy {
    text-align: left;
    align-items: flex-start;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides[data-mirror-focus='split'] .speech-live-next-kicker {
    text-align: left;
  }
}

@media (max-width: 1023px) {
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-mirror-fade,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-focus-chip,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-me-tile-meta,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-ready-title,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-ready-key,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-ready-hint {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-ready {
    display: contents;
  }
}

/* -------------------------------------------------------------------------- */
/* Mirror teleprompter drive (Follow voice / Scroll)                          */
/* -------------------------------------------------------------------------- */

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter--mirror {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: block;
  pointer-events: none;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
  border: 0;
  padding: 0;
  margin: 0;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter--mirror.is-mirror-text {
  transform: scaleX(-1);
}

/* Status chip lives under the script (not over the first line). With slides,
   "→ Next slide" is suppressed in JS — the deck NEXT card already covers that. */
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-chip {
  position: absolute;
  left: 50%;
  top: auto;
  bottom: 4px;
  transform: translateX(-50%);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(30, 34, 36, 0.55);
  color: #FAF8F5;
  font-family: var(--sp-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-chip[hidden] {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-debug {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 6;
  max-width: min(420px, calc(100% - 16px));
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(15, 20, 24, 0.82);
  color: #E8F0F4;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.35;
  white-space: pre-wrap;
  pointer-events: none;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: auto;
  cursor: grab;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-viewport:active {
  cursor: grabbing;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-scroll {
  will-change: transform;
  /* Top pad clears SCRIPT kicker; bottom pad keeps lines above the status chip. */
  padding: 8px 20px 36%;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-line {
  position: relative;
  margin: 0 0 0.55em;
  padding: 4px 12px 4px 22px;
  font-family: var(--sp-serif, 'Newsreader', Georgia, serif);
  font-size: calc(22px * var(--sp-script-scale, 1)) !important;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: #4A4743;
  text-align: left;
  border-radius: 10px;
  background: transparent;
  transition: opacity 180ms ease, background 180ms ease, font-size 120ms ease;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-line.is-prev {
  font-size: calc(18px * var(--sp-script-scale, 1)) !important;
  opacity: 0.7;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-line.is-next {
  font-size: calc(18px * var(--sp-script-scale, 1)) !important;
  opacity: 0.55;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-line.is-current {
  font-weight: 600;
  color: #1E2224;
  background: rgba(250, 248, 245, 0.72);
  opacity: 1;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-line-caret {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--teal-core, #00C4A0);
  font-size: 8px;
  line-height: 1;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-tp-line.is-current .speech-tp-line-caret {
  opacity: 1;
}

/* me focus: current 30px + next 22px only; keep script off the face */
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1[data-mirror-focus='me'] .speech-tp-line.is-current,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1:not(.has-slides) .speech-tp-line.is-current {
  font-size: calc(30px * var(--sp-script-scale, 1)) !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1[data-mirror-focus='me'] .speech-tp-line.is-next,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1:not(.has-slides) .speech-tp-line.is-next {
  font-size: calc(22px * var(--sp-script-scale, 1)) !important;
  opacity: 0.55;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter--mirror.is-prestart .speech-tp-line.is-current {
  background: transparent;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter--mirror.is-prestart .speech-tp-line-caret {
  opacity: 0;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter--mirror .speech-teleprompter-word {
  color: inherit;
  text-decoration: none;
  box-shadow: none;
  background: transparent;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter--mirror .speech-teleprompter-word.is-read {
  color: #1E2224;
  font-weight: 600;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter--mirror .speech-teleprompter-word.is-upcoming {
  color: #4A4743;
  font-weight: 500;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter--mirror .speech-teleprompter-word.is-active,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter--mirror .speech-teleprompter-word.is-current {
  color: #1E2224;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--teal-core, #00C4A0);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1 .speech-teleprompter:not(.speech-teleprompter--mirror) {
  display: none !important;
}

/* Bottom bar: stats left · actions right (desktop). Mobile uses the
   max-width:1023 column toolbar so End rep stays fully on-screen. */
@media (min-width: 1024px) {
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-bottom {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-live-primary {
    display: none !important;
  }
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-menu-wrap {
  position: relative;
  display: inline-flex;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-menu-btn {
  appearance: none;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(30, 34, 36, 0.12);
  background: rgba(255, 255, 255, 0.7);
  color: #1E2224;
  font-family: var(--sp-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-menu-btn.is-open {
  border-color: #D6CFC5;
  background: #EDE8E1;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-menu-caret {
  font-size: 10px;
  opacity: 0.7;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  z-index: 30;
  width: min(300px, calc(100vw - 32px));
  padding: 16px;
  border-radius: 16px;
  background: #FAF8F5;
  border: 1px solid #E8E3DC;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-popover[hidden] {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-mode {
  display: inline-flex;
  align-items: center;
  gap: 0;
  width: 100%;
  height: 36px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(30, 34, 36, 0.06);
  border: 1px solid rgba(30, 34, 36, 0.08);
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-mode-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #4A4743;
  font-family: var(--sp-sans);
  font-size: 12px;
  font-weight: 600;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  flex: 1;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-mode-btn.is-on {
  background: #fff;
  color: #1E2224;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-scroll-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  width: 100%;
  margin-top: -2px;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-scroll-controls[hidden] {
  display: none !important;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-row-label {
  flex: none;
  font-family: var(--sp-sans);
  font-size: 14px;
  font-weight: 600;
  color: #1E2224;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-scroll-controls-inner,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-pop-row-controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-wpm-btn {
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(30, 34, 36, 0.12);
  background: rgba(255, 255, 255, 0.7);
  color: #1E2224;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  flex: none;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-wpm-label {
  min-width: 76px;
  text-align: center;
  font-family: var(--sp-sans);
  font-size: 13px;
  font-weight: 600;
  color: #1E2224;
  font-variant-numeric: tabular-nums;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-pop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  padding-top: 14px;
  border-top: 1px solid rgba(30, 34, 36, 0.08);
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-setting {
  appearance: none;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(30, 34, 36, 0.12);
  background: rgba(255, 255, 255, 0.45);
  color: #4A4743;
  font-family: var(--sp-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-pop-row-controls .speech-tp-setting {
  flex: none;
  min-width: 40px;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-popover > .speech-tp-setting {
  width: 100%;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-popover > .speech-tp-setting + .speech-tp-setting {
  margin-top: 2px;
}

html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-setting.is-on,
html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell .speech-tp-setting[aria-pressed='true'] {
  color: #1E2224;
  border-color: rgba(30, 34, 36, 0.18);
  background: rgba(30, 34, 36, 0.06);
}

/* -------------------------------------------------------------------------- */
/* Setup compact phone (<768) — desktop / tablet (≥768) unchanged             */
/* -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  html[data-kouli-theme='light'] body.kouli-speech-active #ted-mode-setup.speech-setup {
    --sp-setup-page: #F4F0EB;
    --sp-setup-card: #FAF8F5;
    --sp-setup-inner: #FFFFFF;
    --sp-setup-border: #E8E3DC;
    --sp-setup-divider: #EFEAE3;
    --sp-setup-ink: #1E2224;
    --sp-setup-body: #4A4743;
    --sp-setup-muted: #6B6762;
    --sp-setup-teal: #0F6B5C;
    --sp-setup-sticky-h: calc(54px + 12px + 18px + 12px + env(safe-area-inset-bottom, 0px) + 12px);
  }

  html[data-kouli-theme='light'] body.kouli-speech-active #ted-mode-page {
    background: var(--sp-setup-page) !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup.speech-setup {
    background: var(--sp-setup-page);
  }

  /* Top bar: Home | Speech | balance */
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-topbar {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0;
    height: 52px;
    padding: 0 16px;
    background: var(--sp-setup-page);
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-home,
  html[data-kouli-theme='light'] #ted-mode-setup #speech-setup-home {
    grid-column: 1;
    justify-self: start;
    margin: 0 !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-mode {
    grid-column: 2;
    justify-self: center;
    margin: 0 !important;
    padding: 0 !important;
    font-family: var(--sp-serif), 'Newsreader', Georgia, serif !important;
    font-size: 22px !important;
    font-weight: 500 !important;
    line-height: 1.2;
    color: var(--sp-setup-ink) !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-topbar-spacer {
    display: block !important;
    grid-column: 3;
    width: auto;
    min-height: 1px;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-hero {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-main {
    padding: 12px 16px var(--sp-setup-sticky-h) !important;
    gap: 12px !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-grid,
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-side {
    gap: 12px !important;
  }

  /* Script card */
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script {
    padding: 16px !important;
    border-radius: 20px !important;
    background: var(--sp-setup-card) !important;
    border: 1px solid var(--sp-setup-border) !important;
    gap: 12px !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script .speech-setup-card-title {
    margin: 0;
    font-family: var(--sp-sans), Inter, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--sp-setup-ink);
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script-actions {
    display: inline-flex;
    align-items: center;
    gap: 16px;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-upload-label-full {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-upload-label-short {
    display: inline !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-upload,
  html[data-kouli-theme='light'] #ted-mode-setup #ted-transcript-upload-button {
    appearance: none !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    min-height: 44px;
    height: auto !important;
    border-radius: 0 !important;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    font-family: var(--sp-sans), Inter, sans-serif;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--sp-setup-ink) !important;
    width: auto !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-upload svg {
    width: 14px;
    height: 14px;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-clear-header:not([hidden]) {
    display: inline-flex !important;
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    min-height: 44px;
    align-items: center;
    font-family: var(--sp-sans), Inter, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--sp-setup-muted);
    cursor: pointer;
    width: auto !important;
  }

  /* 3-line preview (fixed). Expanded → ~50vh. */
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script-body,
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script-editor,
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script-body textarea.speech-setup-script-editor {
    flex: none !important;
    height: calc(17px * 1.5 * 3 + 24px) !important;
    min-height: calc(17px * 1.5 * 3 + 24px) !important;
    max-height: calc(17px * 1.5 * 3 + 24px) !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script-body {
    padding: 12px 14px !important;
    border-radius: 14px !important;
    background: var(--sp-setup-inner) !important;
    border: 1px solid var(--sp-setup-border) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    -webkit-mask-image: linear-gradient(#000 60%, transparent);
    mask-image: linear-gradient(#000 60%, transparent);
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script-editor,
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script-body textarea.speech-setup-script-editor {
    font-family: var(--sp-serif), 'Newsreader', Georgia, serif !important;
    font-size: 17px !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    color: var(--sp-setup-ink) !important;
    padding: 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: none !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script.is-script-expanded .speech-setup-script-body,
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script.is-script-expanded .speech-setup-script-editor,
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script.is-script-expanded .speech-setup-script-body textarea.speech-setup-script-editor {
    height: 50vh !important;
    min-height: 50vh !important;
    max-height: 50vh !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script.is-script-expanded .speech-setup-script-body {
    -webkit-mask-image: none;
    mask-image: none;
    overflow: auto !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script-meta:not([hidden]) {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script-meta-stats {
    margin: 0;
    font-family: var(--sp-sans), Inter, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: var(--sp-setup-muted);
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script-edit,
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script-done {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    min-height: 44px;
    font-family: var(--sp-sans), Inter, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--sp-setup-ink);
    cursor: pointer;
    width: auto !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script-edit[hidden],
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-script-done[hidden] {
    display: none !important;
  }

  /* Reshape + Beats grouped list */
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-toggles {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    border: 1px solid var(--sp-setup-border);
    border-radius: 14px;
    background: var(--sp-setup-inner);
    overflow: hidden;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-toggle {
    width: 100% !important;
    min-height: 52px;
    margin: 0 !important;
    padding: 10px 14px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    align-items: center;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-toggle + .speech-setup-toggle {
    border-top: 1px solid var(--sp-setup-divider) !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-toggle-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--sp-setup-ink);
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-toggle-hint {
    font-size: 12px;
    color: var(--sp-setup-muted);
  }

  /* Length card */
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-length {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      'title estimate'
      'segment segment';
    align-items: center;
    column-gap: 12px;
    row-gap: 10px;
    padding: 14px 16px !important;
    border-radius: 20px !important;
    background: var(--sp-setup-card) !important;
    border: 1px solid var(--sp-setup-border) !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-length .speech-setup-card-title {
    grid-area: title;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--sp-setup-ink);
  }

  html[data-kouli-theme='light'] #ted-mode-setup #speech-setup-read-estimate {
    grid-area: estimate;
    margin: 0 !important;
    font-family: var(--sp-sans), Inter, sans-serif;
    font-size: 12px !important;
    font-weight: 400;
    color: var(--sp-setup-muted) !important;
    text-align: right;
  }

  html[data-kouli-theme='light'] #ted-mode-setup #speech-setup-read-estimate[hidden] {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-segment,
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-chips {
    grid-area: segment;
    height: 40px !important;
    min-height: 40px !important;
    padding: 3px !important;
    border-radius: 12px !important;
    background: #EDE8E1 !important;
    gap: 0 !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-chip {
    height: 100% !important;
    min-height: 0 !important;
    border-radius: 9px !important;
    font-family: var(--sp-sans), Inter, sans-serif;
    font-size: 14px !important;
    font-weight: 600 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-chip.is-selected,
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-chip.is-on,
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-chip[aria-pressed='true'] {
    background: #FFFFFF !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
  }

  /* Show "min" on the selected chip only */
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-chip span {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-chip.is-selected span,
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-chip.is-on span,
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-chip[aria-pressed='true'] span {
    display: inline !important;
  }

  /* Hide full-width Clear row on phone — header Clear replaces it */
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-cache-row {
    display: none !important;
  }

  /* Reshape changelog (HOOK/STAKES/…) — keep Original/Revised tabs, hide the list on phone */
  html[data-kouli-theme='light'] #ted-mode-setup #ted-arc-changes,
  html[data-kouli-theme='light'] #ted-mode-setup #ted-arc-changes:not([hidden]) {
    display: none !important;
  }

  /* Camera row */
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-camera {
    padding: 12px 16px !important;
    border-radius: 20px !important;
    background: var(--sp-setup-card) !important;
    border: 1px solid var(--sp-setup-border) !important;
    gap: 12px;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-camera-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--sp-setup-ink);
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-camera-hint {
    font-size: 12px;
    color: var(--sp-setup-muted);
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-camera-hint-full {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-camera-hint-short {
    display: inline !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-privacy-link {
    color: var(--sp-setup-teal) !important;
    font-weight: 600;
  }

  /* Sticky Continue bar — full viewport width, label centred in the pill */
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-start {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
    z-index: 30;
    margin: 0 !important;
    padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 12px) !important;
    background: var(--sp-setup-page) !important;
    border-top: 1px solid var(--sp-setup-border);
    gap: 6px !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-cta,
  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup #ted-start-btn,
  html[data-kouli-theme='light'] #ted-mode-setup #ted-start-btn {
    width: 100% !important;
    max-width: none !important;
    margin: 0 auto !important;
    height: 54px !important;
    min-height: 54px !important;
    border-radius: 999px !important;
    background: var(--sp-setup-teal) !important;
    color: #fff !important;
    font-family: var(--sp-sans), Inter, sans-serif !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    box-shadow: none !important;
    filter: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-cta:hover,
  html[data-kouli-theme='light'] #ted-mode-setup #ted-start-btn:hover {
    background: var(--sp-setup-teal) !important;
    box-shadow: none !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-start-note {
    margin: 0 !important;
    font-family: var(--sp-sans), Inter, sans-serif;
    font-size: 12px !important;
    color: var(--sp-setup-muted) !important;
    text-align: center;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-start-note-full {
    display: none !important;
  }

  html[data-kouli-theme='light'] #ted-mode-setup .speech-setup-start-note-short {
    display: inline !important;
  }
}

/* -------------------------------------------------------------------------- */
/* Reduced motion                                                             */
/* -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html[data-kouli-theme='light'] .speech-setup-switch::after,
  html[data-kouli-theme='light'] .speech-live-progress-fill,
  html[data-kouli-theme='light'] #ted-recording-area.speech-live-shell.speech-mirror-v1.has-slides .speech-live-main {
    transition: none;
  }
}
