/* ObsidianStage — Responsive Dark / Light Studio Stylesheet */

:root,
[data-theme="dark"] {
  --bg-app: #0c0e14;
  --bg-surface: #131722;
  --bg-elevated: #191f2e;
  --bg-card: #1d2436;
  --bg-card-hover: #252e45;
  --bg-stage-well: #090b10;
  --border: rgba(148, 163, 184, 0.2);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-rose: #e11d48;
  --accent-soft: rgba(56, 189, 248, 0.16);
  --rose-soft: rgba(225, 29, 72, 0.16);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.3);
  --alpha-a: #161b26;
  --alpha-b: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] {
  --bg-app: #f4f5f8;
  --bg-surface: #ffffff;
  --bg-elevated: #eef1f6;
  --bg-card: #f8fafc;
  --bg-card-hover: #e9eef6;
  --bg-stage-well: #e5e9f2;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.22);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent: #0284c7;
  --accent-strong: #0369a1;
  --accent-rose: #e11d48;
  --accent-soft: rgba(2, 132, 199, 0.12);
  --rose-soft: rgba(225, 29, 72, 0.12);
  --shadow-lg: 0 18px 42px rgba(15, 23, 42, 0.14);
  --shadow-sm: 0 3px 10px rgba(15, 23, 42, 0.08);
  --alpha-a: #f8fafc;
  --alpha-b: rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* 4-Zone Desktop Layout */
.app-shell {
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) var(--timeline-height, 204px);
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: var(--bg-app);
}

/* Zone 1: Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-bar::-webkit-scrollbar {
  display: none;
}

.top-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-icon {
  display: block;
  border-radius: 6px;
  flex-shrink: 0;
}

.brand-name {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  white-space: nowrap;
}

.title-input {
  width: 156px;
  height: 30px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 12px;
  font-weight: 500;
  outline: none;
}

.title-input:focus {
  border-color: var(--accent);
}

.top-select,
.tl-select,
.prop-select {
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 12px;
  outline: none;
}

.top-select:focus,
.tl-select:focus,
.prop-select:focus {
  border-color: var(--accent);
}

.pill-group {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  gap: 2px;
}

.pill-btn {
  height: 24px;
  padding: 0 9px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.pill-btn:hover {
  color: var(--text-primary);
}

.pill-btn.is-active {
  background: var(--accent);
  color: #04131c;
}

.icon-btn,
.mini-btn,
.secondary-btn,
.primary-btn {
  height: 30px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.mini-btn {
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
}

.icon-btn:hover:not(:disabled),
.mini-btn:hover:not(:disabled),
.secondary-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.icon-btn:disabled,
.mini-btn:disabled,
.primary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mini-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.danger-btn:hover:not(:disabled) {
  background: var(--rose-soft);
  border-color: var(--accent-rose);
  color: var(--accent-rose);
}

.primary-btn {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
  color: #031018;
}

.primary-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.new-scene-btn {
  border-color: rgba(56, 189, 248, 0.35);
  background: var(--accent-soft);
  color: var(--accent);
}

.new-scene-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #04131c;
}

[data-theme="light"] .new-scene-btn {
  border-color: rgba(2, 132, 199, 0.35);
}

[data-theme="light"] .new-scene-btn:hover:not(:disabled) {
  color: #ffffff;
}

.full-w {
  width: 100%;
}

/* Zone 2: 3-Column Workspace */
.workspace {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr) 292px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.library-panel {
  border-right: 1px solid var(--border);
}

.properties-panel {
  border-left: 1px solid var(--border);
}

.properties-panel.is-attention {
  animation: propsAttentionPulse 0.7s ease-out;
}

@keyframes propsAttentionPulse {
  0% {
    box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 0 rgba(56, 189, 248, 0.45);
  }
  45% {
    box-shadow: inset 0 0 0 2px var(--accent), 0 0 18px rgba(56, 189, 248, 0.35);
  }
  100% {
    box-shadow: inset 0 0 0 0 transparent, 0 0 0 0 transparent;
  }
}

.panel-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.tab-btn {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  padding: 0 5px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.tab-btn.is-active {
  background: var(--accent-soft);
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--accent);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  min-height: 46px;
  flex-shrink: 0;
}

.panel-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.props-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
}

/* Library Cards */
.lib-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 12px 0 8px;
}

.lib-section-title:first-child {
  margin-top: 2px;
}

.lib-grid {
  display: grid;
  gap: 7px;
}

.lib-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lib-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lib-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.lib-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 6px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.lib-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.lib-card.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.lib-card.is-wide {
  flex-direction: row;
  justify-content: flex-start;
  text-align: left;
  padding: 9px 10px;
}

.lib-card.is-wide.has-add-btn,
.lib-card.is-wide.has-audition-btn {
  padding-right: 32px;
}

.lib-card-add,
.lib-card-play {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  z-index: 2;
}

.lib-card-play {
  font-size: 9px;
}

.lib-card-add::after,
.lib-card-play::after {
  content: "";
  position: absolute;
  inset: -3px;
}

