
:root {
  --font-ui: var(--ui-font);
   
  --bg: #000000;
  --card: #1a1a1a;
  --muted: #242424;
  --muted-2: #2e2e2e;
  --border: #2b2b2b;
  --fg: #f5f5f5;
  --muted-fg: #a3a3a3;
  --brand: var(--ui-blue-color);
  --brand-label: var(--fg);
  --brand-strong: var(--ui-blue-color);
  --brand-soft: var(--muted);
  --success: hsl(152 50% 48%);
  --warning: hsl(34 90% 55%);
  --danger: hsl(0 72% 58%);
   
  --kind-carrier: #2dd4bf;
  --kind-module: #f472b6;
  --kind-audio: #a78bfa;
  --kind-voice: #8b93b8;
   
  --radius: var(--ui-radius);
  --radius-lg: var(--ui-radius);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-card: 0 1px 2px hsl(240 30% 4% / 0.5), 0 4px 12px -2px hsl(240 30% 4% / 0.4);
  --shadow-float: 0 4px 8px hsl(240 30% 4% / 0.5), 0 16px 40px -8px hsl(240 30% 4% / 0.55);
  --key-edge: hsl(0 0% 100% / 0.22);
  --key-edge-hover: hsl(0 0% 100% / 0.38);
  --topbar-h: 52px;
  --timeline-h: 300px;
  --label-w: 128px;
  --ruler-h: 32px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 2px solid var(--muted-fg);
  border-radius: var(--ui-radius);
  background-color: var(--card);
  cursor: pointer;
}
input[type="checkbox"]:hover:not(:disabled):not(:checked) { border-color: var(--fg); }
input[type="checkbox"]:checked {
  border-color: var(--selection);
  background-color: var(--selection);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3 8l3.2 3.2L13 4.5' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 14px 14px;
}
input[type="checkbox"]:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .6; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: hsl(0 0% 100% / 0.14); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid var(--key-edge);
  background: var(--muted);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
  box-shadow: var(--shadow-card);
  user-select: none;
}
.btn:hover { border-color: var(--key-edge-hover); box-shadow: var(--shadow-float); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-primary { background: var(--brand); border-color: hsl(var(--ui-blue) / 0.5); color: var(--selection-foreground); }
.btn-primary:hover { background: var(--brand-strong); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--muted); border-color: transparent; box-shadow: none; }
.btn-icon { width: 34px; padding: 0; }
.btn-icon svg { width: 17px; height: 17px; }
.btn-danger-ghost { color: var(--muted-fg); }
.btn-danger-ghost:hover { color: var(--danger); background: hsl(0 72% 58% / 0.1); }
.btn-sm { height: 28px; padding: 0 12px; font-size: var(--ui-type-caption); }

.setup {
  position: fixed; inset: 0;
  display: grid; place-items: center;
}
.setup-card {
  width: min(420px, calc(100vw - 48px));
  background: var(--card);
  border-radius: var(--ui-radius);
  box-shadow: var(--shadow-float);
  padding: 32px;
  display: flex; flex-direction: column; gap: 14px;
}
.setup-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.setup-brand .mark { width: 34px; height: 34px; object-fit: contain; }
.wordmark { font-size: 22px; }
.wordmark-sub { color: var(--muted-fg); }
.setup-hint { color: var(--muted-fg); font-size: 13px; margin: 0 0 6px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: var(--ui-type-caption); color: var(--muted-fg); }
.field input {
  height: 38px;
  border-radius: var(--ui-radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font: inherit;
  padding: 0 12px;
  transition: border-color 0.15s;
}
.field input:hover { border-color: hsl(var(--ui-blue) / 0.4); }
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px hsl(var(--ui-blue) / 0.35); }
.setup-error { color: var(--danger); font-size: 13px; margin: 0; }

