/* Media studio — sidebar wizard shell.
 *
 * The visual language is the one the studio already had; what changed is the
 * layout. Two columns: a sidebar that always says where you are and what you
 * chose, and a content column showing exactly one step. Nothing blocks the
 * page any more — progress and the mode choice happen in the column, in view
 * of the sidebar, so the user never loses their place.
 */

:root {
  --ink: #f3f7f6;
  --muted: #9bb0b4;
  --accent: #3db8a7;
  --accent-hi: #5ddea8;
  --accent-ink: #06221e;
  --danger: #ff8f8f;
  --busy: #f0c36a;
  --warn-ink: #ffe2ad;

  --panel: rgba(23, 48, 53, 0.6);
  --sidebar: rgba(9, 22, 25, 0.5);
  --input: #173035;
  --mono-bg: #0d2226;

  --hairline: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.14);
  --border-hi: rgba(255, 255, 255, 0.18);

  --r-control: 7px;
  --r-card: 11px;
  --r-panel: 15px;

  --font: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
  --mono: ui-monospace, Menlo, "SFMono-Regular", "Cascadia Mono", monospace;

  --sidebar-w: 236px;
}

@property --holo-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(61, 184, 167, 0.14), transparent 55%),
    linear-gradient(165deg, #0d1c20 0%, #143033 55%, #0f2428 100%) fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.hidden {
  display: none !important;
}

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

.small {
  font-size: 12px;
}

.ok {
  color: var(--accent-hi);
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  letter-spacing: 0.01em;
}

/* Prose that carries a number. Not .mono: the monospace stack has no Arabic
   or Devanagari, and falling back mid-string breaks the shaping. */
.numeric {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.grow {
  flex: 1;
}

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

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
}

/* ---------- sidebar ---------- */

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 22px 18px 18px;
  background: var(--sidebar);
  border-right: 1px solid var(--hairline);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 26px;
}

.brand img {
  border-radius: 7px;
}

.brand-text {
  display: grid;
  min-width: 0;
}

.brand-text strong {
  font-size: 14px;
  letter-spacing: 0.01em;
}

.brand-text span {
  font-size: 11px;
  color: var(--muted);
}

/* ---------- the stepper: the page's only navigation ---------- */

.stepper {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  align-content: start;
}

.step {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 8px 8px 8px 6px;
  border-radius: var(--r-control);
  opacity: 0.4;
  transition: opacity 0.15s, background 0.15s;
}

/* The thread between the dots, so four rows read as one path. */
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  inset-inline-start: 15px;
  top: 28px;
  bottom: -2px;
  width: 1px;
  background: var(--hairline);
}

.step-dot {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border-hi);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  place-items: center;
  margin-top: 1px;
}

.step-body {
  display: grid;
  min-width: 0;
}

.step-name {
  font-size: 12.5px;
  font-weight: 700;
}

/* The choice already made — this is what replaces the old header's
   "Change mode" and "Choose another file" buttons. */
.step-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-sub:empty {
  display: none;
}

.step.done,
.step.current {
  opacity: 1;
}

.step.done .step-dot {
  border-color: var(--accent);
  background: rgba(61, 184, 167, 0.16);
}

/* The number is the dot's content until the step is behind you, when a
   tick replaces it. */
.step-num {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.step.done .step-num {
  visibility: hidden;
}

.step.done .step-dot::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 4px;
  margin-top: -2px;
  border-left: 1.5px solid var(--accent-hi);
  border-bottom: 1.5px solid var(--accent-hi);
  transform: rotate(-45deg);
}

.step.current {
  background: rgba(61, 184, 167, 0.1);
  box-shadow: inset 0 0 0 1px rgba(61, 184, 167, 0.22);
}

.step.current .step-dot {
  border-color: transparent;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(93, 222, 168, 0.12);
}

.step.current .step-num {
  color: var(--accent-ink);
}

.step.working .step-dot {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

.step.clickable {
  cursor: pointer;
}

.step.clickable:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* ---------- sidebar footer: who you are, what's left ---------- */

.side-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
  display: grid;
  gap: 10px;
}

.acct-head {
  display: flex;
  gap: 8px;
  align-items: center;
}

