/* =========================================================================
   iCue — public teleprompter
   Mobile-first. Dark cinematic. One signature look.
   ========================================================================= */

:root {
  --bg: #0a0a0b;
  --bg-2: #111113;
  --bg-3: #1a1a1d;
  --bg-hover: #222226;
  --text: #f0f0f2;
  --text-dim: #8a8a8f;
  --text-mute: #5a5a5f;
  --accent: #00d4aa;
  --accent-2: #00a080;
  --accent-glow: rgba(0, 212, 170, .18);
  --danger: #ff4757;
  --warn: #ffa502;
  --border: #2a2a2f;
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .4);

  --font-ui: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-read: 'Crimson Pro', Georgia, serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Force [hidden] to win over class-based display rules below. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

::selection { background: var(--accent); color: var(--bg); }

/* =========================================================================
   App shell
   ========================================================================= */

.app {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100dvh;
  padding-top: var(--safe-top);
}

/* ===== Top bar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  padding-left: max(16px, var(--safe-left));
  padding-right: max(16px, var(--safe-right));
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  color: var(--text);
  padding: 4px 6px;
  border-radius: 8px;
}
.brand:hover { background: var(--bg-3); }

.brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--bg);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-name {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -.3px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  color: var(--text-dim);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  min-height: 40px;
}
.icon-btn:hover { color: var(--text); background: var(--bg-3); }
.icon-btn:active { transform: scale(.96); }
.icon-btn span { display: none; }

@media (min-width: 640px) {
  .icon-btn span { display: inline; }
}

/* =========================================================================
   Empty state
   ========================================================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  padding-bottom: calc(24px + var(--safe-bottom));
  overflow-y: auto;
  height: 100%;
}

.empty-title {
  font-family: var(--font-read);
  font-weight: 500;
  font-size: clamp(28px, 7vw, 56px);
  line-height: 1.15;
  letter-spacing: -.5px;
  max-width: 720px;
  margin-bottom: 16px;
}
.empty-title em { color: var(--accent); font-style: italic; }

.empty-sub {
  color: var(--text-dim);
  font-size: clamp(15px, 2.2vw, 18px);
  line-height: 1.5;
  max-width: 520px;
  margin-bottom: 32px;
}

.empty-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 48px;
  flex-wrap: wrap;
  justify-content: center;
}

.empty-features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  max-width: 720px;
  width: 100%;
  margin-bottom: 32px;
}
@media (min-width: 640px) {
  .empty-features { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .empty-features { grid-template-columns: repeat(4, 1fr); }
}

.feature {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.feature strong { font-size: 14px; font-weight: 600; }
.feature span { font-size: 13px; color: var(--text-dim); line-height: 1.4; }

.empty-footer {
  display: flex;
  gap: 12px;
  color: var(--text-mute);
  font-size: 13px;
  align-items: center;
}
.empty-footer a { color: var(--text-dim); }

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, color .15s ease;
  min-height: 44px;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: scale(.97); }

.btn-lg { padding: 14px 24px; font-size: 16px; min-height: 52px; }

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.btn-primary:hover { background: #00e8bc; }

.btn-ghost {
  background: var(--bg-3);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg-hover); }

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-record {
  background: var(--danger);
  color: white;
  box-shadow: 0 0 0 4px rgba(255, 71, 87, .15);
}
.btn-record:hover { background: #ff5e6c; }
.btn-record .rec-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 8px rgba(255, 255, 255, .8);
  animation: pulse 1.4s infinite;
}

/* =========================================================================
   Stage (prompter)
   ========================================================================= */