.editor {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  background: var(--card);
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 5;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.topbar-brand .mark { width: 26px; height: 26px; flex: none; }
.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.video-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { font-size: var(--ui-type-caption); color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-center { display: flex; align-items: center; gap: 4px; }
.history-label { font-size: var(--ui-type-caption); color: var(--muted-fg); max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 6px; }
.topbar-right { flex: 1; display: flex; justify-content: flex-end; }

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 264px 1fr 300px;
  gap: 10px;
  padding: 10px;
}

.panel-left, .panel-right {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.panel-head {
  padding: 12px 14px 8px;
  font-size: var(--ui-type-caption);
  text-transform: uppercase;
  color: var(--muted-fg);
  flex: none;
}
.panel-head-sub { border-top: 1px solid var(--border); margin-top: 4px; }
.scene-list { flex: 1 1 40%; overflow-y: auto; padding: 0 8px 8px; min-height: 80px; }
.scene-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--ui-radius);
  background: transparent;
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.scene-item:hover { background: var(--muted); }
.scene-item.active { background: var(--brand-soft); }
.scene-item .scene-no {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--ui-radius);
  background: var(--muted);
  font-size: var(--ui-type-caption);
  color: var(--muted-fg);
}
.scene-item.active .scene-no { background: var(--brand); color: var(--selection-foreground); }
.scene-item .scene-label { display: flex; flex-direction: column; min-width: 0; }
.scene-item .scene-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene-item .scene-time { font-size: var(--ui-type-caption); color: var(--muted-fg); font-variant-numeric: tabular-nums; }
.scene-audio { flex: 1 1 60%; display: flex; flex-direction: column; min-height: 0; }
.scene-audio-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.empty-hint { color: var(--muted-fg); font-size: 12.5px; padding: 8px 10px; }
.audio-card {
  border-radius: var(--ui-radius);
  background: var(--muted);
  padding: 10px 12px;
  margin: 0 2px 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.15s;
}
.audio-card:hover { border-color: hsl(258 68% 76% / 0.4); }
.audio-card.active { border-color: var(--kind-audio); }
.audio-card .ac-head { display: flex; align-items: center; gap: 8px; }
.audio-card .ac-kind {
  font-size: var(--ui-type-caption); text-transform: uppercase;
  color: var(--kind-audio);
}
.audio-card .ac-kind.voice { color: var(--kind-voice); }
.audio-card .ac-name { font-size: var(--ui-type-caption); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.audio-card .ac-meta { font-size: var(--ui-type-caption); color: var(--muted-fg); margin-top: 2px; font-variant-numeric: tabular-nums; }

.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; gap: 8px; }
.preview-frame {
  flex: 1;
  min-height: 0;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: grid;
  place-items: center;
  padding: 14px;
  overflow: hidden;
}
.preview-viewport {
  position: relative;
  background: #000;
  border-radius: var(--ui-radius);
  overflow: hidden;
  box-shadow: var(--shadow-float);
   
}
.preview-iframe {
  position: absolute;
  top: 0; left: 0;
  width: 1920px; height: 1080px;
  border: 0;
  transform-origin: 0 0;
  background: transparent;
  pointer-events: none;
}
.preview-empty {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 10px;
  color: var(--muted-fg);
  font-size: 13px;
  background: linear-gradient(160deg, #16181c, #101114);
}
.preview-empty img { width: 44px; height: 44px; opacity: 0.5; }
.preview-empty p { margin: 0; }
.preview-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font-size: var(--ui-type-caption);
  color: var(--muted-fg);
}
.carrier-info { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playhead-time { font-variant-numeric: tabular-nums; color: var(--fg); }

.inspector { flex: 1; overflow-y: auto; padding: 4px 14px 16px; }
.insp-section { margin-bottom: 16px; }
.insp-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  margin: 4px 0 10px;
}
.insp-title .chip {
  font-size: var(--ui-type-caption); text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
}
.chip-carrier { background: hsl(173 66% 30% / 0.35); color: var(--kind-carrier); }
.chip-module { background: hsl(327 81% 40% / 0.25); color: var(--kind-module); }
.chip-audio { background: hsl(258 68% 45% / 0.3); color: var(--kind-audio); }
.chip-transition { background: var(--brand-soft); color: var(--brand-label); }
.insp-sub { font-size: var(--ui-type-caption); text-transform: uppercase; color: var(--muted-fg); margin: 14px 0 8px; }
.insp-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.insp-row > label { flex: none; width: 86px; font-size: var(--ui-type-caption); color: var(--muted-fg); }
.insp-row .value { font-variant-numeric: tabular-nums; font-size: var(--ui-type-caption); }
.insp textarea, .inspector textarea {
  width: 100%;
  min-height: 56px;
  border-radius: var(--ui-radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font: inherit; font-size: 13px;
  padding: 8px 10px;
  resize: vertical;
}
.inspector textarea:focus, .inspector input:focus, .inspector select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px hsl(var(--ui-blue) / 0.3);
}
.inspector input[type="text"], .inspector select {
  width: 100%;
  height: 32px;
  border-radius: var(--ui-radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font: inherit; font-size: 13px;
  padding: 0 8px;
}
.inspector select option { background: var(--card); }
.inspector input[type="range"] { flex: 1; accent-color: var(--brand); }
.inspector input[type="color"] {
  width: 34px; height: 26px; flex: none;
  border: 1px solid var(--border); border-radius: var(--ui-radius);
  background: transparent; padding: 2px; cursor: pointer;
}
.inspector input[type="checkbox"] { width: 18px; height: 18px; }
.bind-field { margin-bottom: 10px; }
.bind-field > span { display: block; font-size: var(--ui-type-caption); color: var(--muted-fg); margin-bottom: 4px; }
.insp-actions { display: flex; gap: 8px; margin-top: 14px; }
.insp-note { font-size: var(--ui-type-caption); color: var(--muted-fg); margin: 6px 0; }
.locked-banner {
  display: flex; align-items: center; gap: 8px;
  background: var(--brand-soft);
  border-radius: var(--ui-radius);
  padding: 8px 10px;
  font-size: var(--ui-type-caption);
  margin-bottom: 12px;
}
.locked-banner svg { width: 14px; height: 14px; flex: none; }

.timeline-shell {
  flex: none;
  height: var(--timeline-h);
  display: flex;
  flex-direction: column;
  background: var(--card);
  box-shadow: 0 -2px 12px hsl(240 30% 4% / 0.4);
  border-top: 1px solid var(--border);
}
.timeline-toolbar {
  flex: none;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}
.tl-hint { font-size: var(--ui-type-caption); color: var(--muted-fg); }
.tl-tools { display: flex; gap: 4px; }
.tool-btn {
  width: 26px; height: 24px;
  border: 1px solid var(--border); border-radius: var(--ui-radius);
  background: transparent; color: var(--muted-fg);
  font: inherit; font-size: var(--ui-type-caption);
  cursor: pointer;
}
.tool-btn:hover { background: var(--muted); }
.tool-btn.active { background: var(--brand-soft); color: var(--brand-label); border-color: var(--brand); }
.timeline.razor .clip { cursor: crosshair; }
.timeline.trim .clip { cursor: ew-resize; }
.tl-zoom { display: flex; align-items: center; gap: 8px; color: var(--muted-fg); }
.tl-zoom input { width: 140px; accent-color: var(--brand); }
.zoom-ico { width: 14px; height: 14px; }

.timeline { flex: 1; min-height: 0; display: flex; }
.track-labels {
  flex: none;
  width: var(--label-w);
  border-right: 1px solid var(--border);
  padding-top: var(--ruler-h);
  overflow: hidden;
}
.track-label {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px;
  font-size: var(--ui-type-caption);
  color: var(--muted-fg);
  border-bottom: 1px solid hsl(0 0% 100% / 0.04);
}
.track-label .dot { width: 8px; height: 8px; border-radius: var(--ui-radius); flex: none; }
.track-label svg { width: 12px; height: 12px; flex: none; }
.timeline-scroll { flex: 1; overflow: auto; position: relative; }
.timeline-canvas { position: relative; min-width: 100%; }

.ruler {
  position: sticky; top: 0;
  height: var(--ruler-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  z-index: 4;
  cursor: pointer;
}
.ruler-tick { position: absolute; bottom: 0; width: 1px; height: 8px; background: hsl(0 0% 100% / 0.22); }
.ruler-tick.major { height: 12px; background: hsl(0 0% 100% / 0.38); }
.ruler-tick-label {
  position: absolute; bottom: 12px;
  font-size: var(--ui-type-micro);
  color: var(--muted-fg);
  transform: translateX(3px);
  font-variant-numeric: tabular-nums;
  user-select: none;
}
.scene-marker { position: absolute; top: 0; bottom: 0; width: 1px; background: hsl(var(--ui-blue) / 0.5); }
.scene-marker-flag {
  position: absolute; top: 2px;
  font-size: var(--ui-type-micro);
  color: var(--brand-label);
  background: var(--brand-soft);
  border-radius: var(--ui-radius);
  padding: 1px 5px;
  transform: translateX(2px);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}

.tracks { position: relative; }
.track-row { position: relative; border-bottom: 1px solid hsl(0 0% 100% / 0.04); }
.track-row.drop-hover { background: hsl(var(--ui-blue) / 0.06); }

.clip {
  position: absolute;
  top: 4px; bottom: 4px;
  border-radius: var(--ui-radius);
  overflow: hidden;
  cursor: grab;
  --clip-color: var(--kind-module);
  background: color-mix(in srgb, var(--clip-color) 22%, var(--card));
  border: 1.5px solid color-mix(in srgb, var(--clip-color) 45%, transparent);
  transition: box-shadow 0.15s;
  container-type: size;
}
.clip:hover { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--clip-color) 70%, transparent); }
.clip.selected {
  border-color: var(--clip-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--clip-color) 80%, transparent), var(--shadow-card);
  z-index: 2;
}
.clip.dragging { cursor: grabbing; opacity: 0.85; z-index: 3; }
.clip.clip-carrier { --clip-color: var(--kind-carrier); }
.clip.clip-module { --clip-color: var(--kind-module); }
.clip.clip-audio { --clip-color: var(--kind-audio); }
.clip.clip-voice { --clip-color: var(--kind-voice); cursor: default; }
.clip-body {
  position: absolute; inset: 0;
  display: flex; align-items: center; gap: 6px;
  padding: 0 10px;
  min-width: 0;
}
.clip-label {
  flex: none;
  font-size: var(--ui-type-micro);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--fg);
}
.clip-sub { flex: 1; min-width: 0; font-size: var(--ui-type-micro); color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@container (max-width: 110px) { .clip-sub { display: none; } }
@container (max-width: 44px) { .clip-label { display: none; } }
.clip-lock { width: 11px; height: 11px; flex: none; color: var(--kind-voice); }
.clip-handle {
  position: absolute; top: 0; bottom: 0; width: 8px;
  cursor: ew-resize;
  z-index: 2;
}
.clip-handle.left { left: 0; border-radius: var(--ui-radius); }
.clip-handle.right { right: 0; border-radius: var(--ui-radius); }
.clip-handle::after {
  content: "";
  position: absolute; top: 20%; bottom: 20%;
  left: 3px; width: 2px;
  border-radius: var(--ui-radius);
  background: color-mix(in srgb, var(--clip-color) 60%, transparent);
  opacity: 0;
  transition: opacity 0.15s;
}
.clip:hover .clip-handle::after, .clip.selected .clip-handle::after { opacity: 1; }
.clip.locked .clip-handle { display: none; }

.transition-pin {
  position: absolute;
  width: 16px; height: 16px;
  transform: translate(-8px, -8px) rotate(45deg);
  background: var(--card);
  border: 2px solid var(--brand);
  border-radius: var(--ui-radius);
  cursor: pointer;
  z-index: 3;
  transition: transform 0.15s var(--ease-spring), background 0.15s;
}
.transition-pin:hover { transform: translate(-8px, -8px) rotate(45deg) scale(1.2); }
.transition-pin.is-cut { border-color: hsl(0 0% 100% / 0.35); }
.transition-pin.selected { background: var(--brand); }
.transition-pin.is-cut.selected { background: hsl(0 0% 100% / 0.35); }

.playhead {
  position: absolute;
  top: 0; bottom: 0;
  width: 1.5px;
  background: var(--fg);
  z-index: 5;
  pointer-events: none;
}
.playhead-cap {
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 11px; height: 13px;
  background: var(--fg);
  clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%);
}