.lib-card-add:hover,
.lib-card-play:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #08121e;
}

[data-theme="light"] .lib-card-add:hover,
[data-theme="light"] .lib-card-play:hover {
  color: #ffffff;
}

.lib-audio-slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lib-audio-slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.lib-audio-slider-val {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.lib-audio-slider-row input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.sfx-cue-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sfx-cue-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.sfx-cue-time {
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  cursor: pointer;
}

.sfx-cue-time:hover {
  border-color: var(--accent);
}

.sfx-cue-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sfx-cue-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.sfx-cue-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sfx-cue-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.sfx-cue-btn.is-danger {
  font-size: 12px;
}

.sfx-cue-btn.is-danger:hover {
  border-color: var(--accent-rose);
  background: var(--rose-soft);
  color: var(--accent-rose);
}

.lib-mode-hint {
  padding: 7px 9px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text-primary);
  font-size: 11px;
  line-height: 1.35;
}

.lib-swatch {
  width: 100%;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.lib-swatch.is-alpha {
  background-color: var(--alpha-a);
  background-image:
    linear-gradient(45deg, var(--alpha-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--alpha-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--alpha-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--alpha-b) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}

.lib-icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lib-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.lib-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lib-card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lib-card-sub {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lib-upload-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 9px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.lib-hint {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.lib-btn-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.color-triple {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.color-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 10px;
  color: var(--text-secondary);
  cursor: pointer;
}

.color-chip input[type="color"] {
  width: 100%;
  height: 24px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.segmented-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.seg-btn {
  height: 25px;
  padding: 0 6px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seg-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.text-add-btn {
  justify-content: flex-start;
  padding: 0 12px;
}

/* Center: Stage Area */
.stage-area {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(56, 189, 248, 0.06), transparent 60%),
    var(--bg-stage-well);
}

.stage-frame {
  position: relative;
  border-radius: 10px;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-strong);
  transition: box-shadow 0.15s ease;
  user-select: none;
}

.stage-frame.is-drag-over {
  box-shadow: var(--shadow-lg), 0 0 0 2px var(--accent), 0 0 24px rgba(56, 189, 248, 0.35);
}

.stage-frame[data-alpha="true"] {
  background-color: var(--alpha-a);
  background-image:
    linear-gradient(45deg, var(--alpha-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--alpha-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--alpha-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--alpha-b) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

#stageCanvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  touch-action: none;
}

.stage-gizmo {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.snap-guide {
  position: absolute;
  pointer-events: none;
  z-index: 4;
}

.snap-x {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--accent-rose);
  box-shadow: 0 0 8px rgba(225, 29, 72, 0.7);
}

.snap-y {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--accent-rose);
  box-shadow: 0 0 8px rgba(225, 29, 72, 0.7);
}

.gizmo-box {
  position: absolute;
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  cursor: move;
  touch-action: none;
  z-index: 5;
}

.gizmo-box.is-locked {
  border-style: dashed;
  border-color: var(--accent-rose);
  cursor: not-allowed;
}

.gizmo-box.is-locked .gizmo-handle,
.gizmo-box.is-locked .gizmo-rot-stem,
.gizmo-box.is-locked .gizmo-delete-btn {
  display: none;
}

.gizmo-rot-stem {
  position: absolute;
  left: 50%;
  top: -22px;
  width: 1.5px;
  height: 22px;
  background: var(--accent);
  transform: translateX(-50%);
  pointer-events: none;
}

.gizmo-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 3px;
  border: 1.5px solid #0b1020;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  touch-action: none;
  pointer-events: auto;
}

.gizmo-handle::after {
  content: "";
  position: absolute;
  inset: -10px;
}

.handle-nw {
  top: -6px;
  left: -6px;
  cursor: nwse-resize;
}

.handle-ne {
  top: -6px;
  right: -6px;
  cursor: nesw-resize;
}

.handle-se {
  bottom: -6px;
  right: -6px;
  cursor: nwse-resize;
}

.handle-sw {
  bottom: -6px;
  left: -6px;
  cursor: nesw-resize;
}

.handle-rot {
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--accent);
  cursor: grab;
}

.gizmo-delete-btn {
  position: absolute;
  top: -28px;
  right: -28px;
  z-index: 3;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1.5px solid #0b1020;
  background: var(--accent-rose);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.gizmo-delete-btn:hover {
  transform: scale(1.1);
  filter: brightness(1.1);
}

[data-theme="light"] .gizmo-delete-btn {
  border-color: #ffffff;
}

.inline-text {
  position: absolute;
  z-index: 8;
  padding: 8px 12px;
  border-radius: 8px;
  border: 2px solid var(--accent);
  background: rgba(12, 14, 20, 0.88);
  color: #ffffff;
  resize: none;
  outline: none;
  pointer-events: auto;
  box-shadow: var(--shadow-lg);
}

.stage-status-badge {
  position: absolute;
  left: 12px;
  bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0.92;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-status-badge.is-preview {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(14, 165, 233, 0.18);
  color: #e0f2fe;
}

[data-theme="light"] .stage-status-badge.is-preview {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(14, 165, 233, 0.16);
  color: #0369a1;
}

.stage-top-hud {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.stage-hud-chip {
  pointer-events: auto;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.stage-hud-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.stage-hud-chip.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.stage-hud-chip.is-accent-chip {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(14, 165, 233, 0.16);
  color: #e0f2fe;
}

.stage-hud-chip.is-accent-chip:hover {
  border-color: var(--accent);
  background: rgba(14, 165, 233, 0.28);
  color: #ffffff;
}

[data-theme="light"] .stage-hud-chip.is-accent-chip {
  border-color: rgba(2, 132, 199, 0.45);
  background: rgba(2, 132, 199, 0.14);
  color: #0369a1;
}

[data-theme="light"] .stage-hud-chip.is-accent-chip:hover {
  background: rgba(2, 132, 199, 0.24);
  color: #0c4a6e;
}

.stage-empty-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
  background: rgba(15, 23, 42, 0.8);
  color: #f1f5f9;
  text-align: center;
  pointer-events: none;
  backdrop-filter: blur(6px);
  max-width: 82%;
}

.stage-empty-hint span {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.stage-empty-hint small {
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.35;
}

[data-theme="light"] .stage-empty-hint {
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
}

[data-theme="light"] .stage-empty-hint small {
  color: #475569;
}

.stage-safe-zone {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  border-radius: 10px;
  overflow: hidden;
}

.safe-box {
  position: absolute;
  border: 1.5px dashed rgba(56, 189, 248, 0.8);
  box-shadow: inset 0 0 0 1px rgba(2, 6, 23, 0.35);
  border-radius: 4px;
}

.safe-box.is-title {
  border-style: dotted;
  border-color: rgba(168, 85, 247, 0.85);
}

.safe-danger {
  position: absolute;
  background: rgba(225, 29, 72, 0.14);
  border: 1px dashed rgba(244, 63, 94, 0.65);
}

.safe-tag {
  position: absolute;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.86);
  color: #f8fafc;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* Right: Properties Panel */
.prop-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.prop-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.prop-section-title {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.prop-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.prop-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.prop-range-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prop-range-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prop-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.prop-range-row input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.prop-text-input,
.prop-textarea {
  width: 100%;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 12px;
  outline: none;
}

.prop-text-input:focus,
.prop-textarea:focus {
  border-color: var(--accent);
}

.prop-textarea {
  resize: vertical;
  min-height: 60px;
}

.prop-color-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prop-color {
  width: 34px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.prop-color-hex {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.prop-btn-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.toggle-pill {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  justify-self: start;
}

.toggle-pill.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Zone 3: 3-Layer Timeline */
.timeline-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.timeline-resize-handle {
  position: relative;
  height: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
  touch-action: none;
  background: var(--bg-surface);
  transition: background 0.14s ease;
}

.timeline-resize-handle::before {
  content: "";
  position: absolute;
  inset: -4px 0;
}

.timeline-resize-grip {
  width: 42px;
  height: 3px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.14s ease, width 0.14s ease;
}

.timeline-resize-handle:hover,
.timeline-resize-handle.is-dragging {
  background: var(--accent-soft);
}

.timeline-resize-handle:hover .timeline-resize-grip,
.timeline-resize-handle.is-dragging .timeline-resize-grip {
  background: var(--accent);
  width: 56px;
}

body.is-resizing-timeline,
body.is-resizing-timeline * {
  cursor: ns-resize !important;
  user-select: none !important;
}

.timeline-transport {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.transport-left,
.transport-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.play-btn {
  height: 26px;
  min-width: 64px;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #031018;
  font-size: 11px;
  font-weight: 700;
}

.play-btn.is-playing {
  background: var(--accent-rose);
  color: #ffffff;
}

.time-readout {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  white-space: nowrap;
}

.tl-select {
  height: 26px;
  font-size: 11px;
}

.bg-track-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.timeline-ruler-row {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  height: 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.layer-col-spacer {
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
}

.time-ruler {
  position: relative;
  min-width: 0;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
}

.ruler-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ruler-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--border-strong);
  padding-left: 4px;
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.playhead {
  position: absolute;
  top: 0;
  bottom: -1200px;
  left: 0%;
  width: 2px;
  transform: translateX(-1px);
  z-index: 12;
  pointer-events: none;
}

.playhead-head {
  width: 10px;
  height: 10px;
  background: var(--accent-rose);
  border-radius: 2px 2px 5px 5px;
  transform: translateX(-4px);
}

.playhead-line {
  width: 2px;
  height: 100%;
  background: var(--accent-rose);
  box-shadow: 0 0 8px rgba(225, 29, 72, 0.55);
}

.timeline-tracks {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.timeline-row {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  flex: 0 0 auto;
  min-height: 39px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}

.timeline-row:last-child {
  border-bottom: none;
}

.timeline-row.is-drop-target {
  background: var(--accent-soft);
}

.layer-label-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  border-right: 1px solid var(--border);
  background: var(--bg-surface);
}

.eye-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.eye-btn.is-hidden-layer {
  opacity: 0.45;
  color: var(--text-muted);
}

.layer-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-lane {
  position: relative;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.track-lane.is-layer-muted {
  opacity: 0.45;
}

.clip-row {
  position: relative;
  height: 26px;
  width: 100%;
}

.clip-pill {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.18);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  touch-action: none;
  overflow: hidden;
}

.clip-pill.kind-hologram {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.2);
}

.clip-pill.kind-text {
  border-color: rgba(168, 85, 247, 0.45);
  background: rgba(168, 85, 247, 0.2);
}

.clip-pill.kind-fx-scene,
.clip-pill.kind-fx-point {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.18);
}

.clip-pill.is-selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), var(--shadow-sm);
}

.clip-pill.is-muted {
  opacity: 0.5;
}

.clip-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.24);
  flex-shrink: 0;
}

.clip-label {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clip-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  touch-action: none;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.14s ease, border-color 0.14s ease;
}

.clip-handle::after {
  content: "";
  width: 3px;
  height: 12px;
  border-radius: 999px;
  background: rgba(241, 245, 249, 0.55);
  transition: background 0.14s ease, transform 0.14s ease;
}

.clip-handle.left {
  left: 0;
  border-radius: 5px 0 0 5px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.clip-handle.right {
  right: 0;
  border-radius: 0 5px 5px 0;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.clip-pill:hover .clip-handle,
.clip-pill.is-selected .clip-handle,
.base-bg-pill:hover .clip-handle,
.base-bg-pill.is-selected .clip-handle {
  background: rgba(56, 189, 248, 0.16);
}

.clip-pill:hover .clip-handle::after,
.clip-pill.is-selected .clip-handle::after,
.base-bg-pill:hover .clip-handle::after,
.base-bg-pill.is-selected .clip-handle::after {
  background: rgba(241, 245, 249, 0.9);
}

.clip-handle:hover,
.clip-pill.is-trimming-left .clip-handle.left,
.clip-pill.is-trimming-right .clip-handle.right,
.base-bg-pill.is-trimming-left .clip-handle.left,
.base-bg-pill.is-trimming-right .clip-handle.right {
  background: var(--accent);
}

.clip-handle:hover::after,
.clip-pill.is-trimming-left .clip-handle.left::after,
.clip-pill.is-trimming-right .clip-handle.right::after,
.base-bg-pill.is-trimming-left .clip-handle.left::after,
.base-bg-pill.is-trimming-right .clip-handle.right::after {
  background: #04131c;
  transform: scaleY(1.15);
}

[data-theme="light"] .clip-handle {
  background: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .clip-handle::after {
  background: rgba(15, 23, 42, 0.45);
}

[data-theme="light"] .clip-handle.left {
  border-right-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .clip-handle.right {
  border-left-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .clip-pill:hover .clip-handle::after,
[data-theme="light"] .clip-pill.is-selected .clip-handle::after,
[data-theme="light"] .base-bg-pill:hover .clip-handle::after,
[data-theme="light"] .base-bg-pill.is-selected .clip-handle::after {
  background: rgba(15, 23, 42, 0.85);
}

[data-theme="light"] .clip-handle:hover::after,
[data-theme="light"] .clip-pill.is-trimming-left .clip-handle.left::after,
[data-theme="light"] .clip-pill.is-trimming-right .clip-handle.right::after,
[data-theme="light"] .base-bg-pill.is-trimming-left .clip-handle.left::after,
[data-theme="light"] .base-bg-pill.is-trimming-right .clip-handle.right::after {
  background: #ffffff;
}

body.is-trimming-clip,
body.is-trimming-clip * {
  cursor: ew-resize !important;
}

.base-bg-pill {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px dashed var(--border-strong);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  cursor: grab;
  user-select: none;
  touch-action: none;
  overflow: hidden;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.base-bg-pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.base-bg-pill.is-selected {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.base-bg-pill.is-muted {
  opacity: 0.55;
}

.base-bg-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.base-bg-action-btn {
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.base-bg-action-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.base-bg-action-btn.is-danger {
  width: 18px;
  padding: 0;
  font-size: 12px;
}

.base-bg-action-btn.is-danger:hover {
  border-color: var(--accent-rose);
  background: var(--rose-soft);
  color: var(--accent-rose);
}

/* Audio Timeline Row */
.audio-timeline-row {
  background: rgba(16, 185, 129, 0.03);
}

.audio-track-lane {
  gap: 3px;
}

.audio-bgm-pill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid rgba(16, 185, 129, 0.42);
  background: rgba(16, 185, 129, 0.16);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.audio-bgm-pill:hover {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.24);
}

.audio-bgm-pill.is-muted {
  opacity: 0.5;
}

.audio-sfx-row {
  overflow: visible;
}

.audio-sfx-pill {
  position: absolute;
  top: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  max-width: 144px;
  border-radius: 6px;
  border: 1px solid rgba(236, 72, 153, 0.48);
  border-left: 2.5px solid #ec4899;
  background: rgba(236, 72, 153, 0.18);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  touch-action: none;
  white-space: nowrap;
  z-index: 3;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.audio-sfx-pill.is-near-end {
  transform: translateX(-100%);
  border-left: 1px solid rgba(236, 72, 153, 0.48);
  border-right: 2.5px solid #ec4899;
}

.audio-sfx-pill:hover,
.audio-sfx-pill.is-dragging {
  border-color: #ec4899;
  background: rgba(236, 72, 153, 0.28);
  z-index: 5;
}

.audio-sfx-pill.is-dragging {
  cursor: grabbing;
}

.audio-sfx-pill.is-muted {
  opacity: 0.5;
}

.audio-sfx-del {
  width: 15px;
  height: 15px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.audio-sfx-del:hover {
  border-color: var(--accent-rose);
  background: var(--rose-soft);
  color: var(--accent-rose);
}

[data-theme="light"] .audio-timeline-row {
  background: rgba(5, 150, 105, 0.03);
}

[data-theme="light"] .audio-bgm-pill {
  border-color: rgba(5, 150, 105, 0.38);
  background: rgba(16, 185, 129, 0.14);
}

[data-theme="light"] .audio-bgm-pill:hover {
  border-color: #059669;
  background: rgba(16, 185, 129, 0.22);
}

[data-theme="light"] .audio-sfx-pill {
  border-color: rgba(219, 39, 119, 0.4);
  border-left-color: #db2777;
  background: rgba(236, 72, 153, 0.13);
}

[data-theme="light"] .audio-sfx-pill.is-near-end {
  border-left-color: rgba(219, 39, 119, 0.4);
  border-right-color: #db2777;
}

[data-theme="light"] .audio-sfx-del {
  background: rgba(15, 23, 42, 0.08);
}

/* Mobile Bottom Bar (hidden on desktop) */
.mobile-bar {
  display: none;
}

/* Export Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 8, 14, 0.72);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: 100%;
  max-width: 440px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.format-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.format-option {
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  text-align: left;
  font-size: 12px;
  font-weight: 600;
}

.format-option.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.alpha-notice {
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  color: var(--text-primary);
  font-size: 11px;
  line-height: 1.4;
}

.export-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.export-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.export-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #6366f1);
  transition: width 0.1s linear;
}

.export-status {
  font-size: 11px;
  color: var(--text-secondary);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

.modal-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.download-link {
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
}

/* New Scene Category & Template Modal */
.new-scene-modal-card {
  max-width: 780px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
}

.modal-body.new-scene-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  flex-direction: initial;
  gap: 0;
  padding: 0;
  min-height: 360px;
  overflow: hidden;
}

.new-scene-cats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-right: 1px solid var(--border);
  background: var(--bg-elevated);
  overflow-y: auto;
}

.new-scene-cat-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  color: var(--text-secondary);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.new-scene-cat-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.new-scene-cat-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-primary);
}

.new-scene-cat-btn.is-featured {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, rgba(153, 27, 27, 0.16) 0%, rgba(245, 158, 11, 0.12) 100%);
}

.new-scene-cat-btn.is-featured.is-active {
  border-color: #f59e0b;
  background: linear-gradient(135deg, rgba(153, 27, 27, 0.32) 0%, rgba(245, 158, 11, 0.24) 100%);
}

.new-scene-cat-btn.is-featured .new-scene-cat-platforms {
  color: #fbbf24;
}

[data-theme="light"] .new-scene-cat-btn.is-featured .new-scene-cat-platforms {
  color: #b45309;
}

.new-scene-cat-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.new-scene-cat-platforms {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}

.new-scene-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  min-width: 0;
}

.new-scene-cat-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.new-scene-cat-head-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.new-scene-cat-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.new-scene-cat-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.new-scene-cat-desc {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.new-scene-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.scene-tpl-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.scene-tpl-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.scene-tpl-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scene-tpl-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.scene-tpl-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.scene-tpl-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.scene-tpl-pill {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
}

.scene-tpl-pill.is-alpha {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Theme Pack Banner inside #newSceneTemplateGrid */
.pack-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
}

.pack-banner-swatch {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow-sm);
}

.pack-banner-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pack-banner-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pack-banner-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.pack-banner-badge {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  font-size: 10px;
  font-weight: 600;
}

[data-theme="light"] .pack-banner-badge {
  color: #b45309;
}

.pack-banner-desc {
  margin: 0;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.pack-palette-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.pack-palette-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: var(--shadow-sm);
}

.scene-tpl-swatch {
  height: 6px;
  width: 100%;
  border-radius: 999px;
  margin-bottom: 2px;
}

/* Pro Framework v2 Featured Blueprints Strip inside #newSceneModal */
.pro-blueprints-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.34);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1) 0%, rgba(99, 102, 241, 0.08) 100%);
}

.pro-blueprints-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pro-blueprints-title {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.pro-blueprints-pill {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(14, 165, 233, 0.14);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 600;
}

.pro-blueprints-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pro-blueprint-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.pro-blueprint-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.pro-blueprint-swatch {
  height: 5px;
  width: 100%;
  border-radius: 999px;
}

.pro-blueprint-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.pro-blueprint-meta {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.3;
}

@media (max-width: 680px) {
  .pro-blueprints-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.new-scene-blank-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Saved Scenes Gallery Modal */
.gallery-modal-card {
  max-width: 880px;
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.gallery-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.gallery-filter-btn {
  min-height: 26px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.gallery-filter-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.gallery-filter-btn.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #04131c;
}

[data-theme="light"] .gallery-filter-btn.is-active {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #ffffff;
}

.gallery-search {
  height: 30px;
  min-width: 180px;
  flex: 0 1 220px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12px;
}

.gallery-search::placeholder {
  color: var(--text-muted);
}

.gallery-search:focus {
  border-color: var(--accent);
}

.gallery-grid {
  padding: 16px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: max-content;
  gap: 12px;
  align-content: start;
}

.gallery-card {
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.gallery-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.gallery-card.is-current {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.gallery-thumb {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 100%;
  min-height: 132px;
  padding: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  text-align: left;
  background-color: var(--alpha-a);
  background-image:
    linear-gradient(45deg, var(--alpha-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--alpha-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--alpha-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--alpha-b) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.gallery-thumb:focus-visible {
  outline-offset: -2px;
}

.gallery-thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.gallery-thumb-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}

.gallery-thumb-badges {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}

.gallery-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(12, 14, 20, 0.86);
  color: #f1f5f9;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  backdrop-filter: blur(4px);
}

[data-theme="light"] .gallery-chip {
  border-color: rgba(15, 23, 42, 0.2);
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
}

.gallery-chip.is-current {
  border-color: transparent;
  background: var(--accent);
  color: #04131c;
}

[data-theme="light"] .gallery-chip.is-current {
  border-color: transparent;
  background: var(--accent-strong);
  color: #ffffff;
}

.gallery-card-body {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  gap: 6px;
  padding: 10px 12px 12px;
  min-width: 0;
}

.gallery-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-card-meta {
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-top: 4px;
}

.gallery-card-actions .mini-btn {
  padding: 0 6px;
}

.gallery-card-actions .primary-btn,
.gallery-card-actions .secondary-btn {
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
}

[data-theme="light"] .gallery-card-actions .primary-btn {
  background: linear-gradient(135deg, var(--accent-strong) 0%, #4f46e5 100%);
  color: #ffffff;
}

.gallery-card-actions .danger-btn.is-confirm {
  background: var(--accent-rose);
  border-color: var(--accent-rose);
  color: #ffffff;
}

.gallery-empty {
  grid-column: 1 / -1;
  padding: 36px 16px;
  border-radius: 10px;
  border: 1px dashed var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
  line-height: 1.5;
}

.gallery-count {
  font-size: 12px;
  color: var(--text-secondary);
}

@media (max-width: 820px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  .gallery-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .gallery-search {
    flex: 1 1 100%;
    min-width: 0;
  }
}

/* Adaptive Per-Category Desktop Layouts */
@media (min-width: 961px) {
  .app-shell[data-studio-mode="short-form"] .workspace,
  .app-shell[data-studio-mode="music-canvas"] .workspace {
    grid-template-columns: 304px minmax(0, 1fr) 304px;
  }

  .app-shell[data-studio-mode="youtube"] .workspace {
    grid-template-columns: 276px minmax(0, 1fr) 276px;
  }

  .app-shell[data-studio-mode="brand-promo"] .workspace {
    grid-template-columns: 296px minmax(0, 1fr) 312px;
  }

  .app-shell[data-studio-mode="signage"] .workspace {
    grid-template-columns: 272px minmax(0, 1fr) 264px;
  }
}

[data-studio-mode="music-canvas"] .audio-wrap .tl-select {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

@media (max-width: 720px) {
  .modal-body.new-scene-layout {
    grid-template-columns: minmax(0, 1fr);
    max-height: 68dvh;
    overflow-y: auto;
  }

  .new-scene-cats {
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    flex-shrink: 0;
  }

  .new-scene-cat-btn {
    flex: 0 0 auto;
    min-width: 140px;
  }

  .new-scene-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Responsive Tablet & Mobile <= 960px */
@media (max-width: 960px) {
  .app-shell {
    grid-template-rows: 48px minmax(0, 1fr) var(--timeline-height, 152px) 48px;
  }

  .brand-name {
    display: none;
  }

  .title-input {
    width: 112px;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    position: relative;
  }

  .library-panel,
  .properties-panel {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 48px;
    height: 52dvh;
    z-index: 50;
    border: none;
    border-top: 1px solid var(--border-strong);
    border-radius: 14px 14px 0 0;
    box-shadow: var(--shadow-lg);
  }

  .library-panel.is-mobile-open,
  .properties-panel.is-mobile-open {
    display: flex;
  }

  .timeline-ruler-row,
  .timeline-row {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .mobile-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
  }

  .mobile-tab {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
  }

  .mobile-tab.is-active {
    color: var(--accent);
    box-shadow: inset 0 2px 0 var(--accent);
  }
}

/* Quick Customize Floating Drawer */
.quick-customize-drawer {
  position: absolute;
  top: 44px;
  right: 12px;
  width: 288px;
  max-height: calc(100% - 88px);
  overflow-y: auto;
  z-index: 26;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(15, 20, 32, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
}

[data-theme="light"] .quick-customize-drawer {
  border-color: rgba(15, 23, 42, 0.16);
  background: rgba(255, 255, 255, 0.92);
}

.qc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qc-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.qc-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qc-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qc-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.qc-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qc-input {
  width: 100%;
  height: 30px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s ease;
}

.qc-input:focus {
  border-color: var(--accent);
}

.qc-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.qc-format-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.qc-format-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.qc-format-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.qc-format-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-primary);
}

.qc-format-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
}

.qc-format-name {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.qc-logo-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.qc-logo-btn {
  height: 30px;
  font-size: 11px;
  padding: 0 8px;
}

.qc-palette-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.qc-palette-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.qc-palette-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.qc-palette-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-primary);
}

.qc-palette-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.qc-palette-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.qc-palette-name {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Live FX Engine Drawer */
.live-engine-drawer {
  width: 292px;
}

.live-section {
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.live-section:first-child {
  padding-top: 0;
  border-top: none;
}

.live-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.live-sublabel {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.live-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.live-toggle input[type="checkbox"] {
  accent-color: var(--accent);
  margin: 0;
  cursor: pointer;
}

.live-select {
  width: 100%;
  height: 28px;
  font-size: 11px;
}

.live-check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.live-spectrum-canvas {
  width: 100%;
  height: 44px;
  display: block;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: rgba(6, 10, 20, 0.85);
}

[data-theme="light"] .live-spectrum-canvas {
  background: rgba(15, 23, 42, 0.92);
}

.live-hint {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}

.live-color-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.live-color-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.live-color-input {
  width: 26px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.live-midi-status {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.live-midi-status.is-connected {
  color: #34d399;
}

.live-midi-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 5px;
  align-items: center;
}

.live-midi-btn {
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
  white-space: nowrap;
}

.live-learn-select {
  height: 26px;
  font-size: 10px;
  min-width: 0;
}

.live-cue-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.live-cue-pad {
  height: 32px;
  padding: 0 6px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.live-cue-pad:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.live-cue-pad:active,
.live-cue-pad.is-active {
  transform: scale(0.96);
  border-color: var(--accent);
  background: var(--accent);
  color: #090d16;
}

@media (max-width: 600px) {
  .quick-customize-drawer {
    left: 12px;
    right: 12px;
    top: 44px;
    width: auto;
    max-height: calc(100% - 88px);
  }
}

/* Broadcast Audit Floating Scorecard Popover */
.broadcast-audit-panel {
  top: auto;
  bottom: 12px;
  right: 12px;
  width: 320px;
  max-height: calc(100% - 58px);
}

.audit-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.audit-grade-badge {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  white-space: nowrap;
}

.audit-grade-badge.is-pass {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
}

.audit-grade-badge.is-warn {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
}

.audit-grade-badge.is-fail {
  border-color: rgba(244, 63, 94, 0.5);
  background: rgba(244, 63, 94, 0.16);
  color: #fb7185;
}

.audit-score-hero {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.audit-score-ring {
  display: flex;
  align-items: baseline;
  gap: 2px;
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(14, 165, 233, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.audit-score-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.audit-score-max {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.audit-score-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.audit-scene-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audit-gate-summary {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.3;
}

.audit-metrics-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.audit-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.audit-metric-row dt {
  color: var(--text-secondary);
  font-weight: 500;
}

.audit-metric-row dd {
  margin: 0;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
}

.audit-metric-row dd.is-pass {
  color: #34d399;
}

.audit-metric-row dd.is-fail {
  color: #fb7185;
}

.audit-mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.audit-actions-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
}

.audit-action-btn {
  height: 30px;
  font-size: 11px;
  padding: 0 10px;
}

.audit-benchmark-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 10px;
}

.audit-bench-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--text-secondary);
}

.audit-bench-row strong {
  color: var(--text-primary);
}

.audit-bench-hamming {
  padding-top: 5px;
  border-top: 1px solid var(--border);
  color: var(--accent);
  font-weight: 600;
}

/* Fullscreen Live Presentation Mode */
body.is-presenting .app-shell,
.app-shell.is-presenting {
  grid-template-rows: minmax(0, 1fr);
}

body.is-presenting .top-bar,
body.is-presenting .library-panel,
body.is-presenting .properties-panel,
body.is-presenting .timeline-panel,
body.is-presenting .mobile-bar,
body.is-presenting .stage-top-hud,
body.is-presenting .stage-status-badge,
body.is-presenting .stage-gizmo,
body.is-presenting .stage-safe-zone,
body.is-presenting .stage-empty-hint,
body.is-presenting .quick-customize-drawer,
body.is-presenting .live-engine-drawer,
body.is-presenting .broadcast-audit-panel,
.app-shell.is-presenting .top-bar,
.app-shell.is-presenting .library-panel,
.app-shell.is-presenting .properties-panel,
.app-shell.is-presenting .timeline-panel,
.app-shell.is-presenting .mobile-bar,
.app-shell.is-presenting .stage-top-hud,
.app-shell.is-presenting .stage-status-badge,
.app-shell.is-presenting .stage-gizmo,
.app-shell.is-presenting .stage-safe-zone,
.app-shell.is-presenting .stage-empty-hint,
.app-shell.is-presenting .quick-customize-drawer,
.app-shell.is-presenting .live-engine-drawer,
.app-shell.is-presenting .broadcast-audit-panel {
  display: none !important;
}

body.is-presenting .workspace,
.app-shell.is-presenting .workspace {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: block;
  width: 100vw;
  height: 100vh;
  background: #000000;
}

body.is-presenting .stage-area,
.app-shell.is-presenting .stage-area {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  padding: 0;
  z-index: 900;
  background: #000000;
}

body.is-presenting .stage-frame,
.app-shell.is-presenting .stage-frame {
  border-radius: 0;
  box-shadow: none;
}

body.is-presenting #stageCanvas,
.app-shell.is-presenting #stageCanvas {
  border-radius: 0;
  pointer-events: none;
}

.present-hud {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 920;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(12, 14, 20, 0.84);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

.present-hud-btn {
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(30, 41, 59, 0.72);
  color: #f1f5f9;
  font-size: 11px;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.present-hud-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(148, 163, 184, 0.45);
}

.present-hud-btn.is-muted {
  border-color: rgba(245, 158, 11, 0.55);
  color: #fde68a;
}

.present-hud-btn.is-exit {
  border-color: rgba(225, 29, 72, 0.55);
  background: rgba(225, 29, 72, 0.22);
  color: #fecdd3;
}

.present-hud-btn.is-exit:hover {
  background: rgba(225, 29, 72, 0.36);
}

/* Library Search, Cloud Library Skeletons & Statistical PRO Badges */
.library-search-wrap {
  padding: 8px 10px 4px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.library-search-input {
  width: 100%;
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.library-search-input::placeholder {
  color: var(--text-muted);
}

.library-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.lib-pro-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.3;
  pointer-events: none;
  z-index: 2;
}

[data-theme="light"] .lib-pro-badge {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.lib-cloud-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.lib-scenario-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0 8px;
  margin-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.lib-scenario-bar::-webkit-scrollbar {
  display: none;
}

.lib-scenario-pill {
  flex: 0 0 auto;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.lib-scenario-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.lib-scenario-pill.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.lib-cloud-status {
  font-size: 11px;
  color: var(--text-secondary);
}

.lib-skeleton-card {
  min-height: 76px;
  pointer-events: none;
  overflow: hidden;
  background: var(--bg-card);
}

.lib-skeleton-block {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: libShimmer 1.2s infinite linear;
}

.lib-skeleton-line {
  width: 72%;
  height: 9px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: libShimmer 1.2s infinite linear;
}

@keyframes libShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.lib-cloud-svg-swatch {
  width: 100%;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lib-cloud-svg-swatch svg {
  width: 100%;
  height: 100%;
  display: block;
}

.pro-badge-btn.is-pro-active {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
}

.pro-badge-btn.is-pro-phase {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
}

[data-theme="light"] .pro-badge-btn.is-pro-active {
  color: #047857;
}

[data-theme="light"] .pro-badge-btn.is-pro-phase {
  color: #b45309;
}

/* Export Paywall Box */
.export-paywall-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.12);
}

.export-paywall-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.export-paywall-head span {
  font-size: 11px;
  color: var(--text-secondary);
}

.export-pro-list {
  margin: 0;
  padding-left: 18px;
  font-size: 11px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.export-paywall-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Vault Analytics & Ranking Modal */
.vault-stats-modal-card {
  max-width: 780px;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
}

.vault-stats-body {
  overflow-y: auto;
  min-height: 0;
}

.vault-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.vault-stat-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.vault-stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.vault-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.vault-stat-sub {
  font-size: 10px;
  color: var(--text-secondary);
}

.vault-mode-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.vault-mode-row,
.vault-threshold-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.vault-threshold-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.vault-threshold-input {
  width: 92px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12px;
}

.vault-table-wrap {
  border-radius: 9px;
  border: 1px solid var(--border);
  overflow: auto;
  max-height: 300px;
}

.vault-rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.vault-rank-table th,
.vault-rank-table td {
  padding: 7px 9px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.vault-rank-table th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.vault-tier-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.vault-tier-pill.is-pro {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.vault-tier-pill.is-free {
  background: var(--accent-soft);
  color: var(--accent);
}

@media (max-width: 680px) {
  .vault-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
