/* =====================================================================
   PROMPTER TAB -- teleprompter scripts + full-bleed reading overlay.
   Page recolour (the --gold* token swap + black-red background) lives in
   page-accents.css, scoped to [data-page="prompter"]. This file is layout:
   the script page (composer + saved list) and the overlay base. Accents
   use var(--gold*) so they inherit the on-air red swap for free.
   The scroll engine, mirroring and HUD controls land in later stages; the
   selectors here (.pr-stage / .pr-flip / .pr-scroller / .pr-hud) are the
   layer contract those stages build on.
   ===================================================================== */

.prompter { max-width: 860px; width: 100%; margin: 0 auto; padding-bottom: 40px; }

/* ---- Command Center tile (desktop home): newest-script preview ---- */
.qcc .t-prompter .t-badge { white-space: nowrap; flex: 0 0 auto; }
.qcc .t-prompter .pr-cc-title {
  font-size: 12.5px; font-weight: 600; color: var(--ink2); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: break-word;
}

/* ---- composer (paste-to-create) ---- */
.pr-composer { display: flex; flex-direction: column; gap: 10px; }
.pr-composer.hero { padding: 34px 0 10px; }
.pr-hero-copy { text-align: center; margin-bottom: 14px; }
.pr-hero-h { font-family: var(--font-serif); font-size: 30px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.pr-hero-s { max-width: 460px; margin: 8px auto 0; font-size: 13px; line-height: 1.6; color: var(--ink-3); }

.pr-composer textarea {
  width: 100%; resize: vertical; min-height: 96px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 14px 16px; font-size: 14px; line-height: 1.65; color: var(--ink);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.pr-composer.hero textarea { min-height: 200px; }
.pr-composer textarea::placeholder { color: var(--ink-4); }
.pr-composer textarea:focus { border-color: var(--gold-30); box-shadow: 0 0 0 3px var(--gold-10); }

.pr-composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 26px; }
.pr-savedhint { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-savedhint.on { color: var(--gold); }
.pr-savedhint i { margin-right: 5px; }
.pr-clear {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--ink-2);
  font-size: 12px; font-weight: 600;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.pr-clear:hover { border-color: var(--gold-30); color: var(--gold); background: var(--gold-10); }
.pr-clear i { font-size: 10px; }

/* ---- saved list (hairline dividers, no boxes) ---- */
.pr-list { margin-top: 26px; }
.pr-list-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 6px 8px; margin-bottom: 2px;
  border-bottom: 1px solid var(--gold-18);
}
.pr-list-head span:first-child { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }
.pr-list-n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }

.pr-row { display: flex; align-items: center; gap: 10px; padding: 4px 2px; border-bottom: 1px solid var(--line); }
.pr-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 9px 6px; border-radius: var(--r-sm); transition: background 0.15s; }
.pr-row-main:hover { background: rgba(255,255,255,0.03); }
.pr-row-title { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-row-meta { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.03em; color: var(--ink-4); }
.pr-row-main:hover .pr-row-title { color: var(--gold-hi); }

.pr-icobtn {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-2); color: var(--ink-3); font-size: 12px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.pr-icobtn:hover { color: var(--gold); border-color: var(--gold-30); background: var(--gold-10); }
.pr-icobtn.pr-del:hover { color: var(--err); border-color: rgba(224,108,108,0.4); background: rgba(224,108,108,0.08); }

/* ---- edit modal fields ---- */
.pr-edit { display: flex; flex-direction: column; gap: 6px; }
.pr-edit-lab { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-4); margin-top: 8px; }
.pr-edit-title, .pr-edit-text {
  width: 100%; background: rgba(255,255,255,0.03);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 10px 12px; font-size: 14px; line-height: 1.55; color: var(--ink);
  outline: none;
}
.pr-edit-text { resize: vertical; min-height: 160px; }
.pr-edit-title:focus, .pr-edit-text:focus { border-color: var(--gold-30); box-shadow: 0 0 0 3px var(--gold-10); }

/* =====================================================================
   READING OVERLAY -- full-bleed black takeover (portalled to <body>).
   Base layers only in this stage; the engine adds motion later.
   ===================================================================== */

/* Page scroll locks while reading; the Electron titlebar hides AND drops its
   drag region (drag regions beat z-order, so hiding alone isn't enough). */
body.pr-open { overflow: hidden; }
body.pr-open .titlebar { visibility: hidden; -webkit-app-region: no-drag; }

.pr-stage {
  position: fixed; inset: 0; z-index: 9000;
  background: #000;
  overflow: hidden;
  touch-action: none;
}

/* The ONLY mirrored layer: the engine writes scaleX/scaleY inline (text, countdown
   and eye-line flip together; the sibling HUD never transforms). */
.pr-flip { position: absolute; inset: 0; }

/* rAF (stage 2) writes translate3d straight to this element. */
.pr-scroller { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }

/* Lead-in / lead-out space so the text can start at and scroll past the eye line. */
.pr-spacer-top { height: 33vh; }
.pr-spacer-bottom { height: 67vh; }