.inout-band {
  position: absolute; top: 0; bottom: 0;
  background: hsl(158 64% 52% / 0.16);
  border-inline: 1px solid hsl(158 64% 52% / 0.55);
  pointer-events: none;
}
.inout-edge {
  position: absolute; top: 1px; font-size: var(--ui-type-micro);
  color: hsl(158 64% 52%); pointer-events: none; transform: translateX(-50%);
}
.inout-edge.in { transform: translateX(1px); }
.inout-edge.out { transform: translateX(calc(-100% - 1px)); }

.user-marker { background: hsl(34 90% 55% / 0.7); }
.user-marker-flag { color: var(--warning); background: hsl(34 90% 30% / 0.25); top: 15px; }

.snapline {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--warning);
  z-index: 4;
  pointer-events: none;
}

.preview-controls { display: flex; align-items: center; gap: 6px; }
.preview-controls select {
  height: 24px; border-radius: var(--ui-radius); border: 1px solid var(--border);
  background: var(--card); color: var(--fg); font: inherit; font-size: var(--ui-type-caption);
}
.lib-upload { flex: none; padding: 8px 12px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.upload-rights { display: flex; gap: 8px; font-size: var(--ui-type-caption); color: var(--muted-fg); align-items: flex-start; }
.upload-rights input { margin-top: 2px; accent-color: var(--brand); }
.upload-btn { justify-content: center; cursor: pointer; }
.tool-btn.active { background: var(--brand-soft); color: var(--brand-label); border-color: var(--brand); }
.panel-foot { flex: none; padding: 8px 12px; border-top: 1px solid var(--border); }
.safezones { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.safezones .thirds { position: absolute; background: hsl(0 0% 100% / 0.18); }
.safezones .thirds.v { top: 0; bottom: 0; width: 1px; }
.safezones .thirds.h { left: 0; right: 0; height: 1px; }
.safezones .safe { position: absolute; border: 1px dashed hsl(34 90% 55% / 0.5); }
.safezones .safe.action { inset: 3.5%; }
.safezones .safe.title { inset: 10%; border-color: hsl(var(--ui-blue) / 0.55); }
.timeline-scroll, .clip, .stage-box, .playhead, #ruler { touch-action: none; }

.toast-root {
  position: fixed;
  bottom: calc(var(--timeline-h) + 14px);
  left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 50;
  pointer-events: none;
}
.toast {
  background: var(--muted-2);
  color: var(--fg);
  border-radius: 999px;
  box-shadow: var(--shadow-float);
  padding: 9px 18px;
  font-size: 13px;
  max-width: min(560px, 90vw);
  animation: toast-in 0.25s var(--ease-spring);
}
.toast.error { background: hsl(0 60% 26%); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(0.97); } }

.lib-tabs {
  display: flex; gap: 2px;
  padding: 8px 8px 6px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.lib-tabs button {
  flex: 1;
  height: 28px;
  border: none; border-radius: var(--ui-radius);
  background: transparent; color: var(--muted-fg);
  font: inherit; font-size: var(--ui-type-caption);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lib-tabs button:hover { background: var(--muted); }
.lib-tabs button.active { background: var(--brand-soft); color: var(--brand-label); }
.lib-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.lib-search { padding: 10px 12px 6px; flex: none; }
.lib-search input {
  width: 100%; height: 32px;
  border-radius: 999px; border: 1px solid var(--border);
  background: transparent; color: var(--fg);
  font: inherit; font-size: 13px;
  padding: 0 14px;
}
.lib-search input:focus { outline: none; border-color: var(--brand); }
.lib-rows { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.lib-card {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px;
  border-radius: var(--ui-radius);
  transition: background 0.15s;
}
.lib-card:hover { background: var(--muted); }
.lib-thumb {
  width: 52px; height: 30px; flex: none;
  border-radius: var(--ui-radius);
  background: var(--muted-2) center/cover no-repeat;
}
.lib-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lib-title { font-size: var(--ui-type-caption); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-sub { font-size: var(--ui-type-caption); color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-actions { display: flex; gap: 2px; flex: none; flex-wrap: wrap; justify-content: flex-end; max-width: 130px; }
.lib-target { font-size: var(--ui-type-caption); color: var(--muted-fg); padding: 10px 14px 0; margin: 0; }
.lib-group {
  font-size: var(--ui-type-caption); text-transform: uppercase;
  color: var(--muted-fg);
  padding: 14px 14px 6px;
}
.fx-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 6px; padding: 0 12px;
}
.fx-tile {
  position: relative;
  border: 1px solid var(--border); border-radius: var(--ui-radius);
  background: var(--muted);
  aspect-ratio: 16/10;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, transform 0.15s var(--ease-spring);
}
.fx-tile:hover { border-color: var(--brand); transform: translateY(-1px); }
.fx-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fx-tile span {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 3px 6px;
  font: inherit; font-size: var(--ui-type-caption); color: var(--fg);
  background: linear-gradient(transparent, hsl(240 30% 4% / 0.75));
  text-align: left;
}

.stage-box {
  position: absolute;
  border: 1.5px solid var(--brand);
  border-radius: var(--ui-radius);
  box-shadow: 0 0 0 1px hsl(240 30% 4% / 0.4);
  cursor: move;
  z-index: 3;
}
.stage-handle {
  position: absolute; right: -7px; bottom: -7px;
  width: 14px; height: 14px;
  border-radius: var(--ui-radius);
  background: var(--brand);
  border: 2px solid var(--bg);
  cursor: nwse-resize;
}

.context-menu, .history-menu {
  position: fixed;
  min-width: 200px;
  background: var(--muted-2);
  border-radius: var(--ui-radius);
  box-shadow: var(--shadow-float);
  padding: 6px;
  z-index: 70;
  display: flex; flex-direction: column;
}
.history-menu { position: absolute; top: calc(var(--topbar-h) - 6px); left: 50%; transform: translateX(-50%); max-height: 320px; overflow-y: auto; }
.context-menu button, .history-menu button {
  border: none; background: transparent; color: var(--fg);
  font: inherit; font-size: 12.5px;
  text-align: left;
  padding: 7px 12px;
  border-radius: var(--ui-radius);
  cursor: pointer;
}
.context-menu button:hover:not(:disabled), .history-menu button:hover:not(:disabled) { background: var(--brand-soft); }
.context-menu button:disabled, .history-menu button:disabled { color: var(--muted-fg); cursor: default; }
button.history-label { border: none; background: transparent; cursor: pointer; font: inherit; font-size: var(--ui-type-caption); color: var(--muted-fg); }
button.history-label:hover { color: var(--fg); }
.time-field { width: 90px !important; font-variant-numeric: tabular-nums; }

.confirm-backdrop {
  position: fixed; inset: 0;
  background: hsl(240 30% 4% / 0.6);
  display: grid; place-items: center;
  z-index: 60;
}
.confirm-card {
  width: min(400px, calc(100vw - 48px));
  background: var(--card);
  border-radius: var(--ui-radius);
  box-shadow: var(--shadow-float);
  padding: 24px;
  animation: toast-in 0.22s var(--ease-spring);
}
.confirm-card h3 { margin: 0 0 8px; font-size: 16px; }
.confirm-card p { margin: 0 0 18px; color: var(--muted-fg); font-size: 13px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn-danger { background: var(--danger); border-color: hsl(0 72% 75% / 0.5); color: #fff; }
.btn-danger:hover { background: hsl(0 72% 52%); }

/* Scenvy studio surface: dark, editorial, and deliberately quiet around the canvas. */
:root {
  color-scheme: dark;
  --bg: #000000;
  --card: #17191d;
  --muted: #202329;
  --muted-2: #262a31;
  --border: rgba(255, 255, 255, 0.11);
  --fg: #f5f6f8;
  --muted-fg: #9da3ad;
  --brand: var(--ui-blue-color);
  --brand-strong: var(--ui-blue-color);
  --brand-soft: var(--muted);
  --success: #43c88b;
  --warning: #f5b84c;
  --danger: #f06b6b;
  --kind-carrier: #48c8b5;
  --kind-module: #e77db2;
  --kind-audio: #a996f4;
  --kind-voice: #929bbf;
  --radius: var(--ui-radius);
  --radius-lg: var(--ui-radius);
  --topbar-h: 64px;
  --timeline-h: 318px;
  --label-w: 142px;
  --ruler-h: 34px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 18px 40px rgba(0, 0, 0, 0.18);
  --shadow-float: 0 18px 44px rgba(0, 0, 0, 0.38);
}

html,
body {
  background: var(--bg);
}

body {
  background:
    radial-gradient(60rem 36rem at 84% -16%, hsl(var(--ui-blue) / 0.08), transparent 58%),
    var(--bg);
}

.editor {
  background: transparent;
}

.topbar {
  height: var(--topbar-h);
  padding: 0 18px;
  gap: 20px;
  background: rgba(16, 17, 20, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(18px);
}

.topbar-brand {
  gap: 12px;
}

.topbar-brand .mark {
  width: 30px;
  height: 30px;
  padding: 4px;
  border-radius: var(--ui-radius);
  background: var(--brand-strong);
}

.topbar-title {
  gap: 2px;
}

.topbar-kicker,
.section-kicker {
  color: var(--brand-label);
  font-size: var(--ui-type-caption);
}

.video-title {
  font-size: 13px;
}

.doc-meta {
  color: var(--muted-fg);
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  color: var(--muted-fg);
  font-size: var(--ui-type-caption);
  white-space: nowrap;
}

.save-status::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  content: "";
}

.save-status[data-state="saving"] {
  color: var(--brand-label);
}

.save-status[data-state="saving"]::before {
  background: var(--brand);
  box-shadow: 0 0 0 4px hsl(var(--ui-blue) / 0.12);
}

.save-status[data-state="error"] {
  color: var(--danger);
}

.save-status[data-state="error"]::before {
  background: var(--danger);
}

.topbar-center {
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
}

.topbar-center .btn {
  height: 32px;
  width: 32px;
}

.topbar-center #btn-play {
  background: var(--brand);
  color: #171717;
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.12) inset;
}

.topbar-center #btn-play:hover {
  background: var(--brand-strong);
  color: #fff;
}

.history-label {
  max-width: 180px;
  padding: 0 10px;
  color: var(--muted-fg);
  font-size: var(--ui-type-caption);
}

.topbar-right {
  gap: 8px;
}

.topbar-right .btn-primary {
  min-width: 112px;
  height: 38px;
  padding: 0 18px;
  border-width: 2px;
}

.topbar-right .btn-danger-ghost {
  height: 34px;
  padding: 0 10px;
  font-size: var(--ui-type-caption);
}

.workspace {
  grid-template-columns: 276px minmax(360px, 1fr) 306px;
  gap: 12px;
  padding: 12px;
  background: transparent;
}

.panel-left,
.panel-right,
.preview-frame {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(23, 25, 29, 0.92);
  box-shadow: var(--shadow-card);
}

.panel-left,
.panel-right {
  box-shadow: var(--shadow-card);
}

.panel-titlebar,
.stage-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  min-height: 48px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.panel-titlebar > div,
.stage-heading > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.panel-titlebar strong,
.stage-heading strong {
  font-size: var(--ui-type-caption);
}

.panel-count,
.panel-head-meta,
.stage-state {
  color: var(--muted-fg);
  font-size: var(--ui-type-caption);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.inspector-titlebar {
  min-height: 58px;
}

.lib-tabs {
  gap: 4px;
  padding: 8px 8px 7px;
  border-bottom-color: rgba(255, 255, 255, 0.07);
}

.lib-tabs button {
  height: 30px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted-fg);
}

.lib-tabs button:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.05);
}

.lib-tabs button.active {
  border-color: hsl(var(--ui-blue) / 0.22);
  background: var(--brand-soft);
  color: var(--brand-label);
}

.scene-list {
  padding: 7px 8px 10px;
}

.scene-item {
  gap: 11px;
  margin-bottom: 2px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius);
}

.scene-item:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.06);
}