.acct-email {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.balance {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0 8px;
  align-items: baseline;
}

.balance-num {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.balance-unit {
  font-size: 11px;
  color: var(--muted);
}

.balance-bar {
  grid-column: 1 / -1;
  margin-top: 7px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.balance-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  transition: width 0.3s;
}

.balance-fill.low {
  background: var(--busy);
}

.balance:not(.has-balance) {
  display: none;
}

/* Buying minutes is the one thing the footer offers, so it gets a shape —
   the links under it stay text. */
.buy-btn {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(93, 222, 168, 0.35);
  border-radius: 999px;
  background: rgba(61, 184, 167, 0.1);
  color: var(--accent-hi);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
}

.buy-btn:hover {
  border-color: var(--accent-hi);
  background: rgba(61, 184, 167, 0.18);
}

.side-links {
  display: flex;
  gap: 14px;
  align-items: center;
}

/* ---------- content column ---------- */

.content {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 30px 32px;
  overflow: auto;
}

/* A step that owns the viewport (watch, editor) does its own scrolling. */
.content:has(.stage-view:not(.hidden)) {
  overflow: hidden;
  padding: 18px 20px;
}

/* Every step takes the column. The thing the step is about — the drop
   target, the picture, the lines — grows into the space, and the step's own
   action sits on a bar at the bottom of it. */
.view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.view-head {
  display: grid;
  gap: 5px;
}

.view-head h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.005em;
}

.view-lede {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  max-width: 68ch;
}

.view-lede:empty {
  display: none;
}

/* The primary action of a step sits bottom-right of that step. Never in a
   header, never floating above the thing it acts on. */
.view-actions {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ============================ surfaces ============================ */

.panel {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--r-panel);
  padding: 16px 18px;
}

.panel h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

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

.panel-head h3 {
  margin: 0;
}

.gate {
  border-color: rgba(61, 184, 167, 0.4);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(61, 184, 167, 0.1), transparent 60%),
    var(--panel);
}

.heads-up {
  border-color: rgba(240, 195, 106, 0.35);
  background: rgba(240, 195, 106, 0.06);
}

.heads-up h3 {
  color: var(--warn-ink);
}

.notice {
  margin: 0;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.04);
}

.notice.warn {
  color: var(--warn-ink);
  border-color: rgba(240, 195, 106, 0.4);
  background: rgba(240, 195, 106, 0.08);
}

.notice.error {
  color: var(--danger);
  border-color: rgba(255, 143, 143, 0.4);
  background: rgba(255, 143, 143, 0.08);
}

.notice.ok-notice {
  color: var(--accent-hi);
  border-color: rgba(93, 222, 168, 0.35);
  background: rgba(93, 222, 168, 0.08);
}

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

.pill {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  white-space: nowrap;
}

.pill:empty {
  display: none;
}

.pill.dirty {
  color: var(--warn-ink);
  border-color: rgba(240, 195, 106, 0.45);
  background: rgba(240, 195, 106, 0.08);
}

.pill.saved {
  color: var(--accent-hi);
  border-color: rgba(93, 222, 168, 0.4);
  background: rgba(93, 222, 168, 0.1);
}

.warn-pill {
  color: var(--warn-ink);
  border-color: rgba(240, 195, 106, 0.45);
  background: rgba(240, 195, 106, 0.08);
  text-transform: none;
  letter-spacing: 0;
}

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

.label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

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

button.primary {
  appearance: none;
  border: none;
  border-radius: var(--r-control);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 12.5px;
  padding: 8px 15px;
}

button.primary.big {
  font-size: 14px;
  padding: 10px 22px;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-hi);
}

button.secondary {
  border: 1px solid var(--border-hi);
  border-radius: var(--r-control);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-weight: 600;
  font-size: 12.5px;
  padding: 8px 14px;
}

button.secondary.big {
  font-size: 14px;
  padding: 10px 20px;
}

button.secondary:hover:not(:disabled) {
  border-color: var(--accent);
}

/* Tertiary: text only, until you point at it. */
button.ghost {
  border: 1px solid transparent;
  border-radius: var(--r-control);
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  padding: 5px 9px;
}

button.ghost:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.05);
}

button.ghost.danger,
button.ghost.danger:hover:not(:disabled) {
  color: var(--danger);
  border-color: rgba(255, 143, 143, 0.4);
}

button.ghost.danger:hover:not(:disabled) {
  background: rgba(255, 143, 143, 0.08);
}

button.tiny-ghost {
  font-size: 11px;
  padding: 4px 7px;
}

