/* Self-hosted (vendor/fonts/, SIL OFL) — used only for the wordmark. */
@font-face {
  font-family: "Audiowide";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("vendor/fonts/Audiowide-Regular.woff2") format("woff2");
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #000;
}

body {
  color: #eee;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

.hidden { display: none !important; }

/* The HTML `hidden` attribute must always win, even when a class rule sets
 * an explicit display value (e.g. .modal { display: grid }). */
[hidden] { display: none !important; }

/* Visually hidden but still focusable — unlike `hidden`/display:none,
 * which removes the element from the tab order entirely. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* ---------- Landing ---------- */
.landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.landing-card {
  width: min(640px, 100%);
  text-align: center;
}

.landing h1 {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.tagline {
  color: #999;
  margin: 0 0 2rem;
  font-size: 1rem;
}

.drop-zone {
  display: block;
  position: relative;
  border: 2px dashed #3a3a3a;
  border-radius: 16px;
  padding: 3rem 2rem;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  outline: none;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: #888;
  background: #0d0d0d;
}

/* Keyboard focus lands on the visually-hidden file input inside the label. */
.drop-zone:has(input:focus-visible) {
  border-color: #6aa9ff;
  outline: 2px solid #6aa9ff;
  outline-offset: 2px;
}

.drop-zone-primary {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
}

.drop-zone-secondary {
  display: block;
  color: #777;
  font-size: 0.95rem;
}

.drop-zone code {
  background: #111;
  padding: 0.05em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}

.landing-note {
  margin-top: 1.5rem;
  color: #5a5a5a;
  font-size: 0.85rem;
}

.landing-download {
  margin-top: 0.5rem;
}

.landing-download a {
  color: #6aa9ff;
  text-decoration: none;
}

.landing-download a:hover,
.landing-download a:focus-visible {
  text-decoration: underline;
}

/* ---------- Prompter ---------- */
.prompter {
  position: relative;
}

/* The script scrolls inside this fixed full-screen viewport (not the window)
 * so the mirror transforms below flip what is painted on screen while scroll
 * positions and reading order stay top-down underneath. */
.scroll-viewport {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  /* Programmatic focus target only (tabindex=-1) — used to park keyboard
   * focus when the undo toast hides under it; never a visible tab stop. */
  outline: none;
  /* Kill horizontal drift from diagonal trackpad gestures: vertical panning
   * only, and no overscroll chaining (history-swipe / rubber-banding). */
  touch-action: pan-y pinch-zoom;
  overscroll-behavior: none;
}

.prompter-content {
  font-size: 96px;
  line-height: 1.4;
  padding: 0 9%;
  margin: 50vh 0 0;
}

.prompter-content p {
  /* --para-gap is driven by the "Paragraph spacing" slider. */
  margin: 0 0 var(--para-gap, 0.5em);
}

.prompter-content p:empty::before {
  content: "\00a0";
}

.prompter-content strong {
  color: #fff;
}

.prompter-spacer {
  height: 60vh;
}

/* Mirror flips apply only to the script area. HUD stays readable.
 * Horizontal flips the content in place; vertical flips the viewport box —
 * flipping the full document instead would paint it bottom-up and reverse
 * the scroll/reading order. The two compose for dual-mirror rigs. */
.prompter.mirror-h .prompter-content { transform: scaleX(-1); }
.prompter.mirror-v .scroll-viewport { transform: scaleY(-1); }

/* ---------- DOCX inline formatting ---------- */
.prompter-content u {
  text-decoration: underline;
  text-decoration-thickness: 0.04em;
  text-underline-offset: 0.12em;
}
.prompter-content s { text-decoration: line-through; }

/* Word highlight backgrounds — muted so they remain readable on the dark prompter. */
.prompter-content .hl {
  padding: 0 0.08em;
  border-radius: 0.08em;
}
.prompter-content .hl-yellow      { background: rgba(255, 235, 59, 0.22); }
.prompter-content .hl-green       { background: rgba(76, 175, 80, 0.22); }
.prompter-content .hl-cyan        { background: rgba(0, 188, 212, 0.22); }
.prompter-content .hl-magenta     { background: rgba(233, 30, 99, 0.22); }
.prompter-content .hl-blue        { background: rgba(33, 150, 243, 0.22); }
.prompter-content .hl-red         { background: rgba(244, 67, 54, 0.22); }
.prompter-content .hl-darkblue    { background: rgba(13, 71, 161, 0.30); }
.prompter-content .hl-darkcyan    { background: rgba(0, 96, 100, 0.30); }
.prompter-content .hl-darkgreen   { background: rgba(27, 94, 32, 0.30); }
.prompter-content .hl-darkmagenta { background: rgba(136, 14, 79, 0.30); }
.prompter-content .hl-darkred     { background: rgba(183, 28, 28, 0.30); }
.prompter-content .hl-darkyellow  { background: rgba(245, 127, 23, 0.30); }
.prompter-content .hl-darkgray    { background: rgba(97, 97, 97, 0.35); }
.prompter-content .hl-lightgray   { background: rgba(189, 189, 189, 0.25); }
.prompter-content .hl-black       { background: rgba(0, 0, 0, 0.35); }
.prompter-content .hl-white       { background: rgba(255, 255, 255, 0.10); }

/* ---------- Camera cues (ON CAMERA / OFF CAMERA) ---------- */
/* Stage directions: clearly set apart from spoken copy so the presenter
 * never reads them aloud. Never tokenized for voice tracking. Interactive
 * for authoring (triple-click/Enter flips, hover-✕/Delete removes — see the
 * cue-authoring section at the end of this sheet).
 * --cue-scale is driven by the "Camera cue size" slider. */
.prompter-content p.cue {
  width: fit-content;
  font-size: calc(1em * var(--cue-scale, 0.63));
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #ffc46b; /* OFF CAMERA amber — 13:1 on black, WCAG AAA */
  border: 2px solid rgba(255, 196, 107, 0.5);
  border-radius: 0.45em;
  padding: 0.2em 0.7em;
  margin: 0 0 1.2em;
  cursor: pointer;
  /* The badge is a control, not copy — triple-click flips it and must never
   * leave a text selection behind. */
  user-select: none;
  -webkit-user-select: none;
}
.prompter-content p.cue.cue-on {
  color: #7ce38b; /* ON CAMERA green — 13:1 on black, WCAG AAA */
  border-color: rgba(124, 227, 139, 0.5);
}
.prompter-content p.cue:focus-visible {
  outline: 2px solid #6aa9ff;
  outline-offset: 5px;
}
.prompter-content .cue-num {
  margin-left: 0.6em;
  opacity: 0.85;
}

/* ---------- MathML rendering ---------- */
.prompter-content math {
  font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", "Times New Roman", serif;
  vertical-align: baseline;
  /* Equations scale independently of the text via the "Equation size" slider;
   * --eq-fit is a per-element factor set by the auto-fit pass in app.js. */
  font-size: calc(1em * var(--eq-scale, 1) * var(--eq-fit, 1));
}
.prompter-content math[display="block"] {
  display: block;
  text-align: center;
  /* Equations count as paragraphs for spacing (0.8 ratio keeps the default
   * at the historical 0.4em when --para-gap is 0.5em). */
  margin: calc(var(--para-gap, 0.5em) * 0.8) 0;
  overflow: hidden;
}

/* ---------- HUD (bottom-left) ---------- */
.hud {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 10;
}

.hud-btn {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s ease, opacity .15s ease;
  opacity: 0.6;
}

.hud-btn:hover,
.hud-btn:focus-visible {
  background: rgba(255, 255, 255, 0.26);
  opacity: 1;
  outline: none;
}

.burger {
  display: inline-block;
  width: 24px;
  height: 18px;
  position: relative;
}

.burger span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}
.burger span:nth-child(1) { top: 0; }
.burger span:nth-child(2) { top: 8px; }
.burger span:nth-child(3) { top: 16px; }

.hud-percent {
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 32px;
  background: rgba(255, 255, 255, 0.14);
  padding: 0.35em 0.65em;
  border-radius: 14px;
  color: #fff;
  min-width: 4ch;
  text-align: center;
  opacity: 0.6;
  user-select: none;
}

/* ---------- Drawer ---------- */
.menu {
  position: fixed;
  bottom: 5.5rem;
  left: 1rem;
  width: min(380px, calc(100vw - 2rem));
  background: rgba(18, 18, 18, 0.96);
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  padding: 1rem;
  z-index: 20;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  max-height: calc(100vh - 7.5rem);
  overflow-y: auto;
}

.menu-logo {
  font-family: "Audiowide", system-ui, sans-serif;
  /* Largest single-line fit in the 380px drawer (measured 338px at 49px). */
  font-size: 49px;
  line-height: 1.2;
  text-align: center;
  color: #fff;
  letter-spacing: 0.01em;
  padding: 0.4rem 0 0.5rem;
  user-select: none;
  text-shadow: 0 0 18px rgba(106, 169, 255, 0.25);
}
.menu-logo span { color: #6aa9ff; }

.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.menu-header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ddd;
}

.icon-btn {
  background: transparent;
  color: #aaa;
  border: 0;
  font-size: 1.4rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  line-height: 1;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  outline: none;
}

.menu-section {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.6rem 0;
  border-top: 1px solid #2a2a2a;
}
.menu-section:first-of-type {
  border-top: 0;
  padding-top: 0.25rem;
}

.menu-row {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.control-label {
  display: flex;
  justify-content: space-between;
  color: #c4c4c4;
  font-size: 0.82rem;
}

.control-label output {
  color: #fff;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: #6aa9ff;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: #c4c4c4;
  font-size: 0.88rem;
}

.toggle input { accent-color: #6aa9ff; }

/* Destructive action: visually set apart from the neutral buttons. */
.reset-btn { color: #ff9a9a; }
.reset-btn:hover,
.reset-btn:focus-visible { background: rgba(244, 67, 54, 0.18); }

.primary-btn,
.secondary-btn {
  background: #2a2a2a;
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background .15s ease, transform .05s ease;
}

.primary-btn {
  background: #1f4fa6;
  flex: 1;
  font-size: 0.95rem;
  padding: 0.7rem 0.9rem;
}

.primary-btn:hover { background: #2a63c5; }
.primary-btn:active { transform: translateY(1px); }
.secondary-btn:hover { background: #3a3a3a; }
.secondary-btn:active { transform: translateY(1px); }

button:focus-visible {
  outline: 2px solid #6aa9ff;
  outline-offset: 2px;
}

kbd {
  background: #111;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 0.05em 0.4em;
  font-size: 0.72em;
  color: #ccc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.menu-footer {
  border-top: 1px solid #2a2a2a;
  padding-top: 0.6rem;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: #7a7a7a;
  line-height: 1.7;
}

.menu-footer p { margin: 0; }

/* ---------- Word tokens (for STT cursor tracking) ---------- */
.prompter-content .w {
  /* invisible — words flow inline normally; only used as anchors */
}

/* ---------- Block editing (double-click a paragraph) ---------- */
.prompter-content p.editing {
  outline: 2px solid rgba(106, 169, 255, 0.7);
  outline-offset: 8px;
  border-radius: 6px;
  background: rgba(106, 169, 255, 0.08);
  cursor: text;
}

/* ---------- Cursor marker (left side, outside text) ---------- */
.cursor-marker {
  position: fixed;
  /* left + font-size are runtime-driven: Pointer → Position / Size sliders
   * (placeCursorMarker / applySettings). These are pre-init fallbacks. */
  left: 0.6rem;
  top: 25%;
  transform: translateY(-50%);
  font-size: 2.5rem;
  line-height: 1;
  color: #6aa9ff;
  text-shadow: 0 0 6px rgba(106, 169, 255, 0.6);
  z-index: 9;
  pointer-events: none;
  /* Faintly visible at all times so the operator always sees the reading
   * line; brightens while voice tracking drives the scroll. */
  opacity: 0.3;
  transition: opacity .2s ease;
  user-select: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.prompter.stt-on .cursor-marker { opacity: 0.9; }

/* ---------- Mic badge (top right) ---------- */
.mic-badge {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(20, 20, 20, 0.85);
  border: 1px solid #2a2a2a;
  border-radius: 999px;
  padding: 0.4rem 0.75rem 0.4rem 0.55rem;
  color: #fff;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  z-index: 11;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  user-select: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

button.mic-badge {
  font-family: inherit;
  cursor: pointer;
  transition: filter .15s ease, transform .08s ease;
}
button.mic-badge:hover  { filter: brightness(1.15); transform: translateY(-1px); }
button.mic-badge:active { transform: translateY(0); filter: brightness(0.95); }
button.mic-badge:focus-visible { outline: 2px solid #6aa9ff; outline-offset: 2px; }

.mic-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6a6a6a;
  flex-shrink: 0;
}

.mic-glyph {
  display: inline-flex;
  align-items: center;
  color: #ddd;
}

.mic-label {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mic-badge[data-state="listening"] {
  border-color: #5a1f1f;
  background: rgba(40, 12, 12, 0.85);
}
.mic-badge[data-state="listening"] .mic-dot {
  background: #ff3a3a;
  animation: micPulse 1.1s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(255, 58, 58, 0.55);
}
.mic-badge[data-state="listening"] .mic-glyph { color: #fff; }

.mic-badge[data-state="reconnecting"] .mic-dot {
  background: #999;
  animation: micBlink 0.7s ease-in-out infinite;
}

.mic-badge[data-state="denied"] {
  border-color: #6a5a1f;
  background: rgba(45, 38, 12, 0.9);
}
.mic-badge[data-state="denied"] .mic-dot { background: #f3c64b; }

.mic-badge[data-state="error"] {
  border-color: #5a3a1f;
  background: rgba(40, 25, 12, 0.9);
}
.mic-badge[data-state="error"] .mic-dot { background: #f08a3a; }

@keyframes micPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 58, 58, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(255, 58, 58, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 58, 58, 0); }
}

@keyframes micBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* ---------- STT menu section ---------- */
.menu-section--stt {
  background: rgba(106, 169, 255, 0.05);
  border-radius: 12px;
  padding: 0.75rem 0.75rem 0.85rem;
  margin: 0 -0.25rem 0.25rem;
  border-top: 1px solid rgba(106, 169, 255, 0.2);
  border-bottom: 1px solid rgba(106, 169, 255, 0.2);
}

.menu-section--stt:first-of-type {
  border-top: 1px solid rgba(106, 169, 255, 0.2);
  padding-top: 0.75rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9bb8e5;
}

.info-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #3a4a6a;
  background: transparent;
  color: #9bb8e5;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  font-style: italic;
  font-family: Georgia, serif;
  line-height: 1;
  padding: 0;
}

.info-btn:hover { background: rgba(106, 169, 255, 0.12); }

.toggle--major {
  font-size: 0.95rem;
  color: #fff;
  font-weight: 500;
  padding: 0.25rem 0;
}
.toggle--major input { transform: scale(1.15); }

.stt-warn {
  background: rgba(243, 198, 75, 0.12);
  border: 1px solid rgba(243, 198, 75, 0.35);
  color: #f3c64b;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  line-height: 1.4;
}

.stt-status {
  font-size: 0.78rem;
  color: #aaa;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
}
.stt-status[data-tone="error"] { color: #f08a3a; background: rgba(240, 138, 58, 0.08); }
.stt-status[data-tone="warn"] { color: #f3c64b; background: rgba(243, 198, 75, 0.08); }

.control-hint {
  color: #777;
  font-size: 0.72rem;
  margin-left: 0.4rem;
}

.select {
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}
.select:focus { border-color: #6aa9ff; }

/* Segmented sensitivity selector */
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 3px;
}

.seg-opt {
  background: transparent;
  color: #bbb;
  border: 0;
  border-radius: 8px;
  padding: 0.45rem 0.5rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}

.seg-opt:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }

.seg-opt[aria-checked="true"] {
  background: #1f4fa6;
  color: #fff;
}

/* Disabled manual playback when STT drives scroll */
.stt-on #play-toggle,
.stt-on #speed {
  opacity: 0.4;
  pointer-events: none;
}
.stt-on #speed { filter: grayscale(1); }

/* ---------- Privacy modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: min(520px, 100%);
  background: #161616;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  padding: 1.5rem 1.5rem 1.25rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.modal-card h3 {
  margin: 0 0 0.6rem;
  font-size: 1.1rem;
  color: #fff;
}

.modal-card p {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #ccc;
  margin: 0.5rem 0;
}

.modal-card ul {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #ccc;
  padding-left: 1.2rem;
  margin: 0.5rem 0;
}

.modal-card strong { color: #fff; }

.modal-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
  justify-content: flex-end;
}

.modal-actions .secondary-btn { flex: 0 0 auto; }
.modal-actions .primary-btn { flex: 0 0 auto; }

/* ---------- Render modes (colors, line breaks, EQ hiding) ---------- */
/* "Show text colors" off: imported Word font colors and highlights render
 * as plain prompter text. !important is required — the colors are inline
 * style attributes, which otherwise beat any selector. */
.prompter-content.no-colors [style*="color"] { color: inherit !important; }
.prompter-content.no-colors .hl { background: none; }

/* "Line breaks" modes: One collapses runs of blanks to the first of the run,
 * None hides every blank (paragraph margins keep the separation). */
.prompter-content.lb-one p:empty + p:empty { display: none; }
.prompter-content.lb-none p:empty { display: none; }
/* A block being edited must stay visible even when blank-hiding rules match
 * (a fresh "+ ¶" paragraph is empty until the first keystroke). */
.prompter-content p:empty.editing { display: block !important; }

/* "Hide EQs in ON CAMERA blocks": only STAND-ALONE equation paragraphs
 * (.eq-only) hide — equations mixed into spoken text always render.
 * .on-cam/.eq-only are stamped by refreshSections() on every cue change. */
.prompter-content.hide-eq-oncam p.on-cam.eq-only { display: none; }
/* A block being edited stays visible even when the hide rule matches (a
 * mid-edit settings change must never yank the editor away). */
.prompter-content.hide-eq-oncam p.on-cam.eq-only.editing { display: block; }

/* ---------- Search highlights (CSS Custom Highlight API) ---------- */
::highlight(fp-find) {
  background-color: rgba(106, 169, 255, 0.35);
}
::highlight(fp-find-current) {
  background-color: rgba(255, 196, 107, 0.85);
  color: #000;
}

/* ---------- Camera cue authoring (hover insert / delete, undo toast) ---------- */
/* Transient, fixed-position singletons living outside the mirrored boxes
 * (like .cursor-marker) — app.js places them from getBoundingClientRect
 * screen coordinates and hides them on any scroll. */
.cue-insert {
  position: fixed;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateY(-50%);
  /* Only the pill takes clicks — the divider must never eat text clicks. */
  pointer-events: none;
}

.cue-insert::before,
.cue-insert::after {
  content: "";
  flex: 1;
  border-top: 2px dashed rgba(106, 169, 255, 0.45);
}

.cue-insert-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  background: rgba(10, 14, 22, 0.92);
  border: 2px dashed rgba(106, 169, 255, 0.8);
  border-radius: 999px;
  padding: 0.45em 1em;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #cfe2ff;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.cue-insert-btn:hover {
  background: rgba(31, 79, 166, 0.45);
  border-style: solid;
}

.cue-insert-plus {
  font-size: 1.25em;
  line-height: 1;
}

/* The pill previews the label the click will insert, in the cue's color. */
.cue-insert-btn[data-type="on"] .cue-insert-label { color: #7ce38b; }
.cue-insert-btn[data-type="off"] .cue-insert-label { color: #ffc46b; }

.cue-delete {
  position: fixed;
  z-index: 12;
  width: 34px;  /* app.js positioning assumes this size */
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255, 154, 154, 0.7);
  background: rgba(26, 12, 12, 0.92);
  color: #ff9a9a;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.cue-delete:hover {
  background: rgba(244, 67, 54, 0.3);
  border-color: #ff9a9a;
  color: #fff;
}

@media (prefers-reduced-motion: no-preference) {
  /* Grows ×1.3 per click of the triple-click delete sequence. */
  .cue-delete { transition: transform 0.12s ease; }
}

/* Undo toast (bottom center) — bright amber glow so the 7s undo window is
 * impossible to miss. */
.cue-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: rgba(24, 18, 8, 0.96);
  border: 1px solid rgba(255, 178, 77, 0.85);
  border-radius: 12px;
  padding: 0.45rem 0.55rem 0.45rem 1rem;
  font-size: 0.9rem;
  color: #ffe3b8;
  box-shadow:
    0 0 16px rgba(255, 178, 77, 0.6),
    0 0 44px rgba(255, 150, 40, 0.35),
    0 16px 48px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* The ¶ pill shares the cue-pill look with a neutral label. */
.cue-insert-para .cue-insert-label {
  color: #cfe2ff;
  font-size: 1.1em;
  line-height: 1;
}

/* ---------- Cue pairing warnings (top right) ---------- */
.warn-badge {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 11;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(45, 34, 10, 0.92);
  border: 1px solid rgba(243, 198, 75, 0.55);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  color: #f3c64b;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.warn-badge:hover { filter: brightness(1.15); }
.warn-glyph {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.05em;
}
/* Drop below the mic badge whenever voice tracking chrome is up. */
.prompter.stt-on .warn-badge { top: 4.4rem; }

/* Shared floating-panel chrome for the top-right overlays. */
.warn-list,
.find-panel {
  position: fixed;
  right: 1rem;
  display: flex;
  flex-direction: column;
  background: rgba(18, 18, 18, 0.96);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.warn-list {
  top: 4.4rem;
  z-index: 21;
  gap: 2px;
  width: min(340px, calc(100vw - 2rem));
  border: 1px solid rgba(243, 198, 75, 0.35);
  border-radius: 12px;
  padding: 0.4rem;
}
.prompter.stt-on .warn-list { top: 7.8rem; }

.warn-item {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #e8d9ac;
  font-size: 0.85rem;
  text-align: left;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
}
.warn-item:hover,
.warn-item:focus-visible {
  background: rgba(243, 198, 75, 0.14);
  color: #fff;
  outline: none;
}

/* ---------- Search & replace ---------- */
/* Shares .hud-btn chrome; only geometry and idle opacity differ. */
.find-toggle {
  position: fixed;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 11;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  opacity: 0.55;
}

.find-panel {
  top: 1rem;
  z-index: 22;
  width: min(360px, calc(100vw - 2rem));
  gap: 0.5rem;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  padding: 0.75rem;
  font-size: 14px;
}
.prompter.stt-on .find-panel { top: 4.4rem; }

.find-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.find-input {
  flex: 1;
  min-width: 0;
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}
.find-input:focus { border-color: #6aa9ff; }

.find-count {
  color: #9bb8e5;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 4.5ch;
  text-align: center;
}

.find-opts { gap: 1rem; }

/* ---------- Undo / redo corner ---------- */
.undo-corner {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10;
  display: flex;
  gap: 0.5rem;
}
.corner-btn { width: 48px; height: 48px; }
.corner-btn:disabled {
  opacity: 0.22;
  cursor: default;
}
.corner-btn:disabled:hover { background: rgba(255, 255, 255, 0.14); }

@media (prefers-reduced-motion: no-preference) {
  .cue-toast:not([hidden]) {
    animation: cueToastIn 0.18s ease-out;
  }

  @keyframes cueToastIn {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
  }

  /* Brief highlight so a freshly inserted cue is easy to spot. */
  .prompter-content p.cue.cue-flash {
    animation: cueFlash 0.55s ease-out;
  }

  @keyframes cueFlash {
    from { background: rgba(106, 169, 255, 0.35); }
    to   { background: transparent; }
  }
}

