/* ==========================================================================
   Activ Teleprompter
   ========================================================================== */

:root {
  /* Shared with activ.in/timer so the two tools feel like one product. */
  --bg: #0a0d12;
  --bg-deep: #04060a;
  --panel: #11161e;
  --panel-2: #161c26;
  --panel-3: #1b222d;
  --input: #0e131b;
  --line: #232b38;
  --line-soft: #1b222d;
  --line-strong: #2c3645;
  --ink: #e6e9ef;
  --ink-2: #b8c0cd;
  --muted: #8f97a5;
  --accent: #ef7f1a;
  --accent-hi: #ff8f30;
  --on-accent: #0a0d12;
  --accent-soft: rgba(239, 127, 26, .15);
  /* Both are replaced at runtime — the wash is mixed opaque against whichever
     background the reader picked, and the reach is measured from the space of
     whichever font they picked. These are the values used until then. */
  --now-wash: rgba(239, 127, 26, .26);
  --now-reach: .14em;
  /* What the composer row may occupy: the viewport less the top bar and the
     padding above and below it. */
  --frame: 91px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 48px rgba(0, 0, 0, .55);
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;

  /* prompter surface — overwritten from JS */
  --pbg: #000000;
  --pfg: #ffffff;
  --cue-pct: 38%;
  --p-size: 64px;
  --p-lh: 1.5;
  --p-width: 80%;
  --p-font: "Poppins", system-ui, sans-serif;
  --p-align: left;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.is-prompting { overflow: hidden; }

a { color: inherit; }

h1, h2 { margin: 0; font-weight: 600; letter-spacing: -.01em; }

.muted { color: var(--muted); }

.ico { width: 1em; height: 1em; display: block; flex: none; }

kbd {
  font: 600 11px/1.6 var(--ui);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--ink-2);
  white-space: nowrap;
}

.sp { display: inline-block; width: 14px; }

/* --------------------------------------------------------------- top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(10, 13, 18, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  text-decoration: none;
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}

.brand:hover .brand-text { color: var(--accent); }
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
}

.brand-text { font-size: 15px; font-weight: 400; letter-spacing: -.01em; }
.brand-text b { font-weight: 600; }

/* The script buttons head the settings panel, so every control on the page is on
   the same side of it and the top bar is left to say only where you are. It
   sticks, because the panel scrolls itself on a short screen and Start prompting
   is the one button that must never be the thing you have to go looking for. */
.script-actions {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  /* The panel gives up its own top padding to this row, so the sticky edge sits
     flush and nothing scrolls through the gap above it. */
  padding: 10px 0;
  margin-bottom: 2px;
  background: var(--panel);
  border-bottom: 1px solid var(--line-soft);
}

.script-actions .btn { height: 32px; }
/* Start prompting is where the row ends, not another button in the run. */
.script-actions .btn.primary { margin-left: auto; }

/* ---------------------------------------------------------------- button */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-2);
  font: 500 13px/1 var(--ui);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}

.btn:hover { background: var(--panel-2); color: var(--ink); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  padding: 0 18px;
}

.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: var(--on-accent); }
.btn.block { width: 100%; justify-content: center; }

.btn:focus-visible,
.seg-btn:focus-visible,
.swatch:focus-visible,
.ctl:focus-visible,
textarea:focus-visible,
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* -------------------------------------------------------------- composer */

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  /* The settings match the height of the script beside them and spread into it,
     rather than bunching at the top over a panel of empty black. */
  align-items: stretch;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px;
}

.pane {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.editor-pane {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--frame));
  padding: 18px;
}

.pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.pane-head h1 { font-size: 15px; }
.pane-head p { margin: 0; font-size: 12px; }

/* The canvas is the editor pretending to be the prompter: same surface,
   same type, and the cue line where it will sit on stage. */