.scene-item.active {
  border-color: hsl(var(--ui-blue) / 0.22);
  background: linear-gradient(90deg, hsl(var(--ui-blue) / 0.16), hsl(var(--ui-blue) / 0.06));
}

.scene-item .scene-no {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--ui-radius);
  background: rgba(255, 255, 255, 0.045);
}

.scene-item.active .scene-no {
  background: var(--brand);
  color: #171717;
}

.scene-item .scene-name {
  font-size: var(--ui-type-caption);
}

.scene-item .scene-time {
  color: var(--muted-fg);
  font-size: var(--ui-type-caption);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 9px;
}

.panel-head-sub {
  margin-top: 0;
}

.scene-audio-list {
  padding: 6px 8px 12px;
}

.audio-card {
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius);
  background: rgba(255, 255, 255, 0.045);
}

.audio-card:hover {
  border-color: rgba(167, 150, 244, 0.38);
  background: rgba(167, 150, 244, 0.08);
}

.audio-card.active {
  border-color: var(--kind-audio);
  background: rgba(167, 150, 244, 0.1);
}

.stage {
  gap: 8px;
}

.stage-heading {
  min-height: 42px;
  padding: 5px 4px 2px;
  border-bottom: 0;
}

.stage-heading strong {
  font-size: 14px;
}

.preview-frame {
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.025), transparent 42%),
    rgba(23, 25, 29, 0.92);
}

.preview-viewport {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--ui-radius);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4), 0 0 0 5px rgba(255, 255, 255, 0.025);
}

.preview-bar {
  min-height: 30px;
  padding: 0 4px;
  gap: 12px;
}

.carrier-info {
  color: var(--muted-fg);
  font-size: var(--ui-type-caption);
}

.preview-controls {
  flex-wrap: nowrap;
  gap: 5px;
}

.preview-controls select,
.preview-controls .tool-btn {
  height: 28px;
  border-color: rgba(255, 255, 255, 0.11);
  border-radius: var(--ui-radius);
  background: rgba(255, 255, 255, 0.04);
}

.preview-controls select {
  padding: 0 6px;
}

.preview-controls .tool-btn {
  width: 30px;
}

.playhead-time {
  min-width: 72px;
  margin-left: 3px;
  color: var(--fg);
  font-size: var(--ui-type-caption);
  text-align: right;
}

.inspector {
  padding: 9px 15px 20px;
}

.insp-title {
  position: sticky;
  top: -9px;
  z-index: 2;
  margin: -9px -15px 14px;
  padding: 13px 15px 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: var(--bg);
  backdrop-filter: blur(12px);
}

.insp-sub {
  margin-top: 19px;
  color: var(--muted-fg);
}

.insp-row {
  margin-bottom: 10px;
}

.insp-row > label {
  width: 92px;
  color: var(--muted-fg);
}

.inspector textarea,
.inspector input[type="text"],
.inspector select {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.035);
}

.inspector textarea {
  min-height: 72px;
  border-radius: var(--ui-radius);
}

