:root {
  --bg: #0a0b0f;
  --p1: #111319;
  --p2: #181b23;
  --p3: #222632;
  --p4: #2b3140;
  --line: #282d3a;
  --line2: #394052;
  --tx: #eceef4;
  --mu: #8a92a6;
  --g: #e2b24c;
  --g2: #f7dc92;
  --g3: #9e7521;
  --em: #38c996;
  --bl: #4a8eff;
  --pu: #9a6bff;
  --r: #ef4444;
  --tlh: min(39vh, 330px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--tx);
  font: 12.5px/1.38 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow: hidden;
  user-select: none;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--p1); }
::-webkit-scrollbar-thumb { background: #303647; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #464e66; }

button, select, input, textarea { font: inherit; color: inherit; }

button {
  background: var(--p3);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
button:hover:not(:disabled) { border-color: var(--line2); background: var(--p4); }
button:active:not(:disabled) { transform: translateY(0.5px); }
button:disabled { opacity: .38; cursor: not-allowed; }
button.gold {
  background: linear-gradient(180deg, var(--g2), var(--g));
  color: #191204;
  border-color: #b58727;
  font-weight: 700;
}
button.gold:hover:not(:disabled) { filter: brightness(1.07); }
button.on {
  background: rgba(226, 178, 76, 0.2);
  border-color: var(--g);
  color: var(--g2);
}
button.danger:hover:not(:disabled) { background: #4c1d20; border-color: var(--r); color: #ffb4b4; }
button.wide { width: 100%; margin-top: 7px; }
button.sm { padding: 3px 7px; font-size: 11px; }

input[type=text], input[type=search], input[type=number], textarea, select {
  background: var(--p2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  width: 100%;
  outline: none;
  user-select: text;
}
input:focus, textarea:focus, select:focus { border-color: var(--g); }
textarea { resize: vertical; min-height: 58px; line-height: 1.4; }
input[type=range] { width: 100%; accent-color: var(--g); height: 18px; cursor: pointer; }
input[type=color] {
  width: 38px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--p2);
  padding: 1px;
  cursor: pointer;
}

.sp { flex: 1; min-width: 4px; }
.hint { color: var(--mu); font-size: 11.5px; line-height: 1.5; }
.pad { padding: 14px; }
.vdiv { width: 1px; height: 18px; background: var(--line); flex: none; margin: 0 2px; }

/* APP GRID */
#app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 28px 46px minmax(0, 1fr) 5px var(--tlh);
  width: 100%;
  height: 100dvh;
}

/* NATIVE TOP MENU BAR */
#menubar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 0 8px;
  background: #0b0d12;
  border-bottom: 1px solid #1e2330;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  z-index: 35;
}
#menubar::-webkit-scrollbar { display: none; }
#menubar > * { flex: 0 0 auto; }
#menubar > .sp { flex: 1 1 8px; min-width: 6px; }
.mb-btn {
  border: 0;
  background: transparent;
  color: #c5cbd9;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  line-height: 18px;
}
.mb-btn:hover, .mb-btn.open {
  background: rgba(226, 178, 76, 0.16);
  color: var(--g2);
}
.mb-status {
  font-size: 10.5px;
  color: var(--mu);
  font-variant-numeric: tabular-nums;
  padding-right: 4px;
  white-space: nowrap;
}
.mb-pop {
  position: fixed;
  z-index: 180;
  min-width: 242px;
  max-width: min(330px, 94vw);
  max-height: min(76vh, 520px);
  overflow-y: auto;
  background: #151822;
  border: 1px solid var(--line2);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .82);
}
.mb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--tx);
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}
.mb-item:hover:not(:disabled) {
  background: rgba(226, 178, 76, 0.18);
  color: var(--g2);
}
.mb-chk { width: 13px; color: var(--g2); font-weight: 800; flex: none; text-align: center; }
.mb-lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.mb-kbd { font-size: 10px; color: var(--mu); margin-left: 10px; flex: none; }
.mb-sep { height: 1px; background: var(--line); margin: 4px 6px; }