.canvas {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 320px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.canvas .cue-line { border-top-style: dashed; }

/* The cue line is set by dragging it where it lives, so the grab handles are
   on the line itself. The line as a whole stays transparent to the pointer:
   it lies across the script box, and a full-width drag strip would swallow
   the click that puts the caret on that row. Only the arrows and the tag
   take it. */
.canvas-cue { outline: none; }

.canvas-cue i,
.canvas-cue-tag { pointer-events: auto; cursor: ns-resize; }

/* An arrow is a 13px triangle — too small to grab. Pad the hit area without
   moving the triangle. */
.canvas-cue i::after {
  content: "";
  position: absolute;
  top: -10px;
  bottom: -10px;
  left: -16px;
  right: -16px;
}

.canvas-cue-tag {
  position: absolute;
  right: 26px;
  top: -11px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font: 600 10px/1 var(--ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  user-select: none;
  -webkit-user-select: none;
  transition: border-color .15s, box-shadow .15s;
}

.canvas-cue-tag b { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.canvas-cue-tag:hover { border-color: var(--accent); }
.canvas-cue:focus-visible .canvas-cue-tag { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.canvas-cue.is-dragging .canvas-cue-tag { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.canvas.is-cue-drag .script { user-select: none; -webkit-user-select: none; }

.script {
  flex: 1;
  width: 100%;
  min-height: 0;
  resize: none;
  /* The sides are widened in JS to hold the text to the same column the stage
     will give it, so what wraps here wraps there. The gutter is reserved whether
     or not the scrollbar is showing, because that measurement comes from
     clientWidth: let it jump by a scrollbar's width and a script long enough to
     overflow the box quietly rewraps to the wrong column. */
  padding: 18px var(--preview-pad, 20px);
  scrollbar-gutter: stable;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--pbg);
  color: var(--pfg);
  text-align: var(--p-align);
  font-family: var(--p-font);
  font-size: var(--preview-size, 16px);
  line-height: var(--p-lh);
  transition: background .18s, color .18s;
}

.script::placeholder { color: currentColor; opacity: .38; }
.script:focus { border-color: var(--line-strong); outline: none; }

/* stats strip */

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
}

.stat {
  flex: 1 1 96px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
}

.stat dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat.highlight { background: var(--accent-soft); border-color: rgba(239, 127, 26, .32); }
.stat.highlight dd { color: #ffa451; }

/* -------------------------------------------------------------- settings */

.settings-pane {
  max-height: calc(100vh - var(--frame));
  padding: 0 16px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
}

/* Two columns on a wide screen, one below that. The wrappers vanish from the
   box tree in the single-column case, so the groups stack exactly as they did
   before there were columns. */
.settings-col { display: contents; }

.group { padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.settings-col:last-child .group:last-of-type { border-bottom: 0; }
.group-head { margin-bottom: 6px; }
.group-head h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

.field { margin-bottom: 8px; }
.field:last-child { margin-bottom: 0; }

.field > label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 5px;
}

.field output { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* A slider and its name sit on one line. Stacked, five of them cost about a
   hundred pixels of the panel's height for no more information, which is the
   difference between the settings fitting a laptop screen and not. */
.field-slider {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 12px;
}

.field-slider > label { flex: 0 0 122px; margin-bottom: 0; }
.field-slider > input[type="range"] { flex: 1 1 110px; min-width: 84px; }
.field-slider > .hint-wrap { flex: 1 0 100%; }

.hint { margin: 7px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.hint b { color: var(--ink-2); font-weight: 600; }

/* A hint that runs long is clamped to two lines and opens on hover or focus.
   The wrapper is given the clamped height in JS, so when the full text lifts
   out of the flow to sit over the panel, nothing below it moves. */
.hint-wrap { position: relative; margin-top: 6px; }
.hint-wrap > .hint { margin: 0; }
.hint-wrap:focus { outline: none; }

.hint-wrap.is-clipped > .hint {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.hint-wrap.is-clipped::after {
  content: "more";
  position: absolute;
  right: 0;
  bottom: 0;
  /* The clamp reserves no room for this badge, so the last line of the hint runs
     underneath it. A fade wide enough to read as a fade is what keeps the word
     under it from looking like a collision. */
  padding-left: 34px;
  background: linear-gradient(to right, transparent, var(--panel) 30px);
  font: 600 9.5px/1.75 var(--ui);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  pointer-events: none;
}

.hint-wrap.is-clipped:hover > .hint,
.hint-wrap.is-clipped:focus > .hint,
.hint-wrap.is-clipped:focus-within > .hint {
  position: absolute;
  top: -9px;
  left: -11px;
  right: -11px;
  z-index: 7;
  display: block;
  overflow: visible;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  box-shadow: var(--shadow);
}

.hint-wrap.is-clipped:hover::after,
.hint-wrap.is-clipped:focus::after,
.hint-wrap.is-clipped:focus-within::after { content: none; }

/* range */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: var(--line);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--accent);
}

input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line); }
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink); border: 3px solid var(--accent);
}

/* segmented control */

.seg {
  display: flex;
  gap: 4px;
  padding: 2px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}

.seg-btn {
  flex: 1;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 500 12.5px/1 var(--ui);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.seg-btn:hover { color: var(--ink); }
.seg-btn.is-on { background: var(--accent); color: var(--on-accent); font-weight: 700; }

.seg + .field { margin-top: 8px; }

/* number row */

.row { display: flex; align-items: center; gap: 8px; }
.row-sep { font-size: 12px; color: var(--muted); }

input[type="number"] {
  width: 72px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--ink);
  font: 500 14px/1 var(--ui);
  font-variant-numeric: tabular-nums;
}

/* swatches + colors */

.swatches { display: flex; gap: 8px; }

.swatch {
  flex: 1;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--sw-bg);
  color: var(--sw-fg);
  font: 600 15px/1 var(--ui);
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}