button.linky {
  border: none;
  background: none;
  padding: 0;
  color: var(--muted);
  font-size: 11.5px;
  text-align: left;
}

button.linky:hover {
  color: var(--ink);
  text-decoration: underline;
}

button.linky.accent {
  color: var(--accent-hi);
  font-weight: 700;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.05);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 10px 0 0;
}

.inline-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.inline-actions.push {
  margin-left: auto;
}

select,
input[type="text"],
input[type="file"] {
  background: var(--input);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  padding: 6px 8px;
  font-family: inherit;
  font-size: 12.5px;
}

input[type="text"]:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--accent);
}

input[type="range"] {
  accent-color: var(--accent);
}

.field {
  display: grid;
  gap: 4px;
}

.check-line {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  margin: 10px 0 0;
}

.check-line.tight {
  margin: 0;
  font-size: 12.5px;
}

.check-line input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

/* ---------- plan badges (mirrors popup.css) ---------- */

.plan-badge {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.plan-badge.trial {
  color: var(--busy);
  border: 1px solid rgba(240, 195, 106, 0.45);
  background: rgba(240, 195, 106, 0.12);
}

.plan-badge.api {
  color: var(--muted);
  border: 1px solid var(--border-hi);
  background: rgba(255, 255, 255, 0.06);
}

/* Paid: the quiet half of the holographic family — same ring, no animation. */
.plan-badge.paid {
  color: #d9ecff;
  border: 2px solid transparent;
  background:
    linear-gradient(#12262e, #12262e) padding-box,
    linear-gradient(120deg, #59f2dc, #7aa8ff, #d78cff) border-box;
}

/* Premium: full animated holographic border + shimmer. The one flourish. */
.plan-badge.premium {
  color: #eafffb;
  border: 2px solid transparent;
  background:
    linear-gradient(#0d2a2e, #0d2a2e) padding-box,
    conic-gradient(from var(--holo-angle), #59f2dc, #7aa8ff, #d78cff, #ffd08a, #59f2dc)
      border-box;
  animation:
    holo-spin 3.2s linear infinite,
    holo-glow 3.2s ease-in-out infinite;
}

@keyframes holo-spin {
  to {
    --holo-angle: 360deg;
  }
}

@keyframes holo-glow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(122, 168, 255, 0.35);
  }
  50% {
    box-shadow: 0 0 10px rgba(215, 140, 255, 0.55);
  }
}

/* ============================ 1. File ============================ */

/* There is nothing else to do on this screen, so the drop target is the
   screen: it takes every pixel the recent list does not need. */
.dropzone {
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 220px;
  padding: 24px;
  text-align: center;
  border: 1px dashed rgba(61, 184, 167, 0.4);
  border-radius: var(--r-panel);
  background:
    radial-gradient(80% 60% at 50% 50%, rgba(61, 184, 167, 0.07), transparent 70%),
    rgba(255, 255, 255, 0.012);
  transition: background 0.15s, border-color 0.15s;
}

.dropzone:focus-visible {
  outline: none;
  border-color: var(--accent-hi);
}

.dropzone.dragover {
  border-color: var(--accent-hi);
  background: rgba(93, 222, 168, 0.1);
}

.dropzone-inner {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  border-radius: var(--r-card);
  background: rgba(61, 184, 167, 0.14);
}

.dropzone-icon svg {
  width: 22px;
  height: 22px;
  fill: var(--accent-hi);
}

.dropzone-lead {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.dropzone-formats {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- recent ---------- */

.recent {
  flex: none;
  display: grid;
  gap: 8px;
}

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

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
}

/* The card is a button, so the housekeeping buttons cannot live inside it —
   they are its siblings, and the row is what positions them. */
.recent-list li {
  position: relative;
  display: grid;
}

/* Each one is a way back into a file you already paid for, so the card
   itself is the button; the housekeeping shows up on hover. */
.recent-card {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 11px 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.recent-card:hover {
  border-color: rgba(61, 184, 167, 0.45);
  background: rgba(61, 184, 167, 0.07);
}

.recent-name {
  color: var(--accent-hi);
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 86px;
}

.recent-meta {
  color: var(--muted);
  font-size: 11px;
}

.recent-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.recent-list li:hover .recent-actions,
.recent-actions:focus-within {
  opacity: 1;
}

/* ============================ 2. Mode ============================ */

/* The two that spend minutes sit side by side; the free one runs underneath
   them, shaped differently so it does not compete for the same glance. */
.mode-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  flex: none;
}

@media (max-width: 820px) {
  .mode-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

.mode-card {
  position: relative;
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 16px 18px 17px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: rgba(255, 255, 255, 0.028);
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}

.mode-card:hover {
  border-color: rgba(61, 184, 167, 0.6);
  background: rgba(61, 184, 167, 0.07);
}

.mode-card.selected {
  border-color: var(--accent-hi);
  background: rgba(61, 184, 167, 0.1);
}

.mode-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(61, 184, 167, 0.16);
}

.mode-icon svg {
  width: 15px;
  height: 15px;
  fill: var(--accent-hi);
}

.mode-card strong {
  font-size: 15px;
}

.mode-card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.mode-meta {
  font-size: 11.5px;
  color: var(--accent-hi);
}

/* The free option: one row, its price where the meta line sits on the
   others. */
.mode-card.wide {
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
}

.mode-body {
  display: grid;
  gap: 2px;
}

.mode-meta.free {
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* Pipeline not set up yet — the card still answers a click, but that click
   walks the user to the guided setup instead of starting the mode. */
.mode-card.locked {
  opacity: 0.6;
}

.mode-card.locked:hover {
  border-color: rgba(240, 195, 106, 0.6);
  background: rgba(240, 195, 106, 0.07);
}

.mode-card.locked strong::before {
  content: "🔒 ";
}

/* The run's settings share the bar with the button that starts it. */
.mode-foot {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.mode-foot select {
  min-width: 140px;
}

/* ============================ 3. Range ============================ */

.range-head {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  flex: none;
}

.range-head > div {
  display: grid;
  gap: 5px;
}

/* The picture is the point of this step, so it takes the room and the
   controls line up underneath it. */
.range-preview {
  flex: 1;
  min-height: 140px;
  border-radius: var(--r-card);
  background: #000;
  border: 1px solid var(--border);
  overflow: hidden;
}

.range-preview video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* No picture: keep the player, shrunk to its transport controls, so the ear
   can still scrub and check the spot. */
.range-preview.audio-only {
  flex: none;
  background: var(--input);
}

.range-preview.audio-only video {
  height: 54px;
}

.range-foot {
  flex: none;
  display: grid;
  gap: 10px;
  padding: 12px 14px 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  background: var(--panel);
}

.range-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.range-row .ghost {
  margin-bottom: 1px;
}

/* How long the selection runs, and what it will cost — the two numbers the
   Generate button is answering. */
.range-total {
  display: grid;
  justify-items: end;
  gap: 1px;
  text-align: right;
}

.range-length {
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.dual-slider {
  position: relative;
  height: 22px;
}

.dual-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 9px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
}

.dual-fill {
  position: absolute;
  top: 9px;
  height: 4px;
  border-radius: 4px;
  background: var(--accent);
}

.dual-slider input[type="range"] {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  width: 100%;
  margin: 0;
  background: none;
  pointer-events: none;
  appearance: none;
  height: 22px;
}

.dual-slider input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  pointer-events: auto;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--accent);
  cursor: grab;
}

.tiny-field input {
  width: 104px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.sample-field {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 12px 0 0;
}

.sample-field input[type="range"] {
  flex: 1;
  min-width: 180px;
}

.cue-preview {
  list-style: none;
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 3px;
  font-size: 12.5px;
}

.cue-preview.tall {
  max-height: none;
  flex: 1;
}

.cue-preview li {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 10px;
  padding: 5px 8px;
  border-radius: var(--r-control);
  line-height: 1.45;
}

.cue-preview li:nth-child(odd) {
  background: rgba(255, 255, 255, 0.025);
}

.cue-preview .when {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.result-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

/* ============================ working ============================ */

.progress-block {
  flex: none;
  display: grid;
  gap: 7px;
}

.progress-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
}

.progress-count {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-eta {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-hi);
  font-variant-numeric: tabular-nums;
}

/* Minutes of waiting are easier to sit through when you can watch the words
   arrive, so the run shows its own output as it lands. */
.run-feed {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 8px;
}

.feed-list {
  list-style: none;
  margin: 0;
  padding: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 2px;
  align-content: start;
  scroll-behavior: smooth;
}

.feed-list li {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  column-gap: 12px;
  align-items: baseline;
  padding: 5px 8px;
  font-size: 13.5px;
  line-height: 1.5;
  transition: opacity 0.3s;
}

/* The newest few stay bright; the ones above them recede rather than
   scrolling out of mind. */
.feed-list li.faded {
  opacity: 0.42;
}

.feed-list .when {
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

#runFeedEmpty {
  padding: 12px 10px;
  margin: 0;
}

.work-panel {
  display: grid;
  gap: 12px;
  max-width: 620px;
}

.work-top {
  display: flex;
  gap: 14px;
  align-items: center;
}

.work-lines {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.work-label {
  margin: 0;
  font-size: 13px;
}

.work-label:empty {
  display: none;
}

.work-eta {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-hi);
  font-variant-numeric: tabular-nums;
  min-height: 16px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  transition: width 0.25s;
}

/* No fraction to show: travel across the track instead of pretending to a
   percentage we do not have. */
.progress-fill.indeterminate {
  width: 32%;
  transition: none;
  animation: travel 1.4s ease-in-out infinite;
}

@keyframes travel {
  0% {
    margin-left: -32%;
  }
  100% {
    margin-left: 100%;
  }
}

.spinner {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
  .progress-fill.indeterminate {
    animation-duration: 3.5s;
  }
  .step.working .step-dot {
    animation: none;
  }
}

/* ============================ watch & editor shell ============================ */

/* These two steps are theatre: they take the column's full height and do
   their own scrolling inside. */
.stage-view {
  height: 100%;
  gap: 10px;
}

.sub-header {
  display: flex;
  gap: 8px;
  align-items: center;
  height: 56px;
  flex: none;
  padding: 0 2px;
  border-bottom: 1px solid var(--hairline);
}

.sub-title {
  font-size: 14px;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-header .inline-actions:not(.push) {
  margin-left: auto;
}

.icon-btn.back {
  font-size: 17px;
}

/* ---------- the sub-header's own controls ---------- */

.live-pill {
  color: var(--accent-hi);
  border-color: rgba(93, 222, 168, 0.4);
  background: rgba(93, 222, 168, 0.1);
}

/* Which layout suits the file, as one control rather than two buttons. */
.segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: rgba(255, 255, 255, 0.03);
}

.seg {
  border: none;
  border-radius: 5px;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  padding: 4px 11px;
}

.seg:hover:not(:disabled) {
  color: var(--ink);
}

.seg.on {
  background: rgba(61, 184, 167, 0.18);
  color: var(--accent-hi);
  font-weight: 700;
}

.seg:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ---------- watch ---------- */

.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.watch-layout.panel-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.watch-layout.panel-hidden .subs-panel {
  display: none;
}

.watch-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.stage {
  position: relative;
  background: #000;
  border-radius: var(--r-card);
  overflow: hidden;
}

.watch-main .stage {
  flex: 1;
  min-height: 0;
}

.watch-main .stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* ---------- the transport ---------- */

/* One transport serves both layouts: over the picture on a scrim when there
   is one, and a bar of its own when there is not. */
.transport {
  display: flex;
  gap: 12px;
  align-items: center;
}

.stage .transport {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 26px 14px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
}

.play-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--ink);
}

.play-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.play-btn .i-pause,
.playing .play-btn .i-play {
  display: none;
}

.playing .play-btn .i-pause {
  display: block;
}

.seek {
  position: relative;
  flex: 1;
  min-width: 60px;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.seek:focus-visible {
  outline: none;
}

.seek-track {
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.seek-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent-hi);
}

.seek-knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 11px;
  height: 11px;
  margin-left: -5.5px;
  border-radius: 50%;
  background: var(--ink);
  transform: translateY(-50%) scale(0);
  transition: transform 0.12s;
}

.seek:hover .seek-knob,
.seek:focus-visible .seek-knob,
.seek.scrubbing .seek-knob {
  transform: translateY(-50%) scale(1);
}

.transport .numeric {
  flex: none;
  color: rgba(255, 255, 255, 0.85);
}

/* ---------- the bar under the picture ---------- */

.control-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  flex: none;
  padding: 9px 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  background: var(--panel);
}

.shift-field,
.zoom-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.stepper-field {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--mono-bg);
}