/* HEADER */
#topbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 0 10px;
  background: linear-gradient(180deg, #161922, #111319);
  border-bottom: 1px solid var(--line);
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  z-index: 20;
}
#topbar::-webkit-scrollbar { display: none; }
#topbar > * { flex: 0 0 auto; }
#topbar > .sp { flex: 1 1 8px; min-width: 6px; }
.brand { display: flex; align-items: center; gap: 7px; flex: none; }
.brand-ic { width: 26px; height: 26px; border-radius: 6px; flex: none; }
.logo { font-size: 17px; font-weight: 800; letter-spacing: -.4px; white-space: nowrap; }
.logo b { color: var(--g); }
.logo small { font-size: 9px; font-weight: 700; color: var(--mu); margin-left: 6px; letter-spacing: .6px; text-transform: uppercase; }

.seg {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
  flex: none;
}
.seg button {
  border: 0;
  background: transparent;
  padding: 4px 11px;
  border-radius: 6px;
  font-weight: 600;
  color: var(--mu);
}
.seg button.on {
  background: linear-gradient(180deg, var(--g2), var(--g));
  color: #191204;
}
.seg.mini button { padding: 3px 8px; font-size: 11px; }

.proj-bar { display: flex; align-items: center; gap: 6px; flex: none; }
#projName { width: 140px; min-width: 95px; font-weight: 600; height: 29px; }
.save-badge {
  font-size: 10.5px;
  color: var(--em);
  white-space: nowrap;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(56, 201, 150, 0.1);
  border: 1px solid rgba(56, 201, 150, 0.25);
  flex: none;
}
.save-badge.dirty { color: var(--g2); background: rgba(226, 178, 76, 0.12); border-color: rgba(226, 178, 76, 0.35); }
#aspect { width: auto; min-width: 112px; max-width: 190px; height: 29px; white-space: nowrap; flex: none; }
.hdr-acts { display: flex; align-items: center; gap: 5px; flex: none; }
.mbtn { display: none; }

/* MAIN WORKSPACE */
#workspace {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr) 318px;
  min-height: 0;
  min-width: 0;
}

aside { background: var(--p1); overflow-y: auto; overflow-x: hidden; min-height: 0; }
#lib { border-right: 1px solid var(--line); }
#props { border-left: 1px solid var(--line); }

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--p1);
  z-index: 4;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 1 0 auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 9px 7px;
  color: var(--mu);
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
}
.tabs button.on {
  color: var(--g2);
  box-shadow: inset 0 -2px var(--g);
  background: rgba(226, 178, 76, 0.06);
}

.libpad { padding: 10px; }
.lib-cat {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--g);
  font-weight: 700;
  margin: 12px 0 6px;
}
.lib-cat:first-child { margin-top: 2px; }
.lib-filter { margin-bottom: 8px; }

#drop {
  margin: 8px 0;
  border: 1.5px dashed #3a4154;
  border-radius: 9px;
  padding: 12px 8px;
  text-align: center;
  color: var(--mu);
  font-size: 11.5px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
#drop:hover, #drop.over {
  border-color: var(--g);
  color: var(--g2);
  background: rgba(226, 178, 76, 0.06);
}

.mitem {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--p2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  margin-bottom: 6px;
  cursor: grab;
  transition: border-color .12s;
}
.mitem:hover { border-color: var(--g3); }
.mth { width: 62px; height: 36px; object-fit: cover; border-radius: 4px; background: #000; flex: none; }
.mi { min-width: 0; flex: 1; }
.mi b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
.mi span { color: var(--mu); font-size: 10.5px; }
.mitem button { padding: 3px 7px; flex: none; }

.ebtn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  margin-bottom: 6px;
  padding: 8px 9px;
  background: var(--p2);
}
.ebtn.gold-tint { border-color: rgba(226, 178, 76, 0.45); background: rgba(226, 178, 76, 0.08); }
.ebtn i { font-style: normal; font-size: 16px; width: 22px; text-align: center; flex: none; }
.ebtn small { display: block; color: var(--mu); font-size: 10.5px; white-space: normal; }

