/* Tanglish Studio: dark editor theme */
:root {
  --accent: #ff5a3c;
  --accent-hover: #ff6f55;
  --accent-soft: rgba(255, 90, 60, .14);
  --sel: #4da3ff;
  --sel-soft: rgba(77, 163, 255, .16);
  --ink: #ececef;
  --muted: #8b8e97;
  --line: #2a2c32;
  --bg: #0d0e11;
  --panel: #16171b;
  --card: #1e1f24;
  --card-2: #25272d;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --text-track: #7c5cff;
  --ov-track: #2f6fde;
  --cap-track: #12a594;
  --left-w: 300px;
  --right-w: 300px;
  --tl-h: 280px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink); background: var(--bg);
  display: grid; grid-template-rows: 52px minmax(0, 1fr) 6px var(--tl-h); grid-template-columns: minmax(0, 1fr);
  overflow: hidden; font-size: 13.5px; width: 100vw; padding: 0 8px 8px; gap: 0;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.sm { font-size: 12px; }
.spacer { flex: 1; }
a { color: var(--sel); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #34363d; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #44474f; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.top-actions { display: flex; align-items: center; gap: 8px; }

.btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; color: var(--ink);
  padding: 8px 14px; font-weight: 600; transition: background .15s, border-color .15s, transform .05s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; justify-content: center;
}
.btn:hover { background: var(--card-2); border-color: #383a42; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--card); }
.btn.icon { width: 36px; padding: 7px 0; font-size: 17px; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn.block { width: 100%; }
.btn.danger:hover { background: rgba(239, 68, 68, .15); border-color: rgba(239, 68, 68, .5); color: #ff8a8a; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.select, .input, textarea.input {
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; background: var(--card); outline: none; width: 100%; color: var(--ink);
}
.select { width: auto; }
.select option, .select optgroup { background: #1e1f24; color: var(--ink); }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--sel); }

/* ---------- workspace ---------- */
.workspace {
  display: grid; min-height: 0; min-width: 0; overflow: hidden;
  grid-template-columns: 64px var(--left-w) 6px minmax(0, 1fr) 6px var(--right-w);
}
.tabs {
  background: var(--panel); border-radius: var(--radius) 0 0 var(--radius);
  display: flex; flex-direction: column; padding: 8px 6px; gap: 2px; border-right: 1px solid var(--line);
  overflow-y: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: transparent; border-radius: 10px; padding: 8px 2px; flex: none;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; color: var(--muted);
}
.tabs button span { font-size: 15px; font-weight: 800; }
.tabs button:hover { background: var(--card); color: var(--ink); }
.tabs button.active { background: var(--accent-soft); color: var(--accent); }

.panel, .inspector { background: var(--panel); overflow-y: auto; padding: 16px; min-width: 0; }
.panel { border-radius: 0 var(--radius) var(--radius) 0; }
.inspector { border-radius: var(--radius); }
.panel h3, .inspector h3 { margin: 0 0 4px; font-size: 15px; }
.panel h4, .inspector h4 { margin: 18px 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.panel p, .inspector p { margin: 0 0 12px; }
.field { margin-bottom: 12px; }
.field label { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field label span { color: var(--ink); font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1; }
.insp-actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=color] { width: 100%; height: 34px; border: 1px solid var(--line); border-radius: 9px; padding: 3px; background: var(--card); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.status { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: var(--card); margin-top: 10px; }
.status.err { background: rgba(239, 68, 68, .14); color: #ff9a9a; }
kbd {
  font: 600 10.5px/1 Inter, system-ui, sans-serif; padding: 3px 5px; border-radius: 5px;
  background: var(--card-2); border: 1px solid #3a3c44; border-bottom-width: 2px; color: var(--ink);
}
.keys-list > div { padding: 5px 0; font-size: 12px; color: var(--muted); border-bottom: 1px solid #202227; }
.keys-list kbd { margin-right: 2px; }

.dropzone {
  border: 1.5px dashed #393b43; border-radius: var(--radius); padding: 20px; text-align: center; color: var(--muted);
  margin-bottom: 14px; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, body.dragover .dropzone { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.media-item { border-radius: 11px; overflow: hidden; border: 1px solid var(--line); background: #000; position: relative; }
.media-item img { width: 100%; height: 86px; object-fit: cover; display: block; }
.media-item .cap { position: absolute; inset: auto 0 0 0; padding: 4px 8px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.8)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-actions { position: absolute; inset: 0 0 auto 0; display: flex; gap: 4px; padding: 5px; opacity: 0; transition: opacity .15s; }
.media-item:hover .media-actions { opacity: 1; }
.media-actions button { flex: 1; border: 0; border-radius: 7px; padding: 4px 2px; font-size: 11px; font-weight: 700; background: rgba(13,14,17,.85); color: #fff; }
.media-actions button:hover { background: var(--accent); }

.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.preset { border: 1.5px solid var(--line); border-radius: 10px; background: #000; height: 56px; overflow: hidden; padding: 0; width: 100%; }
.preset.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.look-group { font-size: 11px; font-weight: 700; color: var(--ink); margin: 12px 0 6px; opacity: .8; }
.preset-name { font-size: 11px; text-align: center; margin-top: 4px; color: var(--muted); font-weight: 600; }
.filter-thumb { width: 100%; height: 56px; object-fit: cover; display: block; }

.seg-list { display: flex; flex-direction: column; gap: 4px; }
.seg { display: grid; grid-template-columns: 62px 1fr 26px; gap: 6px; align-items: center; padding: 5px; border-radius: 9px; border: 1px solid transparent; }
.seg.sel { border-color: var(--cap-track); background: rgba(18, 165, 148, .12); }
.seg .t { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; cursor: pointer; }
.seg input { border: 1px solid transparent; background: transparent; border-radius: 7px; padding: 5px 6px; width: 100%; }
.seg input:focus { border-color: var(--line); background: var(--card); outline: none; }
.seg .x { border: 0; background: transparent; color: var(--muted); border-radius: 6px; }
.seg .x:hover { background: var(--card); color: #ff8a8a; }
.seg-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.aspect-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.aspect-btn { border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 600; }
.aspect-btn.sel { border-color: var(--accent); background: var(--accent-soft); }
.aspect-shape { border: 2px solid currentColor; border-radius: 4px; }
.seg-group { display: flex; background: var(--card); border-radius: 10px; padding: 3px; gap: 3px; }
.seg-group button { flex: 1; border: 0; background: transparent; border-radius: 8px; padding: 7px 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.seg-group button.sel { background: var(--card-2); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.4); }

/* ---------- splitters ---------- */
.splitter { position: relative; z-index: 5; }
.splitter.v { cursor: col-resize; }
.splitter.h { cursor: row-resize; }
.splitter::after { content: ''; position: absolute; border-radius: 4px; background: transparent; transition: background .15s; }
.splitter.v::after { left: 2px; right: 2px; top: 40%; bottom: 40%; }
.splitter.h::after { top: 2px; bottom: 2px; left: 46%; right: 46%; }
.splitter:hover::after, .splitter.active::after { background: var(--sel); }

/* ---------- stage ---------- */
.stage-wrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 10px 10px 4px; background: var(--panel); border-radius: var(--radius); }
.stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
#preview { max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 10px; background: #000; box-shadow: var(--shadow); touch-action: none; }
.stage-empty { position: absolute; inset: 0; display: grid; place-items: center; }
.empty-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 30px 34px; text-align: center; box-shadow: var(--shadow); max-width: 340px; }
.empty-card h2 { margin: 6px 0; font-size: 19px; }
.empty-card p { color: var(--muted); margin: 0 0 18px; }
.empty-ico { width: 50px; height: 50px; margin: 0 auto; border-radius: 15px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 26px; }
.transport { height: 50px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }
.play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--ink); color: #111; font-size: 14px; }
.play:hover { background: #fff; }
.aspect-chip { justify-self: end; font-size: 11.5px; font-weight: 600; background: var(--card); border-radius: 999px; padding: 4px 10px; color: var(--muted); }

/* ---------- timeline ---------- */
.timeline-wrap { background: var(--panel); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.tl-toolbar { height: 44px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); }
.tl-toolbar input[type=range] { width: 130px; margin-left: 6px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 9px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink); font-size: 12.5px; font-weight: 600;
}
.tool:hover { background: var(--card); }
.tool svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool kbd { opacity: .7; }
.tool-sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
@media (max-width: 1250px) { .tool span, .tool kbd { display: none; } }

.timeline { flex: 1; display: flex; min-height: 0; min-width: 0; }
.tl-labels { width: 112px; flex: none; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tl-label-head { height: 26px; flex: none; border-bottom: 1px solid var(--line); }
.tl-labels-list { flex: 1; overflow: hidden; }
.tl-label { height: 46px; display: flex; align-items: center; gap: 8px; padding: 0 10px; font-size: 11.5px; font-weight: 600; color: var(--muted); border-bottom: 1px solid #1d1f24; }
.tl-label.main { height: 54px; color: var(--ink); }
.tl-ico { width: 22px; height: 22px; border-radius: 6px; background: var(--card); display: grid; place-items: center; font-size: 10px; font-weight: 800; flex: none; }
.tl-label.ov .tl-ico { color: #8db7ff; }
.tl-scroll { flex: 1; min-width: 0; overflow: auto; position: relative; }
.tl-inner { position: relative; min-height: 100%; }
.tl-ruler { height: 26px; position: sticky; top: 0; z-index: 8; background: var(--panel); border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; }
.tl-tick { position: absolute; top: 0; height: 26px; border-left: 1px solid #3a3c44; padding-left: 4px; font-size: 10px; color: var(--muted); line-height: 16px; font-variant-numeric: tabular-nums; }
.tl-tick-minor { position: absolute; bottom: 0; height: 6px; border-left: 1px solid #2c2e34; }
.tl-track { height: 46px; position: relative; border-bottom: 1px solid #1d1f24; }
.tl-track.tl-main { height: 54px; background: rgba(255,255,255,.015); }
.tl-empty { position: absolute; left: 12px; top: 8px; bottom: 8px; display: flex; align-items: center; padding: 0 16px; border: 1.5px dashed #393b43; border-radius: 10px; color: var(--muted); font-size: 12px; }
.tl-block {
  position: absolute; top: 5px; bottom: 5px; border-radius: 8px; overflow: hidden; cursor: grab;
  border: 2px solid transparent; user-select: none; touch-action: none;
}
.tl-block.sel { border-color: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.6) inset; }
.tl-block.dragging { opacity: .8; z-index: 5; cursor: grabbing; }
.tl-clip { background-color: #2b2d33; background-size: auto 100%; background-repeat: repeat-x; }
.tl-clip .tl-block-label, .tl-overlay .tl-block-label { position: absolute; left: 8px; bottom: 3px; right: 8px; font-size: 10px; color: #fff; text-shadow: 0 1px 2px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: normal; height: auto; padding: 0; }
.tl-span { background: var(--text-track); color: #fff; }
.tl-caption { background: var(--cap-track); }
.tl-audio { background-color: #11865f; background-size: 100% 100%; background-repeat: no-repeat; }
.tl-audio .tl-block-label { line-height: normal; padding: 3px 8px 0; height: auto; font-size: 10.5px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.tl-label.au .tl-ico { color: #3ddc97; }
.tl-effect { background: linear-gradient(90deg, #c026d3, #9333ea); }
.tl-label.fx .tl-ico { color: #e879f9; }
.tl-overlay { background-color: var(--ov-track); background-size: auto 100%; background-repeat: repeat-x; background-blend-mode: luminosity; }
.tl-span .tl-block-label { padding: 0 10px; line-height: 32px; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 100%; }
.tl-handle { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 2; }
.tl-handle.l { left: 0; }
.tl-handle.r { right: 0; }
.tl-block:hover .tl-handle, .tl-block.sel .tl-handle { background: rgba(255,255,255,.6); }
.tl-block.narrow .tl-handle { display: none; }
/* cut markers between main clips */
.tl-trans { position: absolute; top: 0; bottom: 0; width: 0; z-index: 4; }
.tl-trans-band { position: absolute; top: 8px; bottom: 8px; border-radius: 6px; background: repeating-linear-gradient(135deg, rgba(255,255,255,.28) 0 6px, rgba(255,255,255,.1) 6px 12px); pointer-events: none; }
.tl-trans-btn {
  position: absolute; top: 50%; left: -11px; transform: translateY(-50%); width: 22px; height: 22px; padding: 0;
  border-radius: 7px; border: 1.5px solid #fff; background: #2b2d33; color: #fff; font-size: 13px; font-weight: 800; line-height: 1;
  opacity: 0; transition: opacity .15s; box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.tl-main:hover .tl-trans-btn, .tl-trans.has .tl-trans-btn, .tl-trans.sel .tl-trans-btn, body.trans-drag .tl-trans-btn { opacity: 1; }
.tl-trans.has .tl-trans-btn { background: var(--sel); border-color: #fff; }
.tl-trans.sel .tl-trans-btn { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tl-playhead { position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); pointer-events: none; z-index: 10; will-change: transform; }
.tl-playhead-knob { position: absolute; top: 0; left: -6px; width: 14px; height: 14px; border-radius: 0 0 7px 7px; background: var(--accent); }

/* ---------- popovers, modal & toast ---------- */
.keys-pop {
  position: fixed; right: 24px; bottom: calc(var(--tl-h) - 20px); z-index: 150; width: 330px;
  background: var(--card); border: 1px solid #34363d; border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow);
}
.keys-pop h4 { margin: 0 0 8px; font-size: 13px; }
.keys-pop > div { padding: 5px 0; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid #2a2c32; }
.keys-pop > div:last-child { border: 0; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 100; }
.modal-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px; width: 380px; box-shadow: var(--shadow); }
.modal-card h3 { margin: 0 0 6px; }
.progress { height: 8px; background: var(--card-2); border-radius: 999px; overflow: hidden; margin: 16px 0; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.toast { position: fixed; bottom: calc(var(--tl-h) + 30px); left: 50%; transform: translateX(-50%); background: #f2f2f4; color: #111; padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 600; z-index: 200; box-shadow: var(--shadow); }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 58px minmax(200px, var(--left-w)) 6px minmax(0, 1fr) 6px minmax(220px, var(--right-w)); }
}

/* ---------- projects ---------- */
.brand { min-width: 0; }
.proj-bar { display: inline-flex; align-items: center; gap: 6px; margin-left: 14px; font-weight: 500; }
.proj-name { background: transparent; border: 1px solid transparent; border-radius: 8px; color: var(--ink); font-size: 13px; font-weight: 600; padding: 5px 8px; width: 190px; }
.proj-name:hover { border-color: var(--line); }
.proj-name:focus { border-color: var(--sel); background: var(--card); outline: none; }
.save-state { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.save-state.ok { color: #3ddc97; }
.save-state.err { color: #ff8a8a; }
.proj-card { width: min(920px, 94vw); max-height: 86vh; display: flex; flex-direction: column; }
.proj-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.proj-head h3 { margin: 0; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; overflow-y: auto; padding: 4px 2px 10px; min-height: 120px; }
.proj-item { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.proj-item.cur { border-color: var(--accent); }
.proj-thumb { position: relative; aspect-ratio: 16 / 9; background: #000; display: grid; place-items: center; }
.proj-thumb img { max-width: 100%; max-height: 100%; display: block; }
.proj-thumb span { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 6px; }
.proj-meta { padding: 8px 10px 4px; display: flex; flex-direction: column; min-width: 0; }
.proj-meta b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-meta span { font-size: 11.5px; color: var(--muted); }
.proj-acts { display: flex; gap: 5px; padding: 6px 10px 10px; }
.proj-acts .btn.primary { flex: 1; }
@media (max-width: 1200px) { .proj-name { width: 130px; } }

/* ---------- install ---------- */
.install-btn { background: var(--sel-soft); border-color: rgba(77,163,255,.45); color: #cfe4ff; }
.install-btn:hover { background: rgba(77,163,255,.25); }
.install-card { width: 440px; }
.install-card ol { padding-left: 20px; margin: 10px 0; line-height: 1.6; }
.install-card li { margin-bottom: 6px; }

/* ---------- keyframes ---------- */
.kf-bar { display: flex; gap: 6px; margin-bottom: 10px; }
.kf-nav { width: 34px; flex: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 9px; font-size: 11px; }
.kf-nav:disabled { opacity: .35; cursor: default; }
.kf-main { flex: 1; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 9px; padding: 7px; font-weight: 700; font-size: 12.5px; }
.kf-main:hover, .kf-nav:not(:disabled):hover { border-color: #4a4c55; }
.kf-main.on { background: #f5b700; border-color: #f5b700; color: #111; }
.kf-row { display: flex; align-items: center; gap: 8px; }
.kf-row input { flex: 1; }
.kf-dia { flex: none; width: 24px; height: 24px; border: 0; background: transparent; color: #55575f; font-size: 14px; line-height: 1; border-radius: 6px; }
.kf-dia:hover { background: var(--card); color: var(--ink); }
.kf-dia.keyed { color: #b08800; }
.kf-dia.here { color: #f5b700; text-shadow: 0 0 6px rgba(245,183,0,.6); }
.kf-field label a { font-weight: 600; }
.tl-kfs { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.tl-kf { position: absolute; bottom: 3px; width: 9px; height: 9px; margin-left: -4.5px; background: #f5b700; transform: rotate(45deg); border: 1px solid #111; border-radius: 1px; }

/* ---------- clip animations ---------- */
.anim-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 5px 10px; font-size: 11.5px; font-weight: 600; }
.chip:hover { border-color: #4a4c55; }
.chip.sel { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- transitions ---------- */
.trans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.trans-grid.small { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-bottom: 12px; }
.trans-card { border: 1.5px solid var(--line); border-radius: 11px; padding: 0; overflow: hidden; background: #000; display: flex; flex-direction: column; text-align: left; cursor: grab; }
.trans-card canvas { width: 100%; aspect-ratio: 8 / 5; display: block; }
.trans-card span { background: var(--card); font-size: 11.5px; font-weight: 600; padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trans-grid.small .trans-card span { font-size: 10.5px; padding: 4px 6px; }
.trans-card:hover { border-color: #4a4c55; }
.trans-card.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.trans-card.sel span { color: var(--accent); }

/* ---------- sounds ---------- */
.sfx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.sfx, .fs-row { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 5px 6px; min-width: 0; }
.sfx span { flex: 1; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sfx:hover, .fs-row:hover { border-color: #3a3c44; }
.sfx-play, .sfx-add { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.sfx-play { background: #11865f; color: #fff; }
.sfx-play:hover { background: #18a876; }
.sfx-add { background: var(--card-2); color: var(--ink); font-size: 15px; }
.sfx-add:hover { background: var(--accent); color: #fff; }
.fs-list { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.lib-cats { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.lib-cats .chip span { opacity: .6; font-weight: 500; margin-left: 2px; }
#libList { max-height: 420px; overflow-y: auto; padding-right: 2px; }
.lib-manage { margin-top: 10px; }
.lib-manage summary { cursor: pointer; font-size: 12px; color: var(--muted); font-weight: 600; }
.fs-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fs-meta b { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-meta span { font-size: 11px; color: var(--muted); }

/* ---------- style picker ---------- */
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.style-card { border: 1.5px solid var(--line); border-radius: 11px; padding: 0; overflow: hidden; background: #111; display: flex; flex-direction: column; text-align: left; }
.style-card img { width: 100%; aspect-ratio: 8 / 5; display: block; object-fit: cover; }
.style-card span { background: var(--card); color: var(--ink); font-size: 11.5px; font-weight: 600; padding: 6px 8px; }
.style-card:hover { border-color: #4a4c55; }
.style-card { cursor: grab; }
/* While a style card is dragged, show where it can be dropped. */
body.style-drag .tl-scroll, body.style-drag #preview { outline: 2px dashed var(--sel); outline-offset: -2px; }
.style-card.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.style-card.sel span { color: var(--accent); }
.lottie-item { background: linear-gradient(135deg, #2b2f3a, #14161b); min-height: 72px; cursor: pointer; }
.lottie-name { color: #fff; font-size: 12px; font-weight: 600; padding: 10px; line-height: 1.35; word-break: break-word; }
.lottie-name span { color: #b9bcc6; font-weight: 500; font-size: 11px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch input[type=color] { width: 40px; height: 34px; }

/* Downloaded clips share the editor's media and timeline model. */
.download-panel [hidden]{display:none!important}
.download-panel label{display:block;margin:12px 0;font-size:14px}
.download-panel label input,.download-panel label select{width:100%;margin-top:6px}
.download-panel video{width:100%;max-height:180px;background:#090a0b;border-radius:8px}
.download-panel h4,#dlStatus,#dlName{overflow-wrap:anywhere}
.download-panel button{margin:5px 0}
.dl-actions{display:flex;gap:7px}.dl-actions button{flex:1}
.dl-rail{padding:9px 17px;background:#25272b;border-radius:7px}
#dlTrack{height:42px;position:relative;touch-action:none;background:repeating-linear-gradient(90deg,#454b51 0 1px,transparent 1px 10%),#30343a}
#dlSelection{position:absolute;top:0;bottom:0;background:#ff553555;border-block:3px solid #ff5535;pointer-events:none}
.download-panel .dl-handle{position:absolute;top:0;bottom:0;width:17px;margin:0;padding:0;border:0;border-radius:3px;background:#ff5535;cursor:ew-resize;touch-action:none}
#dlStart{transform:translateX(-100%)}.dl-handle:after{content:"";display:block;background:white;width:3px;height:20px;margin:auto;border-radius:2px}
.dl-handle:focus-visible{outline:2px solid white;outline-offset:2px}
.dl-times{display:flex;justify-content:space-between;font-size:12px;font-variant-numeric:tabular-nums;margin:7px 0}
#dlCard{border:1px solid #ff5535;border-radius:8px;padding:8px;margin:12px 0;cursor:grab;display:grid;gap:6px}
#dlCard img{width:100%;height:90px;object-fit:contain;background:#090a0b;pointer-events:none}
#dlCard span,#dlCard small{pointer-events:none}#dlCard small{color:#a0a9b8}
.download-panel details{margin-top:16px}.download-panel summary{cursor:pointer}
/* Editing workspace */
:root{--radius:6px;--accent:#ed684a;--accent-hover:#f57a5e;--accent-soft:#ed684a18;--bg:#101114;--panel:#191b20;--card:#24272e;--card-2:#2c3038;--line:#30343c;--ink:#e5e8ee;--muted:#9ba3b3;--text-track:#6553a4;--ov-track:#2d5d8a}
body{padding:0;grid-template-rows:54px minmax(0,1fr) 6px var(--tl-h)}
.topbar{padding:0 18px;border-bottom:1px solid var(--line);background:#15171b}
.brand{font-size:14px;letter-spacing:-.25px;font-weight:600}.logo{background:transparent;color:var(--accent);border:1px solid #484039;border-radius:6px;width:30px;height:30px}
.ui-icon{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.top-actions{gap:8px}.top-actions .select{font-size:12px;height:32px;border-radius:5px;max-width:180px}
#exportBtn{height:32px;padding:0 18px;border-radius:5px;font-size:13px;gap:8px}
.btn{border-radius:5px;font-weight:500}.btn.sm{border-radius:4px}.tool{font-weight:500}
.workspace{gap:0}.tabs{border-right:1px solid var(--line);padding:10px 5px;background:#15171b}
.tabs button{border-radius:5px;font-size:10px;font-weight:500;margin-bottom:5px;gap:5px;min-height:54px}
.tabs button>span{height:23px;display:flex;justify-content:center;align-items:center}.tabs button.active{background:#2a2c32;color:#f19076;box-shadow:inset 2px 0 #ed684a}
.panel,.inspector{border-radius:0!important;padding:16px}.panel h3,.inspector h3{font-size:14px;font-weight:600;margin-bottom:14px}
.panel h4,.inspector h4{font-size:11px;font-weight:600;letter-spacing:.07em;border-top:1px solid #30343c;padding-top:16px;margin-top:20px}
.stage-wrap{border-radius:0;background:#111317}.stage{background:radial-gradient(ellipse,#1c1f25,#111317)}#preview{border-radius:0;box-shadow:0 8px 30px #0008}
.transport{height:45px;background:#17191e;border-top:1px solid #282c33}.time{font-family:Consolas,monospace;color:#b1b8c4;font-size:12px}
.play{width:30px;height:28px;border:1px solid #3b414c;background:#282c33;color:#e9edf5;border-radius:5px;box-shadow:none;font-size:12px}
.empty-card{border:1px solid #363b45;box-shadow:0 14px 45px #0005;border-radius:8px;max-width:285px;background:#1c1f25;padding:24px}
.empty-card h2{font-size:17px;font-weight:600}.empty-card p{font-size:13px}.empty-ico{width:40px;height:40px;border-radius:6px;font-size:25px;background:#2a2e35;color:#aeb7c8}
.select,.input,textarea.input{border-radius:5px;background:#22252c}.select{appearance:none;background-image:linear-gradient(45deg,transparent 50%,#9da6b6 50%),linear-gradient(135deg,#9da6b6 50%,transparent 50%);background-position:calc(100% - 14px) 50%,calc(100% - 10px) 50%;background-size:4px 4px;background-repeat:no-repeat;padding-right:28px}
.kf-number{width:65px;min-width:65px;background:#111419;border:1px solid #373d47;border-radius:4px;padding:4px;font-size:12px;font-variant-numeric:tabular-nums}
.kf-row input[type=range]{min-width:40px}.kf-dia{flex-shrink:0}.kf-main{border-radius:4px}
.anim-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
.anim-tile{display:flex;flex-direction:column;gap:7px;padding:7px 4px;background:#20232a;border:1px solid #333944;border-radius:5px;font-size:11px;min-height:78px;align-items:center;color:#b8c0cd}
.anim-tile.sel{border-color:#f08566;background:#372820;color:#ffd7c9}.anim-tile:hover{background:#2b303a}
.anim-swatch{display:grid;place-items:center;width:100%;height:38px;overflow:hidden;background:repeating-linear-gradient(90deg,#282e38 0 1px,transparent 1px 12px)}
.anim-swatch i{width:22px;height:27px;background:#a2b5d0;border:1px solid #deebfc;border-radius:2px;display:block}
.anim-swatch[data-motion=none] i{background:transparent;border-style:dashed}
.anim-tile:hover .anim-swatch:not([data-motion=none]) i{animation:tile-enter 1s ease-in-out infinite}
.anim-tile:hover [data-motion=fade] i{animation:tile-fade 1s ease-in-out infinite}
.anim-tile:hover [data-motion^=slide] i{animation:tile-slide 1s ease-in-out infinite}
@keyframes tile-enter{0%{transform:scale(.35);opacity:.2}80%,100%{transform:scale(1);opacity:1}}
@keyframes tile-fade{0%{opacity:0}80%,100%{opacity:1}}
@keyframes tile-slide{0%{transform:translateX(-28px);opacity:0}80%,100%{transform:translateX(0);opacity:1}}
.seg-group{border-radius:5px;padding:3px;background:#101318}.seg-group button{border-radius:3px;font-size:12px;min-height:29px}
.tl-toolbar{height:42px;background:#1b1e24;border-bottom:1px solid #343a45;gap:2px;padding:0 12px}.tl-toolbar kbd{display:none}
.tool{font-size:12px;border-radius:4px;padding:6px 8px}.tool svg{width:15px;height:15px}
.timeline-wrap{border-radius:0;background:#13161b}.tl-labels{background:#181b21}.tl-label-head{border-bottom:1px solid #313743}
.tl-label-head:after{content:"LAYERS";font-size:10px;letter-spacing:.1em;padding-left:14px;color:#8f9aab}
.tl-label{gap:5px;padding-left:4px!important;color:#bac3d2}.layer-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}
.layer-grip{border:0;background:none;color:#8490a4;cursor:grab;padding:3px;font-size:19px;flex-shrink:0}
.layer-grip:focus-visible{outline:1px solid #f08566}.layer-drop{box-shadow:inset 0 2px #f08566;background:#3a2d27}
.tl-track[hidden]{display:none!important}.tl-track{border-bottom:1px solid #262c35;background:#16191f}
.tl-block{border-radius:4px!important}.tl-ruler{background:#16191f;font-family:Consolas,monospace}.tl-label.main{color:#fff}
#keysPop{border-radius:7px;background:#20242c;border:1px solid #3b4350;box-shadow:0 12px 35px #0008;padding:18px}
.keys-list{font-size:12px}.keys-list>div{padding:7px 0}kbd{border-radius:3px;font:11px Consolas,monospace;border:1px solid #444b57;background:#292f38}
@media(prefers-reduced-motion:reduce){.anim-tile:hover .anim-swatch i{animation:none!important}}
.tl-tracks,.tl-labels-list{overflow-anchor:none}.layer-grip{touch-action:none}.kf-row .kf-number{flex:0 0 65px;width:65px;max-width:65px}

/* ---------- Pro ---------- */
.pro-badge { display: inline-block; font: 700 10px/1 Poppins, system-ui, sans-serif; letter-spacing: .06em; padding: 3px 6px 2px; border-radius: 4px; color: #2b1d00; background: #ffc83d; font-style: normal; }
.pro-badge.corner { position: absolute; top: 6px; right: 6px; pointer-events: none; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.style-card { position: relative; }
.pro-btn { gap: 7px; font-family: Poppins, system-ui, sans-serif; font-weight: 500; border-color: rgba(255, 200, 61, .35); }
.pro-btn:hover { border-color: #ffc83d; }
.pro-btn.active { border-color: transparent; background: transparent; }

.pro-card {
  --p-ink: #f4f4f6; --p-sub: #a3a6b0; --p-line: #2e3038; --p-gold: #ffc83d;
  position: relative; width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  background: #17181d; border: 1px solid var(--p-line); border-radius: 20px; padding: 28px 28px 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55); color: var(--p-ink);
  font-family: Poppins, system-ui, sans-serif; font-size: 14px; line-height: 1.5;
}
.pro-card button, .pro-card input { font-family: inherit; }
.pro-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--p-sub); cursor: pointer; }
.pro-close:hover { background: #24262d; color: var(--p-ink); }
.pro-top { margin-bottom: 20px; }
.pro-chip { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .1em; color: #2b1d00; background: var(--p-gold); padding: 4px 9px 3px; border-radius: 6px; }
.pro-top h3 { margin: 12px 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.pro-top p { margin: 0; color: var(--p-sub); }
.pro-top p b { color: var(--p-ink); font-weight: 600; }

.pro-list { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 12px; }
.pro-list li { position: relative; padding-left: 32px; display: grid; }
.pro-list li::before {
  content: ''; position: absolute; left: 0; top: 1px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255, 200, 61, .14) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffc83d' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.pro-list b { font-weight: 600; font-size: 14px; }
.pro-list span { color: var(--p-sub); font-size: 12.5px; }

.pro-buy { background: #1e2026; border: 1px solid var(--p-line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; }
.pro-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.pro-price:empty { display: none; }
.pro-price .now { font-size: 32px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.pro-price s { color: #6e717b; font-size: 16px; font-weight: 500; }
.pro-price .once { color: var(--p-sub); font-size: 13px; }
.pro-price .offer { flex-basis: 100%; margin-top: 4px; font-size: 12px; font-weight: 500; color: var(--p-gold); }
.pro-cta {
  display: block; text-align: center; text-decoration: none; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 15px; padding: 12px 16px; border-radius: 12px;
}
.pro-cta:hover { background: var(--accent-hover); }
.pro-cta[aria-disabled="true"] { background: #2a2c33; color: #c9cbd2; cursor: default; }
.pro-secondary { border: 1px solid var(--p-line); background: transparent; color: var(--p-ink); font-size: 13px; font-weight: 500; padding: 10px 14px; border-radius: 12px; cursor: pointer; }
.pro-secondary:hover { background: #262830; }

.pro-key { margin-top: 16px; }
.pro-key-toggle { border: 0; background: none; padding: 0; color: var(--p-sub); font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.pro-key-toggle:hover { color: var(--p-ink); }
.pro-key-form { display: flex; gap: 8px; margin-top: 10px; }
.pro-key-form input { flex: 1; min-width: 0; background: #0f1014; border: 1px solid var(--p-line); border-radius: 10px; color: var(--p-ink); padding: 10px 12px; font-size: 13px; outline: none; }
.pro-key-form input:focus { border-color: var(--p-gold); }
.pro-key-form button { border: 0; border-radius: 10px; background: #f4f4f6; color: #111; font-weight: 600; font-size: 13px; padding: 0 16px; cursor: pointer; }
.pro-key-msg { margin: 8px 0 0; color: #ff8a7a; font-size: 12.5px; }
.pro-key-msg:empty { display: none; }
.pro-active { background: #1e2026; border: 1px solid var(--p-line); border-radius: 14px; padding: 16px; }
.pro-active p { color: var(--p-sub); font-size: 12.5px; margin: 6px 0 12px; }
.pro-active button { border: 1px solid var(--p-line); background: transparent; color: var(--p-sub); font-size: 12.5px; padding: 7px 12px; border-radius: 10px; cursor: pointer; }
.pro-legal { display: flex; justify-content: center; gap: 18px; margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--p-line); font-size: 12px; }
.pro-legal a { color: #7f828c; text-decoration: none; }
.pro-legal a:hover { color: var(--p-ink); }
