/* Movzora — design system.
   One set of named colours (tokens) drives every screen. The dark theme is the
   default look; the light theme only swaps the tokens. Nothing below the token
   blocks uses a raw colour for the interface itself (the picture you record and
   the tools drawn on top of it keep fixed colours, because they sit on video). */

/* ================================ 1. tokens ================================ */
:root {
  color-scheme: dark;
  /* surfaces, from the page up to raised controls */
  --bg: #0a0a0b;
  --surface: #111113;
  --surface-2: #17171a;
  --surface-3: #202024;
  --surface-4: #2a2a30;
  --field: #0c0c0e;
  --line: #232327;
  --line-2: #34343a;
  --line-3: #4d4d56;
  /* text */
  --text: #f5f5f6;
  --muted: #b6b6bf;
  --faint: #9a9aa4;
  /* brand red */
  --brand: #e50914;
  --brand-hi: #ff2b37;
  --brand-lo: #b20710;
  --brand-ink: #ffffff;
  --brand-soft: rgba(229, 9, 20, .16);
  --brand-ring: rgba(229, 9, 20, .34);
  --brand-text: #ff6f78;
  --brand-mark: #ff2b37; /* red used as text: bright enough to read on dark */
  /* states */
  --ok: #2fd08a;
  --ok-soft: rgba(47, 208, 138, .13);
  --ok-line: rgba(47, 208, 138, .48);
  --warn: #f5b50a;
  --warn-soft: rgba(245, 181, 10, .13);
  --warn-line: rgba(245, 181, 10, .4);
  --danger-text: #ff8a92;
  /* depth */
  --shadow-1: 0 6px 20px rgba(0, 0, 0, .45);
  --shadow-2: 0 26px 70px rgba(0, 0, 0, .62);
  --veil: rgba(4, 4, 5, .74);
  --knob: #ffffff;
  --thumb-bg: #0c0c0e;
  --thumb-clip: #3d3d45;
  /* shape and size */
  --r-sm: 7px;
  --r: 9px;
  --r-lg: 12px;
  --ctl: 34px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%239c9ca6' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --surface-3: #e4e6eb;
  --surface-4: #d8dadf;
  --field: #f0f2f5;
  --line: #dddfe2;
  --line-2: #ced0d4;
  --line-3: #a9acb2;
  --text: #050505;
  --muted: #45484d;
  --faint: #5c5f65;
  --brand: #e50914;
  --brand-hi: #f6202b;
  --brand-lo: #b20710;
  --brand-ink: #ffffff;
  --brand-soft: rgba(229, 9, 20, .09);
  --brand-ring: rgba(229, 9, 20, .26);
  --brand-text: #c20811;
  --brand-mark: #e50914;
  --ok: #0a6b42;
  --ok-soft: rgba(10, 107, 66, .09);
  --ok-line: rgba(10, 107, 66, .45);
  --warn: #8a5600;
  --warn-soft: rgba(245, 181, 10, .2);
  --warn-line: rgba(168, 106, 0, .42);
  --danger-text: #c20811;
  --shadow-1: 0 2px 4px rgba(0, 0, 0, .1), 0 8px 20px rgba(0, 0, 0, .14);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, .1), 0 12px 28px rgba(0, 0, 0, .2);
  --veil: rgba(20, 20, 26, .5);
  --knob: #ffffff;
  --thumb-bg: #e4e6eb;
  --thumb-clip: #8d9096;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%235c5c66' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
}

/* ================================ 2. base ================================ */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.45 var(--font);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.touch .mouse-only { display: none; }
h2, h3, p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--brand-hi); outline-offset: 2px; }
.sprite { position: absolute; width: 0; height: 0; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 14px; height: 14px; }
.source-video { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; z-index: -1; }
.phone-only { display: none !important; }
.tab-label { display: none; }
body.no-helper .helper-only { display: none !important; }
body:not(.no-helper) .hosted-only { display: none !important; }

/* small capital labels: section titles, bar buttons, tags */
.group h3, .frame-name, .cue-label, .btn.quiet span, .tab-label {
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
}

/* ================================ 3. buttons ================================ */
.btn {
  appearance: none;
  height: var(--ctl);
  border: 1px solid var(--line-2);
  background: var(--surface-3);
  border-radius: var(--r);
  padding: 0 13px;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 500;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-4); border-color: var(--line-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.wide { width: 100%; white-space: normal; height: auto; min-height: var(--ctl); padding-top: 6px; padding-bottom: 6px; text-align: center; line-height: 1.2; }
.btn.primary, .btn.danger { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 650; }
.btn.primary:hover, .btn.danger:hover { background: var(--brand-hi); border-color: var(--brand-hi); }
.btn.on { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.btn.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-text); }
.btn.mini { height: 26px; padding: 0 9px; font-size: 11.5px; border-radius: var(--r-sm); }
.btn.icon { padding: 0 9px; min-width: 40px; height: 30px; font-size: 12px; }
.btn.icon.play { min-width: 36px; width: 36px; height: 36px; border-radius: 50%; background: var(--text); border-color: var(--text); color: var(--bg); padding: 0; }
.btn.icon.play:hover { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* bar buttons: quiet until used */
.btn.quiet { background: none; border-color: transparent; color: var(--muted); padding: 0 10px; position: relative; }
.btn.quiet:hover { color: var(--text); background: var(--surface-3); border-color: transparent; }
.btn.quiet.active { color: var(--text); background: none; }
.btn.quiet.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 1px; height: 2px; border-radius: 2px; background: var(--brand); }
.btn.quiet.active .ic { color: var(--brand); }

