:root {
  --bg: #0d0f13;
  --panel: #15181f;
  --panel2: #11141a;
  --raise: #1c2029;
  --line: #262b36;
  --text: #e7e9ef;
  --muted: #8a92a6;
  --accent: #ffb84d;
  --accent-ink: #1a1204;
  --clip: #3c418f;
  --clip-sel: #5a61cf;
  --playhead: #ff5a5f;
  --wave: #4fd1a5;
  --range: #ffb84d;
  --radius: 8px;
  --ui: "Libya Alahrar", "Segoe UI", Tahoma, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 13.5px/1.45 var(--ui);
  display: grid;
  grid-template-rows: auto 1fr var(--tl-h, 260px);
  overflow: hidden;
  user-select: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.hidden, [hidden] { display: none !important; }

.boot {
  position: fixed; inset: 0; z-index: 99; display: grid; place-items: center;
  background: var(--bg); color: var(--muted); font-size: 15px;
}

/* ---------- buttons & inputs ---------- */
button {
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
button:hover { background: #242936; border-color: #343a48; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button.primary, button.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
button.primary:hover, button.accent:hover { background: #ffc66e; }
button.icon { min-width: 32px; padding: 5px 8px; }
button.big { padding: 7px 16px; font-size: 14px; }
.more-fmt { display: flex; flex-direction: column; gap: 7px; }
.more-fmt > summary { cursor: pointer; color: var(--muted); font-size: 12.5px; padding: 2px 4px; }
.more-fmt[open] > summary { margin-bottom: 7px; }
.fmt.main { padding: 13px 14px; }
.fmt.main b { font-size: 15px; }
button.small { padding: 3px 9px; font-size: 12.5px; }
button.wide { width: 100%; }
button.toggle.on { background: rgba(255, 184, 77, .16); border-color: rgba(255, 184, 77, .55); color: var(--accent); }

input[type=number], input[type=text], select, textarea {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  outline: none;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { width: 100%; resize: vertical; line-height: 1.7; font-size: 15px; user-select: text; }
input[type=number] { direction: ltr; text-align: center; }
input[type=color] { width: 34px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type=color]::-webkit-color-swatch { border: none; border-radius: 4px; }
input[type=range] { accent-color: var(--accent); min-width: 0; }
kbd {
  display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 4px; text-align: center;
  background: var(--raise); border: 1px solid var(--line); border-bottom-width: 2px; font: 600 11.5px/18px "Segoe UI", sans-serif; direction: ltr;
}

.seg { display: inline-flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 2px; gap: 2px; }
.seg button { border: none; background: transparent; padding: 4px 10px; border-radius: 5px; font-size: 12.5px; }
.seg button.on { background: var(--raise); color: var(--accent); box-shadow: inset 0 0 0 1px #3a4152; }
.seg button:disabled { opacity: .4; }

.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.gap { gap: 8px; margin-top: 8px; }
.two > * { flex: 1; }
label.mini { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
label.mini.inline { flex-direction: row; align-items: center; gap: 6px; }
label.mini input[type=number] { width: 100%; }
label.mini.inline input[type=number] { width: 64px; }
.sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 7px 12px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { font-weight: 900; font-size: 21px; letter-spacing: 0; color: var(--accent); }
.proj-name { background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 3px 8px; width: 180px; font-weight: 500; }
.proj-name:hover { border-color: var(--line); }
.tb-group { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.tb-end { margin-inline-start: auto; display: flex; gap: 6px; }

/* ---------- workspace ---------- */
.workspace { display: grid; grid-template-columns: 290px 1fr 330px; min-height: 0; }
.panel { background: var(--panel); min-height: 0; overflow: auto; }
.panel.side { border-inline-end: 1px solid var(--line); }
.inspector { border-inline-end: none; border-inline-start: 1px solid var(--line); }
.panel-title { padding: 9px 12px; font-weight: 700; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 2; }
.pad { padding: 10px 12px 12px; }
#textPanel { display: flex; flex-direction: column; }

/* clip list */
.clip-list { flex: 1; overflow: auto; padding: 4px 0 10px; }
.clip-row {
  display: grid; grid-template-columns: 22px 74px 52px 1fr 22px; gap: 5px; align-items: center;
  padding: 3px 8px 3px 10px; border-inline-start: 3px solid transparent;
}
.clip-row:hover { background: rgba(255, 255, 255, .03); }
.clip-row.sel { background: rgba(90, 97, 207, .18); border-inline-start-color: var(--accent); }
.clip-row.tap { box-shadow: inset 0 0 0 1px var(--accent); }
.clip-row .n { color: var(--muted); font-size: 11px; text-align: center; direction: ltr; }
.clip-row input { padding: 3px 5px; font-size: 12.5px; }
.clip-row input.t { direction: ltr; font-family: "Segoe UI", sans-serif; font-size: 12px; }
.clip-row input.txt { font-size: 14px; }
.clip-row .del { padding: 0; width: 22px; height: 22px; border: none; background: transparent; color: var(--muted); }
.clip-row .del:hover { color: var(--playhead); }
.clip-list .empty { padding: 18px; color: var(--muted); text-align: center; font-size: 12.5px; }

/* ---------- stage ---------- */
.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #0a0b0e; }
.stage-wrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 14px; position: relative; }
.stage {
  position: relative; overflow: hidden; border-radius: 3px;
  box-shadow: 0 0 0 1px #2a2f3a, 0 10px 40px rgba(0, 0, 0, .55);
  background-color: #2a2d34;
  background-image: linear-gradient(45deg, #34373f 25%, transparent 25%), linear-gradient(-45deg, #34373f 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #34373f 75%), linear-gradient(-45deg, transparent 75%, #34373f 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}
.stage.solid { background-image: none; }
.stage canvas, .stage .ref { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .ref { object-fit: cover; }
#overlay { cursor: move; }

.transport {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 7px 12px; background: var(--panel); border-top: 1px solid var(--line);
}
.tgroup { display: flex; align-items: center; gap: 4px; }
.transport .play { min-width: 44px; background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.tc { font: 600 15px "Segoe UI", sans-serif; direction: ltr; letter-spacing: .5px; }
#volume { width: 80px; }
#bgSel { padding: 4px 6px; font-size: 12.5px; }

/* ---------- inspector ---------- */
.insp-head { position: sticky; top: 0; z-index: 3; background: var(--panel); border-bottom: 1px solid var(--line); }
.scope { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 12px 6px; font-size: 12.5px; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0 6px; gap: 2px; }
.tabs button {
  border: none; background: transparent; border-radius: 0; padding: 7px 2px 8px; font-size: 12.5px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 1px; border-bottom: 2px solid transparent;
}
.tabs button:hover { background: rgba(255, 255, 255, .03); color: var(--text); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .ti { font-size: 14px; line-height: 1; font-family: "Segoe UI Symbol", "Segoe UI", sans-serif; }
.note { margin: 8px 12px 0; padding: 7px 10px; border-radius: 6px; background: rgba(255, 184, 77, .1); border: 1px solid rgba(255, 184, 77, .3); font-size: 12.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#selCard { margin: 10px 12px 0; border: 1px solid #3a4152; border-radius: 9px; background: var(--panel2); }
#selCard[hidden] { display: none; }
.card-title { padding: 6px 10px; font-size: 12px; font-weight: 700; color: var(--accent); border-bottom: 1px solid var(--line); }
.card-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
.card-body.row { flex-direction: row; gap: 8px; }
.card-body textarea { font-size: 15px; }
.pane-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 9px; }
details.grp { margin: 0 12px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, .012); }
details.grp > summary {
  list-style: none; cursor: pointer; padding: 8px 10px; font-weight: 700; font-size: 12.5px; display: flex; align-items: center; gap: 6px; border-radius: 9px;
}
details.grp > summary::-webkit-details-marker { display: none; }
details.grp > summary::before { content: "‹"; display: inline-block; width: 10px; color: var(--muted); transition: transform .15s; }
[dir=ltr] details.grp > summary::before { content: "›"; }
details.grp[open] > summary::before { transform: rotate(-90deg); }
[dir=ltr] details.grp[open] > summary::before { transform: rotate(90deg); }
details.grp > summary:hover { background: rgba(255, 255, 255, .03); }
.grp-body { padding: 2px 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.cats { display: flex; flex-wrap: wrap; gap: 4px; }
.cat { padding: 4px 9px; font-size: 12px; border-radius: 14px; background: transparent; position: relative; }
.cat.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.cat.has:not(.on)::after { content: ""; position: absolute; top: 3px; inset-inline-end: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.hex { direction: ltr; font: 12px "Segoe UI", sans-serif; }
.num { direction: ltr; font-size: 12px; }
.lbl.strong { font-weight: 700; color: var(--text); }
.sep-h { height: 1px; background: var(--line); margin: 4px 0; }
.menu-hint { display: block; font-size: 11.5px; }
.gen-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.gen-row label.mini.inline input[type=number] { width: 58px; }
.gap0 { gap: 6px; }
.field { display: grid; grid-template-columns: 92px 1fr 62px; align-items: center; gap: 8px; }
.field > .lbl { font-size: 12.5px; color: var(--muted); cursor: ew-resize; }
.field > .lbl.static { cursor: default; }
.field.wide { grid-template-columns: 92px 1fr; }
.field input[type=number] { width: 62px; padding: 3px 4px; font-size: 12.5px; }
.field .ov { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { padding: 4px 9px; font-size: 12.5px; border-radius: 14px; }
.chip.on { background: rgba(255, 184, 77, .16); border-color: rgba(255, 184, 77, .6); color: var(--accent); }
.chip small { color: var(--muted); margin-inline-start: 4px; font-size: 11px; }
.gallery { display: flex; flex-direction: column; gap: 4px; }
.gal-cat { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.gal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.tpl {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px 6px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; line-height: 1.25; white-space: normal; text-align: center;
}
.tpl:hover { border-color: #4a5164; background: #1b1f28; }
.tpl.on { border-color: var(--accent); background: rgba(255, 184, 77, .1); color: var(--accent); }
.tpl-ico { font-size: 17px; line-height: 1; color: var(--accent); font-family: "Segoe UI Symbol", "Segoe UI", sans-serif; }
.gallery { gap: 8px; }
/* font button + picker */
.font-btn {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 10px; text-align: start;
  background: var(--panel2);
}
.font-btn .fb-name { flex: 1; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-btn .fb-note { font-size: 11px; color: var(--playhead); }
.font-btn .fb-arrow { color: var(--muted); }
.font-btn.missing { border-color: rgba(255, 90, 95, .6); }
.font-pop { padding: 0; gap: 0; overflow: hidden; display: flex; flex-direction: column; }
.font-pop[hidden] { display: none; }
.fp-head { display: flex; gap: 6px; padding: 8px 8px 6px; }
.fp-search { flex: 1; padding: 6px 10px; font-size: 13.5px; }
.fp-filters { padding: 0 8px 8px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 7px; }
.fp-lang { align-self: stretch; display: grid; grid-template-columns: 1fr 1fr; }
.fp-lang button { font-size: 13px; padding: 5px; }
.fp-cats { display: flex; flex-wrap: wrap; gap: 4px; }
.fp-cats .cat small { opacity: .65; font-size: 10.5px; }
.fp-list { overflow: auto; flex: 1; min-height: 160px; padding: 0 0 6px; }
.fp-sec {
  display: flex; justify-content: space-between; padding: 9px 12px 5px; font-size: 11.5px; color: var(--accent); font-weight: 700;
  position: sticky; top: 0; background: var(--raise); z-index: 1; border-bottom: 1px solid var(--line);
}
/* one compact line per font: ☆ | name | sample | ● weights */
.fp-row {
  width: 100%; height: 42px; display: grid; grid-template-columns: 18px 124px minmax(0, 1fr) 30px; align-items: center; gap: 10px;
  padding: 0 12px; border: none; border-bottom: 1px solid rgba(255, 255, 255, .035); border-radius: 0; background: transparent; text-align: start;
}
.fp-row:hover { background: rgba(255, 255, 255, .055); }
.fp-row.on { background: rgba(255, 184, 77, .11); box-shadow: inset 3px 0 0 var(--accent); }
[dir=rtl] .fp-row.on { box-shadow: inset -3px 0 0 var(--accent); }
.fp-name {
  font: 500 12px "Segoe UI", "Libya Alahrar", sans-serif; color: #aeb4c4; direction: ltr; unicode-bidi: isolate;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start;
}
[dir=rtl] .fp-name { text-align: right; }
.fp-row:hover .fp-name, .fp-row.on .fp-name { color: var(--text); }
/* align with the UI (not the sample's own direction) so name and sample always sit side by side */
.fp-sample { font-size: 21px; line-height: 42px; height: 42px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
[dir=rtl] .fp-sample { text-align: right; }
.fp-info { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font: 11px "Segoe UI", sans-serif; color: var(--muted); direction: ltr; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #5a6072; flex: none; }
.dot.ok, .fp-info.ok .dot { background: #4fd1a5; }
.dot.pc, .fp-info.pc .dot { background: transparent; box-shadow: inset 0 0 0 1.5px #7d8496; }
.fp-info.custom .dot { background: #7c8cff; }
.fp-star { font-size: 15px; color: #3d4352; cursor: pointer; line-height: 1; text-align: center; }
.fp-row:hover .fp-star { color: #6b7285; }
.fp-star:hover, .fp-star.on, .fp-row:hover .fp-star.on { color: var(--accent); }
.fp-legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); align-items: center; }
.fp-legend span { display: inline-flex; align-items: center; gap: 5px; }
.fp-foot { display: flex; gap: 6px; justify-content: space-between; padding: 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.fp-list .empty { padding: 20px; text-align: center; color: var(--muted); }
.toggle-row { cursor: pointer; }
.lang { min-width: 36px; font-weight: 700; font-family: "Segoe UI", "Libya Alahrar", sans-serif; }
.dlg.wide { width: min(680px, 94vw); }
.tbl { display: grid; grid-template-columns: 1fr 70px 70px; gap: 5px 8px; align-items: center; }
.tbl .h { font-size: 11.5px; color: var(--muted); text-align: center; }
.tbl .lbl { font-size: 12.5px; color: var(--muted); cursor: ew-resize; }
.tbl input { width: 100%; padding: 3px 4px; font-size: 12.5px; }
.curve-wrap { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
#curveCv { width: 100%; height: 190px; display: block; touch-action: none; }
.bez { direction: ltr; text-align: center; font: 12px "Segoe UI", sans-serif; width: 100%; }
.subtle { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; }
.switch { position: relative; width: 34px; height: 19px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #2d3240; border-radius: 10px; transition: .15s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 15px; height: 15px; border-radius: 50%; background: #c9cdd8; transition: .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { inset-inline-start: 17px; background: #fff; }
.weights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.weights button { padding: 4px 2px; font-size: 13px; }
.weights button.on { border-color: var(--accent); color: var(--accent); background: rgba(255, 184, 77, .1); }

/* ---------- timeline ---------- */
.timeline-panel { position: relative; display: flex; flex-direction: column; background: var(--panel); border-top: 1px solid var(--line); min-height: 0; }
.tl-resize { position: absolute; top: -4px; left: 0; right: 0; height: 8px; cursor: ns-resize; z-index: 5; }
.tl-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tl-toolbar button { padding: 3px 9px; font-size: 12.5px; }
.tl-wrap { flex: 1; min-height: 0; position: relative; direction: ltr; overflow: hidden; }
.tl-canvas { display: block; outline: none; touch-action: none; }
.tapbar { display: flex; align-items: center; gap: 10px; padding: 3px 10px; border-radius: 6px; background: rgba(255, 184, 77, .1); border: 1px solid rgba(255, 184, 77, .4); font-size: 12.5px; flex-wrap: wrap; }
.tapbar b { color: var(--accent); }

/* ---------- popovers, menus, dialogs ---------- */
.popover, .ctx-menu {
  position: fixed; z-index: 50; background: var(--raise); border: 1px solid #343a48; border-radius: 9px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 240px;
}
.pop-title { font-weight: 700; font-size: 13px; }
.ctx-menu { padding: 5px; gap: 1px; min-width: 210px; }
.ctx-menu button { background: transparent; border: none; text-align: start; padding: 6px 10px; display: flex; justify-content: space-between; gap: 20px; border-radius: 5px; }
.ctx-menu button:hover { background: rgba(255, 255, 255, .06); }
.ctx-menu button kbd { opacity: .7; }
.ctx-menu hr { border: none; border-top: 1px solid var(--line); margin: 3px 0; }

.dlg { border: 1px solid #343a48; border-radius: 12px; background: var(--panel); color: var(--text); padding: 0; width: min(560px, 94vw); box-shadow: 0 20px 70px rgba(0, 0, 0, .6); }
.dlg::backdrop { background: rgba(5, 6, 9, .6); }
.dlg-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.dlg h2 { margin: 0; font-size: 17px; }
.fmt-list { display: flex; flex-direction: column; gap: 7px; }
.fmt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; background: var(--panel2); }
.fmt:has(input:checked) { border-color: var(--accent); background: rgba(255, 184, 77, .06); }
.fmt input { margin-top: 4px; accent-color: var(--accent); }
.fmt small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.grid2 label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.grid2 select { width: 100%; }
.small-text { font-size: 12.5px; }
.progress { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.progress .bar { height: 8px; background: var(--panel2); border-radius: 5px; overflow: hidden; border: 1px solid var(--line); }
.progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-start; }
.help ol { margin: 0; padding-inline-start: 20px; line-height: 1.9; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 12.5px; }

.drop-hint { position: fixed; inset: 0; z-index: 80; background: rgba(10, 12, 16, .78); display: grid; place-items: center; pointer-events: none; }
.drop-hint > div { border: 2px dashed var(--accent); border-radius: 16px; padding: 40px 60px; font-size: 22px; font-weight: 700; text-align: center; }
.drop-hint small { display: block; font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 8px; }

.toast {
  position: fixed; bottom: calc(var(--tl-h, 260px) + 14px); left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #23283a; border: 1px solid #3a4152; padding: 8px 16px; border-radius: 8px; z-index: 90; transition: .2s; font-size: 13px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--playhead); }

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

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 240px 1fr 290px; }
}

/* sound effects */
.sfx-list { display: flex; flex-wrap: wrap; gap: 4px; min-height: 22px; align-items: center; }
.sfx-chip { font-size: 11.5px; padding: 2px 8px; border-radius: 10px; background: rgba(255, 213, 74, .12); color: #ffd54a; border: 1px solid rgba(255, 213, 74, .35); white-space: nowrap; }
.ctx-menu .menu-title { font-size: 11px; color: var(--muted); padding: 6px 12px 2px; }

/* sound library */
.sfx-lib {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(var(--tl-h, 300px) + 10px);
  width: min(460px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - var(--tl-h, 300px) - 80px));
  display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; box-shadow: 0 18px 50px rgba(0,0,0,.55);
}
.sfx-lib.drop { outline: 2px dashed var(--accent); outline-offset: -4px; }
.sfx-lib .sl-head { display: flex; align-items: center; gap: 8px; }
.sfx-lib .sl-head b { font-size: 13px; }
.sfx-lib .grow { flex: 1; }
.sfx-lib .sl-search { width: 100%; }
.sfx-lib .sl-cats { display: flex; flex-wrap: wrap; gap: 4px; }
.sfx-lib .sl-list { overflow-y: auto; min-height: 120px; flex: 1; display: flex; flex-direction: column; gap: 2px; padding-inline-end: 2px; }
.sfx-lib .sl-row { display: grid; grid-template-columns: 28px 10px minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 7px; cursor: pointer; min-height: 32px; }
.sfx-lib .sl-row:hover { background: var(--raise); }
.sfx-lib .sl-row.cur { background: rgba(255, 184, 77, .12); }
.sfx-lib .sl-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.sfx-lib .sl-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.sfx-lib .sl-play { width: 26px; height: 26px; padding: 0; font-size: 11px; }
.sfx-lib .sl-del { width: 26px; height: 26px; padding: 0; font-size: 12px; opacity: .7; }
.sfx-lib .sl-row:not(:has(.sl-del)) { grid-template-columns: 28px 10px minmax(0, 1fr) auto; }
.sfx-lib .sl-empty { padding: 16px 6px; text-align: center; }
.sfx-lib .sl-foot { font-size: 11.5px; }