.swatch.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.colors { margin-top: 6px; gap: 14px; }

.color { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }

input[type="color"] {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 4px; }

/* checkboxes */

.checks { display: grid; gap: 6px; }

.check { display: flex; align-items: flex-start; gap: 10px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }

.check input {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  flex: none;
  margin: 1px 0 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-2);
  cursor: pointer;
  position: relative;
}

.check input:checked { background: var(--accent); border-color: var(--accent); }

.check input:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* shortcut list + footer */

/* The shortcuts flow and wrap instead of taking a row each — they are a legend,
   not a list of things to work down, and the height they were costing is height
   the controls in the other column needed. */
.keys {
  list-style: none;
  /* Tight rows: the list grew a scroll line and a shift line, and the column has
     to hold everything without a scrollbar. */
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  font-size: 12px;
  color: var(--muted);
}
.keys li { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

.foot { margin: 10px 0 0; font-size: 11.5px; color: var(--muted); }
.foot a { color: var(--muted); }

/* =============================== STAGE ================================= */

.stage {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--pbg);
  overflow: hidden;
}

.stage[hidden] { display: none; }

.viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform: scaleX(var(--mx, 1)) scaleY(var(--my, 1));
}

.track { will-change: transform; }

.content {
  position: relative;
  width: var(--p-width);
  margin: 0 auto;
  color: var(--pfg);
  font-family: var(--p-font);
  font-size: var(--p-size);
  line-height: var(--p-lh);
  text-align: var(--p-align);
  letter-spacing: -.005em;
}

.line {
  margin: 0;
  padding: .04em 0;
  cursor: pointer;
  transition: opacity .25s ease, filter .25s ease;
}

.line.blank { min-height: .55em; cursor: default; }

/* The sentence being read. The cue deliberately runs a beat ahead of the voice,
   so the cue is no longer the answer to "where am I" — this is. A wash rather
   than a colour change, because the reader chooses the text colour; and it is
   drawn per word with a little spread, so the gaps between the words close up
   into one continuous band. */