.stage {
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.focus-line {
  position: absolute;
  left: 0; right: 0;
  top: 12%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
  pointer-events: none;
  z-index: 2;
}
.focus-line::before, .focus-line::after {
  content: '';
  position: absolute;
  top: -6px;
  width: 12px; height: 12px;
  border: 2px solid var(--accent);
  background: var(--bg);
}
.focus-line::before { left: 12px; border-right: 0; border-bottom: 0; }
.focus-line::after { right: 12px; border-left: 0; border-top: 0; }

.prompter-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: auto;
  padding: 0 calc(max(16px, var(--safe-left)) + 0px) 0 calc(max(16px, var(--safe-right)) + 0px);
}
.prompter-scroll::-webkit-scrollbar { display: none; }

.prompter-pad-top { height: 12vh; }
.prompter-pad-bottom { height: 88vh; }

.prompter-text {
  font-family: var(--font-read);
  font-size: 56px;
  line-height: 1.5;
  letter-spacing: -.3px;
  color: rgba(240, 240, 242, .82);   /* yet-to-come — softer than pure white */
  max-width: 720px;                  /* narrow middle lane — easier to read */
  width: min(720px, 90vw);
  margin: 0 auto;
  text-align: left;
  transition: transform .1s linear;
  will-change: transform;
}

.prompter-text.mirror {
  transform: scaleX(-1);
}

.word {
  display: inline;
  transition: color .25s ease, opacity .25s ease;
  padding: 0 .05em;
}
.word.spoken {
  color: rgba(240, 240, 242, .42);   /* spoken — readable but recedes */
}
.word.current {
  color: var(--accent);
}

/* Status pill */
.status-pill {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .3px;
  z-index: 5;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 1.5s infinite;
}
.status-pill.idle .status-dot {
  background: var(--text-mute);
  box-shadow: none;
  animation: none;
}
.status-time {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--text-dim);
  margin-left: 4px;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: .6; }
}

/* Manual-mode "Rolling in N" pill — shown between the warm-up and the scroll start */
.grace-pill {
  position: absolute;
  top: calc(20px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 22, .82);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .3px;
  color: var(--text-dim);
  z-index: 6;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: gracePop .25s ease;
}
.grace-pill #graceNum {
  color: var(--accent);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 15px;
  margin-left: 4px;
  display: inline-block;
  min-width: 12px;
  text-align: center;
}
@keyframes gracePop {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.grace-pill.fading {
  opacity: 0;
  transform: translate(-50%, -6px);
  transition: opacity .3s ease, transform .3s ease;
}

/* Speed badge */
.speed-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
  z-index: 5;
  animation: fadeIn .2s;
}

/* Countdown */
.countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  background: rgba(10, 10, 11, .85);
  backdrop-filter: blur(8px);
}
.countdown span {
  font-family: var(--font-ui);
  font-size: 180px;
  font-weight: 700;
  color: var(--accent);
  animation: countPop .9s ease;
}
.countdown span.warmup {
  animation: none;
  font-size: 80px;
  color: var(--danger);
  opacity: 1;
  text-shadow: 0 0 32px rgba(255, 71, 87, .6);
}
@keyframes countPop {
  0%   { transform: scale(.5); opacity: 0; }
  20%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* Dock */
.dock {
  position: absolute;
  bottom: 28px;
  bottom: calc(28px + var(--safe-bottom));
  right: 20px;
  right: calc(20px + var(--safe-right));
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 16px 18px;
  background: rgba(20, 20, 22, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 28px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
  z-index: 5;
  transition: opacity .2s ease;
}
/* Dock stays full-opacity even while recording — record button must stay legible. */

/* Elegant captions below each dock button so their purpose is unmistakable */
.dock-btn[data-caption]::after {
  content: attr(data-caption);
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-mute);
  pointer-events: none;
  white-space: nowrap;
  font-family: var(--font-ui);
}
.dock-btn-primary[data-caption]::after {
  color: var(--danger);
  opacity: .9;
}

/* Restart button: text-based instead of a misleading "undo" icon */
.dock-btn-text {
  font-family: var(--font-read);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.2px;
  color: var(--text);
  text-transform: none;
}

/* All dock buttons are the same size — uniform grid, aligned captions */
.dock-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  border: 0;
  transition: transform .12s ease, background .15s ease;
  flex-shrink: 0;
}
.dock-btn:hover { background: rgba(255, 255, 255, .12); }
.dock-btn:active { transform: scale(.92); }