.locked-banner {
  border: 1px solid hsl(var(--ui-blue) / 0.2);
  border-radius: var(--ui-radius);
  background: var(--muted);
  color: var(--fg);
}

.timeline-shell {
  height: var(--timeline-h);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(18, 19, 23, 0.98);
  box-shadow: 0 -16px 34px rgba(0, 0, 0, 0.22);
}

.timeline-toolbar {
  height: 46px;
  padding: 0 16px;
  gap: 14px;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.timeline-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 156px;
}

.timeline-title strong {
  font-size: var(--ui-type-caption);
}

.tl-tools {
  gap: 5px;
}

.tool-btn {
  width: 30px;
  height: 28px;
  border-color: rgba(255, 255, 255, 0.11);
  border-radius: var(--ui-radius);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted-fg);
}

.tool-btn:hover {
  border-color: hsl(var(--ui-blue) / 0.35);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
}

.tool-btn.active {
  border-color: hsl(var(--ui-blue) / 0.55);
  background: var(--brand-soft);
  color: var(--brand-label);
}

.tl-hint {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--muted-fg);
  font-size: var(--ui-type-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-zoom {
  min-width: 178px;
}

.tl-zoom input {
  width: 110px;
}

.zoom-value {
  min-width: 31px;
  color: var(--muted-fg);
  font-size: var(--ui-type-caption);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.track-labels {
  border-right-color: rgba(255, 255, 255, 0.1);
}

.track-label,
.track-row {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.ruler {
  background: var(--bg);
  border-bottom-color: var(--border);
}

.ruler-tick {
  background: var(--border);
}

.ruler-tick.major {
  background: var(--muted-fg);
}

.clip {
  border-radius: var(--ui-radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.clip.selected {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--clip-color) 80%, transparent), 0 10px 22px rgba(0, 0, 0, 0.28);
}

.clip-body {
  padding: 0 11px;
}

.clip-label {
  font-size: var(--ui-type-micro);
}

.clip-sub {
  color: var(--muted-fg);
  font-size: var(--ui-type-micro);
}

.transition-pin {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px hsl(var(--ui-blue) / 0.09);
}

.preview-empty {
  background:
    radial-gradient(circle at 50% 40%, hsl(var(--ui-blue) / 0.08), transparent 42%),
    linear-gradient(160deg, #171a20, #0e1014);
}

.toast-root {
  bottom: calc(var(--timeline-h) + 18px);
}

.toast {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #242830;
}

.context-menu,
.history-menu {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #22262d;
}

@media (max-width: 1160px) {
  .workspace {
    grid-template-columns: 244px minmax(320px, 1fr) 272px;
  }

  .timeline-title {
    min-width: 126px;
  }
}

@media (max-width: 820px) {
  :root {
    --topbar-h: 58px;
    --timeline-h: 278px;
    --label-w: 112px;
    --ruler-h: 32px;
  }

  html,
  body {
    min-width: 0;
    overflow: hidden;
  }

  .topbar {
    padding: 0 10px;
    gap: 8px;
  }

  .topbar-brand {
    min-width: 0;
    gap: 8px;
  }

  .topbar-brand .mark {
    width: 28px;
    height: 28px;
  }

  .video-title {
    max-width: min(38vw, 240px);
    font-size: var(--ui-type-caption);
  }

  .doc-meta,
  .save-status,
  .history-label {
    display: none;
  }

  .topbar-center {
    flex: none;
    gap: 0;
    padding: 3px;
  }

  .topbar-center .btn {
    width: 30px;
    height: 30px;
  }

  .topbar-right {
    flex: none;
  }

  .topbar-right .btn-primary {
    min-width: 94px;
    height: 36px;
    padding: 0 11px;
    font-size: var(--ui-type-caption);
  }

  #btn-reset {
    display: none;
  }

  .workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    gap: 9px;
    height: calc(100svh - var(--topbar-h) - var(--timeline-h));
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 9px;
  }

  .stage {
    order: 1;
    min-height: 280px;
  }

  .panel-left {
    order: 2;
    min-height: 300px;
    max-height: 360px;
  }

  .panel-right {
    order: 3;
    min-height: 320px;
    max-height: 520px;
  }

  .preview-frame {
    min-height: 225px;
    padding: 11px;
  }

  .stage-heading {
    min-height: 36px;
  }

  .preview-bar {
    align-items: flex-start;
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .carrier-info {
    max-width: 48%;
  }

  .preview-controls {
    margin-left: auto;
  }

  .timeline-shell {
    min-height: var(--timeline-h);
  }

  .timeline-toolbar {
    height: 44px;
    padding: 0 10px;
    gap: 9px;
  }

  .timeline-title {
    min-width: auto;
  }

  .timeline-title strong {
    display: none;
  }

  .tl-hint {
    display: none;
  }

  .tl-zoom {
    min-width: 118px;
    margin-left: auto;
    gap: 5px;
  }

  .tl-zoom input {
    width: 68px;
  }

  .zoom-ico {
    display: none;
  }

  .track-label {
    padding: 0 9px;
    font-size: var(--ui-type-caption);
  }

  .timeline-scroll {
    overflow-x: auto;
    overflow-y: auto;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 5px;
  }

  .topbar-brand .mark {
    width: 26px;
    height: 26px;
  }

  .topbar-kicker {
    display: none;
  }

  .video-title {
    max-width: 34vw;
    font-size: var(--ui-type-caption);
  }

  .topbar-center .btn {
    width: 28px;
    height: 28px;
  }

  .topbar-right .btn-primary {
    min-width: 82px;
    padding: 0 8px;
    font-size: var(--ui-type-caption);
  }

  .panel-titlebar,
  .stage-heading {
    padding-inline: 12px;
  }

  .preview-controls select {
    max-width: 54px;
    font-size: var(--ui-type-caption);
  }

  .preview-controls .tool-btn {
    width: 27px;
  }

  .playhead-time {
    min-width: 66px;
    font-size: var(--ui-type-caption);
  }

  .timeline-title .section-kicker {
    font-size: var(--ui-type-micro);
  }

  .tl-tools {
    gap: 3px;
  }

  .tool-btn {
    width: 27px;
    height: 27px;
  }

  .zoom-value {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Interactive surfaces keep their native keyboard affordance after the visual reset. */
.clip:focus-visible,
.transition-pin:focus-visible,
.audio-card:focus-visible,
.scene-item:focus-visible,
.lib-tabs button:focus-visible,
.tool-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.audio-card {
  display: block;
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* Empty, loading, and picker states share the editor's geometry so the shell
   never jumps while a library or document is being fetched. */
.editor {
  position: relative;
}

body.modal-open {
  overflow: hidden;
}

.setup {
  z-index: 70;
  padding: 16px;
}

.setup-card {
  width: min(440px, 100%);
  max-height: calc(100svh - 32px);
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.setup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.btn-select-video {
  height: 34px;
  padding-inline: 13px;
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--muted-fg);
  white-space: nowrap;
}

.btn-select-video:hover {
  color: var(--fg);
}

.preview-viewport {
  width: min(100%, 960px);
  aspect-ratio: 16 / 9;
  max-height: 100%;
}

.preview-empty {
  z-index: 1;
  text-align: center;
  padding: 24px;
}

.preview-empty strong,
.preview-empty p {
  max-width: min(360px, 100%);
}

.preview-empty strong {
  color: var(--fg);
  font-size: 14px;
}

.preview-empty p {
  color: var(--muted-fg);
}

.preview-empty .btn {
  margin-top: 4px;
}

.empty-panel-card,
.inspector-empty,
.picker-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 190px;
  padding: 24px 16px;
  color: var(--muted-fg);
  text-align: center;
}

.empty-panel-card strong,
.inspector-empty strong,
.picker-empty strong {
  color: var(--fg);
  font-size: var(--ui-type-caption);
}

.empty-panel-card .btn {
  margin-top: 8px;
}

.empty-glyph {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid hsl(var(--ui-blue) / 0.26);
  border-radius: var(--ui-radius);
  background: var(--muted);
  color: var(--brand-label);
  font-size: 16px;
}

.inspector-empty {
  min-height: 220px;
  padding-inline: 18px;
}

.lib-tabs.is-disabled {
  opacity: 0.46;
  pointer-events: none;
}

.timeline {
  position: relative;
}

.timeline-empty {
  position: absolute;
  z-index: 5;
  inset: var(--ruler-h) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(23, 25, 29, 0.94), rgba(18, 19, 23, 0.98));
  color: var(--muted-fg);
  font-size: var(--ui-type-caption);
  text-align: center;
}

.timeline-empty strong {
  color: var(--fg);
  font-size: var(--ui-type-control);
}

.timeline.is-empty .timeline-scroll,
.timeline.is-empty .track-labels {
  visibility: hidden;
}

.editor-loading {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(11, 13, 16, 0.52);
  backdrop-filter: blur(7px);
}

.loading-card {
  display: flex;
  align-items: center;
  gap: 13px;
  width: min(370px, 100%);
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--ui-radius);
  background: rgba(31, 35, 42, 0.96);
  box-shadow: var(--shadow-float);
}

.loading-card > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.loading-card strong {
  font-size: var(--ui-type-caption);
}

.loading-card span:last-child {
  color: var(--muted-fg);
  font-size: var(--ui-type-caption);
}

.loading-spinner {
  width: 18px;
  height: 18px;
  flex: none;
  border: 2px solid hsl(var(--ui-blue) / 0.22);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: editor-spin 0.85s linear infinite;
}

@keyframes editor-spin {
  to { transform: rotate(360deg); }
}

.video-picker {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 9, 12, 0.7);
  backdrop-filter: blur(14px);
}

.picker-card {
  display: flex;
  width: min(640px, 100%);
  max-height: min(720px, calc(100svh - 48px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--ui-radius);
  background: #191c21;
  box-shadow: var(--shadow-float);
}

.picker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.picker-header h2 {
  margin: 7px 0 5px;
  font-size: 19px;
}

.picker-header p {
  max-width: 420px;
  margin: 0;
  color: var(--muted-fg);
  font-size: var(--ui-type-caption);
}

.picker-search {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 16px 22px 8px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--ui-radius);
  background: rgba(255, 255, 255, 0.035);
}

.search-icon {
  color: var(--muted-fg);
  font-size: 18px;
}

.picker-search input {
  width: 100%;
  height: 38px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: var(--ui-type-caption);
}

.picker-status {
  min-height: 22px;
  padding: 0 22px;
  color: var(--muted-fg);
  font-size: var(--ui-type-caption);
}

.picker-status.error {
  color: #ff9c9c;
}

.picker-status.loading {
  color: var(--brand-label);
}

.picker-list {
  min-height: 170px;
  overflow-y: auto;
  padding: 0 14px 12px;
}

.video-group {
  padding: 0 4px 10px;
}

.video-group h3 {
  margin: 5px 8px 7px;
  color: var(--muted-fg);
  font-size: var(--ui-type-caption);
  text-transform: uppercase;
}

.video-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 14px;
  width: 100%;
  padding: 12px 12px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius);
  background: transparent;
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.video-option:hover,
.video-option:focus-visible {
  border-color: hsl(var(--ui-blue) / 0.28);
  outline: 0;
  background: var(--muted);
}

.video-option-title,
.video-option-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-option-title {
  font-size: var(--ui-type-caption);
}

.video-option-meta {
  color: var(--muted-fg);
  font-size: var(--ui-type-caption);
  text-transform: capitalize;
}

.video-option-arrow {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--brand-label);
  font-size: var(--ui-type-caption);
  white-space: nowrap;
}

