:root {
  --bg: #0a0b0d; --panel: #111215; --panel2: #16171b; --panel3: #1c1e23; --panel4: #24262c;
  --line: rgba(255,255,255,.07); --line2: rgba(255,255,255,.12); --line3: rgba(255,255,255,.2);
  --text: #eceef2; --text2: #a4a9b4; --text3: #6d727d;
  --accent: #7be4d4; --accent2: #5fd3c1; --accent-ink: #062622; --accent-soft: rgba(123,228,212,.12); --accent-line: rgba(123,228,212,.45);
  --danger: #ff6b6b; --warn: #ffb454; --ok: #4ade80;
  --c-video: #2b5cc4; --c-image: #3a6fd8; --c-overlay: #7a4fd6; --c-text: #d9892b; --c-sticker: #d44c8e; --c-audio: #1f9e7a; --c-voice: #2f8fd8; --c-caption: #c2417a;
  --r: 8px; --r-sm: 6px; --r-lg: 12px;
  --tl-h: 300px; --rail-w: 68px; --panel-w: 316px; --insp-w: 300px; --head-w: 132px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 10px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 13px/1.4 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
button svg, .field svg { width: 16px; height: 16px; flex: none; }
input[type=number] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
::selection { background: rgba(123,228,212,.3); }
.scroll-y { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2a2c32 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2c32; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #3a3d45; }
::-webkit-scrollbar-corner { background: transparent; }
[hidden] { display: none !important; }
.muted { color: var(--text2); } .faint { color: var(--text3); }
kbd { font: 11px/1 var(--font); background: var(--panel4); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; color: var(--text2); }

/* ── boot ── */
#boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 1000; }
#boot .box { display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--text2); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(123,228,212,.18); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── layout ── */
#app { display: grid; height: 100vh; grid-template-rows: 52px minmax(0, 1fr) 6px var(--tl-h); grid-template-columns: var(--rail-w) var(--panel-w) minmax(0, 1fr) var(--insp-w); }
#hdr { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
#rail { grid-row: 2; grid-column: 1; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 8px 0; gap: 2px; overflow-y: auto; scrollbar-width: none; }
#panel { grid-row: 2; grid-column: 2; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#stage-wrap { grid-row: 2; grid-column: 3; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #07080a; }
#inspector { grid-row: 2; grid-column: 4; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#resizer { grid-row: 3; grid-column: 1 / -1; cursor: row-resize; background: var(--panel); border-top: 1px solid var(--line); position: relative; }
#resizer::after { content: ''; position: absolute; left: 50%; top: 1px; width: 36px; height: 3px; margin-left: -18px; border-radius: 3px; background: var(--line2); }
#resizer:hover::after { background: var(--accent); }
#timeline { grid-row: 4; grid-column: 1 / -1; background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
#app.no-panel { grid-template-columns: var(--rail-w) 0 minmax(0, 1fr) var(--insp-w); }
#app.no-panel #panel { display: none; }
@media (max-width: 1180px) { :root { --panel-w: 280px; --insp-w: 272px; } }
@media (max-width: 980px) { #app { grid-template-columns: var(--rail-w) 0 minmax(0,1fr) 0; } #panel, #inspector { display: none; } #app.panel-open #panel { display: flex; position: fixed; left: var(--rail-w); top: 52px; bottom: calc(var(--tl-h) + 6px); width: 300px; z-index: 50; box-shadow: var(--shadow); } }

/* ── header ── */
.hbtn { height: 32px; min-width: 32px; padding: 0 10px; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--text2); transition: background .12s, color .12s; white-space: nowrap; }
.hbtn:hover:not(:disabled) { background: var(--panel3); color: var(--text); }
.hbtn:disabled { opacity: .35; cursor: default; }
.hbtn svg { width: 18px; height: 18px; flex: none; }
.hdr-logo { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 4px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.hdr-logo img { width: 26px; height: 26px; border-radius: 7px; }
.hdr-sep { width: 1px; height: 22px; background: var(--line2); margin: 0 4px; }
.proj-name { background: transparent; border: 1px solid transparent; border-radius: var(--r-sm); padding: 5px 8px; font-weight: 600; width: 240px; max-width: 28vw; color: var(--text); }
.proj-name:hover { border-color: var(--line2); }
.proj-name:focus { outline: none; border-color: var(--accent-line); background: var(--panel2); }
.save-state { font-size: 12px; color: var(--text3); display: flex; align-items: center; gap: 6px; }
.hdr-spacer { flex: 1; }
.btn-primary { height: 34px; padding: 0 16px; border-radius: var(--r); background: var(--accent); color: var(--accent-ink); font-weight: 700; display: inline-flex; align-items: center; gap: 8px; transition: filter .12s, transform .06s; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-primary svg { width: 16px; height: 16px; }
.btn { height: 32px; padding: 0 12px; border-radius: var(--r-sm); background: var(--panel3); border: 1px solid var(--line); color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 500; transition: background .12s, border-color .12s; }
.btn:hover:not(:disabled) { background: var(--panel4); border-color: var(--line2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.lg { height: 40px; padding: 0 16px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.btn.accent:hover:not(:disabled) { background: rgba(123,228,212,.2); }
.btn.danger { color: var(--danger); }
.btn svg { width: 15px; height: 15px; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 99px; background: var(--panel3); border: 1px solid var(--line); color: var(--text2); font-size: 12px; }
.chip:hover { color: var(--text); border-color: var(--line2); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.badge { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; background: rgba(255,180,84,.12); color: var(--warn); border: 1px solid rgba(255,180,84,.35); }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }

/* dropdown */
.dd { position: relative; }
.dd-menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 220px; background: var(--panel2); border: 1px solid var(--line2); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; z-index: 200; }
.dd-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r-sm); text-align: left; color: var(--text); }
.dd-item:hover { background: var(--panel4); }
.dd-item .sub { color: var(--text3); font-size: 12px; margin-left: auto; }
.dd-item.on { color: var(--accent); }
.dd-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.ar-ico { width: 22px; height: 22px; display: grid; place-items: center; }
.ar-ico i { display: block; border: 1.5px solid currentColor; border-radius: 2px; }

/* ── rail ── */
.rail-btn { width: 56px; padding: 7px 0 6px; border-radius: var(--r); display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text3); font-size: 10.5px; font-weight: 500; transition: color .12s, background .12s; }
.rail-btn svg { width: 20px; height: 20px; }
.rail-btn:hover { color: var(--text); background: var(--panel3); }
.rail-btn.on { color: var(--accent); background: var(--accent-soft); }
.rail-sep { width: 32px; height: 1px; background: var(--line); margin: 6px 0; }

/* ── panel ── */
.pnl-head { padding: 14px 14px 10px; display: flex; align-items: center; gap: 8px; }
.pnl-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; flex: 1; }
.pnl-body { flex: 1; min-height: 0; padding: 0 14px 18px; }
.pnl-sec { margin: 14px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text3); display: flex; align-items: center; gap: 8px; }
.pnl-sec .grow { flex: 1; }
.search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r); }
.search:focus-within { border-color: var(--accent-line); }
.search input { flex: 1; background: none; border: 0; outline: none; min-width: 0; }
.search svg { width: 15px; height: 15px; color: var(--text3); }
.tabs { display: flex; gap: 4px; padding: 3px; background: var(--panel2); border-radius: var(--r); border: 1px solid var(--line); }
.tab { flex: 1; height: 28px; border-radius: 6px; color: var(--text2); font-weight: 500; font-size: 12.5px; }
.tab:hover { color: var(--text); }
.tab.on { background: var(--panel4); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.3); }