.w.is-now {
  background: var(--now-wash);
  /* A word's background stops at the word, so a run of them comes out as
     separate blocks with the spaces punched out between. Two copies of the box
     offset left and right close those gaps into one band — offsets rather than
     a spread, so the band does not also grow taller, and shadows rather than
     padding, so nothing on the line moves when the highlight arrives. */
  box-shadow: var(--now-reach) 0 0 var(--now-wash),
              calc(-1 * var(--now-reach)) 0 0 var(--now-wash);
  border-radius: .06em;
  transition: background .18s ease, box-shadow .18s ease;
}

.stage.is-focus .line { opacity: .3; }
.stage.is-focus .line.is-active { opacity: 1; }
.stage.is-focus .line.is-near { opacity: .62; }
/* A sentence that wraps onto a second line keeps both lines lit, so dimming
   never cuts the sentence you are reading in half. */
.stage.is-focus .line.is-now-line { opacity: 1; }

/* cue line */

.cue-line {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--cue-pct);
  height: 0;
  z-index: 3;
  pointer-events: none;
  border-top: 1px solid color-mix(in srgb, var(--pfg) 18%, transparent);
}

.cue-line i {
  position: absolute;
  top: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.cue-line i:first-child { left: 0; border-left: 13px solid var(--accent); }
.cue-line i:last-child { right: 0; border-right: 13px solid var(--accent); }

/* HUD */

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px 22px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .82), rgba(0, 0, 0, .45) 55%, transparent);
  color: #fff;
  transition: opacity .35s ease;
}

.stage.is-idle .hud,
.stage.is-idle .stage-hint { opacity: 0; pointer-events: none; }

.hud-left { display: flex; align-items: flex-end; gap: 18px; }
.hud-left[hidden] { display: none; }

.timer { display: flex; flex-direction: column; line-height: 1; }

.timer-main {
  font-size: 30px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.timer.alt .timer-main { font-size: 19px; font-weight: 500; color: rgba(255, 255, 255, .62); }

.timer-sub {
  margin-top: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255, 255, 255, .45);
}

.hud-controls { display: flex; align-items: center; gap: 6px; }

.ctl {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.ctl:hover { background: rgba(255, 255, 255, .16); }
.ctl.is-on { background: var(--accent); border-color: var(--accent); }
.ctl.exit:hover { background: var(--accent); border-color: var(--accent); }

.ctl.play {
  width: 46px;
  height: 46px;
  font-size: 21px;
  background: var(--accent);
  border-color: var(--accent);
}

.ctl.play:hover { background: #d96c0c; }
.ctl.play .pause-i { display: none; }
.stage.is-playing .ctl.play .play-i { display: none; }
.stage.is-playing .ctl.play .pause-i { display: block; }

.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, .12);
}

.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .12s linear;
}

/* countdown + hint */

.countdown {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .72);
  color: #fff;
  font-size: min(28vw, 220px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.countdown[hidden] { display: none; }

.countdown span { animation: pop .9s ease-out; }

@keyframes pop {
  from { transform: scale(.55); opacity: 0; }
  40%  { transform: scale(1); opacity: 1; }
  to   { transform: scale(1); opacity: .85; }
}

.stage-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  z-index: 5;
  margin: 0;
  text-align: center;
  font-size: 11.5px;
  color: rgba(255, 255, 255, .5);
  transition: opacity .35s ease;
}

.stage-hint kbd { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .16); color: rgba(255, 255, 255, .8); }

/* toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 90;
  transform: translateX(-50%) translateY(8px);
  padding: 9px 16px;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font: 600 12.5px/1 var(--ui);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}

.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------------------------------------------------------- dialog

   confirm() draws a system alert: it looks like Windows rather than like this
   page, it lands wherever the browser decides, and it freezes the tab while
   it is up. These questions belong to the app, so the app asks them — in a
   card in the middle of the screen. */

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  transition: opacity .16s ease;
}

.modal[hidden] { display: none; }
.modal.is-on { opacity: 1; }

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

.modal-card {
  position: relative;
  width: min(430px, 100%);
  padding: 22px 22px 20px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateY(10px) scale(.985);
  transition: transform .16s ease;
}