/* the one that matters */
.btn.record {
  background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 700;
  padding: 0 18px 0 14px; border-radius: 99px; height: 36px; box-shadow: 0 4px 18px var(--brand-ring);
}
.btn.record:hover { background: var(--brand-hi); border-color: var(--brand-hi); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand-ink); }
body.recording .rec-dot { border-radius: 2px; }

.link { background: none; border: 0; padding: 0; color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { color: var(--text); }
a.link, dialog a:not(.btn) { text-decoration: underline; text-underline-offset: 2px; }
a.link { margin-top: 0; }
.group > p.hint { margin-top: 2px; }
dialog a:not(.btn) { color: var(--muted); }
dialog a:not(.btn):hover { color: var(--text); }

.icon-btn {
  appearance: none; width: var(--ctl); height: var(--ctl); flex: none; display: grid; place-items: center;
  border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface-3); color: var(--text);
}
.icon-btn:hover { background: var(--surface-4); border-color: var(--line-3); }
.icon-btn.muted { color: var(--brand-text); border-color: var(--brand-ring); background: var(--brand-soft); }
.icon-btn.bare { border: 0; background: none; color: var(--faint); width: 28px; height: 28px; }
.icon-btn.bare:hover { color: var(--text); background: var(--surface-3); }
.icon-btn.bare.danger:hover { color: var(--brand); }

/* choose one of a few */
.seg { display: inline-flex; background: var(--field); border: 1px solid var(--line); border-radius: var(--r); padding: 3px; gap: 2px; }
.seg.full { display: flex; }
.seg.full button { flex: 1; min-width: 0; white-space: normal; height: auto; min-height: 26px; padding: 4px 6px; line-height: 1.15; }
.seg button {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  height: 26px; padding: 0 10px; border-radius: 6px; white-space: nowrap; font-weight: 500;
}
.seg button small { color: inherit; opacity: .7; margin-left: 4px; font-size: 11px; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--line-2); font-weight: 600; }
.seg button:disabled { opacity: .4; cursor: not-allowed; }

/* round quick-pick buttons */
.cue {
  appearance: none; height: 30px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line-2);
  background: var(--surface-3); color: var(--text); font-size: 12.5px; font-weight: 500;
}
.cue:hover { background: var(--surface-4); border-color: var(--line-3); }

.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px;
  border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--muted);
  font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.led { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.led.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.led.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

/* ================================ 4. fields ================================ */
input[type="url"], input[type="text"], input[type="number"], select, textarea {
  width: 100%; min-width: 0; background: var(--field); border: 1px solid var(--line-2); border-radius: var(--r); padding: 0 10px;
  transition: border-color .12s;
}
input[type="url"], input[type="text"], input[type="number"], select { height: var(--ctl); }
input[type="url"]:hover, input[type="text"]:hover, input[type="number"]:hover, select:hover, textarea:hover { border-color: var(--line-3); }
input:disabled { opacity: .5; cursor: not-allowed; }
textarea { resize: vertical; line-height: 1.4; padding: 8px 10px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
select {
  appearance: none; padding-right: 28px; cursor: pointer;
  background-image: var(--chevron); background-repeat: no-repeat; background-position: right 9px center;
}
input[type="color"] { width: 32px; height: 26px; padding: 0; border: 1px solid var(--line-2); border-radius: 6px; background: none; cursor: pointer; flex: none; }

/* sliders: the filled part follows --p (set from the script) */
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 18px; margin: 0; background: transparent; cursor: pointer; display: block; --p: 0%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 9px;
  background: linear-gradient(to right, var(--brand) var(--p), var(--line-2) var(--p));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%;
  background: var(--knob); box-shadow: 0 0 0 1px rgba(0, 0, 0, .12), 0 1px 3px rgba(0, 0, 0, .45);
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 9px; background: var(--line-2); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 9px; background: var(--brand); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--knob); box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
input[type="range"]:disabled { opacity: .4; cursor: not-allowed; }

.switch {
  appearance: none; width: 36px; height: 21px; border-radius: 99px; background: var(--line-2); position: relative;
  margin: 0; flex: none; cursor: pointer; transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--knob); transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
.switch:checked { background: var(--brand); }
.switch:checked::after { transform: translateX(15px); }

.field { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12.5px; }
.field select { color: var(--text); font-size: 13px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 26px; cursor: pointer; }
.slider { display: block; color: var(--muted); font-size: 12.5px; }
.slider output { float: right; color: var(--text); font-variant-numeric: tabular-nums; }
.slider input[type="range"] { margin-top: 4px; }
.slider .inline { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.slider .inline input[type="range"] { margin: 0; }
.row { display: flex; gap: 8px; }
.row.two > * { flex: 1; min-width: 0; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.row.grow { flex: 1; min-width: 0; }
#linkForm input { flex: 1; }
.hint { color: var(--muted); font-size: 12.5px; }
.hint:empty { display: none; }
.hint.error, #edMsg.error { color: var(--danger-text); }
.hint b { color: var(--text); }
kbd { background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; font: inherit; font-size: 11px; }
.keys { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; align-items: center; font-size: 12px; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); }
.progress, .meter { height: 4px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--brand); transition: width .25s; }
.stage-cta.busy { pointer-events: none; font-variant-numeric: tabular-nums; }
.stage-cta.busy .ic { display: none; }
#linkStatus { font-variant-numeric: tabular-nums; }
.meter div { height: 100%; width: 0; background: linear-gradient(to right, var(--ok) 0 70%, var(--warn) 88%, var(--brand)); background-size: 220px 100%; }

/* ================================ 5. top bar ================================ */
.topbar {
  flex: none; height: 56px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 0 14px 0 18px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; text-decoration: none; justify-self: start; }
.wordmark { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.02em; text-transform: uppercase; color: var(--brand-mark); }
.logo { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--brand-mark); position: relative; flex: none; }
.logo::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--brand-mark); }
.top-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
#fpsPill { min-width: 0; overflow: hidden; flex-shrink: 1; }
#fpsText { overflow: hidden; text-overflow: ellipsis; }
.timer { font-variant-numeric: tabular-nums; font-size: 15px; color: var(--muted); min-width: 50px; text-align: right; }
body.recording .timer { color: var(--brand-mark); font-weight: 700; }