.picker-skeleton {
  height: 54px;
  margin: 6px 4px;
  border-radius: var(--ui-radius);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  background-size: 200% 100%;
  animation: editor-shimmer 1.2s ease-in-out infinite;
}

@keyframes editor-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 10px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted-fg);
  font-size: var(--ui-type-caption);
}

@media (max-width: 820px) {
  .topbar-right {
    min-width: 0;
  }

  .btn-select-video {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .timeline-empty {
    flex-wrap: wrap;
    align-content: center;
    padding-inline: 28px;
  }

  .picker-card {
    max-height: calc(100svh - 28px);
  }
}

@media (max-width: 520px) {
  .setup {
    padding: 10px;
  }

  .setup-card {
    padding: 22px;
    border-radius: var(--ui-radius);
  }

  .setup-actions {
    flex-direction: column-reverse;
  }

  .setup-actions .btn {
    width: 100%;
  }

  .btn-select-video {
    width: 34px;
    min-width: 34px;
    padding: 0;
    font-size: 0;
  }

  .btn-select-video::before {
    content: "+";
    font-size: 20px;
  }

  .video-picker {
    align-items: end;
    padding: 0;
  }

  .picker-card {
    width: 100%;
    max-height: 92svh;
    border-radius: var(--ui-radius);
  }

  .picker-header,
  .picker-footer {
    padding-inline: 16px;
  }

  .picker-search {
    margin-inline: 16px;
  }

  .picker-status {
    padding-inline: 16px;
  }

  .picker-list {
    padding-inline: 9px;
  }
}

/* Match the product shell: the same dark neutrals and blue action color,
   with flat surfaces that keep the timeline and canvas readable. */
:root {
  color-scheme: dark;
  --bg: #000000;
  --card: hsl(0 0% 16%);
  --muted: hsl(0 0% 18%);
  --muted-2: hsl(0 0% 21%);
  --border: hsl(0 0% 28%);
  --fg: hsl(0 0% 96%);
  --muted-fg: hsl(0 0% 70%);
  --brand: var(--ui-blue-color);
  --brand-strong: var(--ui-blue-color);
  --brand-soft: var(--muted);
  --success: hsl(152 50% 48%);
  --warning: hsl(48 90% 55%);
  --danger: hsl(0 72% 58%);
  --radius: var(--ui-radius);
  --radius-lg: var(--ui-radius);
  --shadow-card: none;
  --shadow-float: 0 18px 48px rgba(0, 0, 0, 0.34);
}

html,
body {
  background: var(--bg);
}

body {
  background: var(--bg);
}

.btn {
  height: 40px;
  border-width: 1px;
  border-radius: var(--ui-radius);
  box-shadow: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn:hover {
  box-shadow: none;
  transform: none;
}

.btn:active {
  transform: none;
}

.btn-primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  border-color: var(--brand-strong);
  background: var(--brand-strong);
  color: #fff;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

.topbar {
  background: var(--card);
  border-bottom-color: var(--border);
  box-shadow: none;
  backdrop-filter: none;
}

.topbar-center {
  padding: 0;
  border: 0;
  background: transparent;
}

.topbar-center #btn-play {
  border-color: transparent;
  color: #fff;
  box-shadow: none;
}

.topbar-right .btn-primary {
  height: 40px;
  border-width: 1px;
}

.panel-left,
.panel-right,
.preview-frame {
  background: var(--card);
  border-color: var(--border);
  box-shadow: none;
}

.panel-titlebar,
.stage-heading {
  min-height: 44px;
  padding-block: 10px;
}

.panel-titlebar > div,
.stage-heading > div {
  gap: 0;
}

.panel-titlebar strong,
.stage-heading strong,
.timeline-title strong {
  font-size: 13px;
}

.timeline-title {
  min-width: 112px;
}

.timeline-shell {
  box-shadow: none;
  background: var(--card);
}

.timeline-toolbar {
  box-shadow: none;
}

.field input,
.picker-search,
.inspector input[type="text"],
.inspector select,
.inspector textarea,
.preview-controls select {
  border: 1px solid var(--border);
  border-radius: var(--ui-radius);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: none;
}

.field input:focus,
.picker-search:focus-within,
.inspector input:focus,
.inspector select:focus,
.inspector textarea:focus,
.preview-controls select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px hsl(var(--ui-blue) / 0.14);
  outline: none;
}