.dock-btn-secondary { color: var(--text-dim); }

/* Primary action = red "roll and record" — same circle size, distinguished by colour. */
.dock-btn-primary {
  background: var(--danger);
  color: white;
  box-shadow: 0 0 0 3px rgba(255, 71, 87, .22);
}
.dock-btn-primary:hover { background: #ff5e6c; }
.dock-btn-primary.playing { animation: rec-halo 1.6s infinite ease-in-out; }
.dock-btn-primary.playing .i-play { display: none; }
.dock-btn-primary.playing .i-pause { display: block !important; }

.dock-btn { position: relative; }

/* =========================================================================
   Silent recording — no view switch
   ========================================================================= */

.rec-hidden {
  position: fixed;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.rec-hidden video,
.rec-hidden canvas {
  width: 1px;
  height: 1px;
}

.rec-indicator {
  position: fixed;
  top: calc(72px + var(--safe-top));
  right: 20px;
  right: calc(20px + var(--safe-right));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 71, 87, .14);
  border: 1px solid rgba(255, 71, 87, .35);
  color: white;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  z-index: 50;
  backdrop-filter: blur(10px);
}
.rec-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 12px var(--danger);
  animation: pulse 1.2s infinite;
}
.rec-time {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 400;
  letter-spacing: .3px;
  color: rgba(255, 255, 255, .85);
  margin-left: 2px;
}

@keyframes rec-halo {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, .4); }
  50%      { box-shadow: 0 0 0 10px rgba(255, 71, 87, 0); }
}

/* Recording preview in the finalize modal */
.record-preview {
  width: 100%;
  max-height: 60vh;
  background: black;
  border-radius: 10px;
}

/* =========================================================================
   Drawer
   ========================================================================= */

/* Menu = full-screen modal. 3-column compact grid, everything visible at once. */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  padding-top: max(18px, var(--safe-top));
  padding-bottom: max(18px, var(--safe-bottom));
}
.drawer-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeIn .25s;
}
.drawer-panel {
  position: relative;
  width: 100%;
  max-width: min(1180px, 96vw);
  max-height: 96vh;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: scaleIn .25s cubic-bezier(.2, .9, .3, 1);
  overflow: hidden;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-head h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.5px;
  font-family: var(--font-read);
  line-height: 1;
  margin-bottom: 4px;
}
.drawer-sub {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 400;
}

.drawer-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px 18px 18px;
  overflow-y: auto;
  align-content: start;
}
@media (min-width: 640px) {
  .drawer-body { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1000px) {
  .drawer-body { grid-template-columns: 1fr 1fr 1fr; }
  .drawer-section.span-2 { grid-column: span 2; }
}

.drawer-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.drawer-section h3 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-mute);
  margin-bottom: 12px;
}

.drawer-row { display: flex; gap: 8px; align-items: center; }
.drawer-row-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.drawer-row-stack > .btn { min-height: 38px; padding: 8px 10px; font-size: 13px; }

/* =========================================================================
   Form controls
   ========================================================================= */

.control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  margin-bottom: 10px;
  align-items: baseline;
}
.control > span:first-child {
  grid-column: 1;
  grid-row: 1;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}
.control input[type="range"] {
  grid-column: 1 / -1;
  grid-row: 2;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}
.control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 0;
  box-shadow: 0 0 0 4px var(--accent-glow);
}
.control input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 0;
}
.control output {
  grid-column: 2;
  grid-row: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-mute);
  min-width: 32px;
  text-align: right;
  align-self: baseline;
}
.control input[type="text"] {
  grid-column: 1 / -1;
  grid-row: 2;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 11px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
}
.control input[type="text"]:focus {
  outline: 0;
  border-color: var(--accent);
}
.control select {
  grid-column: 1 / -1;
  grid-row: 2;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* Segmented mode toggle — Voice vs Manual */
.mode-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-3);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 14px;
  gap: 0;
}
.mode-btn {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 9px 6px;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
  letter-spacing: .3px;
}
.mode-btn.active {
  background: var(--bg-2);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .05);
}