.modal.is-on .modal-card { transform: none; }

.modal-title { margin: 0; font-size: 17px; }
.modal-body { margin: 8px 0 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.modal-body[hidden] { display: none; }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal-actions .btn { min-width: 104px; justify-content: center; }

.btn.primary.danger { background: #e5484d; border-color: #e5484d; color: #fff; }
.btn.primary.danger:hover { background: #f05055; border-color: #f05055; color: #fff; }

html.is-modal body { overflow: hidden; }

@media (max-width: 480px) {
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

/* ============================= responsive ============================== */

/* Wide enough for the settings to stand in two columns beside the editor,
   which is what keeps them on one screen on a laptop without scrolling. */
@media (min-width: 1200px) {
  .composer { grid-template-columns: minmax(0, 1fr) 588px; }
  /* The button row spans both columns and is sized by its content; the row
     under it takes everything that is left, so the leftover height lands in the
     controls rather than being shared out with the buttons. */
  .settings-pane {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    gap: 0;
    align-items: stretch;
  }
  .script-actions { grid-column: 1 / -1; }

  /* A rule down the middle. Each group already draws a line under itself, and
     those lines stop at the edge of their own column at heights that have no
     reason to agree — without a divider the two sets read as one broken grid
     rather than as two columns. The gutter is padding either side of the rule
     rather than a gap, so the rule lands exactly between them. */
  .settings-col:first-child { padding-right: 20px; }
  .settings-col + .settings-col {
    padding-left: 20px;
    border-left: 1px solid var(--line-soft);
  }

  /* Each column owns the full height of the pane and the groups share it out
     between them, so the space left over becomes breathing room around the
     controls instead of a gap at the bottom. */
  /* No min-height:0 here on purpose. It would let the column shrink below its
     own contents, and because the pane clips what overflows, the bottom control
     would simply stop being drawn — which is how the alignment switch went
     missing. Without it the grid row grows instead and the panel scrolls: worse
     than fitting, but at least it tells you. */
  .settings-col { display: flex; flex-direction: column; }
  .settings-col .group { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }
  .settings-col .group:first-child { padding-top: 0; }
  .settings-col .group:last-of-type { border-bottom: 0; }
}

@media (max-width: 1040px) {
  .composer { grid-template-columns: minmax(0, 1fr); }
  .editor-pane { min-height: 52vh; }
  .settings-pane { max-height: none; }
}

@media (max-width: 720px) {
  .topbar { padding: 10px 14px; flex-wrap: wrap; row-gap: 10px; }
  .script-actions { width: 100%; gap: 6px; }
  .script-actions .btn { flex: 1 1 auto; justify-content: center; padding: 0 10px; }
  .script-actions .btn.primary { flex: 1 1 100%; }
  .composer { padding: 14px; gap: 14px; }
  .editor-pane { padding: 14px; }
  .hud { padding: 12px 12px 20px; flex-direction: column; align-items: stretch; gap: 12px; }
  .hud-left { justify-content: space-between; gap: 12px; }
  .hud-controls { justify-content: center; }
  .mic { align-self: center; }
  .timer-main { font-size: 26px; }
  .stage-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print { body { display: none; } }

/* ------------------------------------------------------------ select box */

select {
  width: 100%;
  height: 34px;
  padding: 0 32px 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--input) no-repeat right 10px center / 10px 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2393939a' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  color: var(--ink);
  font: 500 13px/1 var(--ui);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.seg-btn[disabled] { opacity: .4; cursor: not-allowed; }
.seg-btn[disabled]:hover { color: var(--muted); }

/* ------------------------------------------------------------- mic chip */

.mic {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 26px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .06);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255, 255, 255, .8);
  white-space: nowrap;
  transition: opacity .25s ease;
}

.mic[hidden] { display: none; }

.mic-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(239, 127, 26, .6);
  animation: mic-pulse 1.4s ease-out infinite;
}

.mic.is-quiet { opacity: .55; }
.mic.is-quiet .mic-dot { animation: none; background: rgba(255, 255, 255, .4); box-shadow: none; }

.mic.is-bad {
  border-color: rgba(255, 92, 92, .55);
  background: rgba(255, 92, 92, .14);
  color: #ffb4b4;
  opacity: 1;
}

.mic.is-bad .mic-dot { animation: none; background: #ff5c5c; box-shadow: none; }
.mic.is-bad .mic-level { display: none; }

/* Live input level — proof that audio is reaching the page, not just that
   the recogniser was asked to start. */
.mic-level {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  margin-left: 2px;
}

.mic-level i {
  width: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .22);
  transition: height .08s linear, background .08s linear;
}

.mic-level i:nth-child(1) { height: 4px; }
.mic-level i:nth-child(2) { height: 6px; }
.mic-level i:nth-child(3) { height: 8px; }
.mic-level i:nth-child(4) { height: 10px; }
.mic-level i:nth-child(5) { height: 12px; }

.mic-level i.is-lit { background: var(--accent); }

/* Text for screen readers only. Used to give a control a name that does not
   change when the visible status text inside it does. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The same chip in the settings, where it is a button: it reports the state
   of the microphone and asks for it again if the first answer was no. */
.mic-check {
  -webkit-appearance: none;
  appearance: none;
  width: fit-content;
  margin: 2px 0 6px;
  font-family: inherit;
  cursor: pointer;
}

.mic-check:hover { border-color: rgba(255, 255, 255, .3); }
.mic-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mic-check.is-bad:hover { border-color: rgba(255, 92, 92, .8); }

@keyframes mic-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(239, 127, 26, .6); }
  70%  { box-shadow: 0 0 0 7px rgba(239, 127, 26, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 127, 26, 0); }
}