.drop-zone { border: 1.5px dashed var(--line3); border-radius: var(--r-lg); padding: 22px 14px; text-align: center; color: var(--text2); cursor: pointer; transition: border-color .15s, background .15s; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.drop-zone:hover, .drop-zone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.drop-zone svg { width: 28px; height: 28px; color: var(--accent); }
.drop-zone b { color: var(--text); font-size: 14px; }
.drop-zone small { color: var(--text3); font-size: 11.5px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.card { position: relative; border-radius: var(--r); overflow: hidden; background: var(--panel3); border: 1px solid var(--line); cursor: pointer; transition: border-color .12s, transform .12s; }
.card:hover { border-color: var(--line3); }
.card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.card .thumb { aspect-ratio: 16/10; background: #000 center/cover no-repeat; display: grid; place-items: center; position: relative; overflow: hidden; }
.card .thumb img, .card .thumb video, .card .thumb canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .meta { padding: 6px 8px; font-size: 11.5px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .dur { position: absolute; right: 5px; bottom: 5px; font-size: 10.5px; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.72); color: #fff; font-variant-numeric: tabular-nums; }
.card .add { position: absolute; right: 5px; top: 5px; width: 24px; height: 24px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; opacity: 0; transform: scale(.85); transition: opacity .12s, transform .12s; }
.card:hover .add { opacity: 1; transform: none; }
.card .add svg { width: 14px; height: 14px; }
.card .status { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.55); font-size: 11px; color: var(--text2); text-align: center; padding: 6px; }
.card .kind { position: absolute; left: 5px; top: 5px; font-size: 10px; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.65); color: #fff; }

.list-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r); cursor: pointer; }
.list-row:hover { background: var(--panel3); }
.list-row .ico { width: 34px; height: 34px; border-radius: 8px; background: var(--panel4); display: grid; place-items: center; flex: none; color: var(--accent); }
.list-row .ico svg { width: 16px; height: 16px; }
.list-row .txt { flex: 1; min-width: 0; }
.list-row .t1 { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .t2 { font-size: 11.5px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .act { opacity: 0; transition: opacity .12s; }
.list-row:hover .act { opacity: 1; }
.play-mini { width: 30px; height: 30px; border-radius: 50%; background: var(--panel4); display: grid; place-items: center; flex: none; color: var(--text); }
.play-mini:hover { background: var(--accent); color: var(--accent-ink); }
.play-mini svg { width: 13px; height: 13px; }

/* text preset gallery */
.tp-card { height: 74px; border-radius: var(--r); background: linear-gradient(135deg, #1b1d22, #121317); border: 1px solid var(--line); display: grid; place-items: center; cursor: pointer; overflow: hidden; padding: 6px; text-align: center; transition: border-color .12s; }
.tp-card:hover { border-color: var(--accent-line); }
.tp-card canvas { max-width: 100%; max-height: 100%; }
.cap-card { height: 86px; border-radius: var(--r); background: #1a1c20 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8"><rect width="4" height="4" fill="%23202227"/><rect x="4" y="4" width="4" height="4" fill="%23202227"/></svg>'); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; gap: 4px; }
.cap-card:hover { border-color: var(--line3); }
.cap-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cap-card canvas { max-width: 96%; }
.cap-card span { font-size: 11px; color: var(--text2); }
.fx-card { border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); cursor: pointer; background: var(--panel3); }
.fx-card:hover { border-color: var(--line3); }
.fx-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.fx-card canvas { width: 100%; aspect-ratio: 1; display: block; background: #000; }
.fx-card span { display: block; padding: 5px 6px; font-size: 11px; color: var(--text2); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.emoji-grid button { font-size: 24px; height: 42px; border-radius: 8px; }
.emoji-grid button:hover { background: var(--panel3); }

.ai-card { display: flex; gap: 12px; padding: 12px; border-radius: var(--r-lg); background: var(--panel2); border: 1px solid var(--line); margin-bottom: 8px; cursor: pointer; transition: border-color .12s, background .12s; }
.ai-card:hover { border-color: var(--accent-line); background: var(--panel3); }
.ai-card .ico { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; background: linear-gradient(135deg, rgba(123,228,212,.25), rgba(122,79,214,.25)); color: var(--accent); }
.ai-card .ico svg { width: 18px; height: 18px; }
.ai-card b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.ai-card p { font-size: 12px; color: var(--text2); line-height: 1.45; }
.ai-card.busy { pointer-events: none; opacity: .7; }

/* ── stage ── */
#stage { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; overflow: hidden; padding: 18px; }
#stage canvas#preview { display: block; background: #000; box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 20px 60px rgba(0,0,0,.6); border-radius: 2px; }
#overlay { position: absolute; pointer-events: none; }
#overlay .sel { position: absolute; border: 1.5px solid var(--accent); pointer-events: auto; cursor: move; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
#overlay .sel.hover { border-style: dashed; border-color: rgba(123,228,212,.7); pointer-events: none; }
#overlay .h { position: absolute; width: 12px; height: 12px; background: #fff; border: 1.5px solid var(--accent); border-radius: 3px; margin: -6px 0 0 -6px; pointer-events: auto; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
#overlay .h.rot { border-radius: 50%; cursor: grab; }
#overlay .h.rot::after { content: ''; position: absolute; left: 4px; top: 10px; width: 1.5px; height: 14px; background: var(--accent); }
#overlay .guide { position: absolute; background: #ff4fd8; pointer-events: none; }
#overlay .guide.v { width: 1px; top: 0; bottom: 0; }
#overlay .guide.h2 { height: 1px; left: 0; right: 0; }
#overlay .safe { position: absolute; inset: 0; pointer-events: none; }
#overlay .safe img { width: 100%; height: 100%; }
.inline-edit { position: absolute; pointer-events: auto; outline: none; color: transparent; caret-color: var(--accent); white-space: pre-wrap; text-align: center; background: rgba(0,0,0,.001); }
.stage-empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.stage-empty .box { pointer-events: auto; text-align: center; max-width: 440px; padding: 28px; border-radius: 18px; border: 1.5px dashed var(--line3); background: rgba(17,18,21,.9); display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; transition: border-color .15s; }
.stage-empty .box:hover { border-color: var(--accent); }
.stage-empty .box > svg { width: 40px; height: 40px; color: var(--accent); }
.stage-empty h2 { font-size: 20px; letter-spacing: -.02em; }
.stage-empty p { color: var(--text2); line-height: 1.5; }
.stage-empty .row { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
.stage-empty { display: flex; overflow: auto; padding: 12px; }
.stage-empty .box { max-width: 560px; margin: auto; padding: 18px 20px; gap: 8px; }
.stage-empty .box > svg { width: 30px; height: 30px; }
.stage-empty h2 { font-size: 18px; }
.stage-empty .box > p:not(.faint) { font-size: 13px; }
.stage-empty .recipes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin-top: 8px; }
.stage-empty .recipe { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2, rgba(255,255,255,.03)); color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; }
.stage-empty .recipe:hover { border-color: var(--accent); background: rgba(123,228,212,.06); }
.stage-empty .recipe .re { font-size: 20px; flex: none; }
.stage-empty .recipe .rt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stage-empty .recipe b { font-size: 13px; font-weight: 600; }
.stage-empty .recipe small { font-size: 11.5px; color: var(--text2); }
.stage-drop { position: absolute; inset: 10px; border: 2px dashed var(--accent); border-radius: 16px; background: rgba(123,228,212,.08); display: grid; place-items: center; color: var(--accent); font-size: 16px; font-weight: 600; pointer-events: none; z-index: 40; }
#transport { height: 50px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-top: 1px solid var(--line); background: var(--panel); }
#transport .time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text); min-width: 150px; }
#transport .time span { color: var(--text3); }
.play-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--text); color: #000; display: grid; place-items: center; transition: transform .08s, background .12s; }
.play-btn:hover { background: #fff; transform: scale(1.05); }
.play-btn svg { width: 16px; height: 16px; }
#transport .grow { flex: 1; }
.stage-badge { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; z-index: 5; }
.stage-badge span { font-size: 10.5px; font-weight: 600; padding: 3px 7px; border-radius: 5px; background: rgba(0,0,0,.6); color: var(--text2); backdrop-filter: blur(6px); }

/* ── inspector ── */
.insp-head { padding: 12px 14px 0; display: flex; align-items: center; gap: 8px; min-height: 44px; }
.insp-head .ico { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; flex: none; }
.insp-head .ico svg { width: 15px; height: 15px; }
.insp-head .t { font-weight: 700; font-size: 14px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insp-tabs { display: flex; gap: 2px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.insp-tab { padding: 8px 8px; font-size: 12.5px; font-weight: 500; color: var(--text3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.insp-tab:hover { color: var(--text); }
.insp-tab.on { color: var(--text); border-bottom-color: var(--accent); }
.insp-body { flex: 1; min-height: 0; padding: 12px 14px 24px; }
.grp { padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.grp:last-child { border-bottom: 0; }
.grp-h { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text3); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.grp-h .grow { flex: 1; }
.grp-h button { color: var(--text3); font-size: 11px; text-transform: none; letter-spacing: 0; }
.grp-h button:hover { color: var(--accent); }
.row { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.row > label { width: 84px; flex: none; font-size: 12px; color: var(--text2); }
.row .grow { flex: 1; min-width: 0; }
.slider { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.slider input[type=range] { flex: 1; min-width: 0; }
.num { width: 54px; height: 26px; padding: 0 6px; border-radius: 5px; background: var(--panel2); border: 1px solid var(--line); text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.num:focus { outline: none; border-color: var(--accent-line); }
input[type=range] { -webkit-appearance: none; appearance: none; height: 18px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--pct, 50%), var(--panel4) var(--pct, 50%)); }
input[type=range]::-moz-range-track { height: 3px; border-radius: 3px; background: var(--panel4); }
input[type=range]::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; margin-top: -5.5px; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }
.kf-btn { width: 20px; height: 20px; display: grid; place-items: center; color: var(--text3); flex: none; border-radius: 4px; }
.kf-btn:hover { color: var(--text); background: var(--panel3); }
.kf-btn.on { color: var(--warn); }
.kf-btn.has { color: #c8a05a; }
.kf-btn svg { width: 11px; height: 11px; }
.field { width: 100%; height: 32px; padding: 0 10px; border-radius: var(--r-sm); background: var(--panel2); border: 1px solid var(--line); }
.field:focus { outline: none; border-color: var(--accent-line); }
textarea.field { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
select.field { appearance: none; background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6"><path d="M1 1l4 4 4-4" stroke="%23888" fill="none" stroke-width="1.5"/></svg>'); background-repeat: no-repeat; background-position: right 10px center; padding-right: 26px; }
.seg { display: flex; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; gap: 2px; flex: 1; }
.seg button { flex: 1; height: 26px; border-radius: 4px; color: var(--text2); font-size: 12px; display: grid; place-items: center; }
.seg button svg { width: 15px; height: 15px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel4); color: var(--text); }
.swatch { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line2); cursor: pointer; flex: none; position: relative; overflow: hidden; }
.swatch input { position: absolute; inset: -8px; width: 44px; height: 44px; opacity: 0; cursor: pointer; }
.toggle { position: relative; width: 34px; height: 20px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; border-radius: 20px; background: var(--panel4); transition: background .15s; cursor: pointer; }
.toggle span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #cfd3da; transition: transform .15s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(14px); background: #fff; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { height: 28px; padding: 0 10px; border-radius: 7px; background: var(--panel2); border: 1px solid var(--line); color: var(--text2); font-size: 12px; }
.pill:hover { color: var(--text); border-color: var(--line2); }
.pill.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.anim-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.anim-tile { height: 56px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; color: var(--text2); overflow: hidden; }
.anim-tile:hover { border-color: var(--line2); color: var(--text); }
.anim-tile.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.anim-tile i { display: block; width: 18px; height: 12px; border-radius: 3px; background: currentColor; opacity: .8; }
.anim-tile:hover i { animation: var(--demo) 0.9s ease infinite; }
@keyframes a-fade { 0% { opacity: 0; } 100% { opacity: .8; } }
@keyframes a-pop { 0% { transform: scale(.2); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes a-up { 0% { transform: translateY(10px); opacity: 0; } 100% { transform: none; opacity: .8; } }
@keyframes a-down { 0% { transform: translateY(-10px); opacity: 0; } 100% { transform: none; opacity: .8; } }
@keyframes a-left { 0% { transform: translateX(14px); opacity: 0; } 100% { transform: none; opacity: .8; } }
@keyframes a-right { 0% { transform: translateX(-14px); opacity: 0; } 100% { transform: none; opacity: .8; } }
@keyframes a-zoom { 0% { transform: scale(.4); opacity: 0; } 100% { transform: none; opacity: .8; } }
@keyframes a-spin { 0% { transform: rotate(-180deg) scale(.4); } 100% { transform: none; } }
@keyframes a-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }
@keyframes a-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes a-wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
.empty-insp { padding: 28px 18px; text-align: center; color: var(--text2); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty-insp svg { width: 34px; height: 34px; color: var(--text3); }
.hint { font-size: 11.5px; color: var(--text3); line-height: 1.45; margin-top: 6px; }
.note { font-size: 12px; color: var(--text2); background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; line-height: 1.5; }
.note.warn { border-color: rgba(255,180,84,.35); background: rgba(255,180,84,.06); }

/* ── timeline ── */
.tl-bar { height: 42px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.tl-bar .hbtn { height: 30px; min-width: 30px; padding: 0 7px; }
.tl-bar .hbtn.on { color: var(--accent); }
.tl-bar .sep { width: 1px; height: 20px; background: var(--line2); margin: 0 5px; }
.tl-bar .grow { flex: 1; }
.tl-zoom { display: flex; align-items: center; gap: 4px; }
.tl-zoom input { width: 110px; }
.tl-scroll { flex: 1; min-height: 0; overflow: auto; position: relative; scrollbar-width: thin; overscroll-behavior: contain; }
.tl-grid { position: relative; min-width: 100%; }
.tl-ruler-row { position: sticky; top: 0; z-index: 12; display: flex; height: 26px; background: var(--panel); border-bottom: 1px solid var(--line); }
.tl-corner { position: sticky; left: 0; z-index: 13; width: var(--head-w); flex: none; background: var(--panel); border-right: 1px solid var(--line); }
.tl-ruler { position: relative; flex: 1; cursor: text; }
.tl-ruler canvas { position: sticky; left: var(--head-w); display: block; }
.tl-row { display: flex; position: relative; border-bottom: 1px solid rgba(255,255,255,.035); }
.tl-head { position: sticky; left: 0; z-index: 10; width: var(--head-w); flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; align-items: center; gap: 2px; padding: 0 6px 0 10px; }
.tl-head .nm { flex: 1; font-size: 11.5px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.tl-head .nm svg { width: 13px; height: 13px; flex: none; }
.tl-head button { width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center; color: var(--text3); }
.tl-head button:hover { color: var(--text); background: var(--panel3); }
.tl-head button.on { color: var(--warn); }
.tl-head button svg { width: 13px; height: 13px; }
.tl-lane { position: relative; flex: 1; }
.tl-row.main .tl-lane { background: rgba(255,255,255,.018); }
.tl-row.drop-target .tl-lane { background: rgba(123,228,212,.06); }
.tl-item { position: absolute; top: 3px; bottom: 3px; border-radius: 6px; overflow: hidden; cursor: grab; background: var(--c); border: 1px solid rgba(255,255,255,.14); color: #fff; user-select: none; touch-action: none; }
.tl-item.sel { box-shadow: 0 0 0 2px #fff inset, 0 0 0 1px rgba(0,0,0,.4); border-color: #fff; z-index: 3; }
.tl-item.dragging { opacity: .88; z-index: 6; cursor: grabbing; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.tl-item.ghost { opacity: .35; }
.tl-item canvas { position: absolute; top: 0; height: 100%; pointer-events: none; }
.tl-item .lbl { position: absolute; left: 6px; top: 3px; right: 6px; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0,0,0,.8); pointer-events: none; display: flex; gap: 5px; align-items: center; }
.tl-item .lbl .spd { background: rgba(0,0,0,.5); padding: 0 4px; border-radius: 3px; font-size: 10px; }
.tl-item .hdl { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 2; }
.tl-item .hdl.l { left: 0; } .tl-item .hdl.r { right: 0; }
.tl-item.sel .hdl::after { content: ''; position: absolute; top: 50%; width: 3px; height: 16px; margin-top: -8px; border-radius: 2px; background: #fff; }
.tl-item.sel .hdl.l::after { left: 3px; } .tl-item.sel .hdl.r::after { right: 3px; }
.tl-item .fades { position: absolute; inset: 0; pointer-events: none; }
.tl-item .kfs { position: absolute; left: 0; right: 0; bottom: 2px; height: 8px; pointer-events: none; }
.tl-item .kfs i { position: absolute; width: 7px; height: 7px; margin-left: -3.5px; background: #ffd27a; transform: rotate(45deg); border: 1px solid rgba(0,0,0,.5); }
.tl-item.missing { background: repeating-linear-gradient(45deg, #3a1d1d, #3a1d1d 8px, #2a1515 8px, #2a1515 16px); }
.tl-trans { position: absolute; bottom: 5px; width: 18px; height: 18px; margin: 0 0 0 -9px; border-radius: 5px; background: var(--panel4); border: 1px solid var(--line3); z-index: 5; display: grid; place-items: center; color: var(--text2); opacity: 0; transition: opacity .12s, transform .12s; }
.tl-row.main:hover .tl-trans, .tl-trans.has { opacity: 1; }
.tl-trans:not(.has) { pointer-events: none; }
.tl-row.main:hover .tl-trans { pointer-events: auto; }
.tl-trans:hover { transform: scale(1.12); color: var(--accent); border-color: var(--accent); }
.tl-trans.has { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tl-trans.sel { box-shadow: 0 0 0 2px #fff; }
.tl-trans svg { width: 11px; height: 11px; }
.tl-playhead { position: absolute; top: 0; bottom: 0; width: 0; z-index: 14; pointer-events: none; }
.tl-playhead::before { content: ''; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,.6); }
.tl-playhead i { position: absolute; top: 2px; left: -7px; width: 14px; height: 18px; background: #fff; border-radius: 3px 3px 7px 7px; pointer-events: auto; cursor: ew-resize; }
.tl-snap { position: absolute; top: 0; bottom: 0; width: 1px; background: #ffd400; z-index: 13; pointer-events: none; }
.tl-insert { position: absolute; width: 3px; margin-left: -1.5px; background: var(--accent); border-radius: 2px; z-index: 15; pointer-events: none; box-shadow: 0 0 8px var(--accent); }
.tl-marquee { position: absolute; border: 1px solid var(--accent); background: rgba(123,228,212,.08); z-index: 12; pointer-events: none; }
.tl-empty svg { width: 16px; height: 16px; flex: none; }
.tl-empty { position: absolute; left: calc(var(--head-w) + 24px); top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 12.5px; pointer-events: none; display: flex; gap: 8px; align-items: center; }
.tl-marker { position: absolute; top: 0; width: 0; height: 26px; z-index: 12; }
.tl-marker i { position: absolute; left: -5px; top: 3px; width: 10px; height: 12px; background: var(--warn); clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%); cursor: pointer; }

/* ── modal ── */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 500; display: grid; place-items: center; animation: fadein .15s ease; }
.modal { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; animation: popin .18s cubic-bezier(.2,.9,.3,1.2); }
.modal.wide { width: min(860px, calc(100vw - 32px)); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; }
.modal-h h3 { font-size: 16px; flex: 1; letter-spacing: -.01em; }
.modal-b { padding: 4px 18px 18px; overflow-y: auto; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
@keyframes fadein { from { opacity: 0; } }
@keyframes popin { from { opacity: 0; transform: scale(.96) translateY(6px); } }
.progress { height: 8px; border-radius: 8px; background: var(--panel4); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); border-radius: 8px; transition: width .2s; }

/* ── toast ── */
#toasts { position: fixed; left: 50%; bottom: calc(var(--tl-h) + 72px); transform: translateX(-50%); z-index: 600; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--panel4); border: 1px solid var(--line2); color: var(--text); padding: 9px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; display: flex; gap: 10px; align-items: center; pointer-events: auto; animation: toastin .2s ease; max-width: 520px; }
.toast.err { border-color: rgba(255,107,107,.5); }
.toast.ok svg { color: var(--ok); }
.toast button { color: var(--accent); font-weight: 600; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* context menu */
.ctx { position: fixed; z-index: 700; min-width: 200px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; }
.ctx button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 6px; text-align: left; font-size: 12.5px; }
.ctx button:hover:not(:disabled) { background: var(--panel4); }
.ctx button:disabled { opacity: .4; }
.ctx button svg { width: 14px; height: 14px; color: var(--text2); }
.ctx button kbd { margin-left: auto; }
.ctx hr { border: 0; height: 1px; background: var(--line); margin: 4px; }

/* transcript */
.transcript { line-height: 1.9; font-size: 14px; }
.transcript .w { border-radius: 3px; padding: 1px 1px; cursor: pointer; transition: background .1s; }
.transcript .w:hover { background: var(--panel4); }
.transcript .w.now { background: var(--accent); color: var(--accent-ink); }
.transcript .w.sel { background: rgba(123,228,212,.28); }
.transcript .w.filler { text-decoration: underline wavy rgba(255,180,84,.7); text-underline-offset: 3px; }
.transcript .w.cut { text-decoration: line-through; color: var(--text3); }
.transcript .gap { display: inline-block; color: var(--text3); font-size: 11px; padding: 0 3px; cursor: pointer; }
.transcript .gap:hover { color: var(--warn); }
.cap-line { display: flex; gap: 8px; align-items: flex-start; padding: 6px; border-radius: 8px; }
.cap-line:hover { background: var(--panel2); }
.cap-line.now { background: var(--accent-soft); }
.cap-line .tc { font-size: 11px; color: var(--text3); font-variant-numeric: tabular-nums; padding-top: 6px; width: 38px; flex: none; cursor: pointer; }
.cap-line .tc:hover { color: var(--accent); }
.cap-line input { flex: 1; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; }
.cap-line input:hover { border-color: var(--line); }
.cap-line input:focus { outline: none; border-color: var(--accent-line); background: var(--panel2); }

.kbd-grid { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 13px; }
.kbd-grid div:nth-child(odd) { color: var(--text2); }
.upsell { background: linear-gradient(135deg, rgba(123,228,212,.14), rgba(122,79,214,.14)); border: 1px solid var(--accent-line); border-radius: 12px; padding: 14px; }
