/* Standalone VidAgent Captions Studio — Dark-first minimalist studio styling */
:root {
  --bg: #0a0b0e;
  --bg-elev: #111319;
  --card: #151821;
  --card-2: #1c202c;
  --ink: 245, 246, 250;
  --fg: #f5f6fa;
  --muted: rgba(245, 246, 250, 0.58);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.17);
  --gold: #f0c056;
  --gold-hi: #f8d274;
  --gold-ink: #12100b;
  --ok: #3cd070;
  --err: #ff5f6d;
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
}

[data-theme="light"] {
  --bg: #f4f5f8;
  --bg-elev: #ffffff;
  --card: #ffffff;
  --card-2: #eef0f5;
  --ink: 17, 19, 25;
  --fg: #111319;
  --muted: rgba(17, 19, 25, 0.6);
  --line: rgba(17, 19, 25, 0.1);
  --line-strong: rgba(17, 19, 25, 0.2);
  --gold: #dfa422;
  --gold-hi: #eab538;
  --gold-ink: #111319;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font-family: inherit; color: inherit; }
button, .drop-card, .style-card, .chip, .tab, .seg-btn, .switch { touch-action: manipulation; }
a { color: inherit; text-decoration: none; }

.app-root {
  height: 100%;
  height: 100dvh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
}
.dim { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--fg);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 90ms ease, opacity 120ms ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--line-strong); background: rgba(var(--ink), 0.1); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-gold {
  background: var(--gold);
  border-color: transparent;
  color: var(--gold-ink);
}
.btn-gold:hover:not(:disabled) { background: var(--gold-hi); border-color: transparent; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: rgba(var(--ink), 0.06); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--fg);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
  flex: none;
}
.icon-btn:hover:not(:disabled) { background: rgba(var(--ink), 0.1); border-color: var(--line-strong); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.icon-btn svg, .btn svg { width: 16px; height: 16px; }
.drop-icon svg { width: 26px; height: 26px; }
.ok-dot svg { width: 14px; height: 14px; }

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(var(--ink), 0.18);
  border-top-color: var(--gold);
  animation: spin 0.75s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= HERO / LANDING ================= */
.landing {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 480px at 50% -10%, rgba(240, 192, 86, 0.12), transparent 65%),
    radial-gradient(700px 420px at 85% 95%, rgba(88, 128, 255, 0.09), transparent 65%),
    var(--bg);
}
.land-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
}
.brand-name em {
  font-style: normal;
  color: var(--gold);
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: none;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-tag {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(240, 192, 86, 0.14);
  color: var(--gold);
  border: 1px solid rgba(240, 192, 86, 0.25);
}
.land-nav-right { display: flex; align-items: center; gap: 10px; }

.land-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 52px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}
.land-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gold);
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(240, 192, 86, 0.1);
  border: 1px solid rgba(240, 192, 86, 0.24);
  margin-bottom: 18px;
}
.land-main h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 5.4vw, 54px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.land-main h1 em {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  color: var(--gold);
}
.land-lede {
  margin: 0 0 28px;
  font-size: 16.5px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 560px;
}

.drop-card {
  width: 100%;
  max-width: 600px;
  padding: 36px 26px;
  border-radius: 22px;
  border: 1.5px dashed var(--line-strong);
  background: rgba(var(--ink), 0.025);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 120ms ease;
}
.drop-card:hover, .drop-card.over {
  border-color: var(--gold);
  background: rgba(240, 192, 86, 0.06);
  transform: translateY(-1px);
}
.drop-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: rgba(240, 192, 86, 0.14);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}
.drop-icon svg { width: 26px; height: 26px; }
.drop-title { font-size: 18px; font-weight: 700; }
.drop-sub { font-size: 13.5px; color: var(--muted); }
.drop-acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 6px; }

.resume-card {
  margin-top: 16px;
  width: 100%;
  max-width: 600px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}
.resume-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.resume-tx b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resume-tx span { font-size: 12.5px; color: var(--muted); }
.resume-acts { display: flex; align-items: center; gap: 6px; flex: none; }

.restoring {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
}
.restoring b { font-size: 16px; }
.restoring span.dim { font-size: 13px; }

.land-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  font-size: 12.5px;
  color: var(--muted);
}
.land-pills span {
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(var(--ink), 0.04);
  border: 1px solid var(--line);
}

/* ================= STUDIO WORKSPACE ================= */
.studio {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  height: 56px;
  padding: 0 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
}
.top-left, .top-right { display: flex; align-items: center; gap: 9px; min-width: 0; }
.title-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--fg);
  max-width: 260px;
  min-width: 90px;
}
.title-input:hover { border-color: var(--line); }
.title-input:focus { outline: none; border-color: var(--gold); background: var(--card); }
.priv-pill {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ok);
  background: rgba(60, 208, 112, 0.11);
  border: 1px solid rgba(60, 208, 112, 0.25);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
}

