/* Layout: video-editor shell. Left rail + panel (Media / Captions / Auto captions), centre caption preview,
   right style inspector, full-width multi-track timeline along the bottom. Dark-first, light theme supported. */
:root {
  --bg:#0B0C10; --panel:#14161C; --panel-2:#1A1D25; --panel-3:#232733; --line:#262B37; --line-2:#363C4B;
  --ink:#EDEFF5; --ink-2:#A5ACBC; --ink-3:#6D7587;
  --accent:#6C9BFF; --accent-ink:#0A0C12; --accent-soft:rgba(108,155,255,.15); --accent-line:rgba(108,155,255,.5);
  --live:#FF5A6E; --ok:#3DD6A0; --warn:#F2B84B; --danger:#FF6B80; --danger-soft:rgba(255,107,128,.14);
  --stage-bg:#07080B; --tl-bg:#0F1116; --tl-row:#12141A; --tl-head:#171A21;
  --vid-bg:#262E5C; --vid-line:#5B6BE0; --vid-ink:#C9D0FF;
  --aud-bg:#103A36; --aud-line:#2FC4A9; --aud-ink:#BFF3E8;
  --cc0-bg:#4A3B12; --cc0-line:#E7B341; --cc0-ink:#FFDD93;
  --cc1-bg:#3B2A5C; --cc1-line:#B48CFF; --cc1-ink:#E0D0FF;
  --cc2-bg:#4F2335; --cc2-line:#FF7FA6; --cc2-ink:#FFC6D8;
  --cc3-bg:#17404D; --cc3-line:#5FD0F0; --cc3-ink:#C0F0FF;
  --shadow:0 1px 2px rgba(0,0,0,.4),0 16px 40px -18px rgba(0,0,0,.7);
  --font-ui:'Geist','Noto Sans Sinhala',ui-sans-serif,system-ui,-apple-system,'Segoe UI',sans-serif;
  --font-mono:'Geist Mono','Noto Sans Sinhala',ui-monospace,'SF Mono',Menlo,monospace;
  --gl:max(16px,env(safe-area-inset-left,0px)); --gr:max(16px,env(safe-area-inset-right,0px));
  --gut:184px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:#E8EAF0; --panel:#FFFFFF; --panel-2:#F4F5F8; --panel-3:#E9ECF2; --line:#DCE0E8; --line-2:#C5CBD7;
    --ink:#12151D; --ink-2:#4F566A; --ink-3:#868DA0;
    --accent:#2D5BE8; --accent-ink:#FFFFFF; --accent-soft:rgba(45,91,232,.1); --accent-line:rgba(45,91,232,.45);
    --live:#E5384F; --ok:#0E9B6C; --warn:#A86300; --danger:#D12F49; --danger-soft:rgba(209,47,73,.1);
    --stage-bg:#CDD2DD; --tl-bg:#EDEFF4; --tl-row:#F4F5F9; --tl-head:#FFFFFF;
    --vid-bg:#D8DCFF; --vid-line:#6573E6; --vid-ink:#2A3590;
    --aud-bg:#C6EEE5; --aud-line:#1C9D86; --aud-ink:#0B5E50;
    --cc0-bg:#FFEDBE; --cc0-line:#D69A1B; --cc0-ink:#6A4700;
    --cc1-bg:#E9DEFF; --cc1-line:#8E63E3; --cc1-ink:#4A2A8F;
    --cc2-bg:#FFDCE7; --cc2-line:#E0507E; --cc2-ink:#7A1E3F;
    --cc3-bg:#CDEFFA; --cc3-line:#2AA3C7; --cc3-ink:#0B4F63;
    --shadow:0 1px 2px rgba(20,24,40,.06),0 14px 32px -18px rgba(20,24,40,.3);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg:#E8EAF0; --panel:#FFFFFF; --panel-2:#F4F5F8; --panel-3:#E9ECF2; --line:#DCE0E8; --line-2:#C5CBD7;
  --ink:#12151D; --ink-2:#4F566A; --ink-3:#868DA0;
  --accent:#2D5BE8; --accent-ink:#FFFFFF; --accent-soft:rgba(45,91,232,.1); --accent-line:rgba(45,91,232,.45);
  --live:#E5384F; --ok:#0E9B6C; --warn:#A86300; --danger:#D12F49; --danger-soft:rgba(209,47,73,.1);
  --stage-bg:#CDD2DD; --tl-bg:#EDEFF4; --tl-row:#F4F5F9; --tl-head:#FFFFFF;
  --vid-bg:#D8DCFF; --vid-line:#6573E6; --vid-ink:#2A3590;
  --aud-bg:#C6EEE5; --aud-line:#1C9D86; --aud-ink:#0B5E50;
  --cc0-bg:#FFEDBE; --cc0-line:#D69A1B; --cc0-ink:#6A4700;
  --cc1-bg:#E9DEFF; --cc1-line:#8E63E3; --cc1-ink:#4A2A8F;
  --cc2-bg:#FFDCE7; --cc2-line:#E0507E; --cc2-ink:#7A1E3F;
  --cc3-bg:#CDEFFA; --cc3-line:#2AA3C7; --cc3-ink:#0B4F63;
  --shadow:0 1px 2px rgba(20,24,40,.06),0 14px 32px -18px rgba(20,24,40,.3);
  color-scheme: light;
}

