/* VideoGen Studio — warm, quiet workspace; dark stages for media; compact controls. */
:root {
  --bg: #F3F0E9; --surface: #FFFDF9; --surface-2: #F8F5EF; --surface-3: #EEE9E0;
  --ink: #22201C; --ink-2: #57514A; --ink-3: #8A8277; --ink-4: #B3AA9D;
  --line: #E7E0D4; --line-2: #D9D0C2;
  --accent: #C0582F; --accent-2: #A2461F; --accent-soft: #F8E7DD; --on-accent: #FFFFFF;
  --ok: #2F7A55; --ok-soft: #E2F0E7; --warn: #A2670F; --warn-soft: #FAEED6;
  --wait: #5257A6; --wait-soft: #EAEAF7; --bad: #B23B2C; --bad-soft: #F9E2DD; --neutral-soft: #EFEAE2;
  --stage: #16130F; --stage-ink: #EFE7DA; --star: #D9A13B;
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
  --shadow-1: 0 1px 2px rgb(50 35 15 / .05);
  --shadow-2: 0 12px 32px -14px rgb(50 35 15 / .22), 0 1px 3px rgb(50 35 15 / .05);
  --shadow-3: 0 28px 70px -20px rgb(25 18 10 / .42);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-ui: "Segoe UI Variable Display", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Sitka Display", "Sitka Heading", "Sitka Text", Georgia, Cambria, serif;
  --font-serif-text: "Sitka Text", Georgia, Cambria, serif;
  --font-mono: "Cascadia Mono", "Cascadia Code", Consolas, monospace;
  --top: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131210; --surface: #1C1A17; --surface-2: #211F1B; --surface-3: #2B2823;
    --ink: #F0EAE1; --ink-2: #C8BFB2; --ink-3: #958C80; --ink-4: #6D665C;
    --line: #2E2B26; --line-2: #3C3831;
    --accent: #E07B4C; --accent-2: #EE915F; --accent-soft: #3A251A; --on-accent: #1A0D06;
    --ok: #6CC496; --ok-soft: #183225; --warn: #E2AA52; --warn-soft: #382A14; --wait: #A6A9EE; --wait-soft: #25264A; --bad: #F08172; --bad-soft: #42211B; --neutral-soft: #2A2722;
    --stage: #0B0A08;
    --shadow-1: 0 1px 2px rgb(0 0 0 / .3); --shadow-2: 0 14px 34px -14px rgb(0 0 0 / .7); --shadow-3: 0 28px 70px -20px rgb(0 0 0 / .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131210; --surface: #1C1A17; --surface-2: #211F1B; --surface-3: #2B2823;
  --ink: #F0EAE1; --ink-2: #C8BFB2; --ink-3: #958C80; --ink-4: #6D665C;
  --line: #2E2B26; --line-2: #3C3831;
  --accent: #E07B4C; --accent-2: #EE915F; --accent-soft: #3A251A; --on-accent: #1A0D06;
  --ok: #6CC496; --ok-soft: #183225; --warn: #E2AA52; --warn-soft: #382A14; --wait: #A6A9EE; --wait-soft: #25264A; --bad: #F08172; --bad-soft: #42211B; --neutral-soft: #2A2722;
  --stage: #0B0A08;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .3); --shadow-2: 0 14px 34px -14px rgb(0 0 0 / .7); --shadow-3: 0 28px 70px -20px rgb(0 0 0 / .8);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 16px); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
body.modal-open { overflow: hidden; }
img, video { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 16px; height: 16px; flex: none; }
.mono { font-family: var(--font-mono); font-size: .9em; }
.sub, .muted { color: var(--ink-3); font-size: 12.5px; font-weight: 400; }
.small { font-size: 12.5px; }
.pad { padding: 8px 0; }
[hidden] { display: none !important; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; gap: 10px; } .row.end { justify-content: flex-end; gap: 8px; } .row.center { justify-content: center; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2.tight { gap: 10px; }
.split { display: grid; grid-template-columns: minmax(240px, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.split.tight { gap: 24px; }
.split > .card { margin: 0; }
.push { margin-left: auto; }

/* ---------- boot / login ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--ink-3); }
.boot b { font: 600 20px var(--font-serif); color: var(--ink); }
.boot-mark { width: 40px; height: 40px; border-radius: 11px; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.9); opacity: .7; } }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-2); display: grid; gap: 12px; }
.login-card h1 { font: 600 26px var(--font-serif); }
.login-card form { display: grid; gap: 12px; margin-top: 6px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; height: var(--top); display: flex; align-items: center; gap: 24px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.brand-mark .i { width: 18px; height: 18px; }
.brand-mark.lg { width: 44px; height: 44px; border-radius: 12px; } .brand-mark.lg .i { width: 26px; height: 26px; }
.brand-name { font: 600 17px var(--font-serif); }
.brand-name em { font-style: italic; font-weight: 400; color: var(--ink-3); }
.topnav { display: flex; gap: 2px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font: 500 13.5px var(--font-ui); }
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item.active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
.nav-item .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font: 600 10.5px/18px var(--font-ui); text-align: center; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.local-pill { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--line); color: var(--ink-3); font-size: 12px; }
.local-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.bottomnav { display: none; }
.main { min-height: calc(100vh - var(--top)); }
.page { max-width: 1240px; margin: 0 auto; padding: 32px 28px 64px; }

/* ---------- headings ---------- */
.eyebrow, .kicker { font: 600 11px/1.3 var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.eyebrow { margin-bottom: 8px; }
.kicker { margin-bottom: 3px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 22px; }
.page-head h1 { font: 600 38px/1.05 var(--font-serif); letter-spacing: -.02em; }
.lede { margin-top: 8px; max-width: 620px; color: var(--ink-2); font-size: 14.5px; }
.head-actions { display: flex; gap: 8px; flex: none; }
.footnote { display: flex; gap: 9px; align-items: flex-start; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 12.5px; }
.title-lg { font: 600 24px/1.15 var(--font-serif) !important; }
.section-title { display: flex; align-items: center; gap: 8px; font: 600 12.5px var(--font-ui); color: var(--ink); margin-bottom: 10px; }
.section-title .sub { font-size: 12px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: 500 13.5px/1 var(--font-ui); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s; position: relative; box-shadow: var(--shadow-1); }
.btn:hover { background: var(--surface-2); border-color: var(--ink-4); }
.btn:active { transform: translateY(.5px); }
.btn .i { width: 15px; height: 15px; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 7px; }
.btn-xs { height: 26px !important; width: 26px !important; border-radius: 6px; }
.btn-icon { width: 34px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: color-mix(in srgb, var(--ok) 86%, black); border-color: transparent; }
:root[data-theme="dark"] .btn-ok { color: #0B1A12; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-ok { color: #0B1A12; } }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--ink); }
.btn-link { height: auto; padding: 0; border: 0; background: none; box-shadow: none; color: var(--accent); font: 500 inherit var(--font-ui); font-size: inherit; }
.btn-link:hover { background: none; text-decoration: underline; color: var(--accent-2); }
.btn-launch { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 7px; background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-launch:hover { background: color-mix(in srgb, var(--ink) 82%, var(--accent)); border-color: transparent; }
.btn-launch .i { color: var(--accent); width: 14px; height: 14px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; pointer-events: none; box-shadow: none; }
.btn.wide { width: 100%; }
.btn.round { border-radius: 50%; }
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink-3); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn-primary.is-busy::after, .btn-launch.is-busy::after, .btn-ok.is-busy::after { border-color: #fff; border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn .i-pause, .btn.playing .i-play, .btn .when-play, .btn.playing .when-stop { display: none; }
.btn.playing .i-pause { display: block; }
.btn.playing .when-play { display: inline; }
#cmp-play .i, #mix-play .i, #sub-play .i { fill: currentColor; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; font: 600 11.5px/1 var(--font-ui); white-space: nowrap; background: var(--neutral-soft); color: var(--ink-2); }
.chip .i { width: 12px; height: 12px; stroke-width: 2.4; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.wait { background: var(--wait-soft); color: var(--wait); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.glass { background: rgb(20 16 12 / .55); color: #F4ECE0; backdrop-filter: blur(6px); }

/* ---------- segmented switch ---------- */
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 9px; background: var(--surface-3); max-width: 100%; }
.seg button { height: 28px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font: 500 13px var(--font-ui); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; transition: background .12s, color .12s; }
.seg button small { font-size: 11px; color: var(--ink-4); font-weight: 600; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 0 0 .5px var(--line-2); }
.seg button.on small { color: var(--ink-3); }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; }
.seg.scroll { overflow-x: auto; scrollbar-width: none; }

/* ---------- forms ---------- */
.field { display: grid; gap: 5px; min-width: 0; }
.field > span:first-child { font: 500 12px var(--font-ui); color: var(--ink-2); }
.field em { font-style: normal; color: var(--ink-4); font-weight: 400; margin-left: 4px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea {
  width: 100%; border: 1px solid var(--line-2); background: var(--surface); border-radius: 8px; padding: 6px 10px; min-height: 34px; font-size: 13.5px; transition: border-color .12s, box-shadow .12s; }
textarea { resize: vertical; line-height: 1.55; padding: 9px 11px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
select { appearance: none; padding-right: 30px !important; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 11px) 52%; background-size: 4px 4px; background-repeat: no-repeat; }
.editor { background: var(--surface-2); min-height: 180px; }
.editor-serif { font-family: var(--font-serif-text); font-size: 16px; line-height: 1.6; background: var(--surface); }
.input-unit { display: flex; gap: 6px; align-items: center; }
.input-unit > input, .input-unit > select { flex: 1; min-width: 0; }
input[type="range"] { accent-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 32px; height: 18px; border-radius: 9px; background: var(--line-2); position: relative; transition: background .18s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .18s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:focus-visible + i { box-shadow: var(--focus); }
.search { position: relative; display: flex; align-items: center; }
.search .i { position: absolute; left: 10px; color: var(--ink-3); pointer-events: none; width: 15px; }
.search input { padding-left: 32px !important; width: 220px !important; }
.select-inline select { width: auto; min-width: 170px; }
.dirty { display: inline-flex; align-items: center; gap: 6px; font: 500 12px var(--font-ui); color: var(--warn); margin-right: auto; }
.dirty::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow-1); margin-bottom: 16px; min-width: 0; }
.card-accent { border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-head > div:first-child { min-width: 0; }
.card-head h2 { font: 600 15px/1.3 var(--font-ui); }
.card-head .sub { display: block; margin-top: 2px; }
.card-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.card-foot.flush { margin-top: -4px; }
.section { border-top: 1px solid var(--line); padding-top: 14px; }
.card > .section { margin-top: 16px; }
.note { display: flex; gap: 7px; align-items: flex-start; font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.note .i { width: 14px; height: 14px; margin-top: 1px; }
.note.warn { color: var(--warn); }
.card > .note { margin-top: 12px; }
.banner { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 12px; margin-bottom: 16px; background: var(--neutral-soft); font-size: 13px; color: var(--ink-2); }
.banner > .i { width: 18px; height: 18px; }
.banner p { flex: 1; }
.banner b { color: var(--ink); font-weight: 600; }
.banner.ok { background: var(--ok-soft); } .banner.ok > .i { color: var(--ok); }
.banner.warn { background: var(--warn-soft); } .banner.warn > .i { color: var(--warn); }
.banner.wait { background: var(--wait-soft); } .banner.wait > .i { color: var(--wait); }
.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 30px 18px; border: 1px dashed var(--line-2); border-radius: 12px; color: var(--ink-3); grid-column: 1 / -1; }
.empty .i { width: 26px; height: 26px; color: var(--ink-4); }
.empty p { color: var(--ink-2); font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 12px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 24px; font-size: 12.5px; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; }
.kpi b { font: 600 26px/1 var(--font-serif); }
.kpi span { color: var(--ink-3); font-size: 12.5px; }
.kpi-link { position: relative; padding-right: 36px; }
.kpi-link .i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.kpi-link:hover { border-color: var(--line-2); box-shadow: var(--shadow-1); }
.continue { margin-top: 18px; display: grid; grid-template-columns: 300px 1fr; border-radius: 16px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); }
.continue-reel { position: relative; background: var(--stage); min-height: 260px; overflow: hidden; display: block; }
.continue-reel span { position: absolute; top: 22px; bottom: 22px; aspect-ratio: 9/16; left: calc(24px + var(--i) * 46px); border-radius: 9px; overflow: hidden; box-shadow: 0 10px 30px rgb(0 0 0 / .5); transform: rotate(calc((var(--i) - 2) * 2deg)); transition: transform .3s; }
.continue-reel span:nth-child(1) { z-index: 5; } .continue-reel span:nth-child(2) { z-index: 4; } .continue-reel span:nth-child(3) { z-index: 3; } .continue-reel span:nth-child(4) { z-index: 2; }
.continue-reel:hover span { transform: rotate(calc((var(--i) - 2) * 3deg)) translateX(calc(var(--i) * 6px)); }
.continue-reel img { width: 100%; height: 100%; object-fit: cover; }
.continue-body { padding: 24px 28px; display: grid; gap: 10px; align-content: center; }
.continue-body h2 { font: 600 28px/1.1 var(--font-serif); }
.continue-body h2 a { text-decoration: none; }
.continue-body h2 a:hover { color: var(--accent); }
.mini-stepper { list-style: none; margin: 8px 0 4px; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; }
.mini-stepper a { display: grid; gap: 3px; text-decoration: none; }
.mini-stepper i { height: 4px; border-radius: 2px; background: var(--line); }
.mini-stepper span { font: 600 11.5px var(--font-ui); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-stepper small { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-stepper .done i { background: var(--ok); } .mini-stepper .off i { background: var(--ok); opacity: .4; }
.mini-stepper .active i, .mini-stepper .review i { background: var(--accent); opacity: .5; }
.mini-stepper .next i { background: var(--accent); opacity: 1; }
.mini-stepper .next span { color: var(--accent); }
.mini-stepper a:hover span { color: var(--ink); text-decoration: underline; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 26px 0 16px; }
.toolbar-right { display: flex; gap: 8px; align-items: center; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.pcard { display: flex; flex-direction: column; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; transition: box-shadow .2s, transform .2s, border-color .2s; }
.pcard:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); border-color: var(--line-2); }
.pcard-cover { position: relative; display: block; aspect-ratio: 4/5; background: var(--stage); overflow: hidden; }
.pcard-cover img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; transition: transform .5s; }
.pcard:hover .pcard-cover img { transform: scale(1.03); }
.pcard-tags { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.pcard-time { position: absolute; right: 10px; bottom: 10px; padding: 3px 8px; border-radius: 7px; background: rgb(15 12 9 / .62); color: #F4ECE0; font: 600 11.5px var(--font-mono); backdrop-filter: blur(6px); }
.pcard-body { padding: 14px 16px; display: grid; gap: 7px; }
.pcard-body h3 { font: 600 18px/1.2 var(--font-serif); }
.pcard-body h3 a { text-decoration: none; }
.pcard-body h3 a:hover { color: var(--accent); }
.pcard-meta { font-size: 12.5px; color: var(--ink-3); }
.pcard-next { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.pcard-next .i { width: 14px; height: 14px; color: var(--accent); }
.pcard-foot { font-size: 11.5px; color: var(--ink-4); }
.pcard-new { align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 24px; min-height: 320px; border: 1px dashed var(--line-2); background: transparent; cursor: pointer; color: var(--ink-2); font: inherit; }
.pcard-new .i { width: 36px; height: 36px; padding: 8px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.pcard-new b { font: 600 18px var(--font-serif); color: var(--ink); }
.pcard-new span { font-size: 12.5px; color: var(--ink-3); max-width: 200px; }
.pcard-new:hover { border-color: var(--accent); background: var(--surface); }
.segbar { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.seg-x, .segbar .seg { height: 4px; border-radius: 2px; background: var(--line); padding: 0; }
.segbar .seg.done { background: var(--ok); } .segbar .seg.off { background: var(--ok); opacity: .4; }
.segbar .seg.active, .segbar .seg.review { background: var(--accent); }

/* ---------- studio ---------- */
.studio { padding: 18px 24px 56px; max-width: 1680px; margin: 0 auto; }
.studio-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.title-block { min-width: 0; }
.crumb { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-3); text-decoration: none; font: 500 12.5px var(--font-ui); margin-bottom: 4px; }
.crumb:hover { color: var(--accent); }
.crumb .i { width: 14px; height: 14px; }
.studio-title h1 { font: 600 30px/1.1 var(--font-serif); letter-spacing: -.02em; }
.studio-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; color: var(--ink-3); font-size: 12.5px; }
.studio-meta > span:not(.chip) + span:not(.chip)::before { content: "·"; margin-right: 10px; color: var(--ink-4); }
.studio-actions { display: flex; gap: 6px; flex: none; }
.stepper { display: flex; gap: 6px; align-items: stretch; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); margin-bottom: 18px; }
.stepper ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; flex: 1; min-width: 0; }
.step a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 9px; text-decoration: none; min-width: 0; height: 100%; position: relative; }
.step a:hover { background: var(--surface-2); }
.step-dot { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 600 11px var(--font-ui); border: 1.5px solid var(--line-2); color: var(--ink-3); background: var(--surface); }
.step-dot .i { width: 12px; height: 12px; stroke-width: 2.6; }
.step-text { display: grid; min-width: 0; line-height: 1.25; }
.step-text b { font: 600 13px var(--font-ui); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-text small { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.done .step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.active .step-dot, .step.review .step-dot { border-color: var(--accent); color: var(--accent); }
.step.review .step-text small { color: var(--accent); }
.step.locked .step-dot { color: var(--ink-4); border-style: dashed; }
.step.locked .step-text b { color: var(--ink-3); }
.step.off .step-dot { border-style: dashed; }
.step.current a { background: var(--surface-3); }
.step.current a::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -5px; height: 2px; border-radius: 1px; background: var(--accent); }
.step-jobs { flex: none; display: flex; align-items: center; gap: 7px; padding: 0 12px; border-radius: 9px; text-decoration: none; color: var(--ink-2); font: 500 13px var(--font-ui); border-left: 1px solid var(--line); }
.step-jobs:hover, .step-jobs.current { background: var(--surface-3); color: var(--ink); }
.step-jobs b { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--wait-soft); color: var(--wait); font: 600 10.5px/18px var(--font-ui); text-align: center; }
.studio-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.rail-closed .studio-body { grid-template-columns: minmax(0, 1fr); }
.rail-closed .rail { display: none; }
.stage-pane { min-width: 0; }

/* rail */
.rail { position: sticky; top: calc(var(--top) + 14px); max-height: calc(100vh - var(--top) - 28px); overflow: auto; display: grid; gap: 12px; align-content: start; scrollbar-width: thin; }
.rail-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: var(--shadow-1); }
.rail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-height: 26px; }
.rail-head h2 { font: 600 13.5px var(--font-ui); }
.rail-head > .btn { margin-left: auto; }
.ref-tag, .new-tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font: 700 10.5px var(--font-ui); letter-spacing: .1em; text-transform: uppercase; background: var(--stage); color: #F4ECE0; flex: none; }
.ref-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #E9C46A; }
.new-tag { background: var(--accent); color: var(--on-accent); }
.rail-empty { text-align: center; display: grid; gap: 10px; justify-items: center; padding: 18px 6px; color: var(--ink-3); font-size: 12.5px; }
.rail-empty .i { width: 26px; height: 26px; color: var(--warn); }
.comments .seg { margin-bottom: 4px; }
.comment-list { max-height: 40vh; overflow: auto; scrollbar-width: thin; margin: 0 -2px; padding: 0 2px; }
.comment { padding: 10px 0; display: grid; gap: 5px; border-bottom: 1px solid var(--line); }
.comment header { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); }
.comment header b { color: var(--ink); font-size: 12.5px; font-weight: 600; }
.comment p { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); }
.comment.resolved p { color: var(--ink-4); text-decoration: line-through; text-decoration-color: var(--ink-4); }
.resolve { all: unset; margin-left: auto; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-2); color: transparent; cursor: pointer; transition: all .12s; }
.resolve .i { width: 12px; height: 12px; stroke-width: 2.6; }
.resolve:hover { border-color: var(--ok); color: var(--ok); }
.resolve.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.resolve:focus-visible { box-shadow: var(--focus); }
.comment-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 5px; background: var(--surface-3); border: 0; color: var(--ink-2); font: 500 11px var(--font-ui); text-decoration: none; cursor: pointer; }
.tag .i { width: 10px; height: 10px; fill: currentColor; }
.tag:hover { color: var(--accent); }
.tag-time { font-family: var(--font-mono); }
.avatar { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font: 700 10px var(--font-ui); }
.comment-form { display: grid; gap: 8px; margin-top: 10px; }
.comment-form textarea { min-height: 56px; font-size: 13px; }
.sheet-fab, .sheet-close { display: none; }

/* media stages */
.stage { position: relative; background: var(--stage); border-radius: 12px; overflow: hidden; display: grid; place-items: center; }
.stage.portrait { aspect-ratio: 9/16; width: min(100%, calc(min(64vh, 620px) * .5625)); margin-inline: auto; }
.stage.portrait.short { width: min(100%, calc(min(40vh, 400px) * .5625)); }
.rail .stage.portrait { width: min(100%, calc(min(42vh, 420px) * .5625)); }
.stage video, .stage img { width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage img.dim { opacity: .3; filter: saturate(.6); }
.stage .zoom { all: unset; display: block; width: 100%; height: 100%; cursor: zoom-in; }
.stage .zoom img { object-fit: cover; }
.stage-overlay { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 5px; text-align: center; padding: 18px; color: var(--stage-ink); font-size: 13px; }
.stage-overlay .i { width: 26px; height: 26px; opacity: .7; }
.stage-overlay small { color: color-mix(in srgb, var(--stage-ink) 60%, transparent); font-size: 12px; }
.no-media { width: 100%; height: 100%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-4); }
.no-media .i { width: 22px; height: 22px; }
.media-cap { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.media-actions { display: flex; gap: 6px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.drop-wrap { border-radius: 12px; transition: box-shadow .15s; }
.drop-wrap.drag-over, .dropzone.drag-over { box-shadow: 0 0 0 3px var(--accent); }
.dropzone { display: grid; justify-items: center; align-content: center; gap: 6px; text-align: center; padding: 22px 14px; border: 1px dashed var(--line-2); border-radius: 12px; background: var(--surface-2); color: var(--ink-3); font-size: 13px; }
.dropzone .i { width: 22px; height: 22px; color: var(--ink-4); }
.dropzone b { color: var(--ink); font-weight: 600; }
.dropzone.tall { aspect-ratio: 9/16; width: min(100%, calc(min(56vh, 520px) * .5625)); margin: 0 auto; }
.dropzone:hover { border-color: var(--accent); }

/* launch */
.launch { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-2); display: grid; gap: 8px; }
.stack > .launch { margin-top: 0; }
.launch-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.launch-status { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.blockers { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.blockers li { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.blockers .i { width: 12px; height: 12px; color: var(--ink-4); }
.blockers a { color: var(--accent); font-weight: 600; text-decoration: none; }
.blockers a:hover { text-decoration: underline; }

/* text stage */
.text-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.text-columns .card { margin: 0 0 16px; }
.text-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.text-stats .btn-link { margin-left: auto; display: inline-flex; gap: 4px; align-items: center; font-size: 12px; }
.text-stats .btn-link .i { width: 13px; height: 13px; }
.source-strip { display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 16px; }
.facts { flex: 1; min-width: 0; display: grid; }
.facts b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facts span { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.source-side { display: grid; gap: 10px; align-content: start; }
.source-link { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); text-decoration: none; font-size: 12.5px; color: var(--accent); min-width: 0; }
.source-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* style stage */
.progress-steps { list-style: none; margin: 0 0 16px; padding: 0; display: flex; gap: 6px; }
.progress-steps li { flex: 1; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; background: var(--surface-2); font: 500 12.5px var(--font-ui); color: var(--ink-3); min-width: 0; }
.progress-steps li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-steps i { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font: 600 10.5px var(--font-ui); font-style: normal; border: 1.5px solid var(--line-2); }
.progress-steps i .i { width: 11px; height: 11px; stroke-width: 2.6; }
.progress-steps .done { color: var(--ok); }
.progress-steps .done i { background: var(--ok); border-color: var(--ok); color: #fff; }
.progress-steps .now { color: var(--accent); background: var(--accent-soft); }
.progress-steps .now i { border-color: var(--accent); }
.reel { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.reel-item { position: relative; flex: none; width: 76px; aspect-ratio: 9/16; border-radius: 9px; overflow: hidden; background: var(--stage); }
.reel-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.reel-item:hover img { transform: scale(1.05); }
.reel-item span { position: absolute; left: 5px; top: 5px; font: 700 10.5px var(--font-mono); color: #fff; text-shadow: 0 1px 3px rgb(0 0 0 / .7); }

/* frames */
.meter { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; margin: -4px 0 14px; }
.meter i { display: block; height: 100%; background: var(--ok); border-radius: 2px; transition: width .4s; }
.frame-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.frame-card { display: grid; gap: 5px; text-decoration: none; min-width: 0; }
.frame-thumb { position: relative; aspect-ratio: 9/16; border-radius: 10px; overflow: hidden; background: var(--stage); box-shadow: 0 0 0 1px var(--line); transition: box-shadow .15s, transform .15s; }
.frame-thumb img { width: 100%; height: 100%; object-fit: cover; }
.frame-card:hover .frame-thumb { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--line-2), var(--shadow-2); }
.frame-card.selected .frame-thumb { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.frame-num { position: absolute; left: 6px; top: 6px; padding: 1px 5px; border-radius: 5px; background: rgb(15 12 9 / .6); color: #fff; font: 700 10.5px var(--font-mono); }
.frame-ok { position: absolute; right: 6px; top: 6px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .3); }
.frame-ok .i { width: 11px; height: 11px; stroke-width: 2.8; }
.frame-wait { position: absolute; right: 8px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px #fff; }
.frame-card b { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.frame-card.selected b { color: var(--ink); }
.scene-nav { display: flex; align-items: center; gap: 2px; flex: none; }
.scene-nav .sub { font-family: var(--font-mono); font-size: 11.5px; margin-right: 6px; }
.versions { display: grid; gap: 4px; }
.version { display: flex; gap: 10px; align-items: center; padding: 5px 8px 5px 5px; border-radius: 10px; }
.version.active { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.version-thumb { all: unset; cursor: zoom-in; flex: none; width: 30px; aspect-ratio: 9/16; border-radius: 5px; overflow: hidden; background: var(--stage); }
.version-thumb img, .version-thumb video { width: 100%; height: 100%; object-fit: cover; }
.version-info { flex: 1; display: grid; min-width: 0; }
.version-info b { font: 600 12.5px var(--font-mono); }
.version-info small { font-size: 11.5px; color: var(--ink-3); }
.version-tags { display: flex; gap: 6px; align-items: center; }

/* filmstrip */
.filmstrip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 10px; margin: -4px -4px 6px; scrollbar-width: thin; }
.film-item { flex: none; width: 64px; display: grid; gap: 4px; text-decoration: none; }
.film-thumb { position: relative; aspect-ratio: 9/16; border-radius: 8px; overflow: hidden; background: var(--stage); box-shadow: 0 0 0 1px var(--line); }
.film-thumb img { width: 100%; height: 100%; object-fit: cover; }
.film-item:hover .film-thumb { box-shadow: 0 0 0 1px var(--ink-4); }
.film-item.selected .film-thumb { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.film-thumb .dot { position: absolute; right: 4px; top: 4px; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 1.5px #fff; background: transparent; }
.film-thumb .dot.ok { background: var(--ok); } .film-thumb .dot.accent { background: var(--accent); } .film-thumb .dot.empty { background: rgb(255 255 255 / .25); }
.film-cap { font: 500 11px var(--font-ui); color: var(--ink-3); text-align: center; }
.film-cap b { color: var(--ink); font-family: var(--font-mono); }

/* timeline & trim */
.timeline { display: flex; gap: 3px; height: 76px; overflow-x: auto; scrollbar-width: thin; }
.tl-block { position: relative; flex-basis: 0; min-width: 56px; border-radius: 8px; overflow: hidden; background: var(--stage); text-decoration: none; cursor: grab; transition: box-shadow .15s, opacity .15s; }
.tl-thumb { position: absolute; inset: 0; background-size: cover; background-position: center 30%; opacity: .85; }
.tl-block::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 40%, rgb(0 0 0 / .65)); }
.tl-label { position: absolute; left: 7px; right: 7px; bottom: 5px; z-index: 1; display: flex; justify-content: space-between; align-items: baseline; color: #fff; font: 600 10.5px var(--font-mono); }
.tl-block.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.tl-block.selected::before { content: ""; position: absolute; inset: 0; z-index: 2; border: 2px solid var(--accent); border-radius: 8px; }
.tl-block.missing { opacity: .5; }
.tl-block.dragging { opacity: .35; }
.tl-block.drop-before { box-shadow: -3px 0 0 0 var(--accent); }
.tl-block.drop-after { box-shadow: 3px 0 0 0 var(--accent); }
.ruler { position: relative; height: 16px; margin-top: 6px; }
.ruler span { position: absolute; transform: translateX(-50%); font: 10.5px var(--font-mono); color: var(--ink-3); }
.ruler span:first-child { transform: none; }
.ruler span:last-child:not(:first-child) { transform: translateX(-100%); }
.trim { position: relative; height: 36px; margin: 16px 0 4px; }
.trim-rail { position: absolute; left: 0; right: 0; top: 7px; height: 22px; border-radius: 6px; background: var(--surface-3); }
.trim-range { position: absolute; top: 0; bottom: 0; left: var(--in); width: calc(var(--out) - var(--in)); background: color-mix(in srgb, var(--accent) 20%, transparent); border-block: 2px solid var(--accent); }
.trim-head { position: absolute; top: -4px; bottom: -4px; left: var(--head); width: 2px; background: var(--ink); border-radius: 1px; pointer-events: none; }
.trim input[type="range"] { position: absolute; left: 0; top: 0; width: 100%; height: 36px; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; pointer-events: none; }
.trim input[type="range"]::-webkit-slider-runnable-track { background: transparent; height: 36px; }
.trim input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 10px; height: 30px; margin-top: 3px; border-radius: 4px; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 1px 4px rgb(0 0 0 / .3); cursor: ew-resize; }
.trim input[type="range"]::-moz-range-thumb { pointer-events: auto; width: 8px; height: 28px; border-radius: 4px; background: var(--accent); border: 2px solid var(--surface); cursor: ew-resize; }
.trim input[type="range"]::-moz-range-track { background: transparent; }
.trim input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: var(--focus); }
.trim-fields { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin: 12px 0 2px; }
.trim-len { display: grid; gap: 1px; padding-bottom: 5px; text-align: right; }
.trim-len span { font-size: 11.5px; color: var(--ink-3); }
.trim-len b { font: 600 15px var(--font-mono); }

/* audio: voice */
.kv { margin: 0 0 4px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kv > div { padding: 11px 13px; border-radius: 10px; background: var(--surface-2); min-width: 0; }
.kv dt { font: 600 10.5px var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.kv dd { margin: 0; display: grid; gap: 6px; justify-items: start; min-width: 0; }
.kv dd > b { font-size: 14px; font-weight: 600; }
.kv dd .mono { overflow-wrap: anywhere; }
.kv .ap { width: 100%; }
.card > .section + .section, .card > .section + .launch { margin-top: 16px; }
.characters { display: grid; gap: 8px; max-width: 560px; }
.character-row { display: grid; grid-template-columns: auto 110px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; }
.choice-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.choice { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 7px 10px 7px 8px; transition: background .12s; }
.choice + .choice { border-top: 1px solid var(--line); }
.choice:hover { background: var(--surface-2); }
.choice.selected { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.choice-main { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 0; }
.choice-main:focus-visible { box-shadow: var(--focus); border-radius: 6px; }
.radio { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--surface); transition: all .12s; }
.choice.selected .radio { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.choice-text { display: grid; min-width: 0; }
.choice-text b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.choice-text small { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.choice .id { font-size: 11px; color: var(--ink-4); }
.star { all: unset; cursor: pointer; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; font-size: 15px; color: var(--ink-4); }
.star:hover { color: var(--star); background: var(--surface-3); }
.star.on { color: var(--star); cursor: default; }
.star:focus-visible { box-shadow: var(--focus); }
.sample { all: unset; cursor: pointer; position: relative; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); --p: 0; flex: none; transition: background .12s, color .12s; }
.sample:hover { color: var(--accent); }
.sample .ring-svg { position: absolute; inset: 0; width: 32px; height: 32px; transform: rotate(-90deg); }
.sample .ring { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: calc(var(--p) * 1) 100; transition: stroke-dasharray .2s linear; }
.sample > .i { width: 12px; height: 12px; fill: currentColor; position: relative; }
.sample .i-pause, .sample.playing .i-play { display: none; }
.sample.playing { background: var(--accent-soft); color: var(--accent); }
.sample.playing .i-pause { display: block; }
.sample:focus-visible { box-shadow: var(--focus); }
details.manual { margin-top: 10px; }
details.manual summary { cursor: pointer; font: 500 12.5px var(--font-ui); color: var(--ink-3); width: max-content; }
details.manual summary:hover { color: var(--ink); }
.manual-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; margin-top: 10px; }

/* compact audio player */
.ap { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px 0 3px; border-radius: 17px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.ap audio { display: none; }
.ap-btn { all: unset; cursor: pointer; flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--bg); }
.ap-btn .i { width: 11px; height: 11px; fill: currentColor; }
.ap-btn .i-pause, .ap.playing .ap-btn .i-play { display: none; }
.ap.playing .ap-btn .i-pause { display: block; }
.ap.playing .ap-btn { background: var(--accent); color: var(--on-accent); }
.ap-btn:focus-visible { box-shadow: var(--focus); }
.ap-seek, .scrub { flex: 1; min-width: 60px; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--p, 0%), var(--line-2) var(--p, 0%)); cursor: pointer; }
.ap-seek::-webkit-slider-thumb, .scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / .25); }
.ap-seek::-moz-range-thumb, .scrub::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.ap-time { flex: none; font-size: 11px; color: var(--ink-3); }

/* audio: music */
.music-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; }
.music-grid > .stack:first-child { padding-right: 20px; border-right: 1px solid var(--line); }
.music-grid > .stack:last-child { padding-left: 20px; }
.music-grid .section-title { margin-bottom: 0; }
.tracks { display: grid; gap: 8px; }
.track { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "info actions" "player player"; gap: 8px 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.track.current { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.track .ap { grid-area: player; }
.track-info { grid-area: info; display: grid; min-width: 0; }
.track-info b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-info .sub { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-actions { grid-area: actions; display: flex; gap: 4px; align-items: center; }
.volume-row { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.volume-row input { flex: 1; min-width: 0; }
.field-label { font: 500 12px var(--font-ui); color: var(--ink-2); white-space: nowrap; }
.volume-row output { font: 600 12px var(--font-mono); min-width: 36px; text-align: right; }

/* subtitles */
.sub-split { grid-template-columns: minmax(240px, 5fr) minmax(0, 6fr); }
.sub-preview { position: relative; aspect-ratio: 9/16; width: min(100%, calc(min(64vh, 600px) * .5625)); margin: 0 auto; border-radius: 12px; overflow: hidden; background: var(--stage); container-type: inline-size; }
.sub-preview img { width: 100%; height: 100%; object-fit: cover; }
.safe { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(-45deg, rgb(224 123 76 / .24) 0 5px, rgb(224 123 76 / .08) 5px 10px); }
.safe-top { top: 0; height: var(--top); border-bottom: 1px dashed rgb(255 255 255 / .5); }
.safe-bottom { bottom: 0; height: var(--bottom); border-top: 1px dashed rgb(255 255 255 / .5); }
.sub-line { position: absolute; left: var(--x); top: var(--y); width: var(--w); transform: translate(-50%, -100%); text-align: center; font-weight: 700; line-height: 1.12; font-size: calc(var(--size) * 100cqw / 720); text-shadow: .2cqw .25cqw .3cqw rgb(0 0 0 / .45); transition: opacity .2s; }
.sub-off { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); padding: 3px 9px; border-radius: 7px; background: rgb(0 0 0 / .6); color: #fff; font-size: 11.5px; white-space: nowrap; }
.prov { font: 600 11.5px var(--font-ui); padding: 3px 9px; border-radius: 11px; background: var(--neutral-soft); color: var(--ink-2); white-space: nowrap; }
.prov.ok { background: var(--ok-soft); color: var(--ok); } .prov.accent { background: var(--accent-soft); color: var(--accent); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px 22px; padding-bottom: 4px; }
.control-group { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.control-group .section-title { margin-bottom: 2px; }
.slider { display: grid; grid-template-columns: 104px minmax(0, 1fr) 48px; align-items: center; gap: 12px; font-size: 12.5px; color: var(--ink-2); min-height: 30px; }
.slider input[type="range"] { width: 100%; margin: 0; }
.slider select { min-height: 30px; padding: 3px 8px; font-size: 13px; }
.slider output { font: 12px var(--font-mono); color: var(--ink); text-align: right; }
.swatches { display: flex; gap: 18px; padding: 4px 0; }
.swatches label { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.swatches input[type="color"] { width: 26px; height: 26px; padding: 0; border: 1px solid var(--line-2); border-radius: 7px; background: none; cursor: pointer; }
.swatches input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.swatches input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.words { display: flex; flex-wrap: wrap; gap: 4px; max-height: 180px; overflow: auto; margin-bottom: 4px; }
.word { display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 7px; border-radius: 6px; background: var(--surface-2); font-size: 12.5px; transition: background .1s; }
.word small { font: 10px var(--font-mono); color: var(--ink-4); }
.word.now { background: var(--accent); color: var(--on-accent); }
.word.now small { color: inherit; }

/* final */
.final-split { grid-template-columns: minmax(0, 1fr) minmax(260px, 1fr); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink); }
.checklist li:last-child { border-bottom: 0; }
.check-dot { width: 18px; height: 18px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1.5px dashed var(--ink-4); }
.check-dot .i { width: 11px; height: 11px; stroke-width: 2.8; }
.checklist li.ok { color: var(--ink-2); }
.checklist li.ok .check-dot { border: 0; background: var(--ok); color: #fff; }
.checklist a { margin-left: auto; color: var(--accent); font: 600 12px var(--font-ui); text-decoration: none; }
.checklist a:hover { text-decoration: underline; }
.builds { display: grid; gap: 2px; }
.build { display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-radius: 10px; }
.build:hover { background: var(--surface-2); }
.build.current { background: var(--surface-2); }
.build-info { flex: 1; display: grid; min-width: 0; }
.build-info b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.build-info .sub { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.build-thumb { all: unset; cursor: pointer; width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.build-thumb .i { width: 11px; height: 11px; fill: currentColor; }
.build-thumb:hover { background: var(--ink); color: var(--bg); }
.play-badge { position: absolute; inset: 0; margin: auto; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgb(0 0 0 / .55); color: #fff; }
.play-badge .i { width: 12px; height: 12px; fill: currentColor; }

/* jobs */
.job-group { margin-bottom: 24px; }
.job-group header { margin-bottom: 10px; }
.job-group h2 { font: 600 15px var(--font-ui); }
.job-group h2 small { font: 600 12px var(--font-ui); color: var(--ink-3); margin-left: 4px; }
.job-group header p { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; max-width: 760px; }
.job { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 6px; }
.card .job { background: var(--surface-2); border-color: transparent; }
.job-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--neutral-soft); color: var(--ink-2); }
.job.wait .job-icon { background: var(--wait-soft); color: var(--wait); }
.job.ok .job-icon { background: var(--ok-soft); color: var(--ok); }
.job.bad .job-icon { background: var(--bad-soft); color: var(--bad); }
.job.warn .job-icon { background: var(--warn-soft); color: var(--warn); }
.job-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.job-title h3 { font: 600 13.5px var(--font-ui); }
.job-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.job-sub a { color: var(--accent); text-decoration: none; font-weight: 600; }
.job-sub a:hover { text-decoration: underline; }
.job-msg { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.job-id { font-size: 10.5px; color: var(--ink-4); margin-top: 4px; overflow-wrap: anywhere; }
.job-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* library */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.asset-card { all: unset; cursor: pointer; display: grid; gap: 3px; align-content: start; min-width: 0; }
.asset-thumb { position: relative; aspect-ratio: 9/16; border-radius: 10px; overflow: hidden; background: var(--stage); display: grid; place-items: center; box-shadow: 0 0 0 1px var(--line); transition: transform .15s, box-shadow .15s; margin-bottom: 6px; }
.asset-thumb img, .asset-thumb video { width: 100%; height: 100%; object-fit: cover; }
.asset-thumb.audio { background: linear-gradient(160deg, var(--accent-soft), var(--surface-3)); }
.audio-thumb .i { width: 34px; height: 34px; color: var(--accent); }
.asset-card:hover .asset-thumb { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--line-2), var(--shadow-2); }
.asset-card:focus-visible .asset-thumb { box-shadow: var(--focus); }
.asset-kind { position: absolute; left: 7px; top: 7px; padding: 2px 7px; border-radius: 5px; background: rgb(15 12 9 / .62); color: #F4ECE0; font: 600 10.5px var(--font-ui); backdrop-filter: blur(4px); }
.asset-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-meta { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* connections */
.integration { list-style: none; margin: 10px 0 0; padding: 0; display: grid; }
.integration li { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.integration li:last-child { border-bottom: 0; }
.integration li div { display: grid; gap: 1px; }
.integration b { font-size: 13.5px; font-weight: 600; }
.integration span { font-size: 12px; color: var(--ink-3); }
.card > h2 { font: 600 15px var(--font-ui); display: flex; gap: 8px; align-items: center; }
.card > h2 .i { color: var(--ink-3); }

/* ---------- AI text edit ---------- */
.agent { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.agent .section-title { margin: 0; }
.agent .section-title .i { color: var(--accent); }
.agent-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.agent-presets .tag { height: 24px; padding: 0 9px; border-radius: 12px; font-size: 12px; }
.agent-input { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 4px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); transition: border-color .12s, box-shadow .12s; }
.agent-input:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.agent-input textarea { border: 0 !important; box-shadow: none !important; background: transparent !important; resize: none; min-height: 40px; padding: 6px 8px; }
.agent-input .btn { flex: none; width: 32px; height: 32px; }
.launch-status .i { width: 13px; height: 13px; }
.agent > .launch-status { margin-top: -4px; }
.agent-log { list-style: none; margin: 0; padding: 0; display: grid; }
.agent-log li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 12.5px; min-width: 0; }
.agent-log q, .proposal q { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); quotes: "«" "»"; }
.proposal { border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--accent) 3%, var(--surface)); padding: 12px; display: grid; gap: 10px; }
.proposal header { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; }
.proposal q { font-weight: 600; color: var(--ink); }
.proposal footer { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.diff { white-space: pre-wrap; font-family: var(--font-serif-text); font-size: 14.5px; line-height: 1.6; max-height: 260px; overflow: auto; padding: 10px 12px; border-radius: 8px; background: var(--surface); }
.diff ins, .diff del { text-decoration: none; border-radius: 3px; padding: 0 2px; }
.diff ins { background: var(--ok-soft); color: var(--ok); }
.diff del { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 60%, transparent); }

/* ---------- thumbnail history strip (style, cast versions) ---------- */
.thumb-strip { display: flex; gap: 8px; overflow-x: auto; padding: 3px 3px 6px; margin: -3px -3px 4px; scrollbar-width: thin; }
.strip-item { all: unset; cursor: pointer; position: relative; flex: none; width: 58px; aspect-ratio: 9/16; border-radius: 8px; overflow: hidden; background: var(--stage); box-shadow: 0 0 0 1px var(--line); transition: box-shadow .12s, transform .12s; }
.strip-item img { width: 100%; height: 100%; object-fit: cover; }
.strip-item:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px var(--ink-4); }
.strip-item.current { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.strip-item:focus-visible { box-shadow: var(--focus); }
.strip-n { position: absolute; left: 4px; bottom: 4px; padding: 0 4px; border-radius: 4px; background: rgb(15 12 9 / .62); color: #fff; font: 700 10px var(--font-mono); }
.strip-item .frame-ok { top: 4px; right: 4px; width: 16px; height: 16px; }
.thumb-strip.small .strip-item { width: 44px; }

/* ---------- characters & locations ---------- */
.cast-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.cast-group .section-title .i { color: var(--ink-3); }
.cast-row { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.cast-tile, .cast-add { all: unset; cursor: pointer; flex: none; width: 84px; display: grid; gap: 3px; align-content: start; }
.cast-img { position: relative; display: block; aspect-ratio: 3/4; border-radius: 10px; overflow: hidden; background: var(--surface-3); box-shadow: 0 0 0 1px var(--line); transition: box-shadow .15s, transform .15s; }
.cast-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.cast-tile:hover .cast-img { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--line-2), var(--shadow-2); }
.cast-tile:focus-visible .cast-img, .cast-add:focus-visible span:first-child { box-shadow: var(--focus); }
.cast-tile b { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.cast-tile small { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cast-wait { position: absolute; right: 6px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--wait); box-shadow: 0 0 0 2px #fff; }
.cast-add { aspect-ratio: 3/4; height: auto; border-radius: 10px; border: 1px dashed var(--line-2); display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--ink-3); font: 500 12px var(--font-ui); align-self: start; }
.cast-add:hover { border-color: var(--accent); color: var(--accent); }
.cast-editor { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 22px; align-items: start; }
.cast-media { display: grid; gap: 4px; }
.cast-media .dropzone { aspect-ratio: 3/4; }
.cast-media .thumb-strip { margin-top: 6px; }
.scene-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.scene-toggle { all: unset; cursor: pointer; position: relative; width: 38px; aspect-ratio: 9/16; border-radius: 6px; overflow: hidden; background: var(--stage); opacity: .45; box-shadow: 0 0 0 1px var(--line); transition: opacity .12s, box-shadow .12s; }
.scene-toggle img { width: 100%; height: 100%; object-fit: cover; }
.scene-toggle span { position: absolute; left: 3px; bottom: 3px; font: 700 9.5px var(--font-mono); color: #fff; text-shadow: 0 1px 2px rgb(0 0 0 / .8); }
.scene-toggle:hover { opacity: .8; }
.scene-toggle.on { opacity: 1; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.scene-toggle:focus-visible { box-shadow: var(--focus); }

/* generation inputs of a character / location */
.input-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.input-thumb, .input-add { position: relative; flex: none; width: 58px; aspect-ratio: 3/4; border-radius: 8px; overflow: hidden; }
.input-thumb { background: var(--surface-3); box-shadow: 0 0 0 1px var(--line); }
.input-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.input-thumb.fixed { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, var(--line)); }
.input-x { all: unset; cursor: pointer; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: rgb(15 12 9 / .62); color: #fff; opacity: .85; }
.input-x .i { width: 11px; height: 11px; }
.input-x:hover, .input-x:focus-visible { opacity: 1; background: var(--bad); }
.input-add { all: unset; box-sizing: border-box; cursor: pointer; width: 58px; aspect-ratio: 3/4; border-radius: 8px; border: 1px dashed var(--line-2); display: grid; place-content: center; justify-items: center; gap: 2px; color: var(--ink-3); font: 500 11px var(--font-ui); }
.input-add:hover, .input-add.drag-over { border-color: var(--accent); color: var(--accent); }
.input-add:focus-visible { box-shadow: var(--focus); }
.cast-media .section-title { margin: 0 0 4px; }
.cast-editor .field > .sub { margin: 8px 0 6px; font-size: 12px; }
.cast-create .launch-row { justify-content: space-between; }
.cast-create .launch-status { flex: 1 1 220px; }
.cast-create .launch-row > .row { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; min-width: 0; }

/* characters & locations found in the original */
.cast-extract .launch { margin-top: 16px; }
.cast-extract .note { margin-top: 8px; }
.cast-proposal { margin-top: 16px; }
.cast-proposal > .sub { margin: -4px 0 0; font-size: 12.5px; }
.cp-list { display: grid; gap: 6px; }
.cp-item { display: grid; gap: 6px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.cp-main { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 10px; align-items: start; cursor: pointer; }
.cp-main input { margin: 3px 0 0; accent-color: var(--accent); width: 15px; height: 15px; }
.cp-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-3); }
.cp-icon .i { width: 14px; height: 14px; }
.cp-body { display: grid; gap: 3px; min-width: 0; }
.cp-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.cp-head b { font-size: 13.5px; }
.cp-head small { color: var(--ink-3); font-size: 12px; }
.cp-desc { font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.cp-main:has(input:not(:checked)) .cp-body { opacity: .55; }
.cp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-left: 61px; font-size: 12px; color: var(--ink-3); }
.cp-meta .tag { height: 22px; padding: 0 7px; font-size: 11.5px; }

/* ---------- frame generation & references ---------- */
.gen-box { display: grid; gap: 12px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.gen-box .section-title { margin: 0; }
.gen-box .section-title .i { color: var(--accent); }
.gen-box .launch { margin-top: 0; padding-top: 12px; }
.gen-box textarea { background: var(--surface); }
.refs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ref-chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px 0 3px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font: 500 12.5px var(--font-ui); max-width: 200px; }
.ref-chip img, .ref-chip .no-media { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; object-position: 50% 25%; flex: none; }
.ref-chip .no-media .i { width: 13px; height: 13px; }
.ref-chip span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ref-chip.style { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.res { display: inline-block; padding: 0 5px; border-radius: 4px; font: 700 10.5px/16px var(--font-mono); background: var(--ok-soft); color: var(--ok); vertical-align: 1px; }
.res-360p { background: var(--warn-soft); color: var(--warn); }
.seg button[disabled] { opacity: .4; cursor: not-allowed; }

/* @mentions in scene prompts */
.mention-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: -4px; min-height: 26px; }
.mention-tip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.mention-tip .i { width: 13px; height: 13px; }
.mention-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px 0 2px; border-radius: 13px; border: 1px dashed var(--line-2); background: var(--surface); font: 500 12px var(--font-ui); color: var(--ink-2); max-width: 100%; }
.mention-chip img, .mention-chip .no-media { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; object-position: 50% 25%; flex: none; }
.mention-chip .no-media .i { width: 12px; height: 12px; }
.mention-chip > span:not(.no-media) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mention-chip em { font-style: normal; color: var(--ink-3); font-size: 11px; }
.mention-chip > .i { width: 13px; height: 13px; flex: none; }
.mention-chip.on { border-style: solid; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--ink); }
.mention-chip.on > .i { color: var(--ok); }
.mention-chip.unknown { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; border: 1px dashed var(--warn); background: var(--warn-soft); font: 500 12px var(--font-ui); color: var(--ink); }
.mention-chip.unknown > .i { width: 12px; height: 12px; color: var(--accent); }
.mention-chip.unknown span { color: var(--accent); font-weight: 600; }
.mention-chip.unknown:hover { border-style: solid; }
.mention-chip.unknown:focus-visible { box-shadow: var(--focus); }
.mention-menu { position: fixed; z-index: 300; width: 270px; max-width: calc(100vw - 16px); padding: 5px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-3); display: grid; gap: 1px; }
.mention-item { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center; gap: 9px; padding: 5px 8px 5px 5px; border-radius: 8px; }
.mention-item.on, .mention-item:hover { background: var(--surface-3); }
.mention-item.on { box-shadow: inset 2px 0 0 var(--accent); }
.mi-img { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-3); }
.mi-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.mi-img .i { width: 14px; height: 14px; }
.mention-item.new .mi-img { background: var(--accent-soft); color: var(--accent); }
.mention-item b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mention-item small { display: block; font-size: 11.5px; color: var(--ink-3); }
.mention-empty { padding: 8px 10px; font-size: 12.5px; color: var(--ink-3); }

/* scene lengths from the original */
.strip-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.strip-bar .sub { font-size: 12.5px; }
.durations { display: grid; grid-template-columns: minmax(180px, 230px) minmax(0, 1fr); gap: 20px; align-items: start; }
.dur-player { position: sticky; top: 0; display: grid; gap: 10px; }
.dur-player .note .i { width: 13px; height: 13px; vertical-align: -2px; }
.dur-rows { display: grid; gap: 6px; }
.dur-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.dur-row:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.dur-thumb { position: relative; width: 44px; aspect-ratio: 9/16; border-radius: 6px; overflow: hidden; background: var(--stage); }
.dur-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dur-thumb b { position: absolute; left: 3px; bottom: 3px; font: 700 10px var(--font-mono); color: #fff; text-shadow: 0 1px 2px rgb(0 0 0 / .8); }
.dur-main { display: grid; gap: 6px; min-width: 0; }
.dur-name { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dur-inputs { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.dur-field { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.dur-field input { width: 76px; height: 30px; font-family: var(--font-mono); font-size: 13px; }
.dur-sum { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); }
.dur-sum b { color: var(--ink); }
.dur-warn { display: inline-flex; align-items: center; gap: 5px; color: var(--warn); }
.dur-warn .i { width: 13px; height: 13px; flex: none; }
.dur-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); }
.dur-foot .sub { flex: 1 1 260px; margin: 0; font-size: 12px; }
@media (max-width: 760px) {
  .durations { grid-template-columns: minmax(0, 1fr); }
  .dur-player { top: -14px; z-index: 2; margin: -14px -4px 0; padding: 14px 4px 10px; background: var(--surface); border-bottom: 1px solid var(--line); grid-template-columns: 96px minmax(0, 1fr); align-items: start; }
}

/* reference picker */
.pick-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.pick { position: relative; cursor: pointer; width: 92px; display: grid; gap: 2px; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick-img { display: block; aspect-ratio: 3/4; border-radius: 10px; overflow: hidden; background: var(--surface-3); box-shadow: 0 0 0 1px var(--line); transition: box-shadow .12s; position: relative; }
.pick-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.pick-img::after { content: ""; position: absolute; right: 6px; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: rgb(255 255 255 / .85); border: 1.5px solid var(--line-2); }
.pick input:checked + .pick-img { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.pick input:checked + .pick-img::after { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7'/%3E%3C/svg%3E") center / 11px no-repeat; border-color: var(--accent); }
.pick input:focus-visible + .pick-img { box-shadow: var(--focus); }
.pick b { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.pick small { font-size: 11px; color: var(--ink-3); }
.pick-add { all: unset; cursor: pointer; width: 92px; aspect-ratio: 3/4; border-radius: 10px; border: 1px dashed var(--line-2); display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--ink-3); font: 500 12px var(--font-ui); }
.pick-add:hover, .pick-add.drag-over { border-color: var(--accent); color: var(--accent); }
.pick-add.drag-over { background: var(--accent-soft); }
.pick-add:focus-visible { box-shadow: var(--focus); }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgb(18 14 10 / .5); backdrop-filter: blur(3px); animation: fade .15s ease-out; }
.modal { width: min(680px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-3); border: 1px solid var(--line); animation: rise .2s ease-out; }
.modal.wide { width: min(1040px, 100%); }
.modal.narrow { width: min(480px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font: 600 15px var(--font-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 18px 20px 20px; overflow: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.media-modal { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.modal-media { border-radius: 12px; overflow: hidden; background: var(--stage); display: grid; place-items: center; max-height: 72vh; }
.modal-media img { max-height: 72vh; width: auto; margin: auto; object-fit: contain; }
.modal-media.stage video { max-height: 72vh; width: auto; aspect-ratio: auto; }
.modal-audio { display: grid; gap: 14px; justify-items: center; padding: 26px; border-radius: 12px; background: linear-gradient(160deg, var(--accent-soft), var(--surface-3)); }
.modal-audio > .i { width: 38px; height: 38px; color: var(--accent); }
.modal-audio .ap { width: 100%; }
.meta-list { margin: 0 0 14px; display: grid; }
.meta-list > div { display: grid; grid-template-columns: 100px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.meta-list > div:last-child { border-bottom: 0; }
.meta-list dt { color: var(--ink-3); }
.meta-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
pre.code { margin: 0; padding: 14px; border-radius: 10px; background: var(--stage); color: var(--stage-ink); font: 12px/1.55 var(--font-mono); overflow: auto; max-height: 64vh; white-space: pre-wrap; overflow-wrap: anywhere; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cmp-col { margin: 0; display: grid; gap: 10px; align-content: start; }
.cmp-col figcaption { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.cmp-col figcaption select { width: auto; flex: 1; min-width: 0; }
.cmp-col .stage.portrait { width: min(100%, calc(min(60vh, 580px) * .5625)); }
.transport { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); flex-wrap: wrap; }
.transport .time { font-size: 12px; color: var(--ink-2); min-width: 84px; }
.mixer { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: start; }
.mixer .stage.portrait { width: calc(min(58vh, 540px) * .5625); }
.mixer-side { display: grid; gap: 16px; justify-items: start; align-content: start; padding-top: 4px; }
.mix-title { font: 600 18px/1.25 var(--font-serif); margin-bottom: 4px; overflow-wrap: anywhere; }
.mix-controls { width: 100%; display: grid; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.mixer-side .slider { width: 100%; grid-template-columns: 70px minmax(0, 1fr) 44px; }
.timeline-events { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline-events li { display: grid; grid-template-columns: 48px 1fr; gap: 12px; padding: 6px 0 6px 16px; border-left: 2px solid var(--line); margin-left: 5px; position: relative; font-size: 13px; }
.timeline-events li::before { content: ""; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); }
.timeline-events li.day { display: block; border: 0; margin: 12px 0 2px; padding: 0; font: 600 11px var(--font-ui); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.timeline-events li.day::before { display: none; }
.timeline-events time { font: 12px var(--font-mono); color: var(--ink-3); }
.text-versions { display: grid; gap: 10px; }
.tversion { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); }
.tversion.current { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.tversion header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.tversion header .btn { margin-left: auto; }
.tversion p { white-space: pre-wrap; font-family: var(--font-serif-text); font-size: 14.5px; line-height: 1.55; color: var(--ink-2); max-height: 220px; overflow: auto; }
.tversion ins { text-decoration: none; background: var(--ok-soft); color: var(--ok); border-radius: 3px; padding: 0 2px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 200; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(400px, calc(100vw - 32px)); }
.toast { position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border-radius: 12px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-3); font-size: 13px; animation: rise .2s ease-out; }
.toast > .i { width: 16px; height: 16px; margin-top: 1px; color: #7FD3A6; }
.toast.error > .i { color: #F59A8C; }
.toast.info > .i { color: #B4B7F2; }
.toast span { flex: 1; }
.toast button { all: unset; cursor: pointer; opacity: .55; display: grid; }
.toast button:hover { opacity: 1; }
.toast-progress { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); transition: width .2s; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .studio-body { grid-template-columns: minmax(0, 1fr) 290px; }
  .step-text small { display: none; }
  .step a { padding: 7px 6px; gap: 6px; }
}
@media (max-width: 1100px) {
  .studio-body { grid-template-columns: minmax(0, 1fr); }
  .rail-toggle { display: none; }
  .rail, .rail-closed .rail { display: grid; position: fixed; z-index: 90; left: 0; right: 0; bottom: 0; top: auto; max-height: 86vh; padding: 44px 14px 18px; background: var(--bg); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-3); transform: translateY(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); overflow: auto; }
  .sheet-open .rail { transform: none; }
  body.sheet-lock { overflow: hidden; }
  .sheet-close { display: inline-flex; position: absolute; right: 10px; top: 6px; }
  .rail .stage.portrait { width: min(100%, calc(min(40vh, 400px) * .5625)); }
  .sheet-fab { display: inline-flex; align-items: center; gap: 8px; position: fixed; z-index: 80; right: 16px; bottom: 16px; height: 42px; padding: 0 16px; border-radius: 21px; border: 0; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-3); font: 600 13px var(--font-ui); cursor: pointer; }
  .sheet-fab i { width: 1px; height: 16px; background: color-mix(in srgb, var(--bg) 30%, transparent); }
  .sheet-open .sheet-fab { display: none; }
  .split, .sub-split, .final-split { grid-template-columns: minmax(0, 1fr); }
  .toasts { bottom: 70px; }
}
@media (max-width: 960px) {
  .stepper { overflow-x: auto; scrollbar-width: none; }
  .stepper ol { display: flex; flex: none; }
  .step-text small { display: block; }
  .text-columns, .grid-2, .kv, .music-grid, .cast-groups { grid-template-columns: minmax(0, 1fr); }
  .cast-editor { grid-template-columns: minmax(0, 1fr); }
  .cast-media .stage.portrait.short, .cast-media .dropzone { width: min(100%, 220px); margin-inline: auto; }
  .music-grid > .stack:first-child { padding: 0 0 18px; border-right: 0; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
  .music-grid > .stack:last-child { padding: 0; }
  .continue { grid-template-columns: 1fr; }
  .continue-reel { min-height: 210px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .source-row { grid-template-columns: minmax(0, 1fr); }
  .media-modal, .mixer { grid-template-columns: minmax(0, 1fr); }
  .mixer .stage.portrait { width: min(100%, calc(min(48vh, 440px) * .5625)); }
}
@media (max-width: 760px) {
  :root { --top: 52px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topnav, .local-pill { display: none; }
  .bottomnav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .bottomnav .nav-item { flex-direction: column; height: auto; gap: 1px; padding: 6px 2px; font-size: 10.5px; justify-content: center; }
  .bottomnav .nav-item .i { width: 18px; height: 18px; }
  .bottomnav .nav-item.active { box-shadow: none; background: transparent; color: var(--accent); }
  .bottomnav .nav-item .count { position: absolute; top: 2px; left: 56%; height: 16px; min-width: 16px; font-size: 9.5px; line-height: 16px; padding: 0 4px; }
  .main { padding-bottom: 64px; }
  .page { padding: 20px 14px 36px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .page-head h1 { font-size: 32px; }
  .head-actions .btn { width: 100%; }
  .toolbar, .toolbar-right { flex-direction: column; align-items: stretch; }
  .toolbar .seg { overflow-x: auto; scrollbar-width: none; }
  .search input { width: 100% !important; }
  .select-inline select { width: 100%; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pcard-body { padding: 10px 12px; }
  .pcard-body h3 { font-size: 15.5px; }
  .pcard-new { min-height: 0; grid-column: 1 / -1; flex-direction: row; padding: 14px; }
  .pcard-new span { display: none; }
  .continue-body { padding: 18px; }
  .continue-body h2 { font-size: 24px; }
  .mini-stepper { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .studio { padding: 12px 14px 84px; }
  .studio-title { flex-direction: column; align-items: stretch; gap: 10px; }
  .studio-title h1 { font-size: 25px; }
  .studio-actions .btn span { display: none; }
  .studio-actions .btn { width: 30px; padding: 0; }
  .card { padding: 14px; border-radius: 12px; }
  .card-head { flex-wrap: wrap; }
  .card-head > .seg { width: 100%; display: flex; }
  .card-head > .seg button { flex: 1; }
  .compare { gap: 8px; }
  .cmp-col figcaption { flex-wrap: wrap; gap: 6px; }
  .transport .seg { width: 100%; display: flex; } .transport .seg button { flex: 1; }
  .progress-steps { flex-direction: column; }
  .job { grid-template-columns: auto minmax(0, 1fr); }
  .job-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal, .modal.wide, .modal.narrow { width: 100%; max-height: 94vh; border-radius: 16px 16px 0 0; }
  .modal-body { padding: 14px; }
  .trim-fields { grid-template-columns: 1fr 1fr; }
  .trim-len { grid-column: 1 / -1; display: flex; gap: 8px; align-items: baseline; justify-content: space-between; padding: 0; }
  .sheet-fab { bottom: 76px; }
  .toasts { left: 14px; right: 14px; width: auto; bottom: 128px; }
  .choice { grid-template-columns: auto minmax(0, 1fr) auto; }
  .choice .id { display: none; }
  .character-row { grid-template-columns: auto 1fr; }
  .character-row select { grid-column: 1 / -1; }
  .manual-row { grid-template-columns: minmax(0, 1fr); }
  .slider { grid-template-columns: 92px minmax(0, 1fr) 40px; gap: 8px; }
  .source-strip { flex-wrap: wrap; }
  .source-strip .facts { flex-basis: calc(100% - 100px); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