/* ============================== LANDING ================================
   Matches activ.in/timer so the two tools read as one product.          */

.landing {
  background: var(--bg);
  min-height: 100vh;
}

.landing[hidden] { display: none; }

.landing-inner {
  position: relative;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px 56px;
}

.site-topnav {
  position: absolute;
  top: 18px;
  right: 24px;
  display: flex;
  /* Four tools instead of two, and the row is anchored by its right edge, so
     let it wrap down rather than run out past the left of the hero. */
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 22px;
  font-size: 14px;
  z-index: 2;
}

.site-topnav a { color: var(--ink-2); text-decoration: none; transition: color .15s; }
.site-topnav a:hover { color: var(--accent); }
/* The check-in platform, not a fourth free tool — the one link here worth
   arriving at. */
.site-topnav .stn-home { color: var(--accent); font-weight: 600; }

/* hero */

.ll-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 92px 0 52px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line-soft);
}

.ll-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-size: 11px;
  letter-spacing: .18em;
  color: var(--muted);
  text-transform: uppercase;
}

.ll-mark {
  background: var(--accent);
  color: var(--on-accent);
  padding: 4px 9px;
  border-radius: 5px;
  font-weight: 800;
  letter-spacing: .06em;
}

.ll-title {
  margin: 0 0 14px;
  font-size: clamp(34px, 7vw, 52px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -.02em;
  color: var(--ink);
}

.lt-amber { color: var(--accent); }

.ll-tag {
  max-width: 620px;
  margin: 0 auto 18px;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-2);
}

.ll-pills {
  list-style: none;
  max-width: 640px;
  margin: 8px auto 26px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.ll-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(239, 127, 26, .06);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
}

.ll-pill-primary { background: rgba(239, 127, 26, .15); border-color: rgba(239, 127, 26, .55); color: var(--ink); }
.ll-dot { color: var(--accent); font-weight: 800; font-size: 11px; line-height: 1; }

.launch-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 30px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font: 700 16px/1 var(--ui);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 28px -10px rgba(239, 127, 26, .55);
  transition: transform .15s, box-shadow .15s, background .15s;
}