.pr-text {
  margin: 0 7vw;
  font-size: calc(clamp(34px, 8.5vw, 60px) * var(--pr-fscale, 1));
  line-height: 1.45;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* HUD: never transformed, never mirrored. Safe-area padded for the phone in the rig. */
.pr-hud {
  position: absolute; inset: 0;
  pointer-events: none;
  display: flex; flex-direction: column; justify-content: space-between;
  padding:
    calc(env(safe-area-inset-top, 0px) + 14px)
    calc(env(safe-area-inset-right, 0px) + 16px)
    calc(env(safe-area-inset-bottom, 0px) + 14px)
    calc(env(safe-area-inset-left, 0px) + 16px);
}
.pr-hud > * { pointer-events: auto; }
.pr-hud-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pr-hud-title {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-4);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pr-exit {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px;
  background: rgba(20,20,20,0.7); border: 1px solid var(--line-strong);
  color: var(--ink-2); font-size: 13px; font-weight: 600;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: color 0.15s, border-color 0.15s;
}
.pr-exit:hover { color: var(--ink); border-color: var(--gold-30); }
.pr-exit i { font-size: 12px; }

/* ---- HUD auto-hide: fades out 2.5s into scrolling (engine toggles the class); any
   tap on the stage pauses AND brings it back. Hidden = untappable, top to bottom. ---- */
.pr-hud { transition: opacity 0.35s ease; }
.pr-hud.pr-hud-hidden { opacity: 0; }
.pr-hud.pr-hud-hidden > * { pointer-events: none !important; }

/* ---- progress bar (very top, above the safe-area padding) + time remaining ---- */
.pr-progress {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: rgba(255,255,255,0.08);
  pointer-events: none;
}
.pr-progress-fill { width: 0%; height: 100%; background: var(--gold); opacity: 0.85; }
.pr-time {
  flex: 0 0 auto; margin-left: auto;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em;
  color: var(--ink-3); font-variant-numeric: tabular-nums;
}

/* ---- countdown (inside .pr-flip, so stage-3 mirroring flips it with the text) ---- */
/* Keyed per digit in JSX, so the pop animation restarts on every 3 -> 2 -> 1 step. */
.pr-count {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: clamp(120px, 34vw, 260px); font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 70px var(--gold-10);
  animation: pr-count-pop 0.8s ease-out both;
  pointer-events: none;
}
@keyframes pr-count-pop {
  0%   { opacity: 0;    transform: scale(1.26); }
  22%  { opacity: 1;    transform: scale(1); }
  78%  { opacity: 1;    transform: scale(1); }
  100% { opacity: 0.12; transform: scale(0.92); }
}
/* Text sits faded behind the digits until the read actually starts. */
.pr-ph-countdown .pr-scroller { opacity: 0.18; }
.pr-scroller { transition: opacity 0.3s ease; }

/* ---- eye-line marker: pairs with the 33vh top spacer (line one sits here at y=0) ---- */
.pr-eyeline {
  position: absolute; left: 1.6vw; top: 33vh;
  width: 3.4vw; min-width: 22px; height: 3px; border-radius: 2px;
  background: var(--gold); opacity: 0.35;
  pointer-events: none;
}

/* ---- HUD bottom controls: speed row + actions row, glassy pills, rig-friendly hit
   targets. Lives in .pr-hud so it never mirrors and always reads correctly. ---- */
.pr-hud-bottom { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pr-ctl-group {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 999px;
  background: rgba(20,20,20,0.7); border: 1px solid var(--line-strong);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  max-width: 100%;
}
.pr-ctl {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-width: 40px; height: 40px; padding: 0 13px; border-radius: 999px;
  background: transparent; border: 1px solid var(--line-2);
  color: var(--ink-2); font-size: 13px; font-weight: 700; white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.pr-ctl:hover { color: var(--gold); border-color: var(--gold-30); background: var(--gold-10); }
.pr-ctl:disabled { opacity: 0.35; pointer-events: none; }
.pr-ctl i { font-size: 12px; }
.pr-fontbtn { font-family: var(--font-mono); letter-spacing: 0.02em; }
/* Mirror toggles: filled gold when active, unmissable at arm's length in the rig. */
.pr-ctl.pr-toggle.on { background: var(--gold); border-color: var(--gold); color: #101010; }
.pr-ctl.pr-toggle.on:hover { background: var(--gold-hi); border-color: var(--gold-hi); color: #101010; }
.pr-speed-val {
  min-width: 32px; text-align: center;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* Range input: custom track + fat gold thumb. touch-action none so the drag belongs
   to the slider, not the page, inside the gesture-locked stage. */
.pr-slider {
  -webkit-appearance: none; appearance: none;
  width: min(44vw, 300px); height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.16);
  outline: none; touch-action: none;
}
.pr-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--gold); border: none;
  box-shadow: 0 1px 6px rgba(0,0,0,0.55);
}
.pr-slider::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--gold); border: none;
}

/* ---- mobile ---- */
@media (max-width: 760px) {
  .pr-composer.hero { padding-top: 18px; }
  .pr-hero-h { font-size: 24px; }
  .pr-row-main { padding: 10px 4px; }
  /* keep both HUD control pills inside a 375px phone */
  .pr-ctl-group { gap: 6px; padding: 7px 9px; }
  .pr-ctl { padding: 0 10px; }
  .pr-slider { width: 36vw; }
}