/* Left Panel */
.panel {
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.tab {
  height: 34px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tab:hover { color: var(--fg); background: rgba(var(--ink), 0.05); }
.tab.on { background: var(--card-2); color: var(--fg); border-color: var(--line); }
.tab-badge {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(240, 192, 86, 0.18);
  color: var(--gold);
}

.panel-body {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--ink), 0.18) transparent;
}
.panel-body::-webkit-scrollbar { width: 7px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb { background: rgba(var(--ink), 0.18); border-radius: 999px; }
.panel-body::-webkit-scrollbar-thumb:hover { background: rgba(var(--ink), 0.3); }

/* Styles Browser */
.search-box {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13.5px;
}
.search-box:focus { outline: none; border-color: var(--gold); }
.chips {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  scrollbar-width: none;
  flex: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.chip:hover { color: var(--fg); border-color: var(--line-strong); }
.chip.on { background: var(--gold); color: var(--gold-ink); border-color: transparent; }

.style-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.style-card {
  position: relative;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #12151d;
  padding: 7px 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: pointer;
  text-align: left;
  transition: border-color 120ms ease, transform 100ms ease;
  overflow: hidden;
}
.style-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.style-card.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.style-sample {
  width: 100%;
  aspect-ratio: 9 / 5;
  border-radius: 8px;
  background: radial-gradient(circle at 50% 45%, #232a3d, #0f121a);
  overflow: hidden;
  position: relative;
}
.style-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.style-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.style-name {
  font-size: 12px;
  font-weight: 600;
  color: #f3f5fa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.style-note {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72);
  flex: none;
}

/* Customize Controls */
.ctrl-group {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ctrl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}
.ctrl-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
.ctrl-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}
.ctrl-val { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
  cursor: pointer;
}
select.ctrl-select {
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card-2);
  font-size: 13px;
}
.seg-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  background: var(--bg);
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--line);
}
.seg-btn {
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.seg-btn.on { background: var(--card-2); color: var(--fg); }
.color-pair { display: flex; align-items: center; gap: 6px; }
input[type="color"] {
  width: 30px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  padding: 2px;
  cursor: pointer;
}
.switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  cursor: pointer;
  transition: background 140ms ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 140ms ease;
}
.switch.on { background: var(--gold); border-color: transparent; }
.switch.on::after { transform: translateX(18px); background: #111; }

/* Transcript Panel */
.tx-tools {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.tx-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tx-row .ctrl-select { flex: 1; min-width: 120px; }
.cue-list { display: flex; flex-direction: column; gap: 7px; }
.cue-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 120ms ease;
}
.cue-item.now { border-color: var(--gold); background: rgba(240, 192, 86, 0.06); }
.cue-item.hidden-cue { opacity: 0.45; }
.cue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cue-time {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
.cue-time:hover { color: var(--gold); }
.cue-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 13.5px;
  font-weight: 500;
}
.cue-input:focus { outline: none; border-color: var(--gold); }

/* Right Stage */
.stage-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 14px 18px 16px;
  gap: 12px;
  background:
    radial-gradient(650px 380px at 50% 45%, rgba(255, 255, 255, 0.03), transparent 70%),
    var(--bg);
}

.banner-slot:empty { display: none; }
.banner {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.banner.ready { border-color: rgba(60, 208, 112, 0.4); background: rgba(60, 208, 112, 0.07); }
.banner.warn { border-color: rgba(240, 192, 86, 0.35); background: rgba(240, 192, 86, 0.07); }
.banner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.banner-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.banner-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.banner-tx b { font-size: 13.5px; }
.banner-tx span { font-size: 12px; color: var(--muted); }
.banner-acts { display: flex; align-items: center; gap: 7px; flex: none; }
.ok-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(60, 208, 112, 0.2);
  color: var(--ok);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.prog-bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(var(--ink), 0.1);
  overflow: hidden;
}
.prog-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #ff9f43);
  border-radius: 999px;
  transition: width 140ms ease;
}

/* Video Canvas Container */
.stage-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.stage-box {
  position: relative;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
  user-select: none;
}
.stage-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.motion-host {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  pointer-events: none;
  overflow: hidden;
}
.drag-zone {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: none;
}
.drag-zone.dragging { cursor: grabbing; }
.drag-hint {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.68);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms ease;
}
.stage-box:hover .drag-hint, .drag-zone.dragging .drag-hint { opacity: 1; }
.guide-v {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(240, 192, 86, 0.85);
  pointer-events: none;
  opacity: 0;
}
.guide-v.on { opacity: 1; }