.sfx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.sfx-btn { padding: 8px 6px; font-size: 11.5px; text-align: left; background: var(--p2); }
.sfx-btn:hover { border-color: var(--em); }

/* SUBTITLES LIST */
.sub-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.sub-item {
  background: var(--p2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
}
.sub-item.active { border-color: var(--g); background: rgba(226, 178, 76, 0.08); }
.sub-times { display: flex; align-items: center; gap: 4px; margin-bottom: 5px; font-size: 10.5px; }
.sub-times input { width: 64px; padding: 2px 5px; font-size: 11px; text-align: center; }
.sub-item textarea { min-height: 40px; font-size: 11.5px; padding: 4px 6px; }

/* CENTER STAGE */
#stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background: radial-gradient(circle at 50% 45%, #11141c, #07080b);
}
#stageBody { position: relative; min-height: 0; min-width: 0; overflow: hidden; }
#stageVideo, #stageAudio { position: absolute; inset: 0; min-height: 0; min-width: 0; }

#stageVideo { display: flex; flex-direction: column; }
.stage-hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(14, 16, 22, 0.85);
  border-bottom: 1px solid #1b1f29;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  flex: none;
}
.stage-hud-top::-webkit-scrollbar { display: none; }
.hud-left, .hud-right { display: flex; align-items: center; gap: 5px; flex: none; flex-wrap: nowrap; }
.pill {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--g2);
  background: rgba(226, 178, 76, 0.12);
  border: 1px solid rgba(226, 178, 76, 0.3);
  border-radius: 99px;
  padding: 2px 8px;
}
.pill-btn { padding: 3px 8px; font-size: 11px; border-radius: 99px; background: var(--p2); }
.mini-sel { width: auto; padding: 3px 6px; font-size: 11px; border-radius: 6px; }

#cvWrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow: hidden;
}
#cv {
  background: #000;
  border-radius: 4px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, 0.06);
  display: block;
}
#ovCv {
  position: absolute;
  pointer-events: auto;
  cursor: default;
}

#scopesBox {
  position: absolute;
  right: 14px;
  bottom: 14px;
  background: rgba(12, 14, 20, 0.92);
  border: 1px solid var(--line2);
  border-radius: 9px;
  padding: 6px;
  box-shadow: 0 10px 30px #000b;
  z-index: 6;
}
.scopes-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--mu);
  margin-bottom: 4px;
}
.scopes-head button { padding: 0 4px; font-size: 10px; border: 0; background: transparent; }
#scopesCv { display: block; border-radius: 4px; background: #07080b; }

#empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  color: var(--mu);
  padding: 24px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(16, 19, 28, .85), rgba(8, 9, 13, .92));
}
#empty button { pointer-events: auto; }
.empty-badge {
  font-size: 10px;
  letter-spacing: 1.6px;
  font-weight: 800;
  color: var(--g);
  padding: 3px 10px;
  border: 1px solid rgba(226, 178, 76, .4);
  border-radius: 99px;
  background: rgba(226, 178, 76, .1);
}
#empty h2 { color: var(--tx); font-size: 20px; }
#empty p { max-width: 460px; font-size: 12.5px; line-height: 1.5; }
.empty-acts { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; justify-content: center; }