/* Mode-aware visibility — speed controls vanish in voice mode, etc. */
body.mode-voice  .manual-only { display: none !important; }
body.mode-manual .voice-only  { display: none !important; }
/* Dock −/+ are speed controls — hide in voice mode (10-year-old-friendly) */
body.mode-voice  #speedDownBtn,
body.mode-voice  #speedUpBtn   { display: none !important; }

/* Toggle */
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
  cursor: pointer;
}
.toggle input { display: none; }
.toggle .slider {
  display: inline-block;
  position: relative;
  width: 42px; height: 24px;
  background: var(--bg-3);
  border-radius: 999px;
  transition: background .15s;
}
.toggle .slider::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform .15s;
}
.toggle input:checked + .slider {
  background: var(--accent);
}
.toggle input:checked + .slider::after {
  transform: translateX(18px);
}

/* =========================================================================
   Saved scripts list
   ========================================================================= */

.saved-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.saved-empty {
  color: var(--text-mute);
  font-size: 13px;
  font-style: italic;
}
.saved-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-3);
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
}
.saved-item:hover { background: var(--bg-hover); }
.saved-name {
  font-size: 14px;
  font-weight: 500;
}
.saved-meta {
  font-size: 11px;
  color: var(--text-mute);
  font-family: 'JetBrains Mono', monospace;
}
.saved-del {
  background: none;
  border: 0;
  color: var(--text-mute);
  padding: 6px;
  border-radius: 6px;
}
.saved-del:hover { color: var(--danger); background: rgba(255, 71, 87, .08); }

/* =========================================================================
   Modals
   ========================================================================= */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(8px);
  animation: fadeIn .2s;
}
.modal-panel {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: scaleIn .2s ease;
}
.modal-panel-lg { max-width: 720px; }
@keyframes scaleIn {
  from { transform: scale(.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.3px;
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

#editTextarea {
  width: 100%;
  min-height: 280px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px;
  border-radius: 10px;
  font-family: var(--font-read);
  font-size: 16px;
  line-height: 1.6;
  resize: vertical;
}
#editTextarea:focus {
  outline: 0;
  border-color: var(--accent);
}
.modal-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  color: var(--text-mute);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
}

/* Shortcuts grid */
.shortcuts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 480px) {
  .shortcuts-grid { grid-template-columns: 1fr 1fr; }
}
.shortcuts-grid > div {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}
kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
  min-width: 20px;
  text-align: center;
}

/* =========================================================================
   Toast
   ========================================================================= */

.toast {
  position: fixed;
  bottom: calc(100px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 300;
  animation: toastIn .25s cubic-bezier(.2, .9, .3, 1);
  max-width: calc(100vw - 32px);
  text-align: center;
}
@keyframes toastIn {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}

/* =========================================================================
   Utilities
   ========================================================================= */

.muted { color: var(--text-dim); }
.small { font-size: 13px; }

/* =========================================================================
   Responsive — desktop scale up
   ========================================================================= */

@media (min-width: 1024px) {
  .prompter-text { font-size: 64px; }
}

/* RTL helper — applied via JS based on speech-lang */
.rtl .prompter-text,
.rtl #editTextarea,
.rtl .record-line {
  direction: rtl;
  text-align: right;
}

/* Fullscreen: hide chrome, hug the top so eyes stay near the camera */
:fullscreen .topbar,
:-webkit-full-screen .topbar { display: none; }
:fullscreen .focus-line,
:-webkit-full-screen .focus-line { top: 4%; }
:fullscreen .prompter-pad-top,
:-webkit-full-screen .prompter-pad-top { height: 4vh; }