.stepper-field input {
  width: 56px;
  border: none;
  background: none;
  padding: 3px 4px;
  text-align: center;
  color: var(--ink);
}

.stepper-field input:focus-visible {
  outline: none;
}

.stepper-field .unit {
  font-size: 10.5px;
  color: var(--muted);
  padding-right: 4px;
}

.step-btn {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 13px;
  line-height: 1;
}

.step-btn:hover {
  background: rgba(255, 255, 255, 0.13);
}

.zoom-field .numeric {
  min-width: 66px;
  text-align: center;
  color: var(--muted);
}

/* ---------- no picture: the lines are the content ---------- */

/* Nothing to look at, so the lines take the column and the transport is a bar
   under them. The bar is pinned to the bottom rather than following the
   bottom of the list: a control that walks down the screen as lines arrive is
   a control you have to go and find again. */
.audio-only .watch-layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  overflow: hidden;
}

.audio-only .watch-main {
  width: min(860px, 100%);
  flex: none;
  align-self: end;
}

.audio-only .stage {
  display: none;
}

.audio-only .subs-panel {
  order: -1;
  width: min(860px, 100%);
  min-height: 0;
  border-radius: var(--r-card);
}

/* The scrub bar gets a line of its own, because finding a moment by ear is
   the whole job here and it cannot be done through a two-inch bar. */