*,*::before,*::after { box-sizing:border-box; }
[hidden] { display:none !important; }
html,body { height:100%; }
body { margin:0; background:var(--bg); color:var(--ink); font:13px/1.45 var(--font-ui); -webkit-font-smoothing:antialiased; }
button,input,select,textarea { font:inherit; color:inherit; }
button { cursor:pointer; }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.grow { flex:1 1 auto; }
svg.i { width:16px; height:16px; flex:none; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
svg.i.f { fill:currentColor; stroke-width:1.4; }

/* ---------- shell ---------- */
.app { height:100%; min-height:600px; display:flex; flex-direction:column; gap:8px; padding-block:0 10px; padding-left:var(--gl); padding-right:var(--gr); }
.topbar { flex:none; height:52px; display:flex; align-items:center; gap:10px; }
.brand { display:flex; align-items:center; gap:10px; white-space:nowrap; }
.logo { width:30px; height:30px; flex:none; }
.logo .bg { fill:var(--accent); } .logo .fg { fill:var(--accent-ink); }
.brand b { font-size:15px; font-weight:650; letter-spacing:-.015em; } .brand span { color:var(--ink-3); font-size:15px; font-weight:500; margin-left:5px; }
.proj { margin-left:14px; padding-left:14px; border-left:1px solid var(--line-2); }
.proj input { width:190px; height:30px; padding:0 8px; border:1px solid transparent; border-radius:7px; background:transparent; font-weight:500; font-size:13px; }
.proj input:hover { border-color:var(--line-2); } .proj input:focus { background:var(--panel); border-color:var(--accent); outline:none; }
.vsep { width:1px; height:20px; background:var(--line-2); margin:0 4px; }

.card { background:var(--panel); border:1px solid var(--line); border-radius:14px; min-width:0; min-height:0; }
.body { flex:1; min-height:0; display:grid; gap:8px; --left-w:288px; --right-w:300px; --tl-h:clamp(236px,36vh,360px);
  grid-template-columns:62px var(--left-w) minmax(0,1fr) var(--right-w); grid-template-rows:minmax(0,1fr) var(--tl-h);
  grid-template-areas:"rail left center right" "rail tl tl tl"; transition:grid-template-columns .2s ease; }
.body[data-tab="captions"] { --left-w:clamp(448px,36vw,720px); }
.body[data-tab="generate"] { --left-w:316px; }
.body[data-tab="ai"] { --left-w:clamp(340px,28vw,430px); }

/* ---------- buttons & controls ---------- */
.btn { height:32px; padding:0 12px; display:inline-flex; align-items:center; justify-content:center; gap:7px; border:1px solid var(--line-2); border-radius:8px; background:var(--panel-2); color:var(--ink); font-size:12.5px; font-weight:500; white-space:nowrap; transition:background .12s,filter .12s,border-color .12s; }
.btn:hover { background:var(--panel-3); }
.btn.sm { height:28px; padding:0 10px; font-size:12px; gap:6px; }
.btn.primary { background:var(--accent); color:var(--accent-ink); border-color:transparent; }
.btn.primary:hover { filter:brightness(1.1); background:var(--accent); }
.btn.soft { background:var(--accent-soft); color:var(--accent); border-color:var(--accent-line); }
.btn.lg { height:38px; padding:0 16px; font-size:13.5px; }
.btn:disabled { opacity:.4; cursor:not-allowed; filter:none; }
.btn[aria-pressed="true"] { background:var(--accent-soft); color:var(--accent); border-color:var(--accent-line); }
.icon-btn { width:30px; height:30px; display:inline-grid; place-items:center; flex:none; border:0; border-radius:8px; background:transparent; color:var(--ink-2); }
.icon-btn:hover:not(:disabled) { background:var(--panel-3); color:var(--ink); }
.icon-btn:disabled { opacity:.35; cursor:not-allowed; }
.icon-btn[aria-pressed="true"] { background:var(--accent-soft); color:var(--accent); }
.seg { display:inline-flex; padding:2px; gap:2px; background:var(--panel-3); border-radius:9px; max-width:100%; }
.seg button { height:26px; padding:0 10px; border:0; border-radius:7px; background:transparent; color:var(--ink-2); font-size:12px; font-weight:500; white-space:nowrap; }
.seg button:hover { color:var(--ink); }
.seg button[aria-pressed="true"] { background:var(--panel); color:var(--ink); box-shadow:0 0 0 1px var(--line-2),0 1px 2px rgba(0,0,0,.2); }
.seg.full { display:flex; width:100%; } .seg.full button { flex:1; padding:0 6px; }
select,input[type=text],input[type=number],input[type=password] { width:100%; height:32px; padding:0 10px; border:1px solid var(--line-2); border-radius:8px; background:var(--panel-2); color:var(--ink); font-size:12.5px; }
select { appearance:none; padding-right:28px; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A91A3' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 9px center; }
select option { background:var(--panel-2); color:var(--ink); }
select:hover,input[type=text]:hover { border-color:var(--ink-3); }
select:focus-visible,input:focus-visible { outline:2px solid var(--accent); outline-offset:0; border-color:transparent; }
.chip { display:inline-flex; align-items:center; height:19px; padding:0 7px; border-radius:999px; background:var(--panel-3); color:var(--ink-2); font:500 10.5px var(--font-mono); white-space:nowrap; }
.chip.warn { background:rgba(242,184,75,.16); color:var(--warn); }
.chip.ok { background:var(--accent-soft); color:var(--accent); }
.chip.bad { background:var(--danger-soft); color:var(--danger); }
.count { font:500 11.5px var(--font-mono); color:var(--ink-3); white-space:nowrap; }
.hint { margin:0; font-size:11.5px; color:var(--ink-3); }
.sw { position:relative; width:32px; height:18px; flex:none; border:0; border-radius:9px; background:var(--panel-3); box-shadow:inset 0 0 0 1px var(--line-2); }
.sw::after { content:""; position:absolute; top:2px; left:2px; width:14px; height:14px; border-radius:50%; background:var(--ink-2); transition:transform .15s,background .15s; }
.sw[aria-checked="true"] { background:var(--accent); box-shadow:none; } .sw[aria-checked="true"]::after { transform:translateX(14px); background:var(--accent-ink); }
.cinp { position:relative; width:28px; height:28px; flex:none; border-radius:7px; border:1px solid var(--line-2); overflow:hidden; background:var(--panel-3); }
.cinp input { position:absolute; inset:-8px; width:calc(100% + 16px); height:calc(100% + 16px); padding:0; border:0; cursor:pointer; background:none; }
.cinp:has(input:disabled) { opacity:.4; }
input[type=range] { -webkit-appearance:none; appearance:none; width:100%; height:18px; margin:0; background:transparent; --p:50%; }
input[type=range]::-webkit-slider-runnable-track { height:4px; border-radius:2px; background:linear-gradient(to right,var(--accent) var(--p),var(--panel-3) var(--p)); }
input[type=range]::-moz-range-track { height:4px; border-radius:2px; background:var(--panel-3); }
input[type=range]::-moz-range-progress { height:4px; border-radius:2px; background:var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance:none; width:14px; height:14px; margin-top:-5px; border-radius:50%; background:var(--ink); border:2px solid var(--panel); box-shadow:0 0 0 1px var(--line-2); }
input[type=range]::-moz-range-thumb { width:11px; height:11px; border-radius:50%; background:var(--ink); border:2px solid var(--panel); }
input[type=range]:disabled { opacity:.4; }
.tags { display:flex; flex-wrap:wrap; gap:5px; padding:5px; min-height:36px; border:1px solid var(--line-2); border-radius:8px; background:var(--panel-2); }
.tags:focus-within { outline:2px solid var(--accent); border-color:transparent; }
.tag { display:inline-flex; align-items:center; gap:2px; height:22px; padding:0 3px 0 8px; border-radius:6px; background:var(--accent-soft); color:var(--accent); font-size:12px; font-weight:500; }
.tag button { width:16px; height:16px; display:grid; place-items:center; border:0; border-radius:4px; background:transparent; color:inherit; opacity:.7; }
.tag button:hover { opacity:1; }
.tag button svg.i { width:10px; height:10px; stroke-width:2.4; }
.tags input { flex:1 1 70px; min-width:56px; width:auto; height:22px; padding:0 4px; border:0; background:transparent; outline:none; }
.field { display:grid; gap:6px; margin-top:14px; } .field:first-child { margin-top:2px; }
.field > .lbl,.field > label { font-size:12px; font-weight:500; color:var(--ink-2); }

/* ---------- rail & left panel ---------- */
.rail { grid-area:rail; display:flex; flex-direction:column; align-items:center; gap:4px; padding:8px 6px; }
.rbtn { width:100%; display:flex; flex-direction:column; align-items:center; gap:4px; padding:9px 0 7px; border:0; border-radius:10px; background:transparent; color:var(--ink-2); font-size:10.5px; font-weight:500; }
.rbtn:hover { background:var(--panel-3); color:var(--ink); }
.rbtn[aria-selected="true"] { background:var(--accent-soft); color:var(--accent); }
.rbtn svg.i { width:19px; height:19px; }
.left { grid-area:left; display:flex; flex-direction:column; overflow:hidden; }
.pane { display:flex; flex-direction:column; flex:1; min-height:0; }
.p-head { flex:none; display:flex; align-items:center; gap:8px; padding:12px 14px 10px; }
.p-head h2 { margin:0; font-size:14px; font-weight:600; letter-spacing:-.01em; }
.p-scroll { flex:1; min-height:0; overflow:auto; position:relative; scrollbar-width:thin; scrollbar-color:var(--line-2) transparent; }
.p-bar { flex:none; padding:8px 14px; border-top:1px solid var(--line); border-bottom:1px solid var(--line); background:var(--panel-2); }
.p-foot { flex:none; padding:10px 14px; border-top:1px solid var(--line); }
.drop { display:grid; grid-template-columns:auto 1fr; align-items:center; justify-items:start; column-gap:12px; margin:0 14px 12px; padding:10px 12px; text-align:left; cursor:pointer; border:1.5px dashed var(--line-2); border-radius:12px; color:var(--ink-2); transition:border-color .15s,background .15s; }
.drop.over { border-color:var(--accent); background:var(--accent-soft); }
.p-scroll.over { background:var(--accent-soft); box-shadow:inset 0 0 0 2px var(--accent); border-radius:12px; }
.drop .dz { grid-row:span 2; width:32px; height:32px; display:grid; place-items:center; border-radius:50%; background:var(--panel-3); color:var(--accent); }
.drop b { color:var(--ink); font-weight:600; font-size:13px; } .drop small { font-size:11.5px; color:var(--ink-3); }
.media-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; padding:0 14px 14px; }
.mcard { position:relative; min-width:0; border-radius:10px; border:1px solid var(--line); background:var(--panel-2); overflow:hidden; cursor:grab; }
.mcard:hover { border-color:var(--line-2); }
.mcard.drag { opacity:.5; }
.mthumb { position:relative; aspect-ratio:16/10; display:grid; place-items:center; }
.mthumb .badge { position:absolute; right:6px; bottom:6px; padding:1px 6px; border-radius:5px; background:rgba(0,0,0,.6); color:#fff; font:500 10.5px var(--font-mono); }
.mthumb .type { position:absolute; left:6px; top:6px; width:20px; height:20px; display:grid; place-items:center; border-radius:6px; background:rgba(0,0,0,.55); color:#fff; }
.mthumb .type svg.i { width:12px; height:12px; }
.mthumb .bars { display:flex; align-items:center; gap:2px; height:50%; }
.mthumb .bars i { width:3px; border-radius:2px; background:var(--aud-line); }
.minfo { padding:7px 9px 8px; min-width:0; }
.minfo b { display:block; font-size:12px; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.minfo small { font-size:11px; color:var(--ink-3); }
.madd { position:absolute; right:6px; top:6px; width:24px; height:24px; display:grid; place-items:center; border:0; border-radius:7px; background:var(--accent); color:var(--accent-ink); opacity:0; transition:opacity .12s; }
.mcard:hover .madd,.madd:focus-visible { opacity:1; }
@media (hover:none) { .madd { opacity:1; } }
.media-grid.list { grid-template-columns:minmax(0,1fr); gap:6px; }
.media-grid.list .mcard { display:flex; align-items:center; gap:10px; padding:6px 8px 6px 6px; }
.media-grid.list .mthumb { width:62px; flex:none; border-radius:7px; overflow:hidden; }
.media-grid.list .mthumb .badge, .media-grid.list .mthumb .type { display:none; }
.media-grid.list .minfo { flex:1; padding:0; }
.media-grid.list .madd { position:static; opacity:1; flex:none; background:var(--panel-3); color:var(--ink); }
#mediaViewSeg button { padding:0 8px; }
#pane-media .p-head .count { display:none; }
.mdel { position:absolute; right:36px; top:6px; width:24px; height:24px; display:grid; place-items:center; border:0; border-radius:7px; background:rgba(0,0,0,.6); color:#fff; opacity:0; transition:opacity .12s,background .12s; }
.mdel svg.i { width:13px; height:13px; }
.mdel:hover { background:var(--danger); }
.mcard:hover .mdel,.mdel:focus-visible { opacity:1; }
@media (hover:none) { .mdel { opacity:1; } }
.media-grid.list .minfo { order:2; } .media-grid.list .madd { order:3; }
.media-grid.list .mdel { order:4; position:static; opacity:1; flex:none; background:var(--panel-3); color:var(--ink-2); }
.media-grid.list .mdel:hover { background:var(--danger-soft); color:var(--danger); }

/* captions pane */
.ctabs { flex:none; display:flex; gap:6px; padding:0 14px 10px; overflow-x:auto; scrollbar-width:none; }
.ctab { flex:none; display:inline-flex; align-items:center; gap:7px; height:28px; padding:0 10px; border:1px solid var(--line-2); border-radius:8px; background:transparent; color:var(--ink-2); font-size:12px; font-weight:500; }
.ctab i { width:8px; height:8px; border-radius:50%; background:var(--c); }
.ctab small { font:500 10.5px var(--font-mono); color:var(--ink-3); }
.ctab[aria-pressed="true"] { background:var(--panel-3); color:var(--ink); border-color:var(--c); }
.search { position:relative; display:block; }
.search svg { position:absolute; left:10px; top:50%; translate:0 -50%; color:var(--ink-3); width:14px; height:14px; pointer-events:none; }
.search input { padding-left:30px; height:30px; background:var(--panel); }
.cue { display:grid; gap:8px; padding:15px 18px; border-bottom:1px solid var(--line); transition:background .1s, box-shadow .1s; }
.cue:hover { background:var(--panel-2); }
.cue.sel { background:var(--accent-soft); box-shadow:inset 3px 0 0 var(--accent); }
.cue-top { display:flex; align-items:center; gap:4px; }
.cue .idx { width:24px; flex:none; font:500 11px var(--font-mono); color:var(--ink-3); }
.cue.live .idx { color:var(--live); font-weight:700; }
.tc { width:102px; height:24px; padding:0 5px; border:1px solid transparent; border-radius:5px; background:transparent; font:400 11.5px var(--font-mono); font-variant-numeric:tabular-nums; color:var(--ink-2); }
.tc:hover { border-color:var(--line-2); } .tc:focus { background:var(--panel); color:var(--ink); }
.cue .arr { color:var(--ink-3); font-size:11px; }
.cue-acts { display:flex; gap:0; opacity:0; transition:opacity .12s; margin-left:auto; }
.cue:hover .cue-acts,.cue.sel .cue-acts,.cue:focus-within .cue-acts { opacity:1; }
@media (hover:none) { .cue-acts { opacity:1; } }
.mini { width:24px; height:24px; flex:none; display:inline-grid; place-items:center; border:0; border-radius:6px; background:transparent; color:var(--ink-3); }
.mini:hover { background:var(--panel-3); color:var(--ink); } .mini.danger:hover { background:var(--danger-soft); color:var(--danger); }
.mini svg.i { width:13px; height:13px; }
.cue-text { margin:0 -8px; padding:4px 8px; border-radius:6px; font-size:17px; line-height:1.65; white-space:pre-wrap; overflow-wrap:anywhere; outline:none; caret-color:var(--accent); }
.cue-text:hover { background:color-mix(in srgb,var(--ink) 5%,transparent); }
.cue-text:focus { background:var(--panel); box-shadow:0 0 0 2px var(--accent); }
.en { color:var(--accent); font-weight:500; background:var(--accent-soft); border-radius:4px; padding:0 3px; }
.cue-meta { display:flex; align-items:center; gap:6px; }
.sty { margin-left:auto; display:inline-grid; place-items:center; min-width:34px; height:20px; padding:0 7px; border-radius:5px; background:#181a20; font-size:12px; line-height:1; }
.timing { display:flex; flex-wrap:wrap; align-items:center; gap:6px 8px; }
.timing .lbl { font-size:11.5px; color:var(--ink-3); margin-right:2px; }
.timing .btn { height:26px; padding:0 8px; font:500 11px var(--font-mono); }
.timing .read { min-width:44px; text-align:center; font:500 11.5px var(--font-mono); color:var(--ink-2); }
.empty { display:grid; justify-items:center; gap:6px; padding:36px 20px; text-align:center; color:var(--ink-2); }
.empty .ei { width:48px; height:48px; border-radius:14px; display:grid; place-items:center; background:var(--panel-3); color:var(--ink-3); margin-bottom:4px; }
.empty h3 { margin:0; font-size:14px; color:var(--ink); font-weight:600; } .empty p { margin:0; max-width:30ch; font-size:12.5px; }

/* generate pane */
.gpad { padding:0 14px 14px; }
.swrow { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:10px 12px; border:1px solid var(--line-2); border-radius:10px; background:var(--panel-2); }
.swrow b { display:flex; align-items:center; gap:8px; font-size:12.5px; font-weight:600; } .swrow small { display:block; margin-top:2px; font-size:11.5px; color:var(--ink-3); }
.prog { display:flex; gap:4px; margin-bottom:8px; }
.prog i { flex:1; height:5px; border-radius:3px; background:var(--panel-3); position:relative; overflow:hidden; }
.prog i.run::after { content:""; position:absolute; inset:0; background:linear-gradient(90deg,transparent,var(--accent),transparent); background-size:200% 100%; animation:shimmer 1s linear infinite; }
.prog i.done { background:var(--accent); }
.gstat { margin:0 0 10px; min-height:17px; font-size:12px; color:var(--ink-2); }
@keyframes shimmer { to { background-position:-200% 0; } }

/* ---------- preview ---------- */
.center { grid-area:center; display:flex; flex-direction:column; overflow:hidden; }
.pv-bar { flex:none; display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px; padding:9px 12px; border-bottom:1px solid var(--line); }
.res { position:absolute; left:12px; bottom:9px; z-index:2; font:500 11px var(--font-mono); color:var(--ink-3); pointer-events:none; }
.bgrow { display:flex; align-items:center; gap:6px; }
.bgrow .lbl { font-size:12px; color:var(--ink-3); margin-right:2px; }
.swatch { width:22px; height:22px; flex:none; border-radius:50%; border:1px solid var(--line-2); background:var(--c); padding:0; position:relative; }
.swatch[aria-pressed="true"] { box-shadow:0 0 0 2px var(--panel),0 0 0 4px var(--accent); }
.swatch.tp { background-color:#cfcfcf; background-image:conic-gradient(#9a9a9a 25%,#d8d8d8 0 50%,#9a9a9a 0 75%,#d8d8d8 0); background-size:10px 10px; }
.stage-area { flex:1; min-height:140px; display:grid; place-items:center; background:var(--stage-bg); position:relative; overflow:hidden; }
.frame { position:relative; flex:none; overflow:hidden; border-radius:3px; box-shadow:0 0 0 1px rgba(128,128,128,.25),0 20px 50px -14px rgba(0,0,0,.55); --u:.3; }
.frame.checker { background-color:#cfcfcf; background-image:conic-gradient(#9a9a9a 25%,#d8d8d8 0 50%,#9a9a9a 0 75%,#d8d8d8 0); background-size:22px 22px; }
.cap { position:absolute; transform:translate(-50%,-50%); width:max-content; line-height:1.3; cursor:grab; user-select:none; -webkit-user-select:none; touch-action:none; font-synthesis:none; }
.cap:active { cursor:grabbing; }
.cap.sel { outline:2px dashed #7AA2FF; outline-offset:calc(var(--u) * 8px); }
.cap.a-fade { animation:capFade .28s ease-out; }
.cap.a-pop { animation:capPop .3s cubic-bezier(.2,1.5,.4,1); }
.cap.a-rise { animation:capRise .32s ease-out; }
@keyframes capFade { from { opacity:0; } }
@keyframes capPop { from { opacity:0; scale:.7; } }
@keyframes capRise { from { opacity:0; translate:0 calc(var(--u) * 24px); } }
.g-ov { position:absolute; inset:0; pointer-events:none; }
.g-ov i { position:absolute; border:1px dashed rgba(255,255,255,.45); }
.g-ov i:nth-child(1) { inset:5%; } .g-ov i:nth-child(2) { inset:10%; border-color:rgba(255,255,255,.25); }
.g-ov i:nth-child(3) { left:50%; top:0; bottom:0; border-width:0 0 0 1px; } .g-ov i:nth-child(4) { top:50%; left:0; right:0; border-width:1px 0 0; }
/* where TikTok, Reels and Shorts cover the picture (preview only, never in an export) */
.g-ov .gz { position:absolute; display:block; background:rgba(20,24,36,.46); border:1px dashed rgba(255,255,255,.4); box-sizing:border-box; }
.g-ov .gz em { position:absolute; left:6px; top:5px; padding:2px 8px; border-radius:99px; background:rgba(8,10,18,.82); color:#fff; font:600 max(9px, calc(var(--u) * 26px))/1.3 var(--font-ui); font-style:normal; white-space:nowrap; }
.g-ov .gz.pill { border-radius:99px; background:rgba(8,10,18,.55); display:grid; place-items:center; } .g-ov .gz.pill em { position:static; background:transparent; }
.platbar { position:absolute; left:8px; top:8px; z-index:3; flex-wrap:wrap; max-width:calc(100% - 16px); display:flex; align-items:center; gap:8px; padding:4px 6px 4px 12px; background:var(--panel); border:1px solid var(--line-2); border-radius:12px; box-shadow:0 2px 8px rgba(0,0,0,.12); }
.platbar .lbl { font-size:11.5px; color:var(--ink-3); white-space:nowrap; } .platbar[hidden] { display:none; }
.snapv { position:absolute; left:50%; top:0; bottom:0; width:1px; background:#FF5AA8; pointer-events:none; }
.pv-transport { flex:none; display:flex; align-items:center; gap:6px; padding:8px 12px; border-top:1px solid var(--line); }
.play { width:38px; height:38px; border-radius:50%; border:0; display:grid; place-items:center; flex:none; background:var(--ink); color:var(--bg); transition:transform .1s,filter .12s; }
.play:hover { filter:brightness(1.12); } .play:active { transform:scale(.94); }
.play svg.i { width:16px; height:16px; }
.clock { display:flex; align-items:baseline; gap:6px; margin:0 8px; font-family:var(--font-mono); font-variant-numeric:tabular-nums; }
.clock .now { font-size:19px; font-weight:500; letter-spacing:-.02em; } .clock .tot { font-size:12px; color:var(--ink-3); }
.pv-transport select { width:auto; height:28px; padding-right:24px; font-size:12px; }

/* ---------- right inspector ---------- */
.right { grid-area:right; display:flex; flex-direction:column; overflow:hidden; }
.sec { padding:12px 14px 14px; border-bottom:1px solid var(--line); }
.sec:last-child { border-bottom:0; }
.sec > h3 { margin:0 0 10px; font-size:11px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-3); }
.presets { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px 6px; }
.pbtn { display:grid; gap:4px; padding:0; border:0; background:transparent; color:var(--ink-3); font-size:10px; text-align:center; }
.ptile { height:46px; display:grid; place-items:center; border-radius:8px; border:1px solid var(--line-2); background:#181a20; overflow:hidden; line-height:1; padding:0 2px; }
.pbtn:hover .ptile { border-color:var(--ink-3); }
.pbtn[aria-pressed="true"] .ptile { border-color:var(--accent); box-shadow:0 0 0 1px var(--accent); }
.fontbtn { width:100%; height:36px; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:0 10px; border:1px solid var(--line-2); border-radius:8px; background:var(--panel-2); font-size:15px; text-align:left; }
.fontbtn:hover { border-color:var(--ink-3); }
.fontbtn span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.srow { display:grid; grid-template-columns:70px minmax(0,1fr); align-items:center; gap:8px; margin-top:10px; }
.srow > .l { font-size:12px; color:var(--ink-2); }
.ctl { display:flex; align-items:center; gap:8px; min-width:0; }
.ctl output { flex:none; min-width:40px; text-align:right; font:500 11px var(--font-mono); color:var(--ink-3); }
.tgl { display:flex; gap:4px; }
.tgl .icon-btn { width:32px; height:30px; border:1px solid var(--line-2); border-radius:7px; font-weight:700; font-size:12.5px; }
.tgl .icon-btn[aria-pressed="true"] { border-color:var(--accent-line); }
.quick { display:flex; gap:4px; }
.quick .btn { flex:1; height:26px; padding:0; font-size:11.5px; }
.stybody-empty { display:grid; justify-items:center; gap:8px; padding:40px 24px; text-align:center; color:var(--ink-2); font-size:12.5px; }

/* ---------- timeline ---------- */
.tl { grid-area:tl; display:flex; flex-direction:column; overflow:hidden; background:var(--tl-bg); position:relative; }
.tl-grip { position:absolute; top:0; left:0; right:0; height:7px; z-index:30; cursor:ns-resize; }
.tl-grip::after { content:""; position:absolute; left:50%; top:2px; width:44px; height:3px; margin-left:-22px; border-radius:2px; background:var(--line-2); opacity:.7; }
.tl-bar { flex:none; display:flex; align-items:center; flex-wrap:wrap; gap:4px 10px; padding:7px 10px; border-bottom:1px solid var(--line); background:var(--panel); }
.grp { display:flex; align-items:center; gap:4px; }
kbd { font:500 10.5px/1 var(--font-mono); padding:2px 5px; border-radius:4px; background:var(--panel-3); border:1px solid var(--line-2); border-bottom-width:2px; color:var(--ink-2); white-space:nowrap; }
.tool { height:28px; padding:0 9px; display:inline-flex; align-items:center; gap:6px; border:0; border-radius:7px; background:transparent; color:var(--ink-2); font-size:12px; font-weight:500; white-space:nowrap; transition:background .12s,color .12s; }
.tool:hover:not(:disabled) { background:var(--panel-3); color:var(--ink); }
.tool.icon { width:28px; padding:0; justify-content:center; }
.tool[aria-pressed="true"] { background:var(--accent-soft); color:var(--accent); }
.tool kbd { margin-left:2px; background:transparent; }
.tl-bar .vsep { height:16px; margin:0 3px; }
.avatar { width:32px; height:32px; flex:none; display:grid; place-items:center; border-radius:50%; border:1px solid var(--accent-line); background:var(--accent-soft); color:var(--accent); }
.avatar:hover { filter:brightness(1.12); } .avatar svg.i { width:17px; height:17px; }
.menu hr { border:0; border-top:1px solid var(--line); margin:5px 2px; }
.menu button kbd { margin-left:auto; }
.acc { border-bottom:1px solid var(--line); }
.acc > summary { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:11px 14px; cursor:pointer; list-style:none; }
.acc > summary::-webkit-details-marker { display:none; }
.acc > summary h3 { margin:0; font-size:11px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-3); }
.acc > summary:hover h3 { color:var(--ink-2); }
.acc > summary .chev { color:var(--ink-3); transition:rotate .15s; }
.acc:not([open]) > summary .chev { rotate:-90deg; }
.abody { padding:0 14px 14px; }
.p-bar.stick { position:sticky; top:0; z-index:4; border-top:0; }
.bar-row { display:flex; align-items:center; gap:8px; } .bar-row .search { flex:1; min-width:0; }
.tdet > summary { display:flex; align-items:center; justify-content:space-between; cursor:pointer; list-style:none; font-size:12px; font-weight:600; color:var(--ink-2); }
.tdet > summary::-webkit-details-marker { display:none; }
.tdet > summary .chev { transition:rotate .15s; } .tdet[open] > summary .chev { rotate:180deg; }
.tdet .timing { margin-top:10px; }
.smart { display:grid; grid-template-columns:30px minmax(0,1fr); gap:10px; padding:12px; border:1px solid var(--line-2); border-radius:10px; background:var(--panel-2); }
.smart-ic { width:30px; height:30px; display:grid; place-items:center; border-radius:8px; background:var(--accent-soft); color:var(--accent); }
.smart b { display:block; font-size:12.5px; font-weight:600; } .smart small { display:block; margin-top:2px; font-size:11.5px; color:var(--ink-3); }
.found { display:flex; flex-wrap:wrap; gap:5px; margin-top:8px; } .found .tag { padding:0 8px; }
.t-gap { display:flex; height:18px; background:var(--tl-bg); border-bottom:1px solid var(--line); }
.t-gap .gl { flex:none; position:sticky; left:0; z-index:6; width:var(--gut); padding:3px 10px 0; background:var(--tl-bg); border-right:1px solid var(--line); font:600 9.5px/14px var(--font-ui); letter-spacing:.1em; text-transform:uppercase; color:var(--ink-3); }
.modal.wide { width:min(640px,100%); }
.keys { grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:20px 28px; }
.keys h3 { margin:0 0 6px; font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-3); }
.krow { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:7px 0; border-bottom:1px solid var(--line); font-size:12.5px; }
.krow:last-child { border-bottom:0; } .krow .kk { display:flex; align-items:center; gap:5px; flex-wrap:wrap; justify-content:flex-end; color:var(--ink-3); }
.rbtn.only-narrow { display:none; }
#modeChip { margin-left:12px; height:22px; }
@media (max-width:1180px) { #modeChip { display:none; } }
.grp.zoom { gap:6px; } .grp.zoom input[type=range] { width:110px; }
.tl-scroll { flex:1; min-height:0; overflow:auto; position:relative; }   /* its scroll bar is styled in design.css: always visible, never the macOS auto-hiding one */
.tl-inner { position:relative; min-height:100%; user-select:none; -webkit-user-select:none; }
/* Track names live in their own column above the scroller, so clips can never draw over them. */
.tl-wrap { flex:1; min-height:0; position:relative; display:flex; }
.tl-wrap > .tl-scroll { flex:1; min-width:0; }
.tl-heads { position:absolute; left:0; top:0; bottom:9px; width:var(--gut); overflow:hidden; z-index:20; background:var(--tl-head); }
.hcorner { position:relative; z-index:2; height:30px; background:var(--panel); border-right:1px solid var(--line); border-bottom:1px solid var(--line); }
.hwrap { position:relative; z-index:1; }
#hRows { will-change:transform; }
.hrow { border-bottom:1px solid var(--line); background:var(--tl-head); }
.hgap { height:18px; padding:3px 10px 0; background:var(--tl-bg); border-bottom:1px solid var(--line); border-right:1px solid var(--line); font:600 9.5px/14px var(--font-ui); letter-spacing:.1em; text-transform:uppercase; color:var(--ink-3); }
.tspace { flex:none; width:var(--gut); }
.t-ruler { position:sticky; top:0; z-index:9; display:flex; height:30px; background:var(--panel); }
.t-corner { flex:none; position:sticky; left:0; z-index:10; width:var(--gut); background:var(--panel); border-right:1px solid var(--line); border-bottom:1px solid var(--line); }
.t-rtrack { position:relative; flex:none; height:30px; border-bottom:1px solid var(--line); cursor:ew-resize; touch-action:none; }
.t-rtrack canvas { position:absolute; left:0; top:0; display:block; pointer-events:none; }
.ph-head { position:absolute; left:-7px; top:0; width:0; height:0; border:7px solid transparent; border-top:11px solid var(--live); border-bottom:0; pointer-events:none; will-change:transform; z-index:3; }
.t-row { display:flex; border-bottom:1px solid var(--line); background:var(--tl-row); }
.thead { position:relative; width:var(--gut); height:100%; display:flex; align-items:center; gap:7px; padding:0 4px 0 10px; background:var(--tl-head); border-right:1px solid var(--line); }
.tic { width:22px; height:22px; flex:none; display:grid; place-items:center; border-radius:6px; background:var(--c-bg); color:var(--c-ink); }
.tic svg.i { width:13px; height:13px; }
.tn { min-width:0; flex:1; line-height:1.2; }
.tn b { display:block; font-size:12px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; outline:none; border-radius:3px; }
.tn b[contenteditable="true"] { background:var(--panel-3); box-shadow:0 0 0 2px var(--accent); text-overflow:clip; padding:0 3px; }
.tn small { display:block; font-size:10.5px; color:var(--ink-3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.thead { overflow:hidden; }
.hrow.off .thead { opacity:.55; }
.tbs { position:absolute; right:4px; top:50%; translate:0 -50%; display:flex; }
.tbs .tb { opacity:0; transition:opacity .12s; background:var(--tl-head); }
.thead:hover .tb,.thead:focus-within .tb,.tbs .tb[aria-pressed="true"] { opacity:1; }
@media (hover:none) { .tbs .tb { opacity:1; } }
.tb { width:22px; height:24px; display:grid; place-items:center; border:0; border-radius:5px; background:transparent; color:var(--ink-3); }
.tb:hover { background:var(--panel-3); color:var(--ink); } .tb[aria-pressed="true"] { color:var(--accent); }
.tb svg.i { width:14px; height:14px; }
.ttrack { position:relative; flex:none; height:100%; }
.t-row.off .ttrack { opacity:.38; }
.t-row.locked .ttrack { background:repeating-linear-gradient(135deg,transparent 0 7px,color-mix(in srgb,var(--ink) 5%,transparent) 7px 8px); }
.t-row.locked .blk { cursor:not-allowed; }
.t-row.dropok .ttrack { background:var(--accent-soft); }
.blk { position:absolute; top:5px; bottom:5px; border-radius:6px; overflow:hidden; border:1px solid var(--line-2); cursor:grab; touch-action:pan-x pan-y; z-index:1; }   /* a finger scrolls the timeline over a block; once the block is picked (.sel) the finger moves or trims it */
.blk.sel, .blk.msel { touch-action:none; }
.blk::before,.blk::after { content:""; position:absolute; top:0; bottom:0; width:7px; z-index:2; cursor:ew-resize; }
.blk::before { left:0; } .blk::after { right:0; }
.blk:hover::before,.blk:hover::after { background:color-mix(in srgb,var(--ink) 18%,transparent); }
.blk.video { background-color:var(--vid-bg); border-color:var(--vid-line); color:var(--vid-ink); background-image:repeating-linear-gradient(90deg,transparent 0 59px,rgba(0,0,0,.25) 59px 60px),linear-gradient(180deg,rgba(255,255,255,.07),transparent 60%); }
.blk.audio { background:var(--aud-bg); border-color:var(--aud-line); color:var(--aud-ink); }
.blk.audio canvas { position:absolute; left:0; top:15px; display:block; opacity:.9; pointer-events:none; }
.blk.video canvas.film { position:absolute; left:0; top:0; display:block; pointer-events:none; }
.blk.video canvas.wv { position:absolute; left:0; bottom:0; display:block; pointer-events:none; }
.blk.video .bl { left:6px; right:auto; max-width:calc(100% - 12px); padding:1px 6px; border-radius:4px; background:rgba(0,0,0,.5); color:#fff; }
.cut-line { position:absolute; left:0; top:0; width:0; z-index:7; pointer-events:none; will-change:transform; }
.cut-line::before { content:""; position:absolute; left:-1px; top:-2px; bottom:-2px; width:2px; border-radius:1px; background:var(--ink); box-shadow:0 0 0 1px var(--panel); }
.cut-line::after { content:attr(data-t); position:absolute; left:6px; top:3px; padding:1px 5px; border-radius:4px; background:var(--ink); color:var(--bg); font:500 10px var(--font-mono); white-space:nowrap; }
.tl-inner.blade, .tl-inner.blade .blk, .tl-inner.blade .blk::before, .tl-inner.blade .blk::after, .tl-inner.blade .ttrack { cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg stroke='white' stroke-width='4.4'%3E%3Ccircle cx='6' cy='6' r='3'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Cpath d='M20 4 8.1 15.9M14.5 14.5 20 20M8.1 8.1 12 12'/%3E%3C/g%3E%3Cg stroke='%23111' stroke-width='2'%3E%3Ccircle cx='6' cy='6' r='3'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Cpath d='M20 4 8.1 15.9M14.5 14.5 20 20M8.1 8.1 12 12'/%3E%3C/g%3E%3C/svg%3E") 12 12, crosshair; }
.tl-inner.blade .blk:hover::before, .tl-inner.blade .blk:hover::after { background:none; }
.newtrack-hint { position:absolute; left:var(--gut); right:0; top:0; height:0; border-top:2px dashed var(--accent); z-index:8; pointer-events:none; }
.newtrack-hint span { position:absolute; left:12px; top:-11px; padding:1px 8px; border-radius:999px; background:var(--accent); color:var(--accent-ink); font:600 10.5px var(--font-ui); white-space:nowrap; }
.range-band { position:absolute; top:0; bottom:0; z-index:1; background:color-mix(in srgb,var(--accent) 24%,transparent); border-left:2px solid var(--accent); border-right:2px solid var(--accent); pointer-events:none; }
.rangerow { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr) auto; gap:6px; align-items:end; margin-top:8px; }
.rangerow label { display:grid; gap:4px; font-size:11.5px; color:var(--ink-3); }
.rangerow input { font-family:var(--font-mono); font-size:12px; }
.rangerow .btn { width:32px; padding:0; }
#pvVideo { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; background:#000; pointer-events:none; }
.ttrack.is-empty::after { content:"Drop any video or audio clip here"; position:absolute; left:14px; top:50%; translate:0 -50%; font-size:11.5px; color:var(--ink-3); pointer-events:none; }
.ttrack.cc0 .blk.capb { background:var(--cc0-bg); border-color:var(--cc0-line); color:var(--cc0-ink); }
.ttrack.cc1 .blk.capb { background:var(--cc1-bg); border-color:var(--cc1-line); color:var(--cc1-ink); }
.ttrack.cc2 .blk.capb { background:var(--cc2-bg); border-color:var(--cc2-line); color:var(--cc2-ink); }
.ttrack.cc3 .blk.capb { background:var(--cc3-bg); border-color:var(--cc3-line); color:var(--cc3-ink); }
.blk.sel { box-shadow:0 0 0 2px var(--accent); z-index:3; }
.blk.live { filter:brightness(1.18) saturate(1.1); }
.blk.msel { box-shadow:0 0 0 2px var(--accent); z-index:3; }
.blk.video.msel, .blk.audio.msel { outline:2px dashed var(--accent); outline-offset:-4px; }
.marquee { position:absolute; z-index:8; border:1px solid var(--accent); background:var(--accent-soft); border-radius:3px; pointer-events:none; }
.timing .btn[aria-pressed="true"] { background:var(--accent-soft); color:var(--accent); border-color:var(--accent-line); }
.lt { padding:0; }
.lt-sep { margin-top:10px; padding-top:2px; border-top:1px solid var(--line); }
.lt-row { display:grid; grid-template-columns:86px minmax(0,1fr); align-items:center; gap:10px; margin-top:10px; }
.lt-row > .l { font-size:12px; color:var(--ink-2); }
.lt-hint { margin-top:8px; }
.jn { display:inline-flex; align-items:stretch; width:max-content; max-width:100%; border:1px solid var(--line-2); border-radius:8px; overflow:hidden; background:var(--panel-2); }
.jn button { width:36px; height:30px; padding:0; border:0; background:transparent; color:var(--ink-2); font-size:16px; line-height:1; cursor:pointer; }
.jn button:hover { background:var(--panel-3); color:var(--ink); }
.jn .wnum { width:58px; height:30px; padding:0; border:0; border-inline:1px solid var(--line-2); border-radius:0; background:transparent; color:var(--ink); text-align:center; font:600 13px var(--font-mono); -moz-appearance:textfield; appearance:textfield; }
.jn .wnum::-webkit-inner-spin-button, .jn .wnum::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
.seg output.read { flex:1; display:flex; align-items:center; justify-content:center; min-width:42px; font:500 11px var(--font-mono); color:var(--ink-3); }
.seg.nudge button { font-family:var(--font-mono); font-size:11px; padding:0 2px; }
.srow.col { display:flex; flex-direction:column; align-items:stretch; gap:6px; }
.stepper { display:inline-flex; align-items:center; gap:5px; flex-wrap:wrap; }
.stepper .wnum { width:52px; height:30px; padding:0 6px; text-align:center; border:1px solid var(--line-2); border-radius:7px; background:var(--panel-2); color:var(--ink); font:600 13px var(--font-mono); }
.stepper .quick { display:inline-flex; gap:4px; margin-left:6px; }
.stepper .btn { min-width:28px; height:30px; padding:0 8px; justify-content:center; }
.stepper .btn[aria-pressed="true"] { background:var(--accent-soft); color:var(--accent); border-color:var(--accent-line); }
#lyCustom { width:84px; height:30px; padding:0 8px; border:1px solid var(--line-2); border-radius:7px; background:var(--panel-2); color:var(--ink); font:inherit; }
.blk.grp::after { content:''; position:absolute; left:0; top:0; bottom:0; width:4px; background:var(--accent); }
.tool[hidden] { display:none; }
.exprog { height:6px; border-radius:99px; background:var(--panel-3); overflow:hidden; }
.exprog i { display:block; height:100%; width:0; background:var(--accent); transition:width .25s; }
#exMsg { min-height:16px; }
.restiles { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.rtile { position:relative; display:grid; gap:2px; justify-items:start; padding:10px 12px 9px; border:1px solid var(--line-2); border-radius:10px; background:var(--panel-2); color:var(--ink); text-align:left; cursor:pointer; }
.rtile b { font-size:14px; font-weight:600; }
.rtile small { font:500 11px var(--font-mono); color:var(--ink-3); }
.rtile em { position:absolute; right:10px; top:10px; font-style:normal; font-size:10.5px; font-weight:600; color:var(--ink-2); }
.rtile:hover:not(:disabled) { border-color:var(--ink-3); }
.rtile[aria-pressed="true"] { border-color:var(--accent); background:var(--accent-soft); box-shadow:0 0 0 1px var(--accent) inset; }
.rtile:disabled { opacity:.45; cursor:not-allowed; }
.rtile .bd { margin-top:6px; padding:3px 7px; border-radius:99px; font:600 10px/1 var(--font-mono); font-style:normal; letter-spacing:.04em; }
.bd.gpu { background:rgba(46,184,114,.18); color:#2EB872; }
.bd.cpu { background:rgba(231,179,65,.2); color:#D69A1B; }
.bd.no, .bd.auto { background:var(--panel-3); color:var(--ink-3); }
.optgrid { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:14px; }
.exenc { padding:10px 12px; border:1px solid var(--line-2); border-radius:10px; background:var(--panel-2); color:var(--ink-2); font-size:12px; line-height:1.55; }
.exenc.gpu { border-color:rgba(46,184,114,.55); } .exenc.cpu { border-color:rgba(231,179,65,.55); } .exenc.no { border-color:var(--danger); }
.exsum { padding:10px 12px; border-radius:10px; background:var(--panel-3); color:var(--ink-2); font-size:12px; line-height:1.6; }
#exVid .seg button:disabled { opacity:.4; cursor:not-allowed; }
.modal.ex { width:min(700px,100%); }
.ex-tabs { display:flex; gap:4px; padding:0 20px; border-bottom:1px solid var(--line); }
.ex-tabs button { display:inline-flex; align-items:center; gap:8px; height:44px; margin-bottom:-1px; padding:0 14px; border:0; border-bottom:2px solid transparent; background:transparent; color:var(--ink-3); font-size:13px; font-weight:500; cursor:pointer; }
.ex-tabs button:hover { color:var(--ink); }
.ex-tabs button[aria-pressed="true"] { color:var(--ink); border-bottom-color:var(--accent); }
.ex-tabs svg.i { width:15px; height:15px; }
.m-body.ex-body { gap:20px; }
.ex-pane { display:grid; gap:20px; }
.ex-sec { display:grid; gap:10px; }
.ex-sec > h4 { margin:0; font-size:11px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-3); }
.ex-sec > h4 small { margin-left:8px; font-size:11.5px; font-weight:400; letter-spacing:0; text-transform:none; }
.ex-file { display:flex; align-items:center; gap:10px; } .ex-file input { flex:1; min-width:0; }
.ex-file span { font:500 12px var(--font-mono); color:var(--ink-3); white-space:nowrap; }
.ex-row { display:grid; grid-template-columns:104px minmax(0,1fr); align-items:center; gap:12px; }
.ex-row > span { font-size:12.5px; color:var(--ink-2); }
.ex-cards { display:grid; gap:8px; } .ex-cards.three { grid-template-columns:repeat(3,minmax(0,1fr)); } .ex-cards.two { grid-template-columns:repeat(2,minmax(0,1fr)); }
.ex-cards button { display:grid; gap:3px; justify-items:start; text-align:left; padding:12px 14px; border:1px solid var(--line-2); border-radius:10px; background:var(--panel-2); color:var(--ink); cursor:pointer; }
.ex-cards button b { font-size:13.5px; font-weight:600; }
.ex-cards button small { font-size:11.5px; line-height:1.4; color:var(--ink-3); }
.ex-cards button:hover { border-color:var(--ink-3); }
.ex-cards button[aria-pressed="true"] { border-color:var(--accent); background:var(--accent-soft); box-shadow:0 0 0 1px var(--accent) inset; }
.ex-fixed { display:flex; align-items:baseline; gap:12px; padding:12px 14px; border:1px solid var(--line-2); border-radius:10px; background:var(--panel-2); }
.ex-fixed b { font-size:13.5px; } .ex-fixed span { font-size:12px; color:var(--ink-3); }
.ex-list { display:grid; gap:8px; }
.exdev { display:flex; flex-wrap:wrap; gap:4px 16px; margin-top:8px; font:500 11.5px var(--font-mono); color:var(--ink-3); }
.exdev b { margin-right:4px; color:var(--ink); font-weight:600; } .exdev.warn { color:var(--danger); font-family:inherit; }
.exdevbar { display:flex; align-items:center; flex-wrap:wrap; gap:6px 16px; padding:10px 12px; border:1px solid var(--line-2); border-radius:10px; background:var(--panel-2); font-size:12px; color:var(--ink-2); }
.exdevbar b { margin-left:2px; color:var(--ink); font-weight:600; }
.exdevbar .dot { width:8px; height:8px; flex:none; border-radius:50%; background:#2EB872; }
.exdevbar.soft .dot, .exdevbar.hide .dot { background:#D69A1B; }
.m-body.ex-body { gap:16px; } .ex-pane, .ex-pane.compact { gap:16px; }
.ex-file label { font-size:12.5px; color:var(--ink-2); white-space:nowrap; }
.ex-two { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.restiles.six { grid-template-columns:repeat(6,minmax(0,1fr)); gap:6px; }
.restiles.six .rtile { gap:1px; padding:8px 9px; }
.restiles.six .rtile b { font-size:13px; } .restiles.six .rtile small { font-size:10px; }
.restiles.six .rtile em { right:8px; top:9px; font-size:10px; }
.restiles.six .rtile .bd { margin-top:4px; padding:2px 6px; font-size:9.5px; }
.swrow.slim { align-items:center; padding:9px 12px; } .swrow.slim b { font-size:12.5px; }
.exdevbar .encst { margin-left:auto; font-weight:600; } .exdevbar.gpu .encst { color:#2EB872; } .exdevbar.cpu .encst { color:#D69A1B; }
@media (max-width:640px) { .restiles.six { grid-template-columns:repeat(3,minmax(0,1fr)); } .ex-two { grid-template-columns:1fr; } }
.ex-status { display:grid; gap:8px; } .ex-status:has(#exProg[hidden]):has(#exMsg:empty) { display:none; }
@media (max-width:560px) { .ex-cards.three, .restiles { grid-template-columns:repeat(2,minmax(0,1fr)); } .ex-row { grid-template-columns:1fr; gap:6px; } }
.tool.primary { background:var(--accent); color:var(--accent-ink); }
.tool.primary:hover:not(:disabled) { background:var(--accent); color:var(--accent-ink); filter:brightness(1.1); }
.tool.primary:disabled { opacity:.7; cursor:progress; }
.tool.primary kbd { color:var(--accent-ink); opacity:.8; border-color:rgba(255,255,255,.35); }
.astrip { position:relative; flex:none; margin:0 14px 8px; height:64px; border-radius:10px; background:var(--panel-2); border:1px solid var(--line); overflow:hidden; cursor:pointer; touch-action:none; }
.astrip canvas { position:absolute; inset:0; width:100%; height:100%; display:block; }
.a-t { position:absolute; top:4px; font:500 10px/1 var(--font-mono); color:var(--ink-3); pointer-events:none; }
.a-t.l { left:7px; } .a-t.r { right:7px; }
.bl { position:absolute; left:9px; right:7px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:12px; font-weight:500; pointer-events:none; }
.blk.capb .bl { top:50%; translate:0 -50%; }
.blk.video .bl,.blk.audio .bl { top:4px; font-size:11px; display:flex; align-items:center; gap:5px; }
.blk .bl svg.i { width:11px; height:11px; }
.pend { position:absolute; top:5px; bottom:5px; border-radius:6px; border:1px dashed var(--line-2); background:linear-gradient(100deg,transparent 30%,color-mix(in srgb,var(--accent) 28%,transparent) 50%,transparent 70%) 0 0/220% 100%; animation:shimmer2 1.1s linear infinite; pointer-events:none; }
@keyframes shimmer2 { to { background-position:-220% 0; } }
.ph-line { position:absolute; top:0; bottom:0; left:0; width:0; z-index:5; pointer-events:none; will-change:transform; }
.ph-line::after { content:""; position:absolute; left:-1px; top:30px; bottom:0; width:2px; background:var(--live); border-radius:1px; }

/* ---------- popovers, dialogs, toast ---------- */
.menu { position:fixed; z-index:80; min-width:190px; padding:5px; background:var(--panel-2); border:1px solid var(--line-2); border-radius:10px; box-shadow:0 18px 40px -12px rgba(0,0,0,.55); }
.menu button { display:flex; align-items:center; gap:9px; width:100%; height:32px; padding:0 10px; border:0; border-radius:7px; background:transparent; text-align:left; font-size:12.5px; }
.menu button:hover { background:var(--panel-3); } .menu button.danger { color:var(--danger); }
.fpop { position:fixed; z-index:80; width:292px; max-height:min(420px,70vh); display:flex; flex-direction:column; background:var(--panel-2); border:1px solid var(--line-2); border-radius:12px; box-shadow:0 18px 40px -12px rgba(0,0,0,.55); overflow:hidden; }
.fpop .fl { flex:1; min-height:0; overflow:auto; padding:5px; scrollbar-width:thin; }
.fpop .fi { display:flex; align-items:center; justify-content:space-between; gap:10px; width:100%; height:38px; padding:0 10px; border:0; border-radius:8px; background:transparent; text-align:left; font-size:16px; }
.fpop .fi:hover { background:var(--panel-3); } .fpop .fi[aria-selected="true"] { background:var(--accent-soft); color:var(--accent); }
.fpop .fi small { font:500 10px var(--font-ui); letter-spacing:.04em; color:var(--ink-3); text-transform:uppercase; flex:none; }
.fpop .ff { display:grid; gap:6px; padding:8px; border-top:1px solid var(--line); }
.fpop .ff .row { display:flex; gap:6px; }
.scrim { position:fixed; inset:0; z-index:90; display:grid; place-items:center; padding:16px; background:rgba(5,6,9,.62); backdrop-filter:blur(3px); }
.modal { width:min(480px,100%); max-height:100%; overflow:auto; background:var(--panel); border:1px solid var(--line-2); border-radius:14px; box-shadow:0 24px 64px -12px rgba(0,0,0,.6); }
.modal header { display:flex; align-items:center; justify-content:space-between; padding:14px 14px 12px 20px; border-bottom:1px solid var(--line); }
.modal h2 { margin:0; font-size:15px; font-weight:600; }
.m-body { display:grid; gap:14px; padding:18px 20px; }
.m-body .field { margin:0; }
.m-note { padding:10px 12px; border-radius:9px; background:var(--panel-2); border:1px solid var(--line); font-size:12px; color:var(--ink-2); }
.modal footer { display:flex; justify-content:flex-end; gap:8px; padding:12px 20px 16px; }
.code { margin:0; padding:12px 14px; max-height:170px; overflow:auto; border:1px solid var(--line); border-radius:9px; background:var(--panel-2); font:400 12px/1.7 var(--font-mono); white-space:pre-wrap; overflow-wrap:anywhere; color:var(--ink-2); }
.toast { position:fixed; left:50%; bottom:calc(20px + env(safe-area-inset-bottom,0px)); translate:-50% 12px; z-index:100; display:flex; align-items:center; gap:12px; max-width:min(560px,calc(100% - 32px)); padding:10px 14px; border-radius:10px; background:var(--ink); color:var(--bg); font-size:13px; font-weight:500; box-shadow:var(--shadow); opacity:0; pointer-events:none; transition:opacity .18s,translate .18s; }
.toast.on { opacity:1; translate:-50% 0; pointer-events:auto; }
.toast button { border:0; background:transparent; color:var(--accent); font-weight:700; padding:0; }
:root[data-theme="light"] .toast button { color:#2D5BE8; }
.file-input { display:none; }

/* ---------- responsive ---------- */
@media (max-width:1280px) {
  .body { --left-w:264px; --right-w:276px; }
  .body[data-tab="captions"] { --left-w:clamp(380px,40vw,500px); } .body[data-tab="generate"] { --left-w:296px; } .body[data-tab="ai"] { --left-w:340px; }
  .proj input { width:150px; }
}
@media (max-width:1100px) {
  .body { grid-template-columns:62px var(--left-w) minmax(0,1fr); grid-template-areas:"rail left center" "rail tl tl"; }
  .rbtn.only-narrow { display:flex; }
  .right { grid-area:left; }
  .body:not([data-tab="style"]) .right { display:none; }
  .body[data-tab="style"] .left { display:none; }
  .body[data-tab="style"] { --left-w:300px; }
  .proj input { width:120px; }
  .bgrow .lbl { display:none; } .pv-bar { gap:6px 10px; padding:8px 10px; }
}
/* Tablets (portrait) and phones, up to 900 px: the studio fills the screen and never scrolls as a page.
   Preview on top, timeline under it, a tab bar at the bottom. The panels (Media, Captions, Auto, Style) slide up over the timeline as a sheet; tap the tab again, or the grip, to put it away. */
.sheet-grab { display:none; }
@media (max-width:900px) {
  :root { --gut:128px; --gl:max(8px,env(safe-area-inset-left,0px)); --gr:max(8px,env(safe-area-inset-right,0px)); --tabbar:calc(56px + env(safe-area-inset-bottom,0px)); }
  html,body { overflow:hidden; overscroll-behavior:none; }
  .app { height:100%; height:100dvh; min-height:0; gap:6px; padding-bottom:0; }
  .topbar { height:46px; gap:6px; padding-right:8px; }
  .proj, #modeChip, .brand div { display:none; }
  .body { grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr) var(--tl-h); grid-template-areas:"center" "tl"; --tl-h:clamp(204px,38dvh,340px); padding-bottom:var(--tabbar); transition:none; }
  .center { grid-area:center; } .tl { grid-area:tl; } .tl-grip { display:none; }
  .tool kbd { display:none; }
  /* the rail turns into a tab bar */
  .rail { position:fixed; left:0; right:0; bottom:0; z-index:60; height:var(--tabbar); padding:6px 6px calc(6px + env(safe-area-inset-bottom,0px)); flex-direction:row; justify-content:space-around; align-items:stretch; gap:2px; border-radius:0; border-width:1px 0 0; }
  .rail .grow { display:none; }
  .rbtn { flex:1; width:auto; min-width:0; flex-direction:column; justify-content:center; gap:2px; padding:3px 2px; font-size:10.5px; }
  .rbtn.push { margin-left:0; } .rbtn.only-narrow { display:flex; }
  /* the panels are a sheet that slides up over the timeline */
  .left, .right { position:fixed; left:0; right:0; bottom:var(--tabbar); width:auto; height:min(62dvh,620px); z-index:50; border-radius:16px 16px 0 0; border-width:1px 0 0; padding-top:20px; box-shadow:0 -14px 40px -10px rgba(0,0,0,.45); transform:translateY(calc(100% + var(--tabbar))); visibility:hidden; transition:transform .26s cubic-bezier(.2,.8,.2,1), visibility 0s .26s; }
  .body[data-sheet="open"] .left, .body[data-sheet="open"] .right { transform:none; visibility:visible; transition:transform .26s cubic-bezier(.2,.8,.2,1); }
  .sheet-grab { display:block; position:absolute; top:0; left:0; right:0; height:22px; z-index:3; border:0; background:transparent; cursor:pointer; }
  .sheet-grab::before { content:""; position:absolute; left:50%; top:8px; width:40px; height:4px; margin-left:-20px; border-radius:2px; background:var(--line-2); }
  /* the preview bar is one row you can swipe, the timeline tools too */
  .pv-bar { flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; gap:8px; padding:6px 8px; } .pv-bar > * { flex:none; } .pv-bar::-webkit-scrollbar, .tl-bar::-webkit-scrollbar { display:none; }
  .bgrow .lbl, .stage-area .res { display:none; }
  .pv-transport { padding:6px 8px; gap:6px; }
  .tl-bar { flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; gap:6px; padding:5px 8px; } .tl-bar .grp { flex:none; } .tl-bar > .grow { display:none; }
}
@media (max-width:640px) {
  :root { --gut:104px; }
  .scrim { padding:0; place-items:end center; }
  .modal, .modal.wide, .modal.ex, .modal.cut, .modal.styles { width:100%; max-height:92dvh; border-radius:16px 16px 0 0; }
  .tn small,.proj,.brand span { display:none; }
  .thead { gap:5px; padding-left:6px; } .tbs .tb { width:20px; }
  .tn b { font-size:11px; }
  .tb[data-a="more"] { display:none; }
}
@media (max-width:520px) {
  .brand div,.clock .tot,.vsep { display:none; }
  .topbar { gap:6px; }
  .pv-bar { padding:8px; } .pv-transport { padding:8px; }
  .grp.zoom input[type=range] { width:84px; }
  .clock { margin:0 4px; } .clock .now { font-size:17px; }
}
/* A phone held sideways has little height: the tab bar becomes a column on the left and the panels slide in from there. */
@media (max-width:1100px) and (max-height:520px) {
  :root { --tabbar:0px; }
  .app { gap:4px; } .topbar { height:40px; }
  .body { grid-template-columns:54px minmax(0,1fr); grid-template-areas:"rail center" "rail tl"; --tl-h:clamp(116px,46dvh,190px); padding-bottom:0; }
  .rail { position:static; height:auto; flex-direction:column; justify-content:flex-start; padding:4px; border-width:1px; border-radius:14px; gap:2px; z-index:auto; overflow-y:auto; }
  .rbtn { flex:none; padding:6px 2px; } .rbtn.push { margin-top:auto; }
  .left, .right { top:44px; bottom:4px; left:calc(var(--gl) + 58px); right:auto; width:min(420px,64vw); height:auto; border-radius:14px; border-width:1px; transform:translateX(calc(-100% - 70px)); }
  .body[data-sheet="open"] .left, .body[data-sheet="open"] .right { transform:none; }
  .stage-area { min-height:80px; }
}
/* Fingers: bigger things to hit, and text boxes big enough that a phone does not zoom in when one is touched. */
@media (pointer:coarse) {
  .btn, .tool, .icon-btn, .tb, .seg button, .rbtn { min-height:38px; }
  .icon-btn, .tool.icon, .tb { min-width:38px; }
  .tool { padding-inline:12px; }
  .toolpal .tool.icon { width:38px; height:34px; }
  input[type="text"], input[type="search"], input[type="number"], select, textarea { font-size:16px; }
  input[type="range"] { height:32px; }
  .blk::before, .blk::after { width:16px; }
  .thead .tb { opacity:1; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none !important; transition:none !important; } }

/* ---------- Auto cut dialog ---------- */
.tool.accent { color:var(--accent); } .tool.accent:hover:not(:disabled) { color:var(--accent); background:var(--accent-soft); }
.modal.cut { width:min(660px,100%); }
.cut-body { gap:0; padding:18px 20px 10px; }
.cut-pane { display:grid; gap:18px; }
#dlgCut [hidden] { display:none !important; }
.swrow .sl b { display:block; font-size:12.5px; font-weight:600; } .swrow .sl small { display:block; margin-top:2px; font-size:11.5px; line-height:1.45; color:var(--ink-3); }
.swrow .sw { margin-top:1px; } .swrow .sw:disabled { opacity:.4; cursor:not-allowed; }
.cut-busy { padding:34px 4px 30px; }
.cut-list { display:grid; gap:8px; max-height:min(48vh,440px); overflow:auto; padding-right:2px; scrollbar-width:thin; }
.cut-clip { margin-top:4px; display:flex; align-items:baseline; gap:8px; font:600 11px var(--font-ui); letter-spacing:.06em; text-transform:uppercase; color:var(--ink-3); } .cut-clip small { font-weight:400; letter-spacing:0; text-transform:none; }
.cut-row { display:grid; grid-template-columns:18px minmax(0,1fr) auto; gap:10px; align-items:start; padding:10px 12px; border:1px solid var(--line-2); border-radius:10px; background:var(--panel-2); cursor:pointer; }
.cut-row:hover { border-color:var(--ink-3); }
.cut-top { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.cut-t { font:500 12px var(--font-mono); color:var(--ink-2); } .cut-d { font:500 11.5px var(--font-mono); color:var(--ink-3); }
.cut-tag { padding:2px 8px; border-radius:99px; font:600 10.5px/1.4 var(--font-ui); letter-spacing:.03em; background:var(--panel-3); color:var(--ink-2); }
.cut-tag.k-retake { background:rgba(231,179,65,.2); color:#D69A1B; } .cut-tag.k-mistake { background:rgba(224,86,86,.18); color:#E05656; } .cut-tag.k-filler { background:rgba(91,141,239,.2); color:#5B8DEF; } .cut-tag.k-stumble { background:rgba(155,110,230,.2); color:#9B6EE6; } .cut-tag.k-silence { background:rgba(46,184,114,.18); color:#2EB872; }
.cut-tx { margin:5px 0 0; font-size:12.5px; line-height:1.45; color:var(--ink); display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.cut-keep { margin:3px 0 0; font-size:11.5px; line-height:1.4; color:var(--ink-3); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.cut-acts { display:grid; gap:6px; align-content:start; }
.cut-act { display:inline-flex; align-items:center; gap:6px; height:28px; padding:0 10px; border:1px solid var(--line-2); border-radius:8px; background:var(--panel); color:var(--ink-2); font:600 11.5px var(--font-ui); white-space:nowrap; cursor:pointer; }
.cut-act svg { width:13px; height:13px; } .cut-act:hover { border-color:var(--ink-3); color:var(--ink); }
.cut-act:disabled { opacity:.45; cursor:default; } .cut-act:disabled:hover { border-color:var(--line-2); color:var(--ink-2); }
.cut-act.on-air, .btn.on-air { border-color:var(--accent); background:var(--accent-soft); color:var(--accent); }
.cut-tools { display:flex; gap:8px; margin:8px 0 10px; } .cut-tools:not(:has(:not([hidden]))) { display:none !important; }
.cut-row.log { grid-template-columns:minmax(0,1fr) auto; cursor:default; } .cut-row.log:hover { border-color:var(--line-2); }
.cut-empty { margin:0; padding:26px 8px; text-align:center; font-size:13px; color:var(--ink-2); }

/* text animation presets: entry animations, word by word (ideas from lifeprompt-team/remotion-scenes, MIT). The same curves are drawn onto the canvas in drawCaps. */
.alabel { display:block; margin:10px 0 6px; font-size:12px; color:var(--ink-3); }
.a-bounce .w, .a-wave .w, .a-mask .w, .a-type .w, .a-popw .w { display:inline-block; text-decoration:inherit; }
.a-bounce .w { animation:wBounce .5s cubic-bezier(.34,1.56,.64,1) calc(var(--i,0) * var(--st,.07s)) both; }
.a-wave .w { animation:wWaveIn .55s cubic-bezier(.34,1.56,.64,1) calc(var(--i,0) * var(--st,.06s)) both, wWaveLoop 1.3s ease-in-out calc(var(--i,0) * var(--st,.06s) + .55s) infinite; }
.a-mask .w { animation:wMask .4s cubic-bezier(.16,1,.3,1) calc(var(--i,0) * var(--st,.09s)) both; }
.a-type .w { animation:wType .01s steps(1,end) calc(var(--i,0) * var(--st,.13s)) both; }
.a-popw .w { animation:wPopW .38s cubic-bezier(.34,1.56,.64,1) calc(var(--i,0) * var(--st,.06s)) both; }
.a-glitch { animation:capGlitch .42s steps(1,end); }
.demo.a-fade { animation:capFade .28s ease-out; } .demo.a-pop { animation:capPop .3s cubic-bezier(.2,1.5,.4,1); } .demo.a-rise { animation:capRise .32s ease-out; }
@keyframes wBounce { from { opacity:0; translate:0 calc(var(--u) * 34px); scale:.6; } to { opacity:1; translate:0 0; scale:1; } }
@keyframes wWaveIn { from { opacity:0; translate:0 calc(var(--u) * 30px); rotate:-8deg; } to { opacity:1; translate:0 0; rotate:0deg; } }
@keyframes wWaveLoop { 0%, 100% { translate:0 0; } 25% { translate:0 calc(var(--u) * -4px); } 75% { translate:0 calc(var(--u) * 4px); } }
@keyframes wMask { from { clip-path:inset(-50% 100% -50% -20%); } to { clip-path:inset(-50% -20% -50% -20%); } }
@keyframes wType { from { opacity:0; } to { opacity:1; } }
@keyframes wPopW { from { opacity:0; scale:.3; } to { opacity:1; scale:1; } }
@keyframes capGlitch {   /* seven steps of .06 s; the numbers are the GLITCH table in studio.js */
  0% { opacity:0; }
  14.29% { opacity:1; translate:calc(var(--u) * -10px) 0; text-shadow:calc(var(--u) * 6px) 0 rgba(255,40,80,.85), calc(var(--u) * -6px) 0 rgba(0,220,255,.85); }
  28.57% { translate:calc(var(--u) * 8px) calc(var(--u) * 2px); text-shadow:calc(var(--u) * 5px) 0 rgba(255,40,80,.85), calc(var(--u) * -5px) 0 rgba(0,220,255,.85); }
  42.86% { translate:calc(var(--u) * -6px) calc(var(--u) * -2px); text-shadow:calc(var(--u) * 4px) 0 rgba(255,40,80,.85), calc(var(--u) * -4px) 0 rgba(0,220,255,.85); }
  57.14% { translate:calc(var(--u) * 5px) 0; text-shadow:calc(var(--u) * 3px) 0 rgba(255,40,80,.85), calc(var(--u) * -3px) 0 rgba(0,220,255,.85); }
  71.43% { translate:calc(var(--u) * -2px) calc(var(--u) * 1px); text-shadow:calc(var(--u) * 2px) 0 rgba(255,40,80,.85), calc(var(--u) * -2px) 0 rgba(0,220,255,.85); }
  85.71% { translate:0 0; text-shadow:calc(var(--u) * 1px) 0 rgba(255,40,80,.85), calc(var(--u) * -1px) 0 rgba(0,220,255,.85); }
}
#animGrid .demo { --u:.3; --st:.1s; display:inline-flex; gap:.3em; color:#fff; font:700 15px/1 var(--font-ui); }
/* motion looks: the whole caption opens from the middle, the word being spoken gets a box / an underline / a fill sweep, and a typing cursor */
.a-center, .demo.a-center { animation:capCenter .55s cubic-bezier(.16,1,.3,1); }
@keyframes capCenter { from { clip-path:inset(-30% 50% -30% 50%); } to { clip-path:inset(-30% -10% -30% -10%); } }
.cap .w.hlbox { background:linear-gradient(90deg, var(--hb1), var(--hb2)); border-radius:var(--hr,.26em); padding:.05em var(--hp,.22em); margin:-.05em calc(-1 * var(--hp,.22em)); text-shadow:none; box-decoration-break:clone; -webkit-box-decoration-break:clone; }
.cap .w.ul { background-image:linear-gradient(var(--hlc), var(--hlc)); background-repeat:no-repeat; background-position:0 96%; background-size:0% .09em; transition:background-size .16s ease-out; }
.cap .w.ul.on { background-size:100% .09em; }
.cap .w.fw { position:relative; }
.cap .w.fw::after { content:attr(data-t); position:absolute; left:0; top:0; white-space:nowrap; color:var(--hlc); clip-path:inset(0 var(--r,100%) 0 0); pointer-events:none; }
.cap .w { transition:scale .12s ease-out, opacity .12s ease-out, color .08s linear; }
.cap.caret .w { position:relative; }
.cap.caret .w::after { content:''; position:absolute; left:calc(100% + .05em); top:.1em; width:.07em; height:.95em; background:var(--caret); animation:caretOn var(--st,.13s) steps(1,end) calc(var(--i,0) * var(--st,.13s)) both; }
.cap.caret .w:last-of-type::after { animation:caretBlink .9s steps(1,end) calc(var(--i,0) * var(--st,.13s)) infinite; }
/* the caption styles gallery */
.stylesbtn { width:100%; margin-top:10px; display:flex; align-items:center; gap:8px; justify-content:flex-start; height:38px; }
.stylesbtn em { margin-left:auto; font-style:normal; font-size:11px; color:var(--ink-3); font-weight:500; }
.modal.styles { width:min(900px,100%); }
.styles-body { display:grid; gap:12px; }
.stabs { display:flex; gap:6px; overflow-x:auto; padding:4px; background:var(--panel-2,var(--bg)); border-radius:99px; }
.stabs button { flex:none; display:inline-flex; align-items:center; gap:6px; padding:7px 14px; border:0; border-radius:99px; background:transparent; color:var(--ink-2); font:600 12.5px var(--font-ui); cursor:pointer; white-space:nowrap; }
.stabs button[aria-selected="true"] { background:var(--panel); color:var(--accent); box-shadow:0 0 0 1.5px var(--accent) inset; }
.stabs .newtag { font-style:normal; font-size:9.5px; font-weight:700; padding:2px 6px; border-radius:99px; background:var(--accent); color:#fff; letter-spacing:.04em; }
.sgrid { display:grid; grid-template-columns:repeat(auto-fill,minmax(176px,1fr)); gap:12px; }
.mtile { display:grid; gap:8px; padding:8px; border:1px solid var(--line-2); border-radius:14px; background:var(--panel); cursor:pointer; }
.mtile:hover, .mtile:focus-visible { border-color:var(--accent); outline:none; box-shadow:0 0 0 3px var(--accent-soft); }
.mtile[aria-pressed="true"] { border-color:var(--accent); background:var(--accent-soft); }
.mstage { position:relative; display:block; height:92px; border-radius:10px; background:radial-gradient(120% 120% at 30% 0%, #23283a, #0d0f16); overflow:hidden; }
.mstage .cap { cursor:pointer; text-align:center; pointer-events:none; }
.mfoot { display:flex; align-items:center; justify-content:space-between; gap:6px; padding:0 2px 2px; }
.mname { font:600 12.5px var(--font-ui); color:var(--ink); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mfav { border:0; background:transparent; color:var(--ink-3); font-size:16px; line-height:1; cursor:pointer; padding:2px 4px; border-radius:6px; }
.mfav:hover, .mfav[aria-pressed="true"] { color:#F5B301; }
.mempty { grid-column:1/-1; padding:24px 0; text-align:center; }
@keyframes caretOn { from { opacity:1; } to { opacity:0; } }
@keyframes caretBlink { 0%, 55% { opacity:1; } 56%, 100% { opacity:0; } }

/* ===== Caption style panel, redesigned: a live look at the top, four tabs, one line for every control ===== */
.right .p-head { padding:14px 16px 10px; }
.right .p-head h2 { font-size:15px; }
.right #styTarget { height:22px; padding:0 10px; font:600 11px var(--font-ui); background:var(--accent-soft); color:var(--accent); }
.right .p-scroll { display:flex; flex-direction:column; gap:10px; padding:2px 12px 16px; }
.right #styBody { display:flex; flex-direction:column; gap:10px; }
.right .p-scroll > *, .right #styBody > * { flex:none; }   /* blocks keep their height; the panel scrolls */
.right .stybody-empty { padding:30px 20px; border:1px dashed var(--line-2); border-radius:14px; }
.right .p-bar.stick { position:sticky; top:0; z-index:5; padding:2px 0 6px; border:0; background:var(--panel); }
.right .seg { padding:3px; border-radius:11px; }
.right .seg button { height:30px; border-radius:8px; font-weight:600; }
/* the look: this caption's style playing in a small window, its name, a way to browse every style, and the quick styles */
.right .look { display:grid; grid-template-columns:104px minmax(0,1fr); grid-template-areas:"stage name" "stage browse" "strip strip"; gap:6px 12px; align-items:center; padding:10px; border:1px solid var(--line); border-radius:14px; background:var(--panel); }
.lookstage { grid-area:stage; --u:.25; position:relative; display:block; width:104px; height:66px; padding:0; border:0; border-radius:10px; cursor:pointer; background:radial-gradient(120% 130% at 25% 0%, #2a3047 0%, #11131b 62%); overflow:hidden; }
.lookstage .cap { cursor:pointer; text-align:center; pointer-events:none; }
.lookname { grid-area:name; display:grid; min-width:0; align-self:end; }
.lookname b { font:700 13.5px var(--font-ui); color:var(--ink); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lookname small { font-size:11px; color:var(--ink-3); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.right .look .btn.primary { grid-area:browse; align-self:start; width:100%; height:30px; padding:0 10px; border-radius:9px; font-weight:600; font-size:12px; }
.presets.strip { grid-area:strip; display:flex; gap:6px; overflow-x:auto; padding:2px 1px 4px; scroll-snap-type:x proximity; scrollbar-width:none; }
.presets.strip .pbtn { flex:none; width:52px; font-size:0; scroll-snap-align:start; }   /* the name is in the tooltip: no room for a label under each */
.presets.strip .ptile { height:36px; border-radius:9px; }
/* tabs */
.right .tabs { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:2px; padding:3px; background:var(--panel-3); border-radius:11px; }
.right .tabs button { height:30px; border:0; border-radius:8px; background:transparent; color:var(--ink-2); font:600 12px var(--font-ui); }
.right .tabs button:hover { color:var(--ink); }
.right .tabs button[aria-selected="true"] { background:var(--panel); color:var(--accent); box-shadow:0 0 0 1px var(--line-2), 0 1px 2px rgba(0,0,0,.15); }
.right .tabp { display:grid; gap:10px; }
.right .tabp[hidden] { display:none; }
.right .grp { display:grid; gap:8px; padding:10px 12px 12px; border:1px solid var(--line); border-radius:12px; background:var(--panel); }
.right .grp > h4 { margin:0; font:700 10.5px var(--font-ui); letter-spacing:.08em; text-transform:uppercase; color:var(--ink-3); }
/* controls: a slider is one line (label, slider, value); a colour or a switch is one line too */
.right .fld { display:grid; grid-template-columns:70px minmax(0,1fr) 46px; align-items:center; column-gap:8px; min-height:26px; }
.right .fld > .l, .right .row2 > .l, .right .swl > .l { font-size:12px; font-weight:500; color:var(--ink-2); }
.right .fld > output { justify-self:end; font:600 10.5px var(--font-mono); color:var(--ink-2); background:var(--panel-3); padding:2px 7px; border-radius:99px; white-space:nowrap; }
.right .row2 { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:30px; }
.right .row2.stack { flex-direction:column; align-items:stretch; gap:8px; }
.right .rowx { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.right .swl { display:flex; align-items:center; gap:8px; }
.right .row2[hidden], .right .fld[hidden], .right .srow[hidden] { display:none; }
.right .ctl { display:flex; align-items:center; gap:10px; }
.right .cinp { width:30px; height:30px; border-radius:50%; border:2px solid var(--panel); box-shadow:0 0 0 1px var(--line-2); }
.right .cinp input { inset:-10px; width:calc(100% + 20px); height:calc(100% + 20px); }
.right .duo { display:flex; align-items:center; gap:8px; color:var(--ink-3); } .right .duo i { font-style:normal; }
.right .fontbtn { height:38px; border-radius:10px; font-size:13.5px; padding:0 12px; }
.right select { flex:1; min-width:0; height:32px; padding:0 8px; border:1px solid var(--line-2); border-radius:9px; background:var(--panel-2); color:var(--ink); font:500 12.5px var(--font-ui); }
.right .tgl { display:flex; gap:4px; }
.right .tgl .icon-btn { width:32px; height:32px; border:1px solid var(--line-2); border-radius:9px; font-weight:700; font-size:12.5px; }
.right .tgl .icon-btn[aria-pressed="true"] { background:var(--accent-soft); color:var(--accent); border-color:var(--accent-line); }
.right .quick .btn { height:30px; border-radius:9px; font-weight:600; }
.right .seg.pills { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:3px; padding:3px; width:100%; }
.right .seg.pills button { height:28px; padding:0 2px; font-size:11.5px; }
.right .hint { font-size:11.5px; line-height:1.45; }
.right .stepper .wnum { height:32px; width:54px; border-radius:9px; }
.presets.motion { grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px 6px; }
.presets.motion .ptile { height:40px; }

/* the panel's finish: a tinted canvas with raised cards, accent touches, icons on the tabs, a stepper that lines up and a friendlier empty state */
.right .p-head { padding:12px 14px; border-bottom:1px solid var(--line); }
.right .p-head h2 { display:flex; align-items:center; gap:9px; font-size:14.5px; font-weight:700; }
.ph-ic { display:grid; place-items:center; flex:none; width:26px; height:26px; border-radius:8px; background:linear-gradient(135deg, var(--accent), #7C5CFF); color:#fff; }
.ph-ic svg { width:15px; height:15px; }
.right .p-scroll { background:var(--panel-2); padding:12px; gap:12px; }
.right #styBody { gap:12px; }
.right .p-bar.stick { background:var(--panel-2); padding:0 0 4px; }
.right .grp, .right .look { background:var(--panel); border-color:var(--line); box-shadow:0 1px 2px rgba(15,20,40,.05), 0 8px 18px -12px rgba(15,20,40,.22); }
.right .look { border-color:color-mix(in srgb, var(--accent) 32%, var(--line)); }
.right .look .btn.primary { border:0; color:#fff; background:linear-gradient(135deg, var(--accent), #7C5CFF); box-shadow:0 6px 14px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.right .look .btn.primary:hover { filter:brightness(1.07); }
.right .grp > h4 { display:flex; align-items:center; gap:7px; color:var(--ink-2); }
.right .grp > h4::before { content:""; width:6px; height:6px; border-radius:50%; background:var(--accent); }
.right .tabs { padding:4px; border-radius:12px; }
.right .tabs button { display:inline-flex; align-items:center; justify-content:center; gap:5px; height:32px; font-size:12px; }
.right .tabs button svg { width:14px; height:14px; flex:none; }
.right .tabs button[aria-selected="true"] { background:var(--panel); color:var(--accent); box-shadow:0 1px 3px rgba(15,20,40,.2); }
.right .seg button[aria-pressed="true"] { color:var(--accent); }
.right input[type=range]::-webkit-slider-runnable-track { height:6px; border-radius:3px; }
.right input[type=range]::-webkit-slider-thumb { width:16px; height:16px; margin-top:-5px; background:var(--accent); border:3px solid var(--panel); box-shadow:0 0 0 1px var(--accent), 0 2px 4px rgba(0,0,0,.25); }
.right .cinp { width:32px; height:32px; }
.right .stepper { display:grid; grid-template-columns:44px minmax(0,1fr) 44px; gap:6px; align-items:center; width:100%; }
.right .stepper .btn { min-width:0; height:36px; padding:0; border-radius:10px; font-size:16px; }
.right .stepper .wnum { width:100%; height:36px; border-radius:10px; font-size:15px; }
.right .stepper .quick { grid-column:1 / -1; margin:0; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; }
.right .stepper .quick .btn { height:30px; font-size:12.5px; font-weight:600; }
.right .stybody-empty { gap:10px; padding:24px 18px; border:1px dashed var(--line-2); border-radius:16px; background:var(--panel); }
.right .stybody-empty .mock { display:flex; align-items:center; gap:6px; padding:12px 18px; border-radius:12px; background:radial-gradient(120% 130% at 25% 0%, #2a3047, #11131b 62%); color:#fff; font:700 15px var(--font-ui); }
.right .stybody-empty .mock b { padding:1px 8px; border-radius:6px; background:linear-gradient(90deg,#FFD23F,#FF7A3D); color:#111; }
.right .stybody-empty strong { font:700 14px var(--font-ui); color:var(--ink); }
.right .stybody-empty .btn { height:34px; margin-top:4px; padding:0 14px; border-radius:10px; font-weight:600; }

/* Auto cut: a button at every place something was taken out */
.cutmark { position:absolute; top:1px; width:17px; height:17px; margin-left:-8px; padding:0; display:grid; place-items:center; border:1px solid var(--accent); border-radius:50%; background:var(--panel); color:var(--accent); cursor:pointer; z-index:4; opacity:.9; box-shadow:0 1px 3px rgba(0,0,0,.18); }
.cutmark svg { width:10px; height:10px; } .cutmark:hover { opacity:1; background:var(--accent-soft); transform:scale(1.15); }

/* accounts, projects, linking media */
.au-tabs { display:grid; grid-template-columns:1fr 1fr; gap:4px; padding:3px; margin-bottom:12px; background:var(--panel-3); border-radius:var(--r2); }
.au-tabs button { height:30px; border:0; border-radius:calc(var(--r2) - 2px); background:transparent; color:var(--ink-2); font:inherit; font-weight:550; cursor:pointer; }
.au-tabs button[aria-pressed="true"] { background:var(--panel, #fff); color:var(--ink); box-shadow:0 1px 2px rgba(0,0,0,.14); }
.au-err { margin:0 0 10px; padding:8px 10px; border-radius:var(--r2); background:var(--danger-soft); color:var(--danger); font-size:12.5px; }
.au-err.ok { background:var(--accent-soft); color:var(--ink); }
.au-go, .au-google { width:100%; justify-content:center; margin-top:6px; text-decoration:none; }
.au-or { display:flex; align-items:center; gap:10px; margin:12px 0 4px; color:var(--ink-3); font-size:12px; }
.au-or::before, .au-or::after { content:""; flex:1; height:1px; background:var(--line); }
.pj-top { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.pj-list { display:grid; gap:6px; max-height:50vh; overflow:auto; margin-bottom:10px; }
.pj-row { display:flex; align-items:center; gap:10px; padding:10px 12px; border:1px solid var(--line); border-radius:var(--r2); cursor:pointer; }
.pj-row:hover { background:var(--accent-soft); border-color:var(--line-2); }
.pj-row.on { border-color:var(--accent); }
.pj-row .nm { flex:1; min-width:0; }
.pj-row b { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pj-row small { color:var(--ink-3); }
.pj-row .act { flex:none; display:flex; gap:6px; }
.pj-row .act .btn { height:28px; padding:0 10px; font-size:12px; }
.pj-row .act .btn.sure { background:var(--danger); color:#fff; border-color:var(--danger); }
.pj-empty { padding:26px 8px; text-align:center; color:var(--ink-3); }
.pr-row { display:flex; gap:8px; } .pr-row input { flex:1; min-width:0; }
.pr-val { margin:0; font-weight:550; }
.rl-list { display:grid; gap:4px; margin:10px 0; max-height:40vh; overflow:auto; }
.rl-row { display:flex; align-items:center; gap:8px; padding:7px 10px; border:1px solid var(--line); border-radius:var(--r2); font-size:13px; }
.rl-row i { flex:none; width:8px; height:8px; border-radius:50%; background:var(--warn); }
.rl-row.ok i { background:var(--accent); }
.rl-row small { margin-left:auto; color:var(--ink-3); white-space:nowrap; }
.mcard { position:relative; }
.mcard.missing .mthumb { filter:grayscale(1) brightness(.65); }
.mmiss { position:absolute; left:6px; top:6px; z-index:2; padding:2px 8px; border:0; border-radius:999px; background:var(--warn); color:#111; font:600 11px/1.6 inherit; font-family:inherit; cursor:pointer; }

/* billing (Settings) */
.bill { margin-top:14px; padding-top:12px; border-top:1px solid var(--line); }
.bill h3 { margin:0 0 8px; font-size:13px; }
.bill-top { display:flex; align-items:baseline; gap:14px; flex-wrap:wrap; }
.bill-bal { display:flex; align-items:baseline; gap:6px; }
.bill-n { font:600 28px/1 var(--font-mono, monospace); color:var(--ink); }
.bill-n.neg { color:var(--danger); }
.bill-actions { display:flex; align-items:center; gap:10px; margin:10px 0; flex-wrap:wrap; }
.bill-hist > summary, .bill-admin > summary { cursor:pointer; font-size:12.5px; color:var(--ink-2); padding:4px 0; }
.bill-admin { margin-top:10px; padding-top:8px; border-top:1px solid var(--line); }
.bill-rows { display:grid; gap:2px; max-height:220px; overflow:auto; margin:6px 0; }
.bill-row { display:flex; align-items:baseline; gap:10px; padding:5px 6px; border-radius:6px; font-size:12.5px; }
.bill-row:hover { background:var(--accent-soft); }
.bill-row .w { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bill-row small { color:var(--ink-3); }
.bill-row .n { font-family:var(--font-mono, monospace); }
.bill-row .n.minus { color:var(--ink-2); } .bill-row .n.plus { color:var(--accent); }
.bd-form { display:grid; grid-template-columns:1.4fr 1fr; gap:6px; margin:8px 0; }
.bd-form input { min-width:0; } .bd-form .btn { grid-column:1 / -1; }
