/* Raaj Premiere — dark editing environment, mobile first. */
@font-face { font-family: 'Inter'; src: url(../fonts/inter-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(../fonts/inter-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(../fonts/inter-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(../fonts/inter-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(../fonts/inter-latin-800-normal.woff2) format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --bg: #0d0f14;
  --bg2: #12151c;
  --panel: #161a22;
  --panel2: #1c212b;
  --raised: #232936;
  --line: #2a303d;
  --line2: #363e4e;
  --text: #e8ebf1;
  --muted: #9aa3b5;
  --faint: #6b7487;
  --accent: #5b8cff;
  --accent2: #87a9ff;
  --accent-ink: #0b1430;
  --gold: #e3b45b;
  --danger: #ff5d6c;
  --ok: #3ccf91;
  --warn: #ffb547;
  --clip-video: #3a5ba8;
  --clip-image: #3b6f8f;
  --clip-audio: #2a7a5f;
  --clip-text: #7c55c0;
  --clip-shape: #a8653a;
  --clip-adjust: #5a6175;
  --clip-color: #4d4f5c;
  --playhead: #ffd25a;
  --radius: 10px;
  --tap: 44px;
  --top-h: 52px;
  --tabs-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.4 Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 26px; height: 26px; }
a { color: var(--accent2); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line2);
  background: var(--raised); color: var(--text); font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: #4a5468; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #6d99ff; }
.btn.danger { background: transparent; border-color: rgba(255,93,108,.5); color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 10px;
  background: transparent; border: 0; color: var(--text); flex: none; position: relative;
}
.icon-btn:hover { background: rgba(255,255,255,.06); }
.icon-btn:active { background: rgba(255,255,255,.1); }
.icon-btn.on { color: var(--accent2); background: rgba(91,140,255,.14); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }
.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line2);
  background: var(--bg2); color: var(--text); outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,140,255,.2); }
textarea.input { min-height: 84px; resize: vertical; }
.field { display: grid; gap: 6px; margin: 10px 0; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 0 12px; min-height: 36px; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--accent); color: #fff; }
input[type=color] { width: 40px; height: 34px; border: 1px solid var(--line2); border-radius: 8px; background: var(--bg2); padding: 2px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }

/* range sliders */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; touch-action: pan-y; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; background: var(--line2); border-radius: 4px; }
input[type=range]::-moz-range-track { height: 4px; background: var(--line2); border-radius: 4px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }

/* ---------- toasts & dialogs ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); z-index: 1000; display: grid; gap: 8px; pointer-events: none; width: min(92vw, 420px); }
.toast { background: #2b3243; border: 1px solid var(--line2); color: var(--text); padding: 10px 14px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.4); font-weight: 500; transition: opacity .3s, transform .3s; }
.toast.err { border-color: rgba(255,93,108,.6); }
.toast.ok { border-color: rgba(60,207,145,.6); }
.toast.out { opacity: 0; transform: translateY(8px); }
dialog.modal { border: 1px solid var(--line2); background: var(--panel); color: var(--text); border-radius: 16px; padding: 0; width: min(94vw, 520px); max-height: 90vh; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
dialog.modal.wide { width: min(96vw, 760px); }
dialog.modal::backdrop { background: rgba(4,6,10,.65); backdrop-filter: blur(2px); }
dialog.modal form { display: flex; flex-direction: column; max-height: 90vh; }
dialog.modal header { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 18px; border-bottom: 1px solid var(--line); }
dialog.modal h2 { font-size: 16px; margin: 0; }
.modal-body { padding: 14px 18px; overflow: auto; }
.modal-body p { margin: 6px 0; color: var(--muted); }
dialog.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (max-width: 560px) {
  dialog.modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 92vh; }
}
.menu { position: fixed; z-index: 900; min-width: 210px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 12px; padding: 6px; box-shadow: 0 20px 50px rgba(0,0,0,.55); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 12px; border: 0; background: transparent; border-radius: 8px; text-align: left; }
.menu button:hover { background: rgba(255,255,255,.06); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- home ---------- */
.home { min-height: 100%; padding: calc(16px + var(--safe-t)) 16px calc(32px + var(--safe-b)); max-width: 1180px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; flex: none; }
.brand h1 { font-size: 20px; margin: 0; letter-spacing: .02em; }
.brand h1 b { color: var(--gold); font-weight: 800; }
.brand p { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.hero { background: linear-gradient(135deg, #1a2140, #131722 60%); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-bottom: 18px; }
.hero h2 { margin: 0 0 4px; font-size: 22px; }
.hero p { margin: 0 0 14px; color: var(--muted); }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.preset { display: grid; gap: 8px; justify-items: center; padding: 14px 8px; border-radius: 14px; border: 1px solid var(--line2); background: rgba(255,255,255,.03); text-align: center; }
.preset:hover { border-color: var(--accent); }
.preset .frame { border: 2px solid var(--accent2); border-radius: 4px; background: rgba(91,140,255,.12); }
.preset b { font-size: 14px; }
.preset small { color: var(--muted); font-size: 12px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.section-title h3 { margin: 0; font-size: 15px; }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.pcard { position: relative; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); overflow: hidden; }
.pcard .thumb { display: block; width: 100%; aspect-ratio: 16/9; background: #07080b center/contain no-repeat; border: 0; padding: 0; }
.pcard .meta { padding: 10px 44px 12px 12px; }
.pcard .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .meta span { color: var(--muted); font-size: 12px; }
.pcard .icon-btn { position: absolute; right: 2px; bottom: 6px; }
.empty { border: 1px dashed var(--line2); border-radius: 14px; padding: 26px; text-align: center; color: var(--muted); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel); margin: 10px 0; }
.notice.warn { border-color: rgba(255,181,71,.5); background: rgba(255,181,71,.07); }
.notice.err { border-color: rgba(255,93,108,.5); background: rgba(255,93,108,.07); }
.notice .ic { margin-top: 1px; color: var(--warn); }
.storage-bar { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 6px; }
.storage-bar i { display: block; height: 100%; background: var(--accent); }
.foot { margin-top: 28px; color: var(--faint); font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 10px; }
.features div { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--bg2); }
.features b { display: block; margin-bottom: 4px; }
.features span { color: var(--muted); font-size: 13px; }

/* ---------- editor layout (phone portrait = default) ---------- */
.editor {
  position: fixed; inset: 0; display: grid;
  grid-template-columns: 100%;
  grid-template-rows: calc(var(--top-h) + var(--safe-t)) minmax(160px, 1fr) auto minmax(190px, 40%) calc(var(--tabs-h) + var(--safe-b));
  grid-template-areas: "top" "preview" "transport" "tl" "tabs";
  overflow: hidden; background: var(--bg);
}
.topbar { grid-area: top; display: flex; align-items: center; gap: 2px; padding: var(--safe-t) 6px 0; background: var(--bg2); border-bottom: 1px solid var(--line); min-width: 0; }
.topbar .pname { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; background: none; border: 0; padding: 4px 6px; border-radius: 8px; text-align: left; }
.topbar .pname b { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.topbar .pname span { font-size: 11px; color: var(--muted); }
.topbar .pname:hover { background: rgba(255,255,255,.05); }
.save-state { font-size: 11px; color: var(--muted); padding: 0 6px; white-space: nowrap; }
.save-state.err { color: var(--danger); }
.topbar .export-btn { margin-left: 4px; min-height: 38px; padding: 0 12px; }
.preview { grid-area: preview; position: relative; display: grid; place-items: center; background: #050608; overflow: hidden; min-height: 0; touch-action: none; }
.stage { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.stage canvas { display: block; background: #000; box-shadow: 0 0 0 1px rgba(255,255,255,.06); }
.stage .sel-box { position: absolute; border: 1.5px solid var(--accent2); pointer-events: none; transform-origin: 50% 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.stage .sel-box::after { content: ''; position: absolute; right: -7px; bottom: -7px; width: 12px; height: 12px; background: #fff; border: 2px solid var(--accent); border-radius: 3px; }
.stage .split-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--gold); pointer-events: none; }
.stage .split-label { position: absolute; top: 8px; font-size: 11px; font-weight: 700; background: rgba(0,0,0,.6); padding: 2px 6px; border-radius: 4px; pointer-events: none; }
.preview .safe { position: absolute; pointer-events: none; }
.preview .hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); text-align: center; color: var(--muted); pointer-events: none; padding: 16px; }
.preview .hint b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.transport { grid-area: transport; container-type: inline-size; display: flex; align-items: center; gap: 0; padding: 2px 6px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg2); min-width: 0; }
.transport .tc { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; min-width: 0; white-space: nowrap; padding: 0 4px; }
.transport .tc small { color: var(--muted); font-weight: 500; }
.transport .center { flex: 1; display: flex; justify-content: center; align-items: center; min-width: 0; }
.transport .play { width: 48px; height: 48px; border-radius: 50%; background: var(--text); color: #0b0d12; }
.transport .play:hover { background: #fff; }
.transport .hide-sm { display: none; }
@container (min-width: 560px) { .transport .hide-sm { display: inline-grid; } }
@container (max-width: 360px) { .transport .opt { display: none; } .transport .tc small { display: none; } }
.meter { width: 6px; height: 28px; border-radius: 3px; background: var(--line); position: relative; overflow: hidden; margin: 0 6px; }
.meter i { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(to top, var(--ok) 60%, var(--warn) 85%, var(--danger)); height: 0; }

/* bottom tabs */
.tabs { grid-area: tabs; display: flex; background: var(--bg2); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600; min-height: var(--tabs-h); }
.tabs button.on { color: var(--accent2); }
.tabs button .ic { width: 22px; height: 22px; }
.tabs button.ctx { color: var(--text); }

/* sheet / side panel */
.panel { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + var(--safe-b)); height: min(62vh, 560px); z-index: 50;
  background: var(--panel); border-top: 1px solid var(--line2); border-radius: 16px 16px 0 0; box-shadow: 0 -18px 40px rgba(0,0,0,.45);
  display: flex; flex-direction: column; transform: translateY(105%); transition: transform .22s ease; visibility: hidden; }
.panel.open { transform: none; visibility: visible; }
.panel .grab { height: 22px; display: grid; place-items: center; touch-action: none; cursor: grab; flex: none; }
.panel .grab::before { content: ''; width: 40px; height: 4px; border-radius: 3px; background: var(--line2); }
.panel-head { display: flex; align-items: center; gap: 6px; padding: 0 6px 6px 14px; flex: none; }
.panel-head h2 { margin: 0; font-size: 15px; flex: 1; }
.panel-body { overflow: auto; padding: 0 14px calc(16px + var(--safe-b)); flex: 1; overscroll-behavior: contain; }
.inspector { display: none; }

/* timeline */
.tl { grid-area: tl; position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.tl-tools { display: flex; align-items: center; gap: 2px; padding: 2px 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; min-height: 48px; }
.tl-tools::-webkit-scrollbar { display: none; }
.tl-tools .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; flex: none; }
.tl-tools .tool { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 52px; height: 44px; border: 0; background: none; border-radius: 9px; color: var(--text); font-size: 10px; font-weight: 600; padding: 0 4px; flex: none; }
.tl-tools .tool .ic { width: 19px; height: 19px; }
.tl-tools .tool:hover { background: rgba(255,255,255,.06); }
.tl-tools .tool.on { color: var(--accent2); background: rgba(91,140,255,.14); }
.tl-tools .tool:disabled { opacity: .35; }
.tl-scroll { position: relative; flex: 1; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.tl-content { position: relative; min-height: 100%; }
.tl-ruler { position: sticky; top: 0; z-index: 6; height: 28px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.tl-ruler canvas { position: sticky; left: 0; display: block; height: 28px; cursor: ew-resize; touch-action: none; }
.tl-row { display: flex; position: relative; border-bottom: 1px solid #1b2029; }
.tl-row.audio { background: #0f1412; }
.tl-row.drop { background: rgba(91,140,255,.08); }
.tl-head { position: sticky; left: 0; z-index: 5; width: var(--head-w, 76px); flex: none; display: flex; align-items: center; gap: 0; padding: 0 2px 0 6px; background: var(--bg2); border-right: 1px solid var(--line); }
.tl-head .tname { flex: 1; min-width: 0; height: 100%; border: 0; background: none; text-align: left; font-weight: 700; font-size: 12px; color: var(--muted); padding: 0; }
.tl-head .icon-btn { width: 26px; height: 30px; border-radius: 7px; }
.tl-head .tname { min-width: 18px; }
.tl-head .icon-btn .ic { width: 16px; height: 16px; }
.tl-head .icon-btn.off { color: var(--danger); }
.tl-lane { position: relative; flex: none; }
.tl-row.locked .tl-lane { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.03) 0 6px, transparent 6px 12px); }
.tl-row.hidden-track .tl-lane { opacity: .45; }
.clip { position: absolute; top: 3px; bottom: 3px; border-radius: 6px; overflow: hidden; background: var(--clip-video); border: 1px solid rgba(255,255,255,.14); color: #fff; touch-action: pan-x pan-y; user-select: none; -webkit-user-select: none; cursor: grab; contain: layout paint; }
.clip.image { background: var(--clip-image); }
.clip.audio { background: var(--clip-audio); }
.clip.text { background: var(--clip-text); }
.clip.shape { background: var(--clip-shape); }
.clip.adjust { background: var(--clip-adjust); }
.clip.color { background: var(--clip-color); }
.clip canvas.strip { position: absolute; left: 0; top: 0; height: 100%; opacity: .9; pointer-events: none; }
.clip .cname { position: absolute; left: 6px; top: 2px; 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,.9); pointer-events: none; }
.clip .badges { position: absolute; left: 6px; bottom: 2px; display: flex; gap: 3px; pointer-events: none; }
.clip .badges i { font-style: normal; font-size: 9px; font-weight: 800; background: rgba(0,0,0,.55); border-radius: 3px; padding: 0 4px; line-height: 14px; }
.clip.sel { border: 2px solid #fff; box-shadow: 0 0 0 2px var(--accent); z-index: 3; touch-action: none; }
.clip.dragging { opacity: .85; z-index: 10; box-shadow: 0 8px 22px rgba(0,0,0,.6); }
.clip .handle { position: absolute; top: 0; bottom: 0; width: 18px; background: rgba(255,255,255,.9); display: none; touch-action: none; cursor: ew-resize; z-index: 2; }
.clip .handle::after { content: ''; position: absolute; left: 50%; top: 30%; bottom: 30%; width: 2px; margin-left: -1px; background: #1b2236; border-radius: 1px; }
.clip .handle.l { left: 0; border-radius: 4px 0 0 4px; }
.clip .handle.r { right: 0; border-radius: 0 4px 4px 0; }
.clip.sel .handle { display: block; }
.clip .tr-mark { position: absolute; top: 50%; width: 18px; height: 18px; margin-top: -9px; background: rgba(255,255,255,.92); color: #16213e; border-radius: 4px; display: grid; place-items: center; pointer-events: none; z-index: 1; }
.clip .tr-mark.in { left: -1px; }
.clip .tr-mark.out { right: -1px; }
.clip .tr-mark svg { width: 12px; height: 12px; }
.clip .kfdot { position: absolute; bottom: 2px; width: 8px; height: 8px; margin-left: -4px; background: var(--gold); transform: rotate(45deg); pointer-events: none; }
.clip.missing { background: repeating-linear-gradient(135deg, #5a2330 0 8px, #3b1820 8px 16px); }
.tl-playhead { position: absolute; top: 48px; bottom: 0; width: 2px; margin-left: -1px; background: var(--playhead); z-index: 8; pointer-events: none; box-shadow: 0 0 6px rgba(255,210,90,.5); }
.tl-playhead::before { content: ''; position: absolute; top: 0; left: -6px; border: 7px solid transparent; border-top: 9px solid var(--playhead); }
.snap-line { position: absolute; top: 48px; bottom: 0; width: 1px; background: #7fffd4; z-index: 9; pointer-events: none; }
.tl-empty { position: absolute; left: 50%; top: 58%; transform: translate(-50%,-50%); color: var(--faint); font-size: 13px; pointer-events: none; text-align: center; z-index: 4; }
.add-track { display: flex; gap: 6px; padding: 6px 6px 10px; position: sticky; left: 0; width: max-content; }

/* panels content */
.sec { border-top: 1px solid var(--line); padding: 10px 0 6px; }
.sec:first-child { border-top: 0; }
.sec > h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
details.sec > summary { list-style: none; cursor: pointer; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; display: flex; align-items: center; justify-content: space-between; min-height: 32px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: '+'; font-size: 16px; color: var(--faint); }
details.sec[open] > summary::after { content: '–'; }
.ctl { display: grid; grid-template-columns: minmax(84px, 34%) 1fr 58px 30px; align-items: center; gap: 6px; min-height: 40px; }
.ctl label { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.ctl input.num { width: 58px; min-height: 30px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line2); background: var(--bg2); text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; }
.ctl .kf { width: 30px; height: 30px; border: 0; background: none; color: var(--faint); display: grid; place-items: center; border-radius: 6px; }
.ctl .kf.anim { color: var(--gold); }
.ctl .kf .ic { width: 15px; height: 15px; }
.ctl.nokf { grid-template-columns: minmax(84px, 34%) 1fr 58px; }
.ctl-row { display: flex; align-items: center; gap: 8px; min-height: 40px; flex-wrap: wrap; }
.ctl-row > label { font-size: 13px; color: var(--muted); min-width: 84px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line2); background: var(--bg2); color: var(--muted); border-radius: 999px; padding: 0 12px; min-height: 32px; font-size: 12px; font-weight: 600; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.mitem { position: relative; border-radius: 10px; overflow: hidden; background: var(--bg2); border: 1px solid var(--line); }
.mitem .mthumb { display: block; width: 100%; aspect-ratio: 16/10; background: #08090c center/cover no-repeat; border: 0; padding: 0; position: relative; }
.mitem .mthumb .ic { position: absolute; inset: 0; margin: auto; color: var(--faint); width: 28px; height: 28px; }
.mitem .mdur { position: absolute; right: 4px; top: 4px; font-size: 10px; font-weight: 700; background: rgba(0,0,0,.7); border-radius: 4px; padding: 1px 4px; }
.mitem .mname { font-size: 11px; padding: 4px 30px 6px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mitem .madd { position: absolute; right: 4px; bottom: 26px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.mitem .mmore { position: absolute; right: 0; bottom: 0; width: 30px; height: 26px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; }
.mitem.used .mname::before { content: '● '; color: var(--ok); }
.lib-list { display: grid; gap: 6px; }
.lib-item { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 8px 6px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); text-align: left; width: 100%; }
.lib-item:hover { border-color: var(--line2); }
.lib-item .grow b { display: block; font-size: 13px; }
.lib-item .grow span { font-size: 12px; color: var(--muted); }
.lib-item.on { border-color: var(--accent); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.tpl { border: 1px solid var(--line); background: var(--bg2); border-radius: 10px; min-height: 74px; display: grid; place-items: center; padding: 8px; text-align: center; font-weight: 700; gap: 4px; }
.tpl small { font-weight: 500; color: var(--muted); font-size: 11px; }
.tpl:hover { border-color: var(--accent); }
.fx-card { border: 1px solid var(--line); background: var(--bg2); border-radius: 10px; padding: 4px 10px 8px; margin-bottom: 8px; }
.fx-card.off { opacity: .55; }
.fx-card header { display: flex; align-items: center; gap: 6px; min-height: 40px; }
.fx-card header b { flex: 1; font-size: 13px; }
.import-list { display: grid; gap: 6px; margin: 8px 0; }
.import-list div { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.curves { width: 100%; aspect-ratio: 1; max-width: 320px; display: block; margin: 6px auto; touch-action: none; border-radius: 8px; background: #0a0c10; border: 1px solid var(--line); }
.mixer { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.strip-ch { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--bg2); display: grid; gap: 6px; }
.strip-ch b { font-size: 12px; }
.progress { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.source-player { width: 100%; max-height: 46vh; background: #000; border-radius: 10px; display: block; }
.kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; font-size: 12px; text-align: center; background: var(--bg2); }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.pip-grid { display: grid; grid-template-columns: repeat(3, 44px); gap: 4px; }
.pip-grid button { height: 30px; border: 1px solid var(--line2); background: var(--bg2); border-radius: 6px; font-size: 10px; color: var(--muted); }
.unavail { opacity: .55; }
.badge-soon { font-size: 10px; font-weight: 700; color: var(--warn); border: 1px solid rgba(255,181,71,.5); border-radius: 999px; padding: 0 6px; }
.drop-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(91,140,255,.12); border: 3px dashed var(--accent); display: grid; place-items: center; font-size: 18px; font-weight: 700; pointer-events: none; }

/* fullscreen preview */
.editor.fullview .preview { position: fixed; inset: 0; z-index: 80; }
.editor.fullview .transport { position: fixed; left: 0; right: 0; bottom: 0; z-index: 81; background: rgba(13,15,20,.85); padding-bottom: var(--safe-b); }

/* ---------- landscape phones ---------- */
@media (orientation: landscape) and (max-height: 560px) {
  :root { --top-h: 44px; --tap: 40px; }
  .editor {
    grid-template-columns: calc(64px + env(safe-area-inset-left, 0px)) minmax(0, 1fr) minmax(0, 1.1fr);
    grid-template-rows: calc(var(--top-h) + var(--safe-t)) minmax(0, 1fr) auto;
    grid-template-areas: "top top top" "tabs preview tl" "tabs transport tl";
  }
  .tabs { flex-direction: column; overflow-y: auto; border-top: 0; border-right: 1px solid var(--line); padding: 0 0 0 env(safe-area-inset-left, 0px); }
  .tabs button { flex: 0 0 52px; min-height: 52px; font-size: 10px; }
  .panel { left: auto; right: 0; top: calc(var(--top-h) + var(--safe-t)); bottom: 0; height: auto; width: min(52vw, 460px); border-radius: 14px 0 0 0; transform: translateX(105%); border-left: 1px solid var(--line2); }
  .panel .grab { display: none; }
  .panel-head { padding-top: 8px; }
  .tl-playhead, .snap-line { top: 48px; }
}

/* ---------- tablets & desktop: professional workspace ---------- */
@media (min-width: 900px) and (min-height: 561px) {
  :root { --tabs-h: 0px; }
  .editor {
    grid-template-columns: 68px minmax(280px, 330px) minmax(0, 1fr);
    grid-template-rows: 52px minmax(0, 1fr) auto minmax(220px, 38vh);
    grid-template-areas: "top top top" "tabs panel preview" "tabs panel transport" "tl tl tl";
  }
  .tabs { flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding: 6px 0; overflow-y: auto; }
  .tabs button { flex: 0 0 60px; min-height: 60px; }
  .panel { grid-area: panel; position: static; height: auto; transform: none; visibility: visible; border-radius: 0; border-top: 0; border-right: 1px solid var(--line); box-shadow: none; transition: none; min-height: 0; }
  .panel .grab, .panel .close-panel { display: none; }
  .panel-head { padding: 10px 8px 8px 14px; }
  .tl { border-top: 1px solid var(--line); }
  .toasts { bottom: 40px; }
}
@media (min-width: 1280px) and (min-height: 561px) {
  .editor {
    grid-template-columns: 68px minmax(280px, 330px) minmax(0, 1fr) minmax(290px, 340px);
    grid-template-areas: "top top top top" "tabs panel preview insp" "tabs panel transport insp" "tl tl tl tl";
  }
  .tabs button[data-tab=edit] { display: none; }
  .inspector { grid-area: insp; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; }
  .inspector .panel-head { border-bottom: 1px solid var(--line); padding: 10px 8px 8px 14px; min-height: 48px; }
  .inspector .panel-body { padding-top: 6px; }
}
@media (min-width: 1500px) and (min-height: 561px) {
  .editor { grid-template-columns: 72px 360px minmax(0, 1fr) 360px; }
}
@media (max-width: 380px) {
  .topbar .save-state { display: none; }
  .transport .tc small { display: none; }
}
@media (prefers-reduced-motion: reduce) { .panel { transition: none; } }

@media (max-width: 480px) { .tabs button { font-size: 10px; } .tabs button .ic { width: 21px; height: 21px; } }