.audio-only .control-bar {
  flex-wrap: wrap;
  row-gap: 10px;
}

.audio-only .transport {
  flex: 1 1 100%;
  min-width: 0;
}

.audio-only .subs-panel-head {
  display: none;
}

.audio-only .transcript-list {
  padding: 10px;
  font-size: 15px;
}

.audio-only .transcript-list li {
  grid-template-columns: 52px minmax(0, 1fr);
  padding: 9px 12px;
}

.audio-only .control-bar {
  border-radius: var(--r-card);
}

/* The transport gets a filled button here — it is the only picture on the
   screen. Its width is set above, where it takes a line of its own. */
.audio-only .play-btn {
  width: 34px;
  height: 34px;
  background: var(--accent);
  color: var(--accent-ink);
}

.audio-only .seek-track {
  background: rgba(255, 255, 255, 0.14);
}

.audio-only .seek-knob {
  transform: translateY(-50%) scale(1);
  background: var(--accent-hi);
}

.audio-only .transport .numeric {
  color: var(--muted);
}

.audio-only #overlayToggleRow,
.audio-only .stage-fs-btn,
.audio-only #panelToggleBtn,
.audio-only #panelHideBtn {
  display: none;
}

.own-subs {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  flex: none;
  padding: 12px 16px;
}