.launch-btn-primary:hover {
  background: var(--accent-hi);
  transform: translateY(-1px);
  box-shadow: 0 14px 36px -10px rgba(239, 127, 26, .7);
}

.launch-btn-primary:active { transform: translateY(0); }
.launch-btn-primary svg { display: block; }
.launch-btn-primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.ll-meta { margin-top: 18px; font-size: 12.5px; color: var(--muted); }

/* about */

.about { color: var(--ink); }
.about h2 { font-size: 28px; font-weight: 700; margin: 0 0 8px; color: var(--accent); letter-spacing: -.01em; }
.about h3 { font-size: 17px; font-weight: 600; margin: 32px 0 12px; color: var(--ink); }
.about p { font-size: 15px; line-height: 1.7; color: var(--ink-2); margin: 0 0 14px; }
.about b { color: var(--ink); font-weight: 600; }
.about ul { font-size: 15px; line-height: 1.75; color: var(--ink-2); margin: 0 0 14px; padding-left: 22px; }
.about ul li { margin-bottom: 4px; }

.about a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(239, 127, 26, .35);
  transition: color .15s, border-color .15s;
}

.about a:hover { color: var(--ink); border-bottom-color: var(--accent); }

.about details {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 8px 0;
}

.about details summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.about details summary::-webkit-details-marker { display: none; }
.about details summary::after { content: "+"; font-size: 20px; color: var(--muted); line-height: 1; }
.about details[open] summary::after { content: "\2212"; }
.about details[open] summary { margin-bottom: 10px; }
.about details p { font-size: 14px; margin: 6px 0 0; }

.about-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
}

/* ======================== RESPONSIVE — LANDING =========================
   Rules live at the end of the file so they outrank the landing block
   above at equal specificity.                                           */

@media (max-width: 900px) {
  .landing-inner { padding: 0 20px 48px; }
  .site-topnav { top: 14px; right: 20px; gap: 16px; font-size: 13px; }
  .ll-hero { padding: 84px 0 44px; }
}

@media (max-width: 640px) {
  .site-topnav {
    position: static;
    justify-content: center;
    gap: 14px;
    padding: 16px 0 0;
  }

  .landing-inner { padding: 0 16px 40px; }
  .ll-hero { padding: 28px 0 36px; margin-bottom: 22px; }
  .ll-brand { flex-wrap: wrap; justify-content: center; gap: 8px; font-size: 10px; margin-bottom: 20px; }
  .ll-tag { font-size: 15px; }
  .ll-pills { gap: 7px; }
  .ll-pill { font-size: 11.5px; padding: 6px 11px; }

  .launch-btn-primary {
    width: 100%;
    justify-content: center;
    padding-left: 20px;
    padding-right: 20px;
  }

  .about h2 { font-size: 23px; }
  .about h3 { font-size: 16px; margin-top: 26px; }
  .about p,
  .about ul { font-size: 14.5px; }
  .about ul { padding-left: 20px; }
  .about details { padding: 11px 13px; }
  .about details summary { font-size: 13.5px; }
}

@media (max-width: 380px) {
  .ll-brand span:last-child { display: none; }
  .ll-pills { display: none; }
}

/* ======================== RESPONSIVE — APP ============================= */

@media (max-width: 720px) {
  .brand-text { font-size: 14px; }
  .canvas { min-height: 240px; }
  .script { padding: 14px 15px; }
}

@media (max-width: 420px) {
  .topbar { padding: 9px 12px; }
  .script-actions .btn { font-size: 12px; padding: 0 8px; }
  .brand-mark { width: 26px; height: 26px; font-size: 14px; }
}

/* Phone held sideways: the prompter needs the height more than the HUD does. */
@media (max-height: 480px) and (orientation: landscape) {
  .hud { padding: 8px 12px 10px; flex-direction: row; align-items: center; gap: 10px; }
  .timer-main { font-size: 22px; }
  .stage-hint { display: none; }
}

/* Touch devices have no hover and no keyboard — do not promise either. */
@media (hover: none) {
  .stage-hint { display: none; }
}