/* AUDIO STAGE */
#stageAudio { display: flex; flex-direction: column; gap: 8px; padding: 10px; height: 100%; }
.audio-top-row { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 8px; height: 112px; flex: none; }
#specBox, #vuBox {
  position: relative;
  background: var(--p1);
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  padding: 22px 10px 8px;
}
.box-label {
  position: absolute;
  left: 10px;
  top: 5px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--mu);
  font-weight: 700;
}
#spec { width: 100%; height: 100%; display: block; }
.vu-bars { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.vu-ch { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; color: var(--mu); }
.vu-track {
  position: relative;
  flex: 1;
  height: 14px;
  background: #090b0f;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #232836;
}
.vu-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #1ea97c 0%, #38c996 58%, #e2b24c 78%, #ef4444 94%);
  transition: width 35ms linear;
}
.vu-pk { position: absolute; top: 0; bottom: 0; width: 2px; left: 0; background: #fff; opacity: .9; }
.vu-scale { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--mu); margin-top: 8px; padding-left: 14px; }

.audio-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  flex: none;
}
.audio-toolbar::-webkit-scrollbar { display: none; }
.audio-toolbar > * { flex: none; }
.audio-toolbar > .sp { flex: 1 1 4px; }
.audio-toolbar button { font-size: 11.5px; padding: 4px 8px; }

#bwBox {
  position: relative;
  flex: 1;
  min-height: 90px;
  background: #0c0e13;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  cursor: crosshair;
}
#bigwave { position: absolute; inset: 0; width: 100%; height: 100%; }
#bwHead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--r); display: none; pointer-events: none; z-index: 3; }
#bwName { position: absolute; left: 10px; top: 6px; color: var(--g2); font-size: 11px; font-weight: 700; pointer-events: none; z-index: 2; text-shadow: 0 1px 4px #000; }
.bw-hint { position: absolute; right: 10px; bottom: 5px; color: var(--mu); font-size: 10px; pointer-events: none; z-index: 2; background: rgba(10,12,16,.75); padding: 2px 6px; border-radius: 4px; }

/* TRANSPORT */
#transport {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  background: var(--p1);
  border-top: 1px solid var(--line);
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
#transport::-webkit-scrollbar { display: none; }
#transport > * { flex: none; }
#transport > .sp { flex: 1 1 4px; }
.tr-grp { display: flex; align-items: center; gap: 4px; }
#timeWrap {
  display: flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 9px;
  white-space: nowrap;
}
#time { color: var(--g2); font-weight: 700; }
.tsep, #durTime { color: var(--mu); font-size: 11.5px; }
#shuttleBadge {
  margin-left: 4px;
  font-size: 10px;
  font-weight: 800;
  color: #191204;
  background: var(--g);
  padding: 1px 5px;
  border-radius: 4px;
}
.vol { display: flex; align-items: center; gap: 4px; width: 105px; }
#recBtn.rec { background: #5a1a1d; border-color: var(--r); color: #ffb3b5; animation: pulseRec 1.2s infinite; }
@keyframes pulseRec { 50% { filter: brightness(1.25); } }

/* TIMELINE RESIZER */
#tlResizer {
  background: var(--line);
  cursor: ns-resize;
  transition: background .15s;
}
#tlResizer:hover { background: var(--g); }

/* TIMELINE */
#tl { display: flex; flex-direction: column; background: var(--p1); min-height: 0; }
#tlbar {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  flex: none;
  background: #141720;
}
#tlbar button { padding: 4px 8px; font-size: 11.5px; }
.tool-grp { display: flex; gap: 3px; }
#tlbar input[type=range] { width: 105px; }
.zl { color: var(--mu); font-weight: 700; }

#tlscroll { flex: 1; overflow: auto; position: relative; min-height: 0; }
#tlinner { position: relative; min-height: 100%; }
#tlinner.razor-mode .clip { cursor: crosshair !important; }