.own-subs h3 {
  margin: 0;
}

.own-subs-pick {
  display: grid;
  gap: 4px;
}

.own-subs-pick p {
  margin: 0;
}

/* Fullscreens the stage, so the transport and the subtitles come along.
   Appears on hover. */
.stage-fs-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--r-control);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s;
}

.stage:hover .stage-fs-btn,
.stage-fs-btn:focus-visible {
  opacity: 1;
}

.stage-fs-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

/* The browser draws the subtitles from a real track, so the only thing to
   say about them is what they should look like. Everything else — wrapping,
   safe margins, fullscreen, the viewer's own caption size — is its job. */
video::cue {
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-family: var(--font);
  line-height: 1.35;
}

/* ---------- the lines panel ---------- */

.subs-panel,
.editor-lines {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  background: var(--panel);
  overflow: hidden;
}

.subs-panel-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex: none;
  padding: 9px 10px 9px 12px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.025);
}

.transcript-list {
  list-style: none;
  margin: 0;
  padding: 5px 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 1px;
  align-content: start;
  scroll-behavior: smooth;
}

.transcript-list li {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 9px;
  align-items: baseline;
  padding: 7px 9px;
  border-radius: var(--r-control);
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
  transition: background 0.12s;
}

.transcript-list li:hover {
  background: rgba(255, 255, 255, 0.055);
}

.transcript-list li.active {
  background: rgba(61, 184, 167, 0.16);
  box-shadow: inset 2px 0 0 var(--accent);
}

[dir="rtl"] .transcript-list li.active {
  box-shadow: inset -2px 0 0 var(--accent);
}

.transcript-list .when {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.transcript-list .orig {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.8em;
}

#panelEmpty {
  padding: 14px 12px;
  margin: 0;
}

/* ============================ timing editor ============================ */

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.editor-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