.setup-card,
.picker-card,
.loading-card {
  border-color: var(--border);
  border-radius: var(--ui-radius);
  box-shadow: var(--shadow-float);
}

.setup-card {
  background: var(--card);
}

.picker-card {
  background: var(--card);
}

.picker-header h2 {
  margin: 0;
  font-size: 18px;
}

.picker-header {
  padding-block: 18px 15px;
}

.picker-search {
  background: rgba(255, 255, 255, 0.035);
}

.video-option {
  border-radius: var(--ui-radius);
}

.video-option:hover,
.video-option:focus-visible {
  border-color: hsl(var(--ui-blue) / 0.32);
  background: var(--muted);
}

.preview-empty {
  background: hsl(0 0% 7%);
}

.preview-viewport {
  display: grid;
}

.preview-empty {
  position: relative;
  inset: auto;
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
}

.empty-panel-card,
.inspector-empty,
.picker-empty {
  gap: 6px;
}

.loading-card {
  width: auto;
  min-width: 180px;
  justify-content: center;
  padding: 13px 16px;
  background: var(--card);
}

.timeline-empty {
  background: var(--card);
}

/* Shared production chat, opened from the editor toolbar. */
.direction-dialog { width: min(560px, calc(100vw - 24px)); max-height: min(80vh, 760px); padding: 20px; border: 1px solid var(--border, #555); border-radius: var(--ui-radius); color: var(--fg, #fff); background: var(--card, #202027); }
.direction-dialog::backdrop { background: rgba(0,0,0,.65); }
.attribution-dialog { width: min(660px, calc(100vw - 24px)); max-height: min(85vh, 800px); padding: 20px; border: 1px solid var(--border); border-radius: var(--ui-radius); color: var(--fg); background: var(--card); }
.attribution-dialog::backdrop { background: rgba(0,0,0,.65); }
.attribution-dialog header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.attribution-dialog h2 { margin: 0; font-size: 18px; }
.attribution-dialog > p, #attribution-summary { color: var(--muted-fg); }
.attribution-list { max-height: 52vh; overflow: auto; margin: 12px 0; }
.attribution-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.attribution-entry { border-top: 1px solid var(--border); padding: 10px 0; overflow-wrap: anywhere; }
.attribution-entry h3 { margin: 0 0 6px; font-size: 14px; }
.attribution-entry p { margin: 4px 0; font-size: var(--ui-type-caption); }
.attribution-entry a { color: var(--brand-label); }
.attribution-warning { color: var(--warning); }
#youtube-package-dialog { overflow-y: auto; }
#youtube-package-dialog label { display: block; margin: 12px 0 5px; font-size: 13px; }
#youtube-package-dialog input, #youtube-package-dialog select, #youtube-package-dialog textarea { width: 100%; box-sizing: border-box; padding: 9px; border: 1px solid var(--border); border-radius: var(--ui-radius); background: var(--card); color: var(--fg); font: inherit; }
#youtube-package-dialog textarea { resize: vertical; }
#youtube-package-preview { margin-top: 14px; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
#youtube-package-preview pre { max-height: 22vh; overflow: auto; font: inherit; font-size: var(--ui-type-caption); }
#youtube-package-dialog .attribution-footer { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.direction-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.direction-dialog h2 { margin: 0; font-size: 18px; }
.direction-dialog > p { font-size: 13px; opacity: .75; }
.direction-messages { display: flex; flex-direction: column; gap: 12px; min-height: 90px; max-height: 45vh; overflow-y: auto; padding: 12px 0; }
.direction-message { max-width: 90%; padding: 10px 12px; border-radius: var(--ui-radius); background: rgba(127,127,127,.16); overflow-wrap: anywhere; }
.direction-message.from-user { align-self: flex-end; background: rgba(126,98,246,.24); }
.direction-message strong, .direction-message small { font-size: var(--ui-type-caption); }
.direction-message p { margin: 6px 0 0; white-space: pre-wrap; }
.direction-dialog form { display: flex; flex-direction: column; gap: 8px; }
.direction-dialog textarea { width: 100%; box-sizing: border-box; resize: vertical; border-radius: var(--ui-radius); padding: 10px; color: inherit; background: transparent; border: 1px solid rgba(127,127,127,.6); font: inherit; }
.direction-dialog form button { align-self: flex-end; }
#direction-status { min-height: 1em; font-size: var(--ui-type-caption); }
.direction-context { display: flex; gap: 8px; align-items: center; margin: 9px 0; font-size: var(--ui-type-caption); }
.direction-context input { margin: 0; }
#direction-job { min-height: 1em; font-size: var(--ui-type-caption); }

/* Current Scenvy brand system. Keep the editor's controls and layout intact,
   but make its standalone shell use the same neutral surfaces, system type,
   and unboxed mark as the main app. */

:root {
  color-scheme: dark;
  --bg: #000000;
  --card: #1a1a1a;
  --muted: #242424;
  --muted-2: #2e2e2e;
  --border: #333333;
  --fg: #f5f5f5;
  --muted-fg: #b3b3b3;
  --brand: var(--ui-blue-color);
  --brand-strong: var(--ui-blue-color);
  --brand-soft: var(--muted);
  --selection: var(--ui-blue-color);
  --selection-hover: var(--ui-blue-color);
  --selection-foreground: #ffffff;
  --selection-soft: var(--muted);
  --success: #43c88b;
  --warning: #f5b84c;
  --danger: #f06b6b;
  --radius: var(--ui-radius);
  --radius-lg: var(--ui-radius);
  --topbar-h: 64px;
  --timeline-h: 318px;
  --shadow-card: none;
  --shadow-float: 0 20px 60px rgba(0, 0, 0, 0.38);
  --key-edge: rgba(255, 255, 255, 0.14);
  --key-edge-hover: rgba(255, 255, 255, 0.28);
}

html,
body {
  background: var(--bg);
  color: var(--fg);
}

body {
  background: var(--bg);
}

.editor {
  background: var(--bg);
}

.setup {
  background: var(--bg);
}

.setup-card,
.picker-card,
.loading-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-float);
}

.setup-brand .mark,
.topbar-brand .mark {
  padding: 0;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
}

.setup-brand .mark {
  width: 32px;
  height: 32px;
}

.topbar-brand .mark {
  width: 30px;
  height: 30px;
}

.btn {
  border: 1px solid var(--border);
  border-radius: var(--ui-radius);
  box-shadow: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn:hover,
.btn:active {
  box-shadow: none;
  transform: none;
}

.btn-primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  border-color: var(--brand-strong);
  background: var(--brand-strong);
  color: #fff;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.06);
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: none;
}

.topbar-center {
  padding: 0;
  border: 0;
  background: transparent;
}

.panel-left,
.panel-right,
.preview-frame,
.timeline-shell {
  background: var(--card);
  border-color: var(--border);
  box-shadow: none;
}

.lib-tabs button {
  border-radius: var(--ui-radius);
}

.lib-tabs button.active {
  border-color: transparent;
  background: var(--selection-soft);
  color: var(--brand-label);
}

.preview-frame {
  background: var(--card);
}

.preview-viewport {
  border-color: var(--border);
  box-shadow: none;
}

.preview-empty {
  background: var(--card);
}

.field input,
.picker-search,
.inspector input[type="text"],
.inspector select,
.inspector textarea,
.preview-controls select {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.035);
}

.field input:hover,
.field input:focus,
.picker-search:focus-within,
.inspector input:focus,
.inspector select:focus,
.inspector textarea:focus,
.preview-controls select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px hsl(var(--ui-blue) / 0.18);
}

.scene-item.active {
  background: var(--selection-soft);
}