/* Transport Bar */
.transport {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: none;
}
.scrub-wrap {
  position: relative;
  height: 22px;
  display: flex;
  align-items: center;
}
.scrub-ticks {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 999px;
  background: rgba(var(--ink), 0.1);
  overflow: hidden;
  pointer-events: none;
}
.scrub-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(240, 192, 86, 0.42);
  border-radius: 2px;
}
.scrub-input {
  position: relative;
  width: 100%;
  height: 22px;
  margin: 0;
  z-index: 2;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.scrub-input::-webkit-slider-runnable-track {
  height: 6px;
  background: transparent;
  border-radius: 999px;
}
.scrub-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #111;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  margin-top: -5px;
}
.scrub-input::-moz-range-track {
  height: 6px;
  background: transparent;
  border-radius: 999px;
}
.scrub-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #111;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.banner-close {
  width: 28px;
  height: 28px;
  font-size: 16px;
  line-height: 1;
}
.trans-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.trans-left, .trans-right { display: flex; align-items: center; gap: 9px; }
.timecode { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ratio-pill {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--muted);
}

/* Modal & Toasts */
.modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 520px;
  width: calc(100% - 28px);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(4px); }
.modal-card {
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-card p { margin: 0; font-size: 13.5px; line-height: 1.45; }
.modal-card textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 10px 12px;
  font-size: 13.5px;
  resize: vertical;
}
.modal-card textarea:focus { outline: none; border-color: var(--gold); }
.modal-acts { display: flex; justify-content: flex-end; gap: 8px; }

.toast-stack {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 24px);
}
.toast {
  padding: 10px 16px;
  border-radius: 11px;
  background: #1b1f2c;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.sr-file-input {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (hover: none) {
  .stage-box:hover .drag-hint { opacity: 0; }
  .drag-zone.dragging .drag-hint { opacity: 1; }
}

@media (max-width: 900px) {
  .landing {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .land-nav {
    padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  }
  .land-main {
    padding: 16px 16px 36px;
  }
  .land-lede {
    font-size: 15px;
    margin-bottom: 20px;
  }
  .drop-card {
    padding: 26px 18px;
    border-radius: 18px;
  }
  .drop-acts {
    width: 100%;
  }
  .drop-acts .btn-lg {
    flex: 1 1 140px;
    height: 44px;
    font-size: 14.5px;
  }

  .studio {
    height: 100dvh;
    min-height: -webkit-fill-available;
  }
  .topbar {
    height: auto;
    min-height: 50px;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 10px 6px;
    gap: 6px;
  }
  .top-left { gap: 6px; flex: 1; min-width: 0; }
  .top-right { gap: 6px; flex: none; }
  .title-input {
    min-width: 0;
    width: 100%;
    max-width: none;
    padding: 4px 6px;
    font-size: 16px;
  }
  .priv-pill, .hide-mobile { display: none !important; }
  .icon-btn { width: 34px; height: 34px; }
  .topbar .btn-gold { height: 34px; padding: 0 11px; font-size: 13px; }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(280px, 50dvh) minmax(0, 1fr);
  }
  .panel { order: 2; border-right: 0; border-top: 1px solid var(--line); min-width: 0; }
  .stage-col { order: 1; position: relative; padding: 6px 10px 6px; gap: 5px; min-width: 0; overflow: hidden; }

  /* Float status/export banners over top of stage on mobile so the video never collapses into a tiny thumbnail */
  .banner-slot {
    position: absolute;
    top: 6px;
    left: 10px;
    right: 10px;
    z-index: 25;
  }
  .banner {
    padding: 8px 10px;
    gap: 6px;
    border-radius: 12px;
    background: rgba(21, 24, 33, 0.94);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  }
  .banner.ready { background: rgba(18, 34, 25, 0.95); }
  .banner.warn { background: rgba(34, 28, 16, 0.95); }
  [data-theme="light"] .banner { background: rgba(255, 255, 255, 0.95); }
  .banner-row { gap: 8px; }
  .banner-tx b { font-size: 12.5px; }
  .banner-tx span { font-size: 11.5px; }
  .banner-acts { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .banner-acts .btn { flex: 1 1 auto; }

  .transport { padding: 6px 10px; gap: 3px; border-radius: 11px; }
  .scrub-wrap { height: 20px; }
  .trans-left, .trans-right { gap: 6px; }
  .timecode { font-size: 11.5px; }

  .tabs { padding: 7px 10px; }
  .tab { height: 34px; font-size: 12.5px; }
  .panel-body { padding: 10px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); gap: 10px; }

  /* 16px inputs prevent iOS Safari auto-zoom when tapping text fields or selects */
  .search-box, .cue-input, select.ctrl-select, .modal-card textarea {
    font-size: 16px;
  }
  .style-card { padding: 6px 6px 7px; gap: 6px; }
}

@media (max-width: 420px) {
  .hide-xs { display: none !important; }
  .topbar { padding-left: 8px; padding-right: 8px; gap: 5px; }
  .top-left, .top-right { gap: 5px; }
  .topbar .icon-btn { width: 32px; height: 32px; }
  .topbar .btn-gold { height: 32px; padding: 0 10px; font-size: 12.5px; }
  .land-nav .brand-tag { display: none; }
}