/* The picture takes the room. Everything under it is its own height, so a
   taller window is a bigger picture rather than more empty panel. */
.editor-stage {
  flex: 1;
  min-height: 140px;
}

.editor-stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* No picture to adjust against — the strip and the words are the screen. */
.editor-stage.audio-only {
  display: none;
}

/* ---------- the strip ---------- */

.strip-panel {
  flex: none;
  display: grid;
  gap: 9px;
  padding: 11px 13px 13px;
}

.strip-head {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.strip-hint {
  white-space: nowrap;
}

.strip {
  position: relative;
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  background: var(--mono-bg);
  overflow: hidden;
  user-select: none;
}

.strip-ticks {
  position: relative;
  height: 18px;
  border-bottom: 1px solid var(--hairline);
}

.strip-ticks .tick {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.09);
  padding-left: 5px;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  line-height: 18px;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
}

.strip-wave {
  display: block;
  width: 100%;
  height: 34px;
}

.strip-track {
  position: relative;
  height: 46px;
  border-top: 1px solid var(--hairline);
  cursor: crosshair;
}

/* One line, as a block you can grab. */
.cue-block {
  position: absolute;
  top: 6px;
  bottom: 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-size: 11px;
  line-height: 32px;
  padding: 0 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: grab;
  touch-action: none;
}

.cue-block:hover {
  background: rgba(255, 255, 255, 0.1);
}

.cue-block.selected {
  background: rgba(61, 184, 167, 0.32);
  border-color: var(--accent-hi);
  color: var(--ink);
  z-index: 2;
}

.cue-block.edited::before {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--busy);
}

.cue-block.overlapping {
  border-color: rgba(240, 195, 106, 0.7);
}

.strip-track.dragging .cue-block {
  cursor: grabbing;
}

.cue-handle {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 6px;
  cursor: ew-resize;
  touch-action: none;
  background: transparent;
}

.cue-handle.start {
  left: -1px;
}

.cue-handle.end {
  right: -1px;
}

.cue-block.selected .cue-handle {
  background: var(--accent-hi);
  border-radius: 3px;
}

.strip-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--accent-hi);
  pointer-events: none;
  z-index: 3;
}

.strip-playhead span {
  position: absolute;
  top: 1px;
  left: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(93, 222, 168, 0.16);
  color: var(--accent-hi);
  white-space: nowrap;
}

/* ---------- the selected line ---------- */

.selected-row {
  flex: none;
  padding: 10px 13px 12px;
}

.selected-row > .muted {
  margin: 0;
}

.selected-fields {
  display: grid;
  gap: 9px;
}

.selected-times {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.selected-times > .label {
  padding-bottom: 7px;
  white-space: nowrap;
}

.cue-length {
  padding-bottom: 7px;
  color: var(--accent-hi);
}

.selected-times .ghost {
  border-color: var(--border);
  color: var(--ink);
}

.selected-times .ghost:disabled {
  color: var(--muted);
}

/* No picture, no lines to put on it. */
.editor-stage.audio-only ~ .control-bar #editorOverlayRow {
  display: none;
}

/* A wrong word is as wrong as a wrong moment, and the line is already on
   screen — so it is editable where it sits. */
.cue-text-field {
  display: grid;
  gap: 4px;
}

.cue-text-field textarea {
  width: 100%;
  resize: vertical;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--input);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.cue-text-field textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
}

/* ---------- the editor's line list ---------- */

.edit-list li {
  grid-template-columns: 76px minmax(0, 1fr);
}

/* Both ends, stacked: the length of a line is what is being judged here. */
.edit-list .when {
  display: grid;
  gap: 1px;
  min-width: 0;
  line-height: 1.3;
}

.edit-list .when span:last-child {
  opacity: 0.6;
}

.edit-list li.edited .when::after {
  content: "";
  position: absolute;
  margin-top: 4px;
  margin-left: -8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--busy);
}

.edit-list li {
  position: relative;
}

.edit-list li.overlapping {
  box-shadow: inset 2px 0 0 var(--busy);
}

/* ============================ narrow windows ============================ */

@media (max-width: 900px) {
  :root {
    --sidebar-w: 188px;
  }

  .watch-layout,
  .editor-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .audio-only .watch-layout {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .subs-panel,
  .editor-lines {
    max-height: 34vh;
  }
}
