:root {
  --bg: #0c0c0f; --bg-2: #121217; --panel: #15151b; --panel-2: #1b1b22; --panel-3: #22222b;
  --line: #262630; --line-2: #33333f; --text: #ecebf0; --text-2: #a9a8b6; --text-3: #75747f;
  --accent: #ff3b3b; --accent-2: #ff8a1f; --accent-soft: rgba(255, 59, 59, .14);
  --ok: #3ddc84; --warn: #ffb020; --info: #5a8cff;
  --r: 8px; --r-sm: 6px; --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; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
kbd { font: 500 10.5px/1 var(--font); padding: 2px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; color: var(--text-2); background: var(--panel-2); }
.ic { flex: none; display: block; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; }
.gap { gap: 8px; } .wrap { flex-wrap: wrap; } .between { justify-content: space-between; }
.muted { color: var(--text-3); }
.hint { color: var(--text-3); font-size: 12px; margin: 6px 0 2px; line-height: 1.45; }
.pad { padding: 14px; display: grid; gap: 12px; align-content: start; }
.sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; flex: none; }
.subhead { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin: 12px 0 2px; }

#app { display: grid; grid-template-rows: 48px 1fr; height: 100vh; }
.mode-root { min-height: 0; position: relative; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 16px; padding: 0 12px 0 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.brand { display: flex; align-items: center; gap: 9px; font-size: 15px; letter-spacing: -.01em; }
.brand b { font-weight: 700; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.modes { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.modes button { border: 0; background: none; padding: 5px 16px; border-radius: 6px; color: var(--text-2); font-weight: 500; }
.modes button[aria-selected=true] { background: var(--panel-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.local-pill { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-2); padding: 4px 10px; border: 1px solid var(--line); border-radius: 99px; }
.local-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 13px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--panel-3); border-color: #44444f; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #ff4a4a, #e52a2a); border-color: #ff5a5a; color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset; }
.btn.primary:hover { background: linear-gradient(180deg, #ff5c5c, #f03535); }
.btn.danger { background: #3a1416; border-color: #6b2226; color: #ffb4b4; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.sm { height: 27px; padding: 0 10px; font-size: 12px; gap: 6px; }
.btn.on, .icon-btn.on { background: var(--accent-soft); color: #ff8080; border-color: rgba(255, 59, 59, .4); }
.btn kbd { margin-left: 4px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; color: var(--text-2); padding: 0; flex: none; }
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn.sm { width: 24px; height: 24px; }
.icon-btn.btn { padding: 0; width: 32px; }
.icon-btn.on-pick { color: var(--ok); } .icon-btn.on-rej { color: var(--accent); }

/* form controls */
.sel, .txt { height: 30px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg-2); padding: 0 9px; width: 100%; color: var(--text); }
.sel:focus, .txt:focus { border-color: var(--accent-2); outline: none; }
input[type=color] { width: 100%; height: 30px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-2); padding: 2px; }
.field { display: grid; gap: 5px; }
.field > span { font-size: 12px; color: var(--text-2); }
.form-grid { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.fs { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px 12px; display: grid; gap: 10px; margin: 0; }
.fs legend { padding: 0 6px; color: var(--text-2); font-size: 12px; }
.tog { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 12.5px; }
.tog input { position: absolute; opacity: 0; pointer-events: none; }
.tog-ui { width: 30px; height: 17px; border-radius: 99px; background: var(--panel-3); border: 1px solid var(--line-2); position: relative; flex: none; transition: background .15s; }
.tog-ui::after { content: ''; position: absolute; left: 2px; top: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--text-2); transition: transform .15s, background .15s; }
.tog input:checked + .tog-ui { background: var(--accent); border-color: var(--accent); }
.tog input:checked + .tog-ui::after { transform: translateX(13px); background: #fff; }
.tog input:focus-visible + .tog-ui { outline: 2px solid var(--accent-2); }

.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; }
.seg-b { border: 0; background: none; color: var(--text-2); padding: 4px 10px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 12.5px; height: 28px; }
.seg-b:hover { color: var(--text); }
.seg-b[aria-pressed=true] { background: var(--panel-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg.small .seg-b { padding: 2px 8px; font-size: 11.5px; height: 24px; }

/* slider */
.sl { padding: 3px 0 6px; }
.sl-row { display: flex; align-items: center; justify-content: space-between; height: 20px; }
.sl-label { color: var(--text-2); font-size: 12px; cursor: default; user-select: none; }
.sl.changed .sl-label { color: var(--text); }
.sl-val { width: 64px; text-align: right; background: transparent; border: 1px solid transparent; border-radius: 4px; color: var(--text-2); font-size: 11.5px; font-variant-numeric: tabular-nums; padding: 1px 4px; }
.sl-val:hover, .sl-val:focus { border-color: var(--line-2); background: var(--bg-2); color: var(--text); outline: none; }
.sl-bar { position: relative; height: 16px; }
.sl-bar::before { content: ''; position: absolute; left: 0; right: 0; top: 7px; height: 2px; border-radius: 2px; background: var(--line-2); }
.sl-grad { position: absolute; left: 0; right: 0; top: 6px; height: 4px; border-radius: 3px; opacity: .85; }
.sl-track .sl-fill { display: none; }
.sl-fill { position: absolute; top: 7px; height: 2px; background: var(--accent); border-radius: 2px; }
.sl input[type=range] { position: absolute; inset: 0; width: 100%; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.sl input[type=range]::-webkit-slider-runnable-track { height: 16px; background: transparent; }
.sl input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #f4f4f6; margin-top: 1.5px; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.sl input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #f4f4f6; border: 0; }
.sl input[type=range]:focus-visible { outline: none; }
.sl input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent-2); }

/* collapsible sections */
.sec { border-bottom: 1px solid var(--line); }
.sec-top { display: flex; align-items: center; padding-right: 8px; }
.sec-head { flex: 1; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 11px 14px; font-weight: 600; font-size: 12.5px; text-align: left; color: var(--text); }
.sec-head .chev { transition: transform .15s; color: var(--text-3); }
.sec.open .sec-head .chev { transform: rotate(90deg); }
.sec-badge { font-size: 10.5px; color: var(--accent-2); font-weight: 500; }
.sec-extra { display: flex; gap: 2px; }
.sec-body { display: none; padding: 0 14px 14px; }
.sec.open .sec-body { display: block; }

/* panels & layout */
.panel { background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line); min-height: 46px; }
.panel-head h2 { font-size: 13px; }
.photo-mode { display: grid; grid-template-columns: 236px 1fr 318px; height: 100%; min-height: 0; }
.photo-mode .lib { border-right: 1px solid var(--line); }
.photo-mode .dev { border-left: 1px solid var(--line); }
.mode-root.dropping::after { content: 'Drop to import'; position: absolute; inset: 10px; border: 2px dashed var(--accent); border-radius: 14px; background: rgba(255, 59, 59, .07); display: grid; place-items: center; font-size: 20px; font-weight: 600; color: #ff9a9a; pointer-events: none; z-index: 50; }

/* library */
.lib-filter { padding: 10px; border-bottom: 1px solid var(--line); }
.lib-filter .seg { width: 100%; } .lib-filter .seg-b { flex: 1; justify-content: center; padding: 2px 4px; }
.lib-grid { flex: 1; overflow: auto; padding: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; outline: none; }
.lib-empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 20px; text-align: center; color: var(--text-2); }
.lib-empty .ic { color: var(--text-3); }
.lib-foot { padding: 8px 12px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; font-size: 11px; gap: 6px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--panel-2); cursor: pointer; outline: 2px solid transparent; outline-offset: 1px; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.multi { outline-color: #6a6a78; }
.thumb.active { outline-color: var(--accent); }
.thumb.rejected img { opacity: .35; filter: grayscale(1); }
.thumb-ph { position: absolute; inset: 0; display: grid; place-items: center; }
.thumb-badges { position: absolute; left: 4px; top: 4px; display: flex; gap: 3px; }
.thumb-badges .b { display: inline-flex; align-items: center; padding: 2px 4px; border-radius: 4px; background: rgba(0, 0, 0, .65); font-size: 9px; font-weight: 700; letter-spacing: .04em; color: #fff; }
.thumb-badges .pick { color: var(--ok); } .thumb-badges .rej { color: var(--accent); } .thumb-badges .ed { color: var(--accent-2); } .thumb-badges .raw { color: #c9c9d6; }
.thumb-stars { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 5px 3px; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); color: #ffd23d; font-size: 10px; letter-spacing: 1px; }

/* photo viewer */
.pv { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.pv-toolbar { display: flex; align-items: center; gap: 4px; padding: 7px 10px; border-bottom: 1px solid var(--line); background: var(--bg-2); min-height: 46px; }
.zoom-lbl { min-width: 46px; text-align: center; font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pv-host { position: relative; flex: 1; min-height: 0; overflow: hidden; outline: none; }
.pv-host.grab { cursor: grab; } .pv-host.picking { cursor: crosshair; }
.pv-canvas { position: absolute; inset: 0; display: block; }
.pv-overlay { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.pv-overlay .handle, .pv-overlay .crop-rect { pointer-events: all; }
.pv-placeholder, .pv-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--text-3); z-index: 2; pointer-events: none; }
.pv-loading { background: rgba(12, 12, 15, .45); color: var(--text-2); }
.pv-info { display: flex; align-items: center; gap: 14px; padding: 6px 12px; border-top: 1px solid var(--line); background: var(--bg-2); min-height: 38px; font-size: 12px; white-space: nowrap; overflow: hidden; }
.fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.stars { display: flex; }
.star { background: none; border: 0; color: #3e3e4a; font-size: 15px; padding: 0 1px; line-height: 1; }
.star.on { color: #ffd23d; } .star:hover { color: #ffe27a; }
.crop-shade { fill: rgba(0, 0, 0, .55); }
.crop-rect { fill: transparent; stroke: #fff; stroke-width: 1.5; cursor: move; }
.crop-grid { stroke: rgba(255, 255, 255, .35); stroke-width: 1; }
.handle { fill: #fff; stroke: rgba(0, 0, 0, .55); stroke-width: 1.5; cursor: pointer; }
.handle.round { fill: rgba(255, 255, 255, .9); }
.h-nw, .h-se { cursor: nwse-resize; } .h-ne, .h-sw { cursor: nesw-resize; } .h-n, .h-s { cursor: ns-resize; } .h-e, .h-w { cursor: ew-resize; }
.mask-shape { fill: none; stroke: #fff; stroke-width: 1.5; filter: drop-shadow(0 0 1px #000); }
.mask-shape.inner { stroke-dasharray: 4 4; stroke-opacity: .7; }
.mask-line { stroke: #fff; stroke-width: 1.5; filter: drop-shadow(0 0 1px #000); }
.mask-line.dashed { stroke-dasharray: 6 5; } .mask-line.thin { stroke-width: 1; stroke-opacity: .6; }
.redact-box { fill: rgba(255, 59, 59, .1); stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 4; }
.brush-cur { fill: none; stroke: #fff; stroke-width: 1.2; filter: drop-shadow(0 0 1px #000); }

/* right develop panel */
.hist-wrap { padding: 12px 14px 8px; border-bottom: 1px solid var(--line); }
.hist { width: 100%; height: 100px; display: block; border-radius: 6px; background: #0e0e12; }
.meta { font-size: 11px; color: var(--text-3); margin-top: 4px; min-height: 0; }
.side-body { flex: 1; overflow-y: auto; min-height: 0; }
.dev-foot { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); align-items: center; }
.dev-foot .primary { margin-left: auto; }
.side-title { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip-group { width: 100%; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 99px; padding: 4px 11px; font-size: 12px; color: var(--text-2); }
.chip:hover { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.chip.user { border-color: rgba(255, 138, 31, .5); }
.curve-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.curve-cv { width: 100%; aspect-ratio: 1; border-radius: 6px; display: block; cursor: crosshair; touch-action: none; }
.wheels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wheel-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.wheel-head span:first-child { font-weight: 600; color: var(--text); }
.wheel-read { margin-left: auto; font-size: 10px; color: var(--text-3); }
.wheel-cv { width: 100%; aspect-ratio: 1; display: block; cursor: crosshair; touch-action: none; border-radius: 50%; }
.wheel .sl-label { font-size: 11px; }
.mask-list { display: grid; gap: 4px; }
.mask-item { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); cursor: pointer; }
.mask-item.active { border-color: var(--accent); background: var(--accent-soft); }
.mask-opts { display: grid; gap: 10px; padding: 4px 0; }
.card { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); }
.callout { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: var(--r); background: var(--panel-2); color: var(--text-2); border: 1px dashed var(--line-2); }
.side-body .pad .sec { border: 1px solid var(--line); border-radius: var(--r); }

/* dialogs, menus, toasts */
.modal { border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); color: var(--text); padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.modal.wide { width: min(640px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 20px; }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 4px 20px 16px; max-height: min(70vh, 720px); overflow: auto; }
.modal-body p { color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.pbar { height: 8px; border-radius: 99px; background: var(--panel-3); overflow: hidden; margin: 8px 0 12px; }
.pbar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 64px; display: grid; gap: 8px; z-index: 1000; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 9px; background: #1f1f27; border: 1px solid var(--line-2); box-shadow: var(--shadow); max-width: 380px; animation: tin .2s ease-out; }
.toast.error { border-color: #6b2226; } .toast.error .ic { color: var(--accent); }
.toast.ok .ic { color: var(--ok); } .toast.info .ic { color: var(--info); }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.ctx { position: fixed; z-index: 900; min-width: 210px; background: #1d1d25; border: 1px solid var(--line-2); border-radius: 9px; padding: 4px; box-shadow: var(--shadow); }
.ctx button { display: flex; width: 100%; align-items: center; gap: 9px; border: 0; background: none; padding: 7px 10px; border-radius: 6px; text-align: left; font-size: 12.5px; }
.ctx button:hover { background: var(--panel-3); }
.ctx button:disabled { opacity: .4; }
.ctx button.danger { color: #ff8a8a; }
.ctx button kbd { margin-left: auto; }
.ctx hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.ic-sp { width: 14px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* help */
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; }
.help-grid h3 { grid-column: 1 / -1; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-top: 10px; }
.help-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px solid var(--line); color: var(--text-2); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c2c36; border-radius: 10px; border: 2px solid var(--panel); }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1100px) {
  .photo-mode { grid-template-columns: 180px 1fr 290px; }
  .local-pill { display: none; }
}
@media (max-width: 820px) {
  .photo-mode { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .photo-mode .lib { display: none; }
  .photo-mode .dev { max-height: 40vh; }
}

/* ===================== VIDEO MODE ===================== */
.video-mode { display: grid; grid-template-columns: 300px 1fr 330px; grid-template-rows: minmax(0, 1fr) 300px; height: 100%; min-height: 0; }
.video-mode > .vl { grid-row: 1; border-right: 1px solid var(--line); flex-direction: row; }
.video-mode > .vc { grid-row: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.video-mode > .vi { grid-row: 1; border-left: 1px solid var(--line); }
.video-mode > .tl-wrap { grid-column: 1 / -1; grid-row: 2; border-top: 1px solid var(--line); background: var(--bg-2); min-height: 0; display: flex; }

/* library rail */
.vl-rail { width: 64px; flex: none; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 6px 0; gap: 2px; background: var(--bg-2); overflow-y: auto; }
.vl-tab { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; color: var(--text-3); padding: 9px 2px; font-size: 10px; font-weight: 500; position: relative; }
.vl-tab:hover { color: var(--text); }
.vl-tab.on { color: var(--text); }
.vl-tab.on::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.vl-tab.on .ic { color: var(--accent); }
.vl-body { flex: 1; min-width: 0; overflow-y: auto; }
.vl-panel { display: flex; flex-direction: column; min-height: 100%; }
.pad-x { padding-left: 14px; padding-right: 14px; }
.bin { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; align-content: start; }
.bin-empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 10px; text-align: center; padding: 26px 8px; color: var(--text-2); }
.bin-empty .ic { color: var(--text-3); }
.bin-item { position: relative; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; cursor: grab; }
.bin-item:hover { border-color: #4a4a56; }
.bin-item.offline { opacity: .55; cursor: pointer; }
.bin-thumb { aspect-ratio: 16/10; background: #0e0e12; display: grid; place-items: center; overflow: hidden; }
.bin-thumb canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.bin-meta { padding: 5px 7px 6px; display: grid; gap: 1px; font-size: 11px; }
.bin-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); font-weight: 500; }
.bin-used { position: absolute; left: 5px; top: 5px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .7); color: var(--ok); }
.bin-warn { position: absolute; left: 26px; top: 5px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .7); color: var(--warn); }
.bin-add { position: absolute; right: 5px; top: 5px; width: 26px; height: 26px; border-radius: 7px; border: 0; display: grid; place-items: center; background: var(--accent); color: #fff; opacity: 0; transition: opacity .12s; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.bin-item:hover .bin-add, .bin-add:focus-visible { opacity: 1; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; }
.preset { border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 0 0 7px; display: grid; gap: 6px; text-align: center; font-size: 11px; color: var(--text-2); overflow: hidden; }
.preset:hover { border-color: var(--accent); color: var(--text); }
.txt-prev { height: 58px; display: grid; place-items: center; background: linear-gradient(135deg, #2a2a34, #16161c); font-size: 17px; line-height: 1.1; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list { display: grid; padding: 4px 8px 10px; }
.list-item { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 8px; border-radius: 6px; text-align: left; font-size: 12.5px; color: var(--text); }
.list-item:hover { background: var(--panel-2); }
.list-item .link { font-size: 11px; color: var(--accent-2); padding: 2px 6px; border-radius: 4px; }
.list-item .link:hover { background: rgba(255, 138, 31, .12); }
.small { font-size: 11px; }
.beat-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.beat-info div, .stats div { display: grid; justify-items: center; padding: 10px 4px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.beat-info b, .stats b { font-size: 18px; font-variant-numeric: tabular-nums; }
.beat-info span, .stats span { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stats b { font-size: 14px; }
.auto-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.auto-item { position: relative; aspect-ratio: 1; border-radius: 6px; border: 2px solid var(--line); background: var(--panel-2); padding: 0; overflow: hidden; opacity: .5; display: grid; place-items: center; }
.auto-item canvas { width: 100%; height: 100%; object-fit: cover; }
.auto-item.on { opacity: 1; border-color: var(--accent); }
.auto-check { position: absolute; right: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: #fff; display: none; place-items: center; }
.auto-item.on .auto-check { display: grid; }
.callout.warn { border-color: rgba(255, 176, 32, .5); color: #ffd28a; margin: 10px 12px 0; flex-wrap: wrap; }
.callout.warn span { flex: 1; min-width: 120px; }

/* center: preview */
.vc-top { display: flex; align-items: center; gap: 4px; padding: 7px 10px; border-bottom: 1px solid var(--line); background: var(--bg-2); min-height: 46px; }
.proj-name { background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 4px 8px; font-weight: 600; font-size: 13.5px; min-width: 120px; max-width: 280px; }
.proj-name:hover, .proj-name:focus { border-color: var(--line-2); background: var(--bg); outline: none; }
.sel-sm { width: auto; height: 28px; font-size: 12px; }
.vp-host { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; background: radial-gradient(ellipse at center, #15151a, #0b0b0e 70%); }
.vp-stage { position: relative; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); }
.vp-canvas { display: block; background: #000; }
.vp-overlay { position: absolute; inset: 0; overflow: visible; }
.vp-overlay .safe { fill: rgba(255, 59, 59, .12); stroke: rgba(255, 59, 59, .45); stroke-dasharray: 4 4; pointer-events: none; }
.vp-overlay .safe-t { fill: rgba(255, 140, 140, .85); font: 600 10px Inter, sans-serif; pointer-events: none; }
.vp-overlay .blurbox { fill: rgba(255, 59, 59, .12); stroke: #ff5a5a; stroke-width: 1.5; stroke-dasharray: 4 3; cursor: move; }
.pill.ok { background: rgba(61, 220, 132, .14); color: var(--ok); display: inline-flex; align-items: center; gap: 4px; }
.vp-overlay .vbox { fill: transparent; stroke: #fff; stroke-width: 1.4; stroke-dasharray: 5 4; cursor: move; filter: drop-shadow(0 0 1px #000); }
.transport { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--line); background: var(--bg-2); }
.transport .center { justify-content: center; } .transport .end { justify-content: flex-end; }
.play-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #f2f2f4; color: #0b0b0d; display: grid; place-items: center; }
.play-btn:hover { background: #fff; }
.play-btn .ic { fill: currentColor; }
.tc-wrap { display: flex; gap: 6px; align-items: center; margin-left: 8px; font-variant-numeric: tabular-nums; font-size: 12px; }
.tc { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; }

/* inspector */
.insp { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.insp-head { padding: 10px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 9px; }
.insp-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; min-width: 0; }
.insp-title span:not(.pill) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { font-size: 10.5px; font-weight: 500; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: #ff9a9a; flex: none; }
.seg.tabs { width: 100%; } .seg.tabs .seg-b { flex: 1; justify-content: center; padding: 3px 4px; font-size: 12px; }
.insp-body { flex: 1; overflow-y: auto; min-height: 0; }
.kf-row { display: flex; align-items: flex-end; gap: 6px; }
.kf-row .sl { flex: 1; }
.kf-btn { width: 22px; height: 22px; flex: none; margin-bottom: 4px; border: 0; background: none; color: #4a4a56; display: grid; place-items: center; border-radius: 4px; }
.kf-btn:hover { color: var(--text-2); background: var(--panel-3); }
.kf-btn.has { color: #b88a2e; } .kf-btn.on { color: #ffd23d; } .kf-btn.on .ic { fill: #ffd23d; }
.ramp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ramp-card { border: 1px solid var(--line); background: var(--panel-2); border-radius: 7px; padding: 4px 2px 5px; display: grid; justify-items: center; gap: 2px; font-size: 10.5px; color: var(--text-2); }
.ramp-card canvas { width: 100%; height: 28px; }
.ramp-card:hover { border-color: #55555f; color: var(--text); }
.ramp-card.on { border-color: #ffd23d; color: #ffd23d; background: rgba(255, 210, 61, .08); }
.ramp-ed { width: 100%; height: auto; aspect-ratio: 560 / 260; border-radius: 7px; display: block; cursor: crosshair; touch-action: none; }
textarea.txt.area { height: auto; padding: 8px 9px; resize: vertical; line-height: 1.4; font: inherit; }
.proj-list { display: grid; gap: 6px; margin-top: 12px; max-height: 50vh; overflow: auto; }
.proj-item { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); padding: 2px 4px 2px 2px; }
.proj-item.on { border-color: var(--accent); }
.proj-open { display: grid; text-align: left; background: none; border: 0; padding: 8px 10px; gap: 2px; }
.proj-open .muted { font-size: 11px; }

/* timeline */
.tl { display: flex; flex: 1; min-width: 0; min-height: 0; }
.tl-headcol { width: 132px; flex: none; border-right: 1px solid var(--line); overflow: hidden; background: var(--panel); display: flex; flex-direction: column; }
.tl-corner { height: 26px; flex: none; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; padding: 0 6px; }
.tl-heads { will-change: transform; }
.tl-head { display: flex; align-items: center; gap: 6px; padding: 0 4px 0 9px; border-bottom: 1px solid var(--line); font-size: 11.5px; }
.tl-head-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.tl-head-btns { display: flex; }
.tl-head-btns .icon-btn.sm { width: 20px; height: 20px; }
.tl-scroll { flex: 1; overflow: auto; position: relative; outline: none; }
.tl-content { position: relative; min-height: 100%; }
.tl-ruler { display: block; height: 26px; position: sticky; top: 0; z-index: 4; background: var(--bg-2); border-bottom: 1px solid var(--line); cursor: ew-resize; }
.tl-rows { position: relative; }
.tl-row { position: relative; border-bottom: 1px solid #1d1d24; }
.tl-row.main { background: rgba(255, 255, 255, .015); }
.tl-row.drop { background: rgba(255, 59, 59, .07); box-shadow: inset 0 0 0 1px rgba(255, 59, 59, .4); }
.tl-row.hid { opacity: .45; }
.tl-row-hint { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #4a4a55; font-size: 11px; pointer-events: none; white-space: nowrap; }
.tl-clip { position: absolute; top: 3px; bottom: 3px; border-radius: 6px; overflow: hidden; cursor: grab; background: #2b3550; border: 1px solid rgba(255, 255, 255, .1); user-select: none; touch-action: none; }
.tl-clip.k-video { background: #233049; }
.tl-clip.k-image { background: #2f2b45; }
.tl-clip.k-text { background: linear-gradient(180deg, #6b3fd0, #5a32b8); border-color: rgba(255, 255, 255, .15); }
.tl-clip.k-audio { background: #173a2e; border-color: rgba(120, 220, 170, .25); }
.tl-clip.sel { outline: 2px solid #fff; outline-offset: -1px; z-index: 2; }
.tl-clip.dragging { opacity: .8; z-index: 5; cursor: grabbing; box-shadow: 0 8px 20px rgba(0, 0, 0, .5); }
.tl-clip.locked { cursor: not-allowed; }
.tl-strip { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; pointer-events: none; }
.tl-wave { position: absolute; left: 0; right: 0; top: 18px; bottom: 2px; width: 100%; height: calc(100% - 20px); pointer-events: none; }
.tl-wave.mini { top: auto; height: 16px; bottom: 0; opacity: .85; background: linear-gradient(transparent, rgba(0, 0, 0, .55)); }
.tl-rampc { position: absolute; left: 0; right: 0; bottom: 2px; width: 100%; height: 22px; pointer-events: none; }
.tl-clip-label { position: absolute; left: 0; top: 0; right: 0; display: flex; align-items: center; gap: 4px; padding: 2px 7px; font-size: 10.5px; font-weight: 600; color: #fff; text-shadow: 0 1px 2px #000; background: linear-gradient(rgba(0, 0, 0, .55), transparent); white-space: nowrap; overflow: hidden; pointer-events: none; }
.tl-clip-label span { overflow: hidden; text-overflow: ellipsis; }
.k-text .tl-clip-label { background: none; top: 50%; transform: translateY(-50%); }
.tl-clip-badges { position: absolute; right: 6px; top: 2px; display: flex; gap: 3px; pointer-events: none; }
.tl-clip-badges span { display: inline-flex; align-items: center; gap: 3px; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, .65); color: #fff; text-transform: uppercase; }
.tl-clip-badges .ramp { color: #ffd23d; }
.tl-trim { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 3; }
.tl-trim.l { left: 0; } .tl-trim.r { right: 0; }
.tl-clip:hover .tl-trim, .tl-clip.sel .tl-trim { background: rgba(255, 255, 255, .25); }
.tl-trim.l::after, .tl-trim.r::after { content: ''; position: absolute; top: 50%; left: 3px; width: 3px; height: 14px; transform: translateY(-50%); border-radius: 2px; background: rgba(255, 255, 255, 0); }
.tl-clip.sel .tl-trim::after { background: #fff; }
.tl-fade { position: absolute; top: 0; bottom: 0; pointer-events: none; }
.tl-fade.in { left: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .6), transparent); }
.tl-fade.out { right: 0; background: linear-gradient(-90deg, rgba(0, 0, 0, .6), transparent); }
.tl-trans { position: absolute; bottom: 4px; width: 20px; height: 20px; margin-left: -10px; border-radius: 6px; border: 1px solid var(--line-2); background: #1d1d25; color: var(--text-3); display: grid; place-items: center; z-index: 3; padding: 0; opacity: .0; transition: opacity .12s; }
.tl-row:hover .tl-trans, .tl-trans.on { opacity: 1; }
.tl-trans:not(.on) { pointer-events: none; } .tl-row:hover .tl-trans { pointer-events: auto; }
.tl-trans.on { color: #ffd23d; border-color: rgba(255, 210, 61, .5); }
.tl-trans:hover { color: #fff; border-color: #fff; }
.tl-playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; margin-left: -1px; background: var(--accent); z-index: 6; pointer-events: none; }
.tl-ph-head { position: sticky; top: 0; width: 12px; height: 14px; margin-left: -5px; background: var(--accent); clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%); }
.tl-snapline { position: absolute; top: 0; bottom: 0; left: 0; width: 1px; background: #ffd23d; z-index: 7; pointer-events: none; box-shadow: 0 0 6px #ffd23d; }
.tl-insert { position: absolute; top: 26px; height: 64px; width: 3px; margin-left: -1.5px; background: #ffd23d; z-index: 8; border-radius: 2px; box-shadow: 0 0 8px #ffd23d; pointer-events: none; }

@media (max-width: 1280px) {
  .video-mode { grid-template-columns: 260px 1fr 300px; }
}
@media (max-width: 980px) {
  .video-mode { grid-template-columns: 1fr; grid-template-rows: auto minmax(240px, 1fr) auto 260px; }
  .video-mode > .vl { grid-row: 1; max-height: 180px; }
  .video-mode > .vc { grid-row: 2; }
  .video-mode > .vi { grid-row: 3; max-height: 260px; border-left: 0; border-top: 1px solid var(--line); }
  .video-mode > .tl-wrap { grid-row: 4; }
}