.row { display: flex; border-bottom: 1px solid #1c202a; }
.th {
  position: sticky;
  left: 0;
  z-index: 6;
  flex: 0 0 144px;
  background: #13161e;
  border-right: 1px solid var(--line);
  padding: 3px 7px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  overflow: hidden;
}
.th-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.th b { font-size: 11px; color: var(--tx); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th .t-tag { font-size: 9px; padding: 1px 4px; border-radius: 3px; font-weight: 800; color: #fff; flex: none; }
.t-tag.v { background: #2d55a0; }
.t-tag.a { background: #1a7c5c; }
.t-tag.t { background: #9b5c22; }
.t-tag.s { background: #6b42b8; }
.th .tb { display: flex; gap: 3px; align-items: center; }
.th .tb button { padding: 0 5px; font-size: 10px; border-radius: 4px; line-height: 17px; min-width: 21px; }
.th .tb button.solo.on { background: #b58918; color: #111; border-color: var(--g2); }
.th .tb input[type=range] { width: 48px; height: 12px; }

.ruler-row { position: sticky; top: 0; z-index: 8; background: #141720; height: 26px; }
.ruler-th { justify-content: center; align-items: center; }
#fpsLabel { font-size: 10px; color: var(--g); font-weight: 700; letter-spacing: .5px; }
#ruler { position: relative; flex: 0 0 auto; height: 26px; cursor: pointer; }
#ruler i { position: absolute; top: 14px; bottom: 0; border-left: 1px solid #3c4356; pointer-events: none; }
#ruler i b { position: absolute; top: -13px; left: 4px; font-size: 10px; font-weight: 500; color: var(--mu); font-style: normal; white-space: nowrap; }

#loopBar {
  position: absolute;
  top: 0;
  height: 7px;
  background: linear-gradient(90deg, rgba(226,178,76,.85), rgba(56,201,150,.85));
  border-radius: 0 0 3px 3px;
  pointer-events: none;
  z-index: 2;
}
#markersBar { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.marker-pin {
  position: absolute;
  top: 2px;
  width: 10px;
  height: 12px;
  transform: translateX(-5px);
  background: var(--g);
  clip-path: polygon(0 0, 100% 0, 100% 65%, 50% 100%, 0 65%);
  pointer-events: auto;
  cursor: pointer;
}
.marker-pin:hover { filter: brightness(1.25); transform: translateX(-5px) scale(1.15); }

#rhead { position: absolute; top: 0; width: 0; height: 26px; pointer-events: none; z-index: 5; }
#rhead::after {
  content: "";
  position: absolute;
  left: -6px;
  top: 0;
  border: 6px solid transparent;
  border-top: 10px solid var(--r);
}

.lane {
  position: relative;
  flex: 0 0 auto;
  height: 100%;
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(var(--grid) - 1px), #171a22 calc(var(--grid) - 1px), #171a22 var(--grid));
}
.lane.locked { opacity: .65; background-image: repeating-linear-gradient(45deg, transparent 0, transparent 8px, rgba(255,255,255,.025) 8px, rgba(255,255,255,.025) 16px); }

#playhead { position: absolute; top: 0; bottom: 0; width: 0; z-index: 7; pointer-events: none; }
#playhead::before { content: ""; position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; background: var(--r); box-shadow: 0 0 8px rgba(239,68,68,.5); }
#snapLine { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--g2); z-index: 7; pointer-events: none; box-shadow: 0 0 6px var(--g); }

.clip {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 6px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  border: 1px solid rgba(255, 255, 255, .22);
  color: #fff;
  font-size: 11px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.clip.k-video { background: linear-gradient(180deg, #2b4e8f, #1f396b); }
.clip.k-image { background: linear-gradient(180deg, #563a94, #3d286b); }
.clip.k-color { background: linear-gradient(180deg, #4b566e, #333b4d); }
.clip.k-text, .clip.k-lower3 { background: linear-gradient(180deg, #9c5e23, #734316); }
.clip.k-shape, .clip.k-viz { background: linear-gradient(180deg, #8a3a6d, #61254c); }
.clip.k-audio { background: linear-gradient(180deg, #1b7859, #12523d); }
.clip.k-sub { background: linear-gradient(180deg, #6b46b8, #4b2d8a); }
.clip.sel { outline: 2px solid var(--g2); border-color: var(--g2); z-index: 4; box-shadow: 0 0 12px rgba(226, 178, 76, .45); }
.clip.muted { filter: grayscale(.8) brightness(.65); }

.clip .lb {
  position: absolute;
  left: 11px;
  top: 2px;
  right: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px #000;
  pointer-events: none;
  z-index: 3;
  font-weight: 600;
  font-size: 10.5px;
}
.clip canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.clip .bg { position: absolute; inset: 0; background-size: auto 100%; background-repeat: repeat-x; opacity: .48; pointer-events: none; }

.hl, .hr { position: absolute; top: 0; bottom: 0; width: 10px; z-index: 5; cursor: ew-resize; touch-action: none; }
.hl { left: 0; }
.hr { right: 0; }
.hl::after, .hr::after {
  content: "";
  position: absolute;
  top: 26%;
  bottom: 26%;
  width: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .65);
}
.hl::after { left: 3px; }
.hr::after { right: 3px; }

.fhl, .fhr {
  position: absolute;
  top: 2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--g2);
  border: 1.5px solid #111;
  z-index: 6;
  cursor: ew-resize;
  opacity: .85;
}
.fhl:hover, .fhr:hover { transform: scale(1.25); opacity: 1; }

.tbadge { position: absolute; top: 0; bottom: 0; pointer-events: none; z-index: 2; }
.tbadge.i { left: 0; background: linear-gradient(90deg, rgba(226, 178, 76, .75), transparent); }
.tbadge.o { right: 0; background: linear-gradient(270deg, rgba(226, 178, 76, .75), transparent); }

.kf-dot {
  position: absolute;
  bottom: 4px;
  width: 7px;
  height: 7px;
  background: var(--g2);
  border: 1px solid #000;
  transform: translateX(-3.5px) rotate(45deg);
  z-index: 4;
  pointer-events: none;
}

/* RIGHT INSPECTOR */
.phead {
  padding: 10px 12px 6px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.phead b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.phead span {
  color: var(--g2);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .6px;
  background: rgba(226,178,76,.14);
  padding: 2px 6px;
  border-radius: 4px;
  flex: none;
}

.pbtns { display: flex; gap: 5px; padding: 7px 12px; flex-wrap: wrap; }
.pbtns button { flex: 1; }

.ptabs { display: flex; border-bottom: 1px solid var(--line); background: #141720; position: sticky; top: 0; z-index: 3; }
.ptabs button {
  flex: 1;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 8px 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--mu);
}
.ptabs button.on { color: var(--g2); box-shadow: inset 0 -2px var(--g); background: rgba(226,178,76,.06); }

.sec { border-bottom: 1px solid var(--line); padding: 2px 12px 9px; }
.sec summary { cursor: pointer; font-weight: 700; color: var(--g2); padding: 8px 0 6px; list-style: none; font-size: 12px; }
.sec summary::before { content: "▸ "; color: var(--mu); }
.sec[open] summary::before { content: "▾ "; }

.r { margin: 6px 0; }
.rl { display: flex; justify-content: space-between; align-items: center; color: var(--mu); font-size: 11.5px; margin-bottom: 2px; gap: 6px; }
.rl b { color: var(--tx); font-weight: 600; font-variant-numeric: tabular-nums; }
.rl-right { display: flex; align-items: center; gap: 5px; }
.kf-btn {
  padding: 0 4px;
  font-size: 11px;
  line-height: 16px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--mu);
}
.kf-btn.has { color: var(--g2); border-color: var(--g); background: rgba(226,178,76,.18); }
.kf-btn.anim { color: var(--em); border-color: var(--em); }

.r.row2 { display: flex; justify-content: space-between; align-items: center; color: var(--mu); font-size: 11.5px; }
.chk { display: flex; gap: 7px; align-items: center; margin: 6px 0; color: var(--tx); cursor: pointer; font-size: 12px; }
.chk input { accent-color: var(--g); width: 15px; height: 15px; }

.pg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 6px 0; }
.pg button { padding: 5px 3px; font-size: 10.5px; white-space: normal; line-height: 1.2; background: var(--p2); }
.pg button:hover { border-color: var(--g); }

/* COLOR WHEELS & TONE CURVE & EQ CANVAS */
.wheels-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
.wheel-card { text-align: center; background: var(--p2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 4px; }
.wheel-card span { display: block; font-size: 10px; color: var(--mu); margin-bottom: 4px; font-weight: 600; }
.wheel-cv { width: 76px; height: 76px; cursor: crosshair; display: block; margin: 0 auto; border-radius: 50%; }
.wheel-reset { margin-top: 4px; font-size: 9.5px; padding: 1px 5px; }

.curve-wrap, .eq-wrap {
  background: #0c0e13;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  margin: 6px 0;
}
.curve-cv, .eq-cv { width: 100%; display: block; cursor: crosshair; border-radius: 4px; }
.eq-sliders { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 6px; }
.eq-band { text-align: center; background: var(--p2); border-radius: 5px; padding: 4px 2px; border: 1px solid var(--line); }
.eq-band small { display: block; font-size: 9.5px; color: var(--mu); }
.eq-band b { display: block; font-size: 9.5px; color: var(--g2); }

/* MODAL & TOAST */
#modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, 0.78);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 14px;
}
#modal.show { display: flex; }
.mbox {
  background: var(--p1);
  border: 1px solid var(--line2);
  border-radius: 14px;
  padding: 18px 20px;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .85);
}
.mbox h3 { margin-bottom: 10px; font-size: 16.5px; color: var(--g2); }
.mbox p, .mbox li { color: #c7ccd9; line-height: 1.55; font-size: 12.5px; }
.mbox ul { padding-left: 18px; margin: 8px 0; }
.mbox .pbtns { padding: 12px 0 0; }

.seg2 { display: flex; gap: 5px; margin-bottom: 12px; flex-wrap: wrap; }
.seg2 button { flex: 1; min-width: 90px; }

.bar { height: 10px; background: var(--p3); border-radius: 6px; overflow: hidden; margin: 10px 0 6px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--g), var(--g2)); transition: width .1s; }

.proj-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; max-height: 290px; overflow-y: auto; }
.proj-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--p2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
.proj-card.cur { border-color: var(--g); background: rgba(226,178,76,.08); }
.proj-card .pi { flex: 1; min-width: 0; }
.proj-card .pi b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-card .pi small { color: var(--mu); font-size: 11px; }

.rec-preview {
  width: 100%;
  max-height: 250px;
  background: #000;
  border-radius: 8px;
  margin-bottom: 10px;
  object-fit: contain;
  border: 1px solid var(--line);
}
.rec-vu { height: 12px; background: #090b0f; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); margin: 8px 0; }
.rec-vu i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #38c996, #e2b24c 75%, #ef4444); }

kbd {
  background: var(--p3);
  border: 1px solid var(--line2);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10.5px;
  color: var(--g2);
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  background: #1d222f;
  border: 1px solid var(--g);
  color: var(--tx);
  padding: 9px 16px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: .22s;
  z-index: 250;
  max-width: 90vw;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .65);
  font-weight: 500;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* CREATIVE CATALOG CARDS (FX, TRANSITIONS, LUTS, TEXT STYLES, AUDIO LIB) */
.cat-pills {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.cat-pills button {
  flex: 1 1 auto;
  padding: 4px 6px;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--p2);
  color: var(--mu);
}
.cat-pills button.on {
  background: rgba(226, 178, 76, 0.22);
  border-color: var(--g);
  color: var(--g2);
}

.fx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.fx-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 7px 8px;
  background: var(--p2);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  white-space: normal;
  min-width: 0;
}
.fx-card:hover { border-color: var(--g); background: var(--p3); }
.fx-card.active { border-color: var(--g2); background: rgba(226, 178, 76, 0.16); }
.fx-card .fx-ic { font-size: 15px; line-height: 1; margin-bottom: 2px; }
.fx-card b { font-size: 11px; color: var(--tx); word-break: break-word; }
.fx-card small { font-size: 9.5px; color: var(--mu); }

.tr-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  margin-bottom: 5px;
  background: var(--p2);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.tr-row .tr-name { flex: 1; min-width: 0; }
.tr-row .tr-name b { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-row .tr-name small { font-size: 9.5px; color: var(--mu); }
.tr-row button { padding: 3px 6px; font-size: 10px; flex: none; }

.tstyle-card {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px;
  margin-bottom: 6px;
  background: var(--p2);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}
.tstyle-card:hover { border-color: var(--g); }
.tstyle-prev {
  width: 78px;
  height: 36px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  flex: none;
  border: 1px solid rgba(255,255,255,.12);
  overflow: hidden;
  padding: 2px 4px;
}
.tstyle-info { min-width: 0; flex: 1; }
.tstyle-info b { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tstyle-info small { color: var(--mu); font-size: 10px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.audio-lib-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 7px;
  margin-bottom: 5px;
  background: var(--p2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.audio-lib-row:hover { border-color: var(--em); }
.audio-lib-row .al-ic { font-size: 15px; width: 20px; text-align: center; flex: none; }
.audio-lib-row .al-info { flex: 1; min-width: 0; }
.audio-lib-row .al-info b { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-lib-row .al-info small { display: block; font-size: 9.8px; color: var(--mu); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-lib-row button { padding: 3px 6px; font-size: 10.5px; flex: none; }

/* RESPONSIVE */
@media (max-width: 1260px) {
  .logo small, #saveStatus { display: none; }
  #projName { width: 115px; }
  #aspect { max-width: 145px; }
}
@media (max-width: 1080px) {
  #workspace { grid-template-columns: minmax(0, 1fr); }
  .mbtn { display: inline-flex; align-items: center; justify-content: center; padding: 5px 8px; }
  aside {
    position: fixed;
    top: 74px;
    bottom: var(--tlh);
    width: min(88vw, 336px);
    z-index: 60;
    transition: transform .2s ease;
    box-shadow: 0 0 40px #000c;
  }
  #lib { left: 0; transform: translateX(-105%); }
  #props { right: 0; transform: translateX(105%); }
  aside.open { transform: none; }
  #btnHelp, .loop-grp, .vol { display: none; }
  .audio-top-row { grid-template-columns: 1fr; height: auto; }
  #specBox { height: 78px; }
  #vuBox { height: 74px; }
}
@media (max-width: 760px) {
  .proj-bar, .mb-status { display: none; }
  #aspect { max-width: 124px; min-width: 96px; padding: 4px 5px; font-size: 11.5px; }
  .seg button { padding: 4px 8px; font-size: 11.5px; }
  #topbar { gap: 5px; padding: 0 6px; }
  .hdr-acts { gap: 4px; }
  .hdr-acts button { padding: 4px 7px; font-size: 11.5px; }
  #app { --tlh: min(44vh, 300px); }
}
@media (max-width: 480px) {
  .logo { display: none; }
  #undo, #redo, #btnSave, #bFull { display: none; }
  #resBadge { display: none; }
  #aspect { max-width: 88px; min-width: 70px; font-size: 11px; padding: 3px 4px; }
  .seg button { padding: 4px 6px; font-size: 11px; }
  .mbtn, #btnExport, #recBtn { padding: 4px 6px; font-size: 11px; }
  #timeWrap { padding: 3px 6px; font-size: 11px; }
  #bPrevF, #bNextF { display: none; }
}