.notice {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 18px; font-size: 12.5px; color: var(--text);
  background: var(--warn-soft); border-bottom: 1px solid var(--warn-line);
}
.notice span { flex: 1; min-width: 0; }

/* ================================ 6. layout ================================ */
.app { flex: 1; min-height: 0; display: grid; grid-template-columns: 332px minmax(0, 1fr); }
.app.sheet-open { grid-template-columns: 332px minmax(0, 1fr) 316px; }
.steps, .sheet, .list { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* the numbered steps on the left */
.steps { background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; min-height: 0; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.step { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); }
.step.open { border-color: var(--line-2); }
.step-head { appearance: none; width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; background: none; border: 0; text-align: left; border-radius: var(--r-lg); }
.num {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 700; font-size: 13px; background: var(--surface-3); border: 1px solid var(--line-2); color: var(--muted);
}
.step.done .num { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.step.open .num { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.step-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.step-title { font-size: 14px; font-weight: 650; }
.step-state { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step.done .step-state { color: var(--ok); }
.chev { color: var(--faint); transition: transform .15s; }
.step.open .chev { transform: rotate(180deg); }
.step-body { display: none; flex-direction: column; gap: 10px; padding: 2px 12px 14px; }
.step.open .step-body { display: flex; }
.step-body > * { flex-shrink: 0; }
.steps-foot { margin-top: auto; padding: 4px 4px 2px; }

details.more { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; }
details.more summary { cursor: pointer; color: var(--muted); font-size: 12.5px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+"; width: 16px; height: 16px; border-radius: 5px; background: var(--surface-3); display: grid; place-items: center; font-size: 12px; line-height: 1; color: var(--text); }
details.more[open] summary::before { content: "–"; }
details.more summary:hover { color: var(--text); }
details.more > *:not(summary) { margin-top: 10px; }
details.more .list { margin: 10px -4px 0; max-height: 210px; }

.emoji-row { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-row button {
  appearance: none; width: 34px; height: 34px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface-3); font-size: 18px; line-height: 1; padding: 0;
}
.emoji-row button:hover { background: var(--surface-4); border-color: var(--line-3); }
.emoji-row.small button { width: 30px; height: 30px; font-size: 16px; }

/* layouts to pick from */
.scene-grid { display: flex; flex-wrap: wrap; gap: 12px 8px; --tile-w: 62px; padding-top: 4px; }
.scene { flex: none; width: var(--tile-w); color: var(--muted); font-size: 11.5px; line-height: 1.2; text-align: center; position: relative; }
.scene-btn { appearance: none; background: none; border: 0; padding: 0; width: 100%; color: inherit; font: inherit; }
.scene .thumb { position: relative; margin: 0 auto 5px; background: var(--thumb-bg); border: 1.5px solid var(--line-2); border-radius: 6px; overflow: hidden; }
.scene:hover .thumb { border-color: var(--line-3); }
.scene.active .thumb { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-ring); }
.scene.active { color: var(--text); font-weight: 600; }
.scene .thumb i { position: absolute; display: block; }
.scene .thumb .v { background: var(--thumb-clip); }
.scene .thumb .c { background: var(--brand); }
.scene .key {
  position: absolute; top: -5px; left: -1px; z-index: 1; min-width: 17px; height: 17px; border-radius: 5px; padding: 0 3px;
  background: var(--surface-3); border: 1px solid var(--line-2); color: var(--muted); font-size: 11px; line-height: 15px; font-weight: 600;
}
.scene .name { display: block; overflow-wrap: anywhere; }
.scene .del {
  position: absolute; top: -4px; right: -1px; z-index: 2; width: 16px; height: 16px; border-radius: 50%; border: 0; padding: 0;
  background: var(--brand); color: var(--brand-ink); display: none; place-items: center;
}
.scene .del .ic { width: 10px; height: 10px; stroke-width: 2.6; }
.scene:hover .del, .scene:focus-within .del { display: grid; }
.scene.add { appearance: none; background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer; }
.scene.add .thumb { display: grid; place-items: center; border-style: dashed; color: var(--muted); background: none; }
.scene.add:hover .thumb { color: var(--text); }

/* lists: videos used before, finished videos, texts */
.list { list-style: none; margin: 0 -8px; padding: 0; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; min-height: 0; }
.list li { display: flex; align-items: center; gap: 2px; border-radius: var(--r); padding-right: 4px; }
.list li:hover { background: var(--surface-3); }
.list li.active { background: var(--brand-soft); }
.list .item { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 7px 8px; display: flex; flex-direction: column; gap: 1px; border-radius: var(--r); }
.list .item .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li.active .item .t { color: var(--brand-text); font-weight: 600; }
.list .item .s { color: var(--faint); font-size: 12px; }
.list .acts { display: flex; opacity: 0; }
.list .acts.always { opacity: 1; align-items: center; gap: 2px; }
.list li:hover .acts, .list li:focus-within .acts { opacity: 1; }
.list .empty { color: var(--faint); font-size: 12px; padding: 4px 8px; }
.list .empty:hover { background: none; }
#textList:empty { display: none; }
#textList { margin: 0 -4px; }

/* ================================ 7. stage ================================ */
.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 14px 16px; gap: 12px; }

/* open videos, as tabs */
.tab-strip { flex: none; display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; min-height: var(--ctl); }
.tab-strip::-webkit-scrollbar, .cue-bar::-webkit-scrollbar { display: none; }
.vtab {
  flex: 0 1 190px; min-width: 96px; display: flex; align-items: center; height: var(--ctl); border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.vtab:hover { color: var(--text); border-color: var(--line-2); }
.vtab.active { background: var(--brand-soft); border-color: var(--brand); color: var(--text); }
.vtab.active .vtab-main .ic { color: var(--brand); opacity: 1; }
.vtab-main {
  appearance: none; flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: 7px; padding: 0 4px 0 10px;
  border: 0; background: none; color: inherit; font-size: 12.5px; text-align: left; border-radius: var(--r) 0 0 var(--r);
}
.vtab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.vtab-main .ic { flex: none; opacity: .8; }
.vtab-x, .vtab-add { appearance: none; flex: none; display: grid; place-items: center; border: 0; background: none; color: var(--faint); border-radius: 6px; }
.vtab-x { width: 24px; height: 24px; margin-right: 4px; }
.vtab-x:hover { color: var(--text); background: var(--surface-4); }
.vtab-add { width: var(--ctl); height: var(--ctl); border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--muted); }
.vtab-add:hover { color: var(--text); border-color: var(--line-3); }

.stage-area { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; }
.stage-box { position: relative; border-radius: 8px; overflow: hidden; background: var(--thumb-bg); box-shadow: 0 0 0 1px var(--line-2), var(--shadow-2); }
body.recording .stage-box { box-shadow: 0 0 0 2px var(--brand), 0 0 0 6px var(--brand-ring), var(--shadow-2); }
.stage-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#overlay { touch-action: none; }
/* YouTube's player, laid over the video frame. Its own layer, so the browser can record just this. */
.yt-box { position: absolute; z-index: 6; background: #000; overflow: hidden; }
.yt-box iframe { display: block; width: 100%; height: 100%; border: 0; }
.stage-box .countdown { z-index: 7; }

/* Everything below sits on top of the picture, so it keeps fixed colours in both themes. */
.countdown {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-size: min(28vh, 200px); font-weight: 800; color: #fff; text-shadow: 0 6px 40px rgba(0, 0, 0, .7); background: rgba(0, 0, 0, .35);
}
.live-badge {
  position: absolute; top: 10px; left: 10px; pointer-events: none;
  background: #e50914; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .1em; padding: 3px 8px; border-radius: 6px;
  animation: pulse 1.4s infinite;
}
body.rec-paused .live-badge { animation: none; background: #6c6c76; }
@keyframes pulse { 50% { opacity: .55; } }
.stage-cta {
  position: absolute; z-index: 3; transform: translate(-50%, -50%); height: 34px; padding: 0 14px 0 11px; border: 0; border-radius: 99px;
  background: #fff; color: #050505; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 4px 14px rgba(0, 0, 0, .18);
}
.stage-cta .ic { width: 16px; height: 16px; }
.stage-cta:hover { background: var(--brand); color: var(--brand-ink); }
.stage-cta.compact { width: 34px; padding: 0; justify-content: center; }
.stage-cta.compact span { display: none; }
.stage-chips { position: absolute; z-index: 3; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.stage-chips button {
  appearance: none; height: 28px; padding: 0 11px 0 9px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .25); background: rgba(10, 10, 11, .72);
  color: #fff; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; backdrop-filter: blur(6px);
}
.stage-chips button:hover { background: rgba(10, 10, 11, .92); }

/* quick tools for the frame or text you clicked */
.frame-bar {
  position: absolute; z-index: 4; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-1); white-space: nowrap;
}
.frame-bar button {
  appearance: none; border: 0; background: none; color: var(--text); height: 30px; padding: 0 9px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
}
.frame-bar button .ic { width: 16px; height: 16px; }
.frame-bar button:hover { background: var(--surface-4); }
.frame-bar button.active { background: var(--brand-soft); color: var(--brand-text); }
.frame-bar button[aria-disabled="true"] { opacity: .38; }
.frame-name { color: var(--muted); padding: 0 9px 0 7px; border-right: 1px solid var(--line-2); margin-right: 2px; }
.aa { font-size: 16px; font-weight: 800; line-height: 1; }
.aa.small { font-size: 12px; }

/* pop-up texts to fire while recording */
.cue-bar { flex: none; display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 2px; }
.cue-label { color: var(--muted); margin-right: 4px; flex: none; }
.cue { flex: none; height: 32px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cue.live { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 650; }

/* play controls and sound */
.controls { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 10px; }
.transport, .sound { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-height: 48px; }
.transport { display: flex; align-items: center; gap: 10px; padding: 0 10px; }
.transport.live { justify-content: space-between; color: var(--muted); padding: 0 10px 0 14px; }
.transport.disabled { opacity: .45; pointer-events: none; }
.transport input[type="range"] { flex: 1; }
.transport .time { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 36px; text-align: center; font-size: 12px; }
.live-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound { display: flex; align-items: center; gap: 16px; padding: 5px 12px; }
.chan { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.chan-body { flex: 1; min-width: 0; }
.chan-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.chan-top output { font-variant-numeric: tabular-nums; }
.chan .icon-btn { width: 30px; height: 30px; }

/* ================================ 8. side sheet ================================ */
.sheet { background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; min-height: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 6px 16px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.sheet-head h2 { font-size: 16px; font-weight: 750; letter-spacing: -.01em; }
.sheet-body { display: flex; flex-direction: column; }
.group { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.group:last-child { border-bottom: 0; }
.group.grow { flex: 1; min-height: 0; }
.group h3 { color: var(--muted); }
.group-head { display: flex; justify-content: space-between; align-items: center; }

.layers { display: flex; flex-direction: column; gap: 4px; }
.layer { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: var(--r); padding: 2px 4px 2px 2px; background: var(--field); }
.layer.active { border-color: var(--brand); background: var(--brand-soft); }
.layer .pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; background: none; border: 0; padding: 6px 8px; text-align: left; border-radius: 6px; }
.layer .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.layer .sw.v { background: var(--thumb-clip); }
.layer .sw.c { background: var(--brand); }
.layer .where { color: var(--faint); font-size: 12px; margin-left: auto; }
.layer.off .pick { opacity: .5; }

.align { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.align button { appearance: none; height: 30px; display: grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface-3); color: var(--muted); }
.align button:hover { color: var(--text); background: var(--surface-4); }
.nums { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.nums label { display: block; position: relative; }
.nums label input { padding-left: 26px; font-variant-numeric: tabular-nums; }
.nums label::after { content: attr(data-l); position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 11px; font-weight: 700; pointer-events: none; }
.nums input::-webkit-outer-spin-button, .nums input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* text styles: samples of how text looks on video, so they keep a dark backdrop in both themes */
.looks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.look { appearance: none; border: 1.5px solid var(--line-2); background: #2a2a30; border-radius: var(--r); padding: 8px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #b9b9c2; }
.look:hover { border-color: var(--line-3); }
.look.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-ring); color: #fff; }
.look span { font-size: 20px; font-weight: 800; line-height: 1.1; color: #fff; padding: 0 5px; border-radius: 5px; }
.look small { font-size: 11.5px; }
.look-outline span { -webkit-text-stroke: 4px #000; paint-order: stroke fill; }
.look-box span { background: #111; }
.look-label span { background: #ffe24a; color: #111; }
.look-shadow span { text-shadow: 0 3px 5px rgba(0, 0, 0, .9); }
.look-glow span { text-shadow: 0 0 8px #ff3d8b, 0 0 14px #ff3d8b; }
.popup-opts { display: flex; flex-direction: column; gap: 10px; }

/* ================================ 9. dialogs ================================ */
dialog {
  border: 1px solid var(--line-2); border-radius: 16px; background: var(--surface); color: var(--text);
  padding: 22px; width: min(520px, 92vw); box-shadow: var(--shadow-2);
}
dialog::backdrop { background: var(--veil); }
dialog h2 { font-size: 18px; font-weight: 750; letter-spacing: -.01em; margin-bottom: 4px; overflow-wrap: anywhere; }
dialog video { width: 100%; max-height: 52vh; margin-top: 14px; border-radius: 10px; background: #000; }
#confirmDialog { width: min(400px, 92vw); }
#resultDialog.editing { width: min(760px, 94vw); }
#resultActions { flex-wrap: wrap; }
#resultActions .left { margin-right: auto; }
.name-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.name-row label { font-size: 12.5px; font-weight: 650; color: var(--muted); flex: none; }
.name-row input { flex: 1; min-width: 0; height: var(--ctl); }
.name-ext { font-size: 13px; color: var(--muted); flex: none; }
#resultDialog.editing .name-row { display: none; }

.welcome-steps { margin: 16px 0; padding: 0; list-style: none; counter-reset: w; display: flex; flex-direction: column; gap: 10px; }
.welcome-steps li { counter-increment: w; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--muted); }
.welcome-steps li b { color: var(--text); font-weight: 650; }
.welcome-steps li::before {
  content: counter(w); flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}

/* review: trim and crop. The crop tools sit on the video, so they keep fixed colours. */
.review-stage { position: relative; margin: 14px auto 0; max-width: 100%; border-radius: 10px; overflow: hidden; background: #000; }
.review-stage:has(> video[hidden]) { display: none; }
dialog .review-stage video { width: 100%; height: 100%; max-height: none; margin: 0; border-radius: 0; display: block; }
#resultDialog.editing .review-stage video { cursor: pointer; }
.crop-layer { position: absolute; inset: 0; }
.crop-box {
  position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .64); cursor: move; touch-action: none;
  background-image:
    linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255, 255, 255, .35) calc(33.33% - .5px), rgba(255, 255, 255, .35) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255, 255, 255, .35) calc(66.66% - .5px), rgba(255, 255, 255, .35) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255, 255, 255, .35) calc(33.33% - .5px), rgba(255, 255, 255, .35) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255, 255, 255, .35) calc(66.66% - .5px), rgba(255, 255, 255, .35) calc(66.66% + .5px), transparent calc(66.66% + .5px));
}
.crop-box i { position: absolute; width: 18px; height: 18px; background: #fff; border-radius: 4px; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); touch-action: none; }
.crop-box i[data-h="nw"] { left: -9px; top: -9px; cursor: nwse-resize; }
.crop-box i[data-h="se"] { right: -9px; bottom: -9px; cursor: nwse-resize; }
.crop-box i[data-h="ne"] { right: -9px; top: -9px; cursor: nesw-resize; }
.crop-box i[data-h="sw"] { left: -9px; bottom: -9px; cursor: nesw-resize; }

.edit-tools { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.edit-tools.busy .tl-row, .edit-tools.busy .ed-row { opacity: .5; pointer-events: none; }
.tl-row { display: flex; align-items: center; gap: 12px; padding: 0 8px 0 0; }
.tl { position: relative; flex: 1; height: 38px; border-radius: var(--r); background: var(--field); border: 1px solid var(--line-2); cursor: pointer; touch-action: none; margin: 0 7px; }
.tl-keep { position: absolute; top: -1px; bottom: -1px; background: var(--brand-soft); border-top: 2px solid var(--brand); border-bottom: 2px solid var(--brand); pointer-events: none; }
.tl-head { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 2px; pointer-events: none; }
.tl-h { appearance: none; position: absolute; top: -5px; bottom: -5px; width: 14px; margin-left: -7px; padding: 0; border: 0; border-radius: 5px; background: var(--brand); cursor: ew-resize; touch-action: none; }
.tl-h::after { content: ""; position: absolute; left: 6px; top: 32%; bottom: 32%; width: 2px; border-radius: 2px; background: rgba(255, 255, 255, .7); }
.tl-h:hover { background: var(--brand-hi); }
.tl-info { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding: 0 2px; }
.tl-info span:nth-child(2) { color: var(--text); }
.ed-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ed-label { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--line-2); border-left: 3px solid var(--line-3); padding: 10px 14px; border-radius: var(--r);
  box-shadow: var(--shadow-1); z-index: 20; max-width: min(80vw, 560px);
}
.toast.error { border-left-color: var(--brand); }
.drop-veil {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center;
  background: var(--veil); color: #fff; border: 3px dashed var(--brand); font-size: 22px; font-weight: 750; pointer-events: none;
}

/* ================================ 10. smaller windows ================================ */
@media (max-width: 1240px) {
  .seg button small { display: none; }
}
/* While recording, the bar keeps what matters: health, time, Pause, Stop. The video shape
   cannot change during a take, so its buttons step aside on all but very wide windows. */
@media (max-width: 1500px) {
  body.recording .topbar { grid-template-columns: auto 1fr; }
  body.recording #formatSeg { display: none; }
}
@media (max-width: 1180px) {
  body.recording #openRecs, body.recording #openSettings, body.recording #themeBtn { display: none; }
  .app { grid-template-columns: 300px minmax(0, 1fr); }
  .app.sheet-open { grid-template-columns: 300px minmax(0, 1fr) 284px; }
  .btn.quiet span { display: none; }
  .controls { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app.sheet-open { grid-template-columns: 300px minmax(0, 1fr); }
  .sheet { position: fixed; right: 0; top: 56px; bottom: 0; width: min(320px, 92vw); z-index: 10; box-shadow: var(--shadow-2); }
  .frame-bar button span { display: none; }
}

/* ================================ 11. phones ================================ */
@media (max-width: 760px) {
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; } /* no pull-to-refresh: it would throw a recording away */
  body { height: 100dvh; touch-action: manipulation; }
  input, select, textarea { font-size: 16px; } /* stops iPhones zooming in when a field is tapped */
  :root { --ctl: 40px; }

  /* top bar: everything must fit in about 360px, with room for Pause and Stop while recording */
  .topbar { grid-template-columns: auto 1fr; padding: 0 10px 0 12px; padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); gap: 8px; }
  #formatSeg, body.recording #themeBtn { display: none; }
  /* the name stays there for screen readers, just not on screen */
  .wordmark { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .top-right { gap: 6px; min-width: 0; }
  .btn.quiet { padding: 0 8px; }
  .timer { min-width: 44px; font-size: 14px; }
  .btn.record { height: 36px; padding: 0 13px 0 11px; }
  #pauseRecBtn { padding: 0 10px; height: 36px; }
  #fpsPill { padding: 0 8px; max-width: 96px; }
  body.recording #openRecs, body.recording #openSettings { display: none; }
  .phone-only { display: flex !important; }

  .app, .app.sheet-open { display: flex; flex-direction: column; }
  .center { order: 1; flex: 1; height: auto; min-height: 0; padding: 8px 8px 6px; gap: 6px; }

  /* the four steps become a tab bar along the bottom; the open one slides up above it */
  .steps { order: 2; flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; padding: 0; border-right: 0; border-top: 1px solid var(--line); overflow: visible; }
  .step { display: contents; }
  .step-head { grid-row: 2; flex-direction: column; gap: 3px; align-items: center; text-align: center; border-radius: 0; padding: 7px 2px calc(7px + env(safe-area-inset-bottom)); }
  .step-head .chev, .step-text, .steps-foot { display: none; }
  .tab-label { display: block; font-size: 11px; color: var(--muted); }
  body { font-size: 14.5px; }
  .hint, .field, .slider, .step-state { font-size: 13.5px; }
  .transport .time { font-size: 13px; }
  .scene { font-size: 12px; }
  .step.open .tab-label { color: var(--text); }
  .num { width: 24px; height: 24px; font-size: 12px; }
  .step-body { grid-row: 1; grid-column: 1 / -1; max-height: 42dvh; overflow-y: auto; padding: 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }

  .vtab { flex: 0 0 auto; min-width: 118px; max-width: 170px; height: 36px; }
  .vtab-add { width: 36px; height: 36px; }
  .vtab-x { width: 30px; height: 30px; }
  .tab-strip { min-height: 36px; }

  .controls { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
  .transport { min-height: 44px; padding: 0 6px; gap: 6px; }
  #back5, #fwd5 { display: none; }
  .sound { background: none; border: 0; padding: 0; gap: 6px; min-height: 0; }
  .sound .chan { flex: none; }
  .sound .chan-body { display: none; }
  .chan .icon-btn { width: 40px; height: 40px; }
  .cue { height: 36px; }

  .sheet {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 64dvh; z-index: 12;
    border-left: 0; border-top: 1px solid var(--line-2); border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow-2); padding-bottom: env(safe-area-inset-bottom);
  }
  .sheet-head { border-radius: 16px 16px 0 0; }
  .frame-bar button span, .frame-name { display: none; }
  .frame-bar button { height: 36px; padding: 0 10px; }
  .stage-cta { height: 36px; font-size: 13.5px; }
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); } /* above the step bar, not on top of it */
  .stage-cta.compact { width: 36px; }
  .btn.icon { height: 32px; }
  .btn.icon.play { height: 36px; }
  .btn.mini { height: 30px; }
  .emoji-row button { width: 40px; height: 40px; font-size: 21px; }
  dialog { width: 94vw; padding: 16px; }
  dialog video { max-height: 46dvh; }
  .row.end { flex-wrap: wrap; }
  /* finished video and link help: the main action is a full-width button on top, the rest sit in a tidy grid */
  #resultActions, #linkHelpActions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  #resultActions .btn, #linkHelpActions .btn { justify-content: center; min-width: 0; margin: 0; height: 44px; }
  #resultShare, #linkHelpFile, #linkHelpLive { grid-column: 1 / -1; order: -1; }
  #linkForm .btn { height: 44px; padding: 0 18px; }
  #linkForm input { height: 44px; }
  #resultActions .btn, #linkHelpActions .btn { padding: 0 8px; }
  #edAspect { flex-wrap: wrap; }
  .tl { height: 44px; }
  .tl-h { width: 20px; margin-left: -10px; }
  .tl-h::after { left: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* narrow phones and narrow windows: the clock shows only while it is counting, which leaves
   room for the theme switch; while recording, the bar is just health, time, Pause and Stop */
@media (max-width: 480px) {
  body:not(.recording) .timer { display: none; }
  body.recording .brand { display: none; }
  #fpsPill { max-width: none; padding: 0 7px; }
  #fpsText { display: none; }
  .topbar { gap: 6px; }
  .brand { margin-right: 2px; }
  #tDur { display: none; }
  .transport .time { min-width: 30px; }
  .emoji-row button { width: 36px; height: 36px; font-size: 19px; }
}
/* a sliver of a window: one button per row */
@media (max-width: 340px) {
  #fbShape { display: none; } /* still under "More"; makes room for the zoom buttons */
  .frame-bar button { padding: 0 8px; }
  #resultActions, #linkHelpActions { grid-template-columns: 1fr; }
}

/* a phone held sideways: very little height, so the bars slim down and the picture gets the room */
@media (max-height: 520px) and (min-width: 761px) {
  html, body { overscroll-behavior: none; }
  body { height: 100dvh; touch-action: manipulation; }
  input, select, textarea { font-size: 16px; }
  .topbar { height: 46px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .btn.record { height: 34px; }
  .app { grid-template-columns: 264px minmax(0, 1fr); }
  .app.sheet-open { grid-template-columns: 264px minmax(0, 1fr); }
  .sheet { top: 46px; }
  .steps { padding: 8px 8px 8px max(8px, env(safe-area-inset-left)); gap: 6px; }
  .step-head { padding: 7px 10px; gap: 10px; }
  .steps-foot { display: none; }
  .center { padding: 6px max(10px, env(safe-area-inset-right)) 6px 10px; gap: 6px; }
  .controls { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
  .transport { min-height: 40px; padding: 0 6px; gap: 6px; }
  #back5, #fwd5 { display: none; }
  .sound { background: none; border: 0; padding: 0; gap: 6px; min-height: 0; }
  .sound .chan { flex: none; }
  .sound .chan-body { display: none; }
  .chan .icon-btn { width: 40px; height: 40px; }
  .vtab, .vtab-add { height: 32px; }
  .tab-strip { min-height: 32px; }
  dialog { max-height: 96dvh; overflow-y: auto; }
  dialog video { max-height: 40dvh; }
}

/* ================================ 12. light theme: soft white cards ================================
   Daytime look: a grey page, white cards with a soft shadow instead of outlines, round icon
   buttons and filled fields. The structure and every part stay the same; only the surface
   treatment differs. ":where" keeps these as weak as the plain rules above, so the state
   rules (selected, on, muted, recording) still win. */
:where([data-theme="light"]) .topbar { border-bottom-color: transparent; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); position: relative; z-index: 6; }
:where([data-theme="light"]) .notice { position: relative; z-index: 5; }
:where([data-theme="light"]) .steps { background: var(--bg); border-right-color: transparent; }
:where([data-theme="light"]) .step,
:where([data-theme="light"]) .transport,
:where([data-theme="light"]) .sound,
:where([data-theme="light"]) .vtab { border-color: transparent; box-shadow: var(--card-shadow); background: var(--surface); }
:where([data-theme="light"]) .sheet { border-left-color: transparent; box-shadow: -1px 0 2px rgba(0, 0, 0, .1); }
:where([data-theme="light"]) .num { border-color: transparent; }
:where([data-theme="light"]) .btn { border-color: transparent; font-weight: 600; }
:where([data-theme="light"]) .icon-btn { border-color: transparent; border-radius: 50%; }
:where([data-theme="light"]) .emoji-row button,
:where([data-theme="light"]) .align button,
:where([data-theme="light"]) .cue,
:where([data-theme="light"]) .pill,
:where([data-theme="light"]) .layer,
:where([data-theme="light"]) kbd { border-color: transparent; }
:where([data-theme="light"]) .emoji-row button { border-radius: 50%; }
:where([data-theme="light"]) input[type="url"],
:where([data-theme="light"]) input[type="text"],
:where([data-theme="light"]) input[type="number"],
:where([data-theme="light"]) select,
:where([data-theme="light"]) textarea { border-color: transparent; }
:where([data-theme="light"]) input[type="url"],
:where([data-theme="light"]) input[type="text"] { border-radius: 99px; padding: 0 14px; }
:where([data-theme="light"]) .seg { border-color: transparent; background: var(--surface-3); }
:where([data-theme="light"]) .seg button.active { background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
:where([data-theme="light"]) .scene .thumb { border-color: transparent; }
:where([data-theme="light"]) .frame-bar,
:where([data-theme="light"]) .toast { border-color: transparent; }
:where([data-theme="light"]) .toast { border-left: 3px solid var(--line-3); }
:where([data-theme="light"]) dialog { border-color: transparent; border-radius: 12px; }
:where([data-theme="light"]) .stage-box { box-shadow: var(--card-shadow), var(--shadow-1); }
:where([data-theme="light"]) .tl { border-color: transparent; background: var(--surface-3); }
:where([data-theme="light"]) .progress, :where([data-theme="light"]) .meter { background: var(--surface-4); }
@media (max-width: 900px) {
  :where([data-theme="light"]) .sheet { box-shadow: var(--shadow-2); }
}
@media (max-width: 760px) {
  :where([data-theme="light"]) .steps { background: var(--surface); box-shadow: 0 -1px 2px rgba(0, 0, 0, .12); border-top-color: transparent; position: relative; z-index: 4; }
  :where([data-theme="light"]) .step-body { background: var(--surface); border-bottom-color: var(--line); }
  :where([data-theme="light"]) .sound { background: none; box-shadow: none; }
}