.scene-item.active .scene-no {
  background: var(--brand);
  color: var(--selection-foreground);
}

.tool-btn.active {
  border-color: var(--brand);
  background: var(--selection-soft);
  color: var(--brand-label);
}

.empty-glyph {
  border-color: hsl(var(--ui-blue) / 0.26);
  background: var(--selection-soft);
}

/* Compact controls stay quiet until they are hovered, selected, or focused. */
.btn-ghost,
.btn-ghost:hover,
.btn-ghost:active,
.btn-icon,
.btn-icon:hover,
.btn-icon:active,
.btn-select-video,
.btn-select-video:hover,
.tool-btn,
.tool-btn:hover,
.tool-btn:active,
.preview-controls select,
.preview-controls select:hover,
.lib-tabs button,
.lib-tabs button:hover {
  border: 0;
}

.btn-ghost:hover,
.btn-icon:hover,
.btn-select-video:hover,
.tool-btn:hover,
.lib-tabs button:hover {
  background: var(--muted);
}

.tool-btn,
.preview-controls .tool-btn {
  background: transparent;
}

.tool-btn.active,
.preview-controls .tool-btn.active {
  border: 0;
  background: var(--selection-soft);
  color: var(--brand-label);
}

.preview-controls select {
  background: transparent;
}

.preview-controls select:hover {
  background: var(--muted);
}

.scene-item.active,
.tool-btn.active,
.lib-tabs button.active,
.transition-pin.selected {
  --brand: var(--ui-blue-color);
  --brand-strong: var(--ui-blue-color);
  --brand-soft: var(--muted);
}

.lib-tabs button.active,
.tool-btn.active,
.scene-item.active .scene-name {
  color: var(--brand-label);
}

.clip.selected {
  border-color: var(--selection);
  box-shadow: 0 0 0 2px hsl(var(--ui-blue) / 0.45);
}

.audio-card.active {
  border-color: var(--selection);
  background: var(--selection-soft);
}

.transition-pin.selected {
  border-color: var(--selection);
  background: var(--selection);
  box-shadow: 0 0 0 3px hsl(var(--ui-blue) / 0.18);
}

.direction-dialog,
.attribution-dialog {
  border-color: var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--fg);
  box-shadow: var(--shadow-float);
}

.direction-dialog textarea,
.attribution-dialog input,
.attribution-dialog select,
.attribution-dialog textarea {
  border-color: var(--border);
  border-radius: var(--ui-radius);
  background: var(--bg);
  color: var(--fg);
}

.direction-dialog textarea:focus,
.attribution-dialog input:focus,
.attribution-dialog select:focus,
.attribution-dialog textarea:focus {
  outline: 2px solid hsl(var(--ui-blue) / 0.72);
  outline-offset: 2px;
}

.context-menu,
.history-menu,
.picker-card {
  border-color: var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-float);
}

.btn:focus-visible,
.tool-btn:focus-visible,
.lib-tabs button:focus-visible,
.scene-item:focus-visible,
.audio-card:focus-visible,
.clip:focus-visible,
.transition-pin:focus-visible,
.preview-controls select:focus-visible,
.editor input[type="checkbox"]:focus-visible,
.editor input:focus-visible,
.editor textarea:focus-visible,
.editor select:focus-visible {
  outline: 2px solid var(--selection);
  outline-offset: 2px;
}

.editor input[type="range"] { accent-color: var(--selection); }

.preview-controls select:focus {
  border: 0;
  box-shadow: 0 0 0 2px hsl(var(--ui-blue) / 0.5);
}

.btn-sm:not(.btn-primary):not(.btn-danger) {
  border: 0;
  box-shadow: none;
}

.empty-glyph {
  border: 0;
}

.loading-card {
  border: 0;
  border-radius: var(--radius);
  box-shadow: none;
}

/* Page chrome shares the app canvas; controls retain contrasting surfaces. */
.topbar, .panel-left, .panel-right, .stage, .timeline-shell, .timeline-toolbar {
  background: var(--bg);
}

/* Keep editor controls and the canvas usable on narrow or short screens. */
body.editor-ui .topbar-brand { flex: 0 1 200px; min-width: 0; }
body.editor-ui .topbar-right { flex: 1 1 auto; min-width: 0; gap: 8px; }
body.editor-ui .topbar-right .btn { flex-shrink: 0; white-space: nowrap; }
body.editor-ui .topbar-secondary-actions { display: flex; align-items: center; min-width: 0; gap: 8px; overflow-x: auto; scrollbar-width: thin; }
body.editor-ui .picker-search { min-height: 40px; }
body.editor-ui .picker-search .search-icon { display: flex; flex: none; width: 20px; height: 20px; }
body.editor-ui .picker-search .search-icon svg { width: 100%; height: 100%; }
body.editor-ui .picker-search input { min-width: 0; padding: 0; font-size: 14px; }
body.editor-ui .picker-search input:focus-visible { outline: none; }
body.editor-ui .picker-search:focus-within { border-color: var(--border); outline: 2px solid var(--fg); outline-offset: 2px; box-shadow: none; }
body.editor-ui .picker-list { padding-inline: 22px; }

@media (max-width: 900px), (max-height: 600px) {
  :root { --timeline-h: clamp(112px, 34svh, 278px); }
}
@media (max-width: 900px), (max-height: 500px) {
  body.editor-ui .workspace { display: flex; flex-direction: column; gap: 9px; height: calc(100svh - var(--topbar-h) - var(--timeline-h)); min-height: 0; overflow: auto; padding: 9px; }
  body.editor-ui :is(.stage, .panel-left, .panel-right) { flex-shrink: 0; }
  body.editor-ui .stage { order: 1; min-height: max-content; }
  body.editor-ui .panel-left { order: 2; min-height: 300px; max-height: 360px; }
  body.editor-ui .panel-right { order: 3; min-height: 320px; max-height: 520px; }
  body.editor-ui .timeline-title { display: none; }
  body.editor-ui .tl-zoom { flex: 1 1 auto; min-width: 0; }
  body.editor-ui .tl-zoom input { min-width: 0; width: 100%; }
}
@media (max-height: 500px) {
  body.editor-ui .topbar-right .btn { min-height: var(--ui-control-size); }
  body.editor-ui .preview-frame { flex: none; height: clamp(130px, 35svh, 200px); min-height: 0; }
  body.editor-ui .preview-empty { min-height: 0; gap: 4px; padding: 4px; }
  body.editor-ui .preview-empty img { width: 24px; height: 24px; }
}
@media (max-width: 520px) {
  :root { --topbar-h: 108px; }
  body.editor-ui .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand playback" "actions actions"; grid-template-rows: 44px 44px; align-content: center; gap: 4px 8px; padding-inline: 10px; }
  body.editor-ui .topbar-brand { grid-area: brand; }
  body.editor-ui .topbar-center { grid-area: playback; }
  body.editor-ui .topbar-right { grid-area: actions; min-width: 0; }
  body.editor-ui .topbar-right .btn { min-height: var(--ui-control-size); }
  body.editor-ui .topbar-secondary-actions { flex: 1 1 auto; }
  body.editor-ui .btn-select-video { width: auto; min-width: 0; max-width: none; padding: 0 16px; font-size: 14px; }
  body.editor-ui .btn-select-video::before { content: none; }
  body.editor-ui .preview-controls { flex-wrap: wrap; justify-content: flex-end; max-width: 100%; }
  body.editor-ui .preview-controls select { flex: none; max-width: none; padding-inline: 10px 28px; background-position: right 8px center; background-size: 16px; }
  body.editor-ui #aspect-select { width: auto; }
  body.editor-ui #fps-select { width: 112px; }
  body.editor-ui .picker-search { min-height: 44px; }
  body.editor-ui .picker-search input { font-size: 16px; }
  body.editor-ui .picker-list { padding-inline: 16px; }
}
