/* ── SkyBlade Production Board — Dark Theme ────────────────────────── */

/* ── Tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Backgrounds — warm charcoal, archaeological earth */
  --bg-0: #0c0b0a;
  --bg-1: #13120f;
  --bg-2: #1a1815;
  --bg-3: #22201c;
  --bg-hover: #2a2823;
  --bg-active: #33302a;
  /* Borders — weathered stone edges */
  --border: #282623;
  --border-light: #353230;
  /* Text — warm parchment tones */
  --text: #ddd8d0;
  --text-dim: #958e85;
  --text-muted: #787470;
  /* Semantic */
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #f87171;
  --blue: #60a5fa;
  --cyan: #22d3ee;
  /* Brand — forge accents */
  --gold: #d4a017;
  --ember: #c45a2c;
  --ember-dim: rgba(196, 90, 44, 0.15);
  --gold-dim: rgba(212, 160, 23, 0.12);
  --muted: #565350;
  /* Shape */
  --radius: 6px;
  --radius-sm: 4px;
  /* Typography */
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg-0);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

#app { height: 100vh; }

h2, h3, h4 {
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text);
}

h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 8px; }
h4 { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }

p { margin: 0; }
.muted { color: var(--text-muted); }
.text-sm { font-size: 11px; }

img { display: block; max-width: 100%; }

pre {
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
}

button { cursor: pointer; font-family: var(--font); font-size: 12px; }
select { font-family: var(--font); font-size: 12px; cursor: pointer; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  color: var(--text-dim);
  font-size: 16px;
}

/* ── Three-Panel Grid ───────────────────────────────────────────────── */
.production-board {
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  height: 100vh;
  overflow: hidden;
}

.production-board.assets-mode {
  grid-template-columns: 220px 1fr;
}

.production-board.trailer-mode {
  grid-template-columns: 220px 1fr;
}
.production-board.trailer-mode .reference-panel {
  position: fixed;
  right: -320px;
  top: 0;
  bottom: 0;
  width: 300px;
  z-index: 90;
  transition: right 0.15s ease-out;
  box-shadow: -4px 0 20px rgba(0,0,0,0.5);
}
.production-board.trailer-mode .reference-panel.is-open {
  right: 0;
}
.trailer-refs-toggle {
  position: fixed;
  right: 12px;
  top: 12px;
  z-index: 91;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font: 9px var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  cursor: pointer;
  transition: color 0.1s, border-color 0.1s;
}
.trailer-refs-toggle:hover {
  color: var(--gold);
  border-color: var(--gold);
}
.trailer-refs-toggle.is-active {
  color: var(--gold);
  border-color: var(--gold);
}
.trailer-refs-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 89;
}
.trailer-refs-backdrop.is-open {
  display: block;
}

/* ── Scene List (Left Sidebar) ──────────────────────────────────────── */
.scene-list {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scene-list-header {
  padding: 16px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.scene-list-header h2 {
  font-size: 14px;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.scene-list-header .project-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text);
  line-height: 1.2;
}

.scene-count {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.view-tabs {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.view-tab {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.view-tab.active {
  background: var(--ember-dim);
  border-color: var(--ember);
  color: var(--text);
}

.scene-list-scroll {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}

.scene-list-scroll::-webkit-scrollbar { width: 4px; }
.scene-list-scroll::-webkit-scrollbar-track { background: transparent; }
.scene-list-scroll::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

/* Act Groups */
.act-group { margin-bottom: 4px; }

.act-header {
  padding: 10px 14px 4px;
  margin: 4px 6px 0;
}

.act-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Scene Items */
.scene-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  margin: 1px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
  font-size: 12px;
}

.scene-item:hover { background: var(--bg-hover); }
.scene-item.active {
  background: linear-gradient(90deg, var(--gold-dim) 0%, var(--bg-active) 60%);
  box-shadow: inset 0 0 0 1px rgba(212, 160, 23, 0.08);
}

.scene-dot { font-size: 10px; width: 14px; text-align: center; flex-shrink: 0; }
.scene-id { font-weight: 600; flex-shrink: 0; color: var(--text); font-size: 11px; }
.scene-title-short { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.hero-badge { color: var(--gold); font-size: 12px; flex-shrink: 0; filter: drop-shadow(0 0 2px rgba(212, 160, 23, 0.4)); }

/* ── Scene Workspace (Center) ───────────────────────────────────────── */
.scene-workspace {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-0);
}

.scene-workspace.empty-state {
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
}

.assets-workspace .workspace-scroll {
  padding-top: 20px;
}

.workspace-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 32px;
}

.workspace-scroll::-webkit-scrollbar { width: 6px; }
.workspace-scroll::-webkit-scrollbar-track { background: transparent; }
.workspace-scroll::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* Scene Header */
.scene-header {
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}

.scene-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.scene-code {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  flex-shrink: 0;
  text-transform: uppercase;
}

.scene-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.duration-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--bg-2);
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.timecode-badge {
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  color: var(--text-muted);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.assets-summary-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.summary-pill {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
}

.scene-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin-bottom: 4px;
}

.act-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 3px;
  color: var(--bg-0);
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.world-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.world-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* (description moved to Scene Notes collapsible in ReferencePanel) */

/* Status Select */
.status-select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  appearance: auto;
  flex-shrink: 0;
}

.status-select.status-done { color: var(--green); border-color: var(--green); }
.status-select.status-in_flow { color: var(--amber); border-color: var(--amber); }
.status-select.status-draft { color: var(--text-muted); }

/* ── Workflow Strip ─────────────────────────────────────────────────── */
.workflow-strip {
  display: flex;
  align-items: flex-start;
  padding: 14px 24px 10px;
  border-bottom: 1px solid var(--border);
  gap: 0;
  flex-shrink: 0;
}

.workflow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
  position: relative;
  min-width: 0;
}

.wf-dot {
  font-size: 14px;
  line-height: 1;
}

.wf-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wf-detail {
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.wf-hint {
  font-size: 9px;
  font-weight: 400;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.3;
  max-width: 160px;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Step states */
.workflow-step.done .wf-dot { color: var(--gold, #D4A76A); }
.workflow-step.done .wf-label { color: var(--text); }
.workflow-step.done .wf-detail { color: var(--gold, #D4A76A); }

.workflow-step.active .wf-dot { color: var(--accent, #E8927C); }
.workflow-step.active .wf-label { color: var(--text); font-weight: 800; }
.workflow-step.active .wf-detail { color: var(--accent, #E8927C); }

.workflow-step.pending .wf-dot { color: var(--text-dim); }
.workflow-step.pending .wf-label { color: var(--text-dim); }
.workflow-step.pending .wf-detail { color: var(--text-dim); }

/* Connectors */
.wf-connector {
  width: 24px;
  height: 2px;
  background: var(--border);
  align-self: center;
  margin-top: 6px;
  flex-shrink: 0;
  border-radius: 1px;
}

.wf-connector.done {
  background: var(--gold, #D4A76A);
}

/* ── Frame Grid ─────────────────────────────────────────────────────── */
.frame-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.frame-cell {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s;
  aspect-ratio: 16 / 9;
}

.frame-cell:hover { border-color: var(--text-dim); }

.frame-cell.hero {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(212, 160, 23, 0.25), inset 0 0 0 1px rgba(212, 160, 23, 0.1);
}

.frame-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-star {
  position: absolute;
  top: 6px;
  right: 6px;
  color: var(--gold);
  font-size: 18px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.frame-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  text-align: right;
}

.frame-grid-empty {
  background: var(--bg-2);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* ── Variant Switcher ───────────────────────────────────────────────── */
.variant-switcher {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.variant-btn {
  padding: 4px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  transition: all 0.1s;
}

.variant-btn:hover { background: var(--bg-hover); color: var(--text); }
.variant-btn.active {
  background: var(--ember-dim);
  border-color: var(--ember);
  color: var(--text);
}

/* ── Variant Gallery ────────────────────────────────────────────────── */
.variant-gallery-content {
  padding: 12px;
  transition: background 0.15s;
}

.variant-gallery-content.drag-over {
  background: var(--ember-dim);
  outline: 2px dashed var(--ember);
  outline-offset: -4px;
}

/* Horizontal scrollable thumbnail strip */
.variant-thumb-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.variant-thumb-strip::-webkit-scrollbar { height: 4px; }
.variant-thumb-strip::-webkit-scrollbar-track { background: transparent; }
.variant-thumb-strip::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.variant-thumb {
  position: relative;
  flex-shrink: 0;
  width: 140px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.variant-thumb:hover {
  border-color: var(--text-dim);
  transform: scale(1.03);
}

.variant-thumb.selected {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(212, 160, 23, 0.25);
}

.variant-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
}

.variant-gallery-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  text-align: right;
  letter-spacing: 0.04em;
}

/* Expanded detail view */
.variant-detail {
  margin-bottom: 12px;
}

.variant-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.variant-detail-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.variant-detail-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 2x2 quadrant grid */
.variant-quadrants {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quadrant-cell {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: zoom-in;
  transition: border-color 0.15s;
  aspect-ratio: 16 / 9;
}

.quadrant-cell:hover {
  border-color: var(--text-dim);
}

.quadrant-cell.hero {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(212, 160, 23, 0.25), inset 0 0 0 1px rgba(212, 160, 23, 0.1);
}

/* Hero star button on quadrant */
.quadrant-star {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.quadrant-cell:hover .quadrant-star {
  opacity: 1;
}

.quadrant-star:hover {
  color: var(--gold);
  background: rgba(0, 0, 0, 0.7);
}

.quadrant-star.active {
  opacity: 1;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(212, 160, 23, 0.6);
}

.quadrant-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  text-align: right;
}

/* Review notes textarea — inherits prompt-textarea styling, shorter */
.review-notes-textarea {
  min-height: 60px;
}

/* ── Review Notes — Parsed Display ────────────────────────────────── */
.review-parsed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.review-picks {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
}

.review-arrow {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 16px;
  padding: 0 2px;
}

.review-frame-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 6px 10px;
  min-width: 0;
}

.review-tag-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bg-0);
  background: var(--gold);
  padding: 2px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}

.review-tag-frame {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.review-tag-desc {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.review-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-mode-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 3px;
}

.review-mode-badge.itv {
  background: rgba(96, 165, 250, 0.15);
  color: var(--blue);
}

.review-mode-badge.ftv {
  background: rgba(251, 191, 36, 0.15);
  color: var(--amber);
}

.review-duration {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.review-why {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
  margin: 0;
}

.review-edit-btn {
  align-self: flex-start;
}

/* ── Variant Hero Indicators ──────────────────────────────────────── */
.variant-thumb.has-hero {
  border-color: var(--gold);
}

.variant-hero-dot {
  color: var(--gold);
  font-size: 10px;
  margin-right: 2px;
}

.variant-hero-frames {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--gold);
  margin-left: 3px;
  letter-spacing: 0.02em;
}

/* Hero badge on quadrant */
.quadrant-hero-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--bg-0);
  background: var(--gold);
  padding: 2px 6px;
  border-radius: 3px;
}

.variant-gallery-empty {
  background: var(--bg-2);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.variant-gallery-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Collapsible Sections ───────────────────────────────────────────── */
.collapsible-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}

.section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-2);
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  transition: background 0.1s;
}

.section-toggle:hover { background: var(--bg-hover); color: var(--text); }

.static-toggle {
  cursor: default;
}

.static-toggle:hover {
  background: var(--bg-2);
  color: var(--text-dim);
}

.toggle-arrow { font-size: 10px; width: 12px; }

.section-content {
  padding: 12px;
  background: var(--bg-1);
}

/* Badges */
.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: auto;
}

.badge.green { background: rgba(74, 222, 128, 0.15); color: var(--green); }
.badge.amber { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge + .badge { margin-left: 6px; }
.badge.muted { background: rgba(85, 85, 85, 0.2); color: var(--text-muted); }

/* ── Cinema Controls ──────────────────────────────────────────────── */
.cinema-controls {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.cinema-control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cinema-control-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  min-width: 42px;
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.cinema-pills {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.cinema-pills::-webkit-scrollbar { display: none; }
.cinema-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-0);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.1s;
  white-space: nowrap;
  font-family: var(--font-mono);
}
.cinema-pill:hover {
  border-color: var(--text-muted);
  color: var(--text);
}
.cinema-pill.selected {
  background: rgba(212, 160, 23, 0.15);
  border-color: var(--gold);
  color: var(--gold);
}
.cinema-pill.recommended {
  border-color: rgba(212, 160, 23, 0.3);
}
.cinema-summary {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-left: auto;
}
.cinema-toggle-btn {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

/* ── Animation Prompt ───────────────────────────────────────────────── */
.prompt-editor { display: flex; flex-direction: column; gap: 8px; }

.prompt-textarea {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  padding: 10px;
  resize: vertical;
  min-height: 120px;
}

.prompt-textarea:focus {
  outline: none;
  border-color: var(--ember);
}

.prompt-display {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  padding: 10px;
  min-height: 120px;
  white-space: pre-wrap;
  word-wrap: break-word;
  cursor: text;
}

.prompt-display:hover {
  border-color: var(--text-muted);
}

.prompt-display .tag-highlight {
  font-size: 11px;
}

.prompt-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prompt-block-text {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 8px 0;
  max-height: 400px;
  overflow-y: auto;
}

.prompt-meta {
  margin-top: 8px;
}
.prompt-meta summary {
  cursor: pointer;
  user-select: none;
}
.observation-list {
  margin: 4px 0 0 16px;
  padding: 0;
  list-style: disc;
  color: var(--text-dim);
}
.observation-list li {
  margin: 2px 0;
}
.warning-text {
  color: var(--amber);
}

/* ── Assets Workspace ──────────────────────────────────────────────── */
.assets-lane {
  margin-bottom: 22px;
}

.assets-lane-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.assets-lane-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  color: var(--text);
}

.lane-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border);
}

.assets-record-list {
  display: grid;
  gap: 14px;
}

.assets-record {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent), var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.assets-record-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.assets-record-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}

.assets-record-subtitle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.asset-kind-chip,
.stable-id-chip,
.mapping-warning {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.asset-kind-chip {
  color: var(--text-dim);
}

.stable-id-chip {
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.22);
  color: var(--blue);
  border-radius: 999px;
  padding: 3px 8px;
}

.mapping-warning {
  color: var(--amber);
}

.asset-scene-usage {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}

.scene-chip {
  padding: 4px 9px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
}

.scene-chip:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.asset-versions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.asset-version-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.asset-version-thumb {
  width: 100%;
  aspect-ratio: 1.15;
  object-fit: cover;
  background: var(--bg-0);
}

.asset-version-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
}

.asset-version-body {
  padding: 10px;
}

.asset-version-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.asset-version-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold);
}

.asset-version-date {
  font-size: 10px;
  color: var(--text-muted);
}

.asset-version-path {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.5;
  word-break: break-word;
}

.asset-version-sources {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.asset-version-sources code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 5px;
}

.asset-version-actions {
  margin-top: 10px;
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.1s;
  background: var(--bg-2);
  color: var(--text);
}

.btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--ember);
  border-color: var(--ember);
  color: var(--text);
}

.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
  background: var(--bg-3);
  border-color: var(--border-light);
}

.btn-small {
  padding: 3px 10px;
  font-size: 11px;
}

/* ── Reference Panel (Right Sidebar) ────────────────────────────────── */
.reference-panel {
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.reference-panel.empty-state {
  align-items: center;
  justify-content: center;
}

.reference-panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
}

.reference-panel-scroll::-webkit-scrollbar { width: 4px; }
.reference-panel-scroll::-webkit-scrollbar-track { background: transparent; }
.reference-panel-scroll::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

/* ── Flow References ────────────────────────────────────────────────── */
.flow-refs-section {
  margin-bottom: 16px;
}

.flow-refs-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  border-image: linear-gradient(to right, var(--gold) 0%, transparent 80%) 1;
}

/* ── Unified Scene References ──────────────────────────────────────── */
.scene-refs-section {
  margin-bottom: 16px;
}

.scene-refs-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  border-image: linear-gradient(to right, var(--gold) 0%, transparent 80%) 1;
}

.scene-refs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.scene-ref-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.scene-ref-card.missing {
  border-color: rgba(248, 113, 113, 0.3);
}

.scene-ref-card.uploading {
  border-color: var(--gold);
  opacity: 0.7;
}

.scene-ref-card.uploading .scene-ref-thumb {
  animation: pulse-fade 1s ease-in-out infinite;
}

@keyframes pulse-fade {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.scene-ref-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 3px;
  cursor: zoom-in;
}

.scene-ref-placeholder {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  border: 1px dashed var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.scene-ref-placeholder:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.scene-ref-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 4px;
  min-width: 0;
}

.scene-ref-label {
  font-size: 10px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.scene-ref-meta {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.scene-ref-type {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.scene-ref-override {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 4px;
  border-radius: 2px;
  background: rgba(212, 160, 23, 0.15);
  color: var(--gold);
}

.scene-ref-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.1s;
}

.scene-ref-card:hover .scene-ref-actions {
  opacity: 1;
}

.scene-ref-card.missing .scene-ref-actions {
  opacity: 1;
}

.scene-ref-action {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.scene-ref-action:hover {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}

.scene-ref-action.danger:hover {
  background: #e55;
  color: #fff;
  border-color: #e55;
}

.ref-count {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
}

.ref-count.all-good { background: rgba(74, 222, 128, 0.15); color: var(--green); }
.ref-count.has-missing { background: rgba(248, 113, 113, 0.15); color: var(--red); }

.ref-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ref-tag {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}

.ref-tag.missing {
  border-color: rgba(248, 113, 113, 0.3);
}

.ref-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 3px;
}

.ref-thumb-missing {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  border-radius: 3px;
  color: var(--red);
  font-size: 18px;
}

.ref-name {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.3;
  word-break: break-word;
}

/* ── Asset Groups ───────────────────────────────────────────────────── */
.asset-section {
  margin-bottom: 16px;
}

.asset-section > h3 {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  border-image: linear-gradient(to right, var(--gold) 0%, transparent 80%) 1;
}

.asset-group {
  margin-bottom: 10px;
}

.asset-group-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.asset-group-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.asset-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}

.asset-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.asset-thumb.missing img { opacity: 0.3; }

.asset-thumb-placeholder {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  border: 1px dashed var(--border-light);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 14px;
}

.asset-name {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
  word-break: break-word;
}

/* ── Prompt Block (Reference Panel) ─────────────────────────────────── */
.prompt-block-text {
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.6;
}

.tag-highlight {
  background: rgba(96, 165, 250, 0.15);
  color: var(--blue);
  padding: 0 3px;
  border-radius: 2px;
  font-weight: 600;
  font-size: 10px;
}

/* ── Scene Notes ────────────────────────────────────────────────────── */
.notes-block {
  margin-bottom: 8px;
}

.notes-block h4 {
  margin-bottom: 4px;
}

.notes-block p {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

.source-ref-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.source-ref-list code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 5px;
}

/* ── Script Excerpt ────────────────────────────────────────────────── */
.script-excerpt {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
  font-style: italic;
}

/* ── Canon Locks ───────────────────────────────────────────────────── */
.canon-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.canon-lock {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  padding-left: 14px;
  position: relative;
}

.canon-lock::before {
  content: '⚠';
  position: absolute;
  left: 0;
  font-size: 9px;
  color: var(--amber);
}

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-bottom: 2px solid var(--gold);
  color: var(--text);
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  z-index: 1000;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(212, 160, 23, 0.06);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Ref Approve Button ────────────────────────────────────────────── */
.ref-tag { position: relative; }

.ref-manage-btn {
  display: none;
  position: absolute;
  top: 2px;
  right: 2px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  background: var(--bg-2);
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.ref-tag:hover .ref-manage-btn,
.ref-tag.missing .ref-manage-btn {
  display: block;
}

.ref-manage-btn:hover {
  background: var(--bg-active);
  color: var(--text);
}

.ref-scene-badge {
  position: absolute;
  bottom: 34px;
  right: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(212, 160, 23, 0.16);
  border: 1px solid rgba(212, 160, 23, 0.35);
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Reference Replace Overlay ────────────────────────────────────── */
.ref-thumb-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  width: 100%;
}
.ref-replace-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(196, 90, 44, 0.85);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.ref-tag:hover .ref-replace-overlay,
.ref-tag.missing .ref-replace-overlay {
  opacity: 1;
}
.ref-tag.has-override {
  border-color: var(--gold);
}
.ref-override-badge {
  font-size: 8px;
  font-family: var(--font-mono);
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
/* .ref-manage-btn removed from DOM — class no longer used */

/* ReferencePanel overrides */
.scene-ref-override.override-active {
  color: var(--gold);
  border-color: var(--gold);
}
.scene-ref-action.replace-btn {
  width: auto;
  font-size: 9px;
  padding: 2px 6px;
}

/* ── Asset Approval Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(88px, calc(env(safe-area-inset-bottom) + 56px))
    max(16px, env(safe-area-inset-left));
  overflow: auto;
  z-index: 2000;
  animation: fade-in 0.15s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-panel {
  background: var(--bg-1);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  width: 700px;
  max-width: 90vw;
  max-height: calc(100dvh - 136px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(212, 160, 23, 0.04);
  animation: modal-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 14px;
  color: var(--text);
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
}

.modal-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px 8px;
  cursor: pointer;
}

.modal-close:hover { color: var(--text); }

.modal-drag-shell {
  max-width: 100%;
  max-height: 100%;
  will-change: transform;
}

.modal-drag-shell.dragging {
  transition: none;
}

.modal-header.draggable {
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.modal-header.draggable.dragging {
  cursor: grabbing;
}

body.modal-dragging {
  cursor: grabbing;
}

.modal-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  padding: 6px 10px;
  outline: none;
}

.search-input:focus { border-color: var(--ember); }
.search-input::placeholder { color: var(--text-muted); }

.search-count {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
}

.modal-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Downloads Grid */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.download-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: var(--bg-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.1s;
}

.download-item:hover { border-color: var(--text-dim); }
.download-item.selected { border-color: var(--ember); box-shadow: 0 0 8px rgba(196, 90, 44, 0.3); }

.download-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 3px;
  background: var(--bg-3);
}

.download-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

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

.download-meta {
  font-size: 10px;
  color: var(--text-muted);
}

/* ── Asset Versions ────────────────────────────────────────────────── */
.versions-current {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.versions-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--green);
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.versions-current-img {
  height: 60px;
  width: 60px;
  object-fit: cover;
  border-radius: 3px;
  border: 2px solid var(--green);
  cursor: zoom-in;
  flex-shrink: 0;
}

.versions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.version-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.version-thumb {
  height: 60px;
  width: 60px;
  object-fit: cover;
  border-radius: 3px;
  cursor: zoom-in;
  flex-shrink: 0;
}

.version-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.version-date {
  font-size: 11px;
  color: var(--text-dim);
}

.version-size {
  font-size: 10px;
  color: var(--text-muted);
}

.flow-override-badge {
  color: var(--gold);
  border-color: rgba(212, 160, 23, 0.35);
}

.flow-ref-picker-panel {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100dvh - 136px);
  overflow: hidden;
}

.flow-ref-picker-redesign {
  display: flex;
  flex-direction: column;
}

.flow-ref-picker-panel .modal-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg-1);
}

.flow-ref-picker-panel .modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: linear-gradient(to bottom, rgba(26, 22, 18, 0.94), rgba(26, 22, 18, 0.99));
  backdrop-filter: blur(6px);
}

.flow-ref-picker-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.flow-ref-picker-current-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.flow-ref-picker-current-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  background: var(--bg-3);
}

.flow-ref-picker-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.flow-ref-picker-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.flow-ref-picker-tab:hover {
  border-color: var(--border-light);
  color: var(--text);
}

.flow-ref-picker-tab.active {
  color: var(--text);
  border-color: rgba(212, 160, 23, 0.45);
  background: rgba(212, 160, 23, 0.12);
}

.flow-ref-picker-content {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  padding: 16px;
  overflow: hidden;
}

.flow-ref-picker-main,
.flow-ref-picker-side {
  min-height: 0;
}

.flow-ref-picker-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.flow-ref-picker-panel-copy {
  padding: 4px 0 12px;
}

.flow-ref-picker-panel-copy h4 {
  margin: 0 0 4px;
  font-size: 18px;
  color: var(--text);
}

.flow-ref-picker-panel-copy p {
  margin: 0;
  max-width: 720px;
  color: var(--text-dim);
  line-height: 1.6;
}

.flow-ref-picker-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.flow-ref-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.flow-ref-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  text-align: left;
  background: var(--bg-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
}

.flow-ref-option:hover {
  border-color: var(--text-dim);
}

.flow-ref-option.selected {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(212, 160, 23, 0.18);
}

.flow-ref-option-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-3);
}

.flow-ref-option-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.flow-ref-option-meta {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.flow-ref-option-path {
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-ref-picker-side {
  display: flex;
}

.flow-ref-selection-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.018);
}

.flow-ref-selection-card h4 {
  margin: 0;
  font-size: 13px;
  color: var(--text);
}

.flow-ref-selection-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background: var(--bg-3);
}

/* Side-by-side comparison */
.flow-ref-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.flow-ref-compare-slot {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.flow-ref-compare-label {
  font-size: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
}
.flow-ref-compare-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background: var(--bg-3);
}

.flow-ref-selection-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 16px;
  border: 1px dashed var(--border-light);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

.flow-ref-selection-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flow-ref-selection-copy strong {
  font-size: 14px;
  color: var(--text);
}

.flow-ref-selection-copy span {
  font-size: 11px;
  color: var(--text-dim);
}

.flow-ref-selection-copy code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  word-break: break-word;
}

.flow-ref-selection-rules {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.flow-ref-selection-rules p {
  margin: 0;
  font-size: 11px;
  color: var(--text-dim);
}

.flow-ref-upload-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.018);
}

.flow-ref-upload-copy h5 {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--text);
}

.flow-ref-upload-copy p {
  margin: 0;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
}

.flow-ref-upload-button {
  align-self: flex-start;
}

.flow-ref-visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.flow-ref-upload-picked {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
}

.flow-ref-picker-footer {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.flow-ref-picker-selection {
  color: var(--text-dim);
  margin-right: auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .flow-ref-picker-content {
    grid-template-columns: 1fr;
  }

  .flow-ref-picker-side {
    order: -1;
  }

  .flow-ref-selection-card {
    max-height: 220px;
    overflow: auto;
  }
}

@media (max-width: 680px) {
  .flow-ref-picker-tabs {
    flex-wrap: wrap;
  }

  .flow-ref-picker-grid,
  .download-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Image Lightbox ────────────────────────────────────────────────── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  animation: fade-in 0.15s ease-out;
  cursor: zoom-out;
}

.lightbox-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
  z-index: 1;
}

.lightbox-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  opacity: 0.9;
}

.lightbox-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  padding: 4px 8px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.lightbox-close:hover { opacity: 1; }

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  cursor: default;
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

/* Clickable thumbnails */
.ref-thumb { cursor: zoom-in; }
.asset-thumb img { cursor: zoom-in; }
.frame-cell img { cursor: zoom-in; }

/* ── Workspace entrance ────────────────────────────────────────────── */
.workspace-scroll {
  animation: workspace-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes workspace-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Reference panel entrance — slight stagger */
.reference-panel-scroll {
  animation: ref-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

@keyframes ref-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Background Texture ─────────────────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  mix-blend-mode: overlay;
}

/* ── Focus Indicators ──────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

/* Reset outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Specific focus overrides for interactive elements */
.scene-item:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: -2px;
  background: var(--bg-hover);
}

.frame-cell:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: -2px;
}

.variant-btn:focus-visible,
.btn:focus-visible,
.section-toggle:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

.modal-close:focus-visible,
.lightbox-close:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

/* ── Veo Clips ─────────────────────────────────────────────────────── */
.veo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.veo-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.12s;
}
.veo-card:hover { border-color: var(--border-light); }
.veo-card.tier-approved { border-color: var(--green); }
.veo-card.tier-candidate { border-color: var(--amber); }
.veo-card-video {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: var(--bg-0);
  cursor: pointer;
}
/* Show native controls on hover/focus — keeps thumbnail clean */
.veo-card-video::-webkit-media-controls-panel {
  opacity: 0;
  transition: opacity 0.15s;
}
.veo-card-video:hover::-webkit-media-controls-panel,
.veo-card-video:focus::-webkit-media-controls-panel {
  opacity: 1;
}
.veo-card-body { padding: 8px 10px; }
.veo-card-top {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.veo-card-name {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.veo-card-badges { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; }
.veo-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.veo-card-path {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

/* Delete button */
.btn-danger { color: #e55; border-color: #e55; }
.btn-danger:hover { background: #e55; color: #fff; }

/* Section bar (sound toggle) */
.veo-section-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}
.veo-sound-toggle {
  font-size: 14px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.12s, border-color 0.12s;
}
.veo-sound-toggle.is-active {
  color: var(--gold);
  border-color: var(--gold);
}

/* Version / tier labels */
.veo-version-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-top: 10px;
}

/* History block */
.veo-history-block { margin-top: 12px; }
.veo-history-toggle {
  cursor: pointer;
  list-style: none;
}
.veo-history-toggle::-webkit-details-marker { display: none; }
.veo-history-content { margin-top: 6px; }

/* Batch grouping */
.veo-batch-group {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 8px;
}
.veo-batch-group:first-child { border-top: none; margin-top: 0; }
.veo-batch-header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.veo-batch-header::-webkit-details-marker { display: none; }
.veo-batch-content { margin-top: 6px; }

/* Prompt preview */
.veo-prompt-preview {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
  color: var(--text-muted);
  max-height: 3.6em;
  overflow: hidden;
  cursor: pointer;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 6px 0;
  padding: 6px 8px;
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: max-height 0.15s;
}
.veo-prompt-preview.is-expanded {
  max-height: none;
}

/* Ingredient thumbnails */
.veo-ingredients {
  display: flex;
  gap: 4px;
  margin: 6px 0;
  flex-wrap: wrap;
}
.veo-ingredient-thumb {
  width: 32px;
  height: 32px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid var(--border);
  cursor: help;
  background: var(--bg-1);
}

/* Native details toggle arrow for VeoClips */
.collapsible-section > details > summary { list-style: none; }
.collapsible-section > details > summary::-webkit-details-marker { display: none; }
.toggle-arrow-css::before { content: '\25B8'; margin-right: 4px; }
details[open] > summary .toggle-arrow-css::before { content: '\25BE'; }

/* Empty state */
.veo-empty {
  color: var(--text-muted);
  font-size: 11px;
  padding: 12px 0;
}

/* ── Standalone Shots ─────────────────────────────────────────────── */
.shots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.shot-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-1);
}
.shot-card-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.shot-card-body {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.shot-card-name {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shot-card-badges { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; margin: 4px 0 2px; }
.shot-card-actions {
  display: flex;
  gap: 4px;
}

/* ── Per-card prompt & ingredients (VeoClips + StandaloneShots) ────── */
.veo-card-prompt,
.shot-card-prompt {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  max-height: 3.6em;
  overflow: hidden;
  cursor: pointer;
  white-space: pre-wrap;
  margin: 6px 0 2px;
  padding: 6px 8px;
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.veo-card-prompt.is-expanded,
.shot-card-prompt.is-expanded {
  max-height: none;
}
.veo-card-ingredients,
.shot-card-ingredients {
  display: flex;
  gap: 4px;
  margin: 4px 0;
  flex-wrap: wrap;
}
.veo-card-batch {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Per-card Review Notes ────────────────────────────────────────── */
.card-review-note {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  max-height: 3.6em;
  overflow: hidden;
  cursor: pointer;
  white-space: pre-wrap;
  margin: 6px 0 2px;
  padding: 6px 8px;
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-left: 2px solid var(--gold);
}
.card-review-note.is-expanded { max-height: none; }
.card-review-edit {
  display: flex; flex-direction: column; gap: 6px;
  margin: 6px 0 2px; padding: 8px;
  background: var(--bg-1); border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.card-review-status-select {
  font-family: var(--font-mono); font-size: 10px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px 6px; width: fit-content;
}
.card-review-textarea {
  font-family: var(--font-mono); font-size: 10px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 8px; min-height: 48px; resize: vertical; width: 100%;
}
.card-review-actions { display: flex; gap: 4px; }
.badge.card-review-red { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.card-review-add-btn {
  font-size: 9px; color: var(--text-muted); cursor: pointer;
  padding: 2px 6px; margin: 4px 0;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  background: transparent; transition: color 0.1s, border-color 0.1s;
}
.card-review-add-btn:hover { color: var(--gold); border-color: var(--gold); }

/* ── Forge Micro-interactions — Delight ────────────────────────────── */

/* Satisfying button press — forge-hammer weight */
.btn:active {
  transform: translateY(1px);
  transition: transform 0.05s;
}
.btn-ember:hover {
  background: var(--ember);
  box-shadow: 0 0 12px rgba(196, 90, 44, 0.3);
  transition: background 0.15s, box-shadow 0.15s;
}

/* Card lift on hover — subtle depth */
.shot-card:hover,
.veo-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* Hero frame gold pulse — the chosen one glows */
.shot-card-img[data-hero="true"],
.quadrant-thumb.is-hero {
  box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(212, 160, 23, 0.25);
}

/* Approved clip — green ember glow */
.veo-card.tier-approved {
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.1);
}

/* Status badge entrance — fade in from transparent */
.badge {
  animation: badgeFadeIn 0.15s ease-out;
}
@keyframes badgeFadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Review status color accents — forge heat spectrum */
.badge.green { box-shadow: inset 0 0 6px rgba(74, 222, 128, 0.15); }
.badge.amber { box-shadow: inset 0 0 6px rgba(251, 191, 36, 0.15); }
.badge.card-review-red { box-shadow: inset 0 0 6px rgba(248, 113, 113, 0.15); }

/* Reference thumbnail hover — warm reveal */
.ref-thumb,
.veo-ingredient-thumb,
.scene-ref-thumb {
  transition: transform 0.15s, box-shadow 0.15s;
}
.ref-thumb:hover,
.veo-ingredient-thumb:hover,
.scene-ref-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Override badge — gold heat shimmer */
.ref-override-badge,
.scene-ref-override.override-active {
  text-shadow: 0 0 8px rgba(212, 160, 23, 0.4);
}

/* Section toggle arrow — smooth rotation */
.toggle-arrow {
  display: inline-block;
  transition: transform 0.15s ease;
}

/* Card review note — gold border glow on hover */
.card-review-note:hover {
  border-left-color: var(--gold);
  box-shadow: -2px 0 8px rgba(212, 160, 23, 0.15);
}

/* Prompt block — subtle expand hint */
.shot-card-prompt:hover,
.veo-card-prompt:hover {
  border-color: var(--border-light);
}
.shot-card-prompt.is-expanded,
.veo-card-prompt.is-expanded {
  border-color: var(--ember);
  border-left: 2px solid var(--ember);
}

/* Scene status colors — forge palette */
.status-done { color: var(--gold); }
.status-in-flow { color: var(--ember); }
.status-draft { color: var(--text-muted); }

/* Video hover play indicator */
.veo-card-video {
  transition: box-shadow 0.15s;
}
.veo-card-video:hover {
  box-shadow: inset 0 0 0 1px rgba(212, 160, 23, 0.3);
}

/* Replace overlay — ember heat */
.ref-replace-overlay {
  backdrop-filter: blur(2px);
}

/* Scene list item — warm selection */
.scene-item.active {
  transition: background 0.15s, border-color 0.15s;
}

/* Toast notification — slide in from bottom */
.toast {
  animation: toastSlideIn 0.2s ease-out;
}
@keyframes toastSlideIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Colorize — semantic color coding for content types */
.badge.muted {
  background: rgba(120, 116, 112, 0.12);
}

/* Model tier color coding */
.badge[data-tier="pro"] { color: var(--gold); background: var(--gold-dim); }
.badge[data-tier="nb2"] { color: var(--cyan); background: rgba(34, 211, 238, 0.1); }
.badge[data-tier="veo"] { color: var(--ember); background: var(--ember-dim); }

/* World palette chips — scene-aware color coding */
.world-zartu { color: #7b8fa8; }
.world-alitu { color: #5bb8b0; }
.world-suddu { color: #c4756a; }
.world-liminal { color: var(--text-dim); }
.world-synthesis { color: var(--text); }

/* ── Trailer Beats View ───────────────────────────────────────────── */

.trailer-workspace {
  padding: 20px 24px;
  overflow-y: auto;
  height: 100vh;
}
.trailer-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.trailer-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  color: var(--text);
  margin: 0;
}
.trailer-summary {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Timeline strip */
.beat-timeline {
  display: flex;
  height: 36px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.beat-block {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  border: none;
  border-right: 1px solid var(--bg-0);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: background 0.1s;
  padding: 0;
  min-width: 20px;
}
.beat-block:last-child { border-right: none; }
.beat-block:hover { background: var(--bg-hover); }
.beat-block.active { background: var(--bg-active); border-bottom-color: var(--gold); }
.beat-block.generated { background: rgba(74, 222, 128, 0.08); }
.beat-block.generated.active { background: rgba(74, 222, 128, 0.15); }
.beat-block.error { background: rgba(248, 113, 113, 0.08); }
.beat-block-num {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
}
.beat-block.active .beat-block-num { color: var(--gold); font-weight: 600; }

/* Beat detail */
.beat-detail {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.beat-detail-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.beat-detail-num {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  min-width: 40px;
}
.beat-detail-info { flex: 1; }
.beat-detail-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
  margin: 0 0 6px;
}
.beat-detail-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.beat-detail-content {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
}
.beat-detail-media {
  aspect-ratio: 16/9;
  background: var(--bg-0);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.beat-detail-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.beat-detail-hero {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.beat-detail-empty {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.beat-detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: 50vh;
}
.beat-detail-section h3 {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 0 0 6px;
}
.beat-detail-prompt {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  white-space: pre-wrap;
  line-height: 1.5;
  background: var(--bg-0);
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
}
.beat-detail-refs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.beat-detail-ref-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Beat list in sidebar */
.beat-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 0;
}
.beat-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
  border-left: 2px solid transparent;
}
.beat-list-item:hover { background: var(--bg-hover); }
.beat-list-item.active {
  background: var(--bg-active);
  border-left-color: var(--gold);
}
.beat-list-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  min-width: 16px;
}
.beat-list-item.active .beat-list-num { color: var(--gold); }
.beat-list-title {
  font-size: 12px;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.beat-list-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-green { background: var(--green); }
.dot-red { background: var(--red); }
.dot-grey { background: var(--text-muted); }

/* ── Shot Strip (Generation Specs Storyboard) ──────────────────────── */

.scene-detail-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.scene-detail-header {
  margin-bottom: 12px;
}

.scene-detail-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.scene-detail-id {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
}

.scene-detail-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0;
  text-transform: none;
}

.scene-detail-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.shot-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
}

.shot-strip::-webkit-scrollbar { height: 4px; }
.shot-strip::-webkit-scrollbar-track { background: transparent; }
.shot-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.shot-strip-card {
  flex-shrink: 0;
  width: 240px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  overflow: hidden;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
}

.shot-strip-card:hover {
  border-color: var(--border-light);
}

/* ── Lint badges ─────────────────────────────────── */
.lint-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 2px;
  margin-left: 6px;
  vertical-align: middle;
  cursor: default;
  font-family: var(--font-mono, 'SF Mono', monospace);
}

.lint-pass {
  background: rgba(34, 139, 34, 0.2);
  color: #4a9;
  border: 1px solid rgba(34, 139, 34, 0.3);
}

.lint-warn {
  background: rgba(196, 90, 44, 0.2);
  color: var(--ember, #c45a2c);
  border: 1px solid rgba(196, 90, 44, 0.4);
}

.lint-warn:hover {
  background: rgba(196, 90, 44, 0.35);
}

/* Phase color coding via left border */
.phase-cold-open { border-left: 2px solid var(--text-muted); }
.phase-slow-build { border-left: 2px solid var(--amber); }
.phase-escalation { border-left: 2px solid var(--ember); }
.phase-fury { border-left: 2px solid var(--red); }
.phase-stinger { border-left: 2px solid var(--gold); }

/* Phase badges */
.badge.phase-cold-open { color: var(--text-muted); border-color: var(--text-muted); }
.badge.phase-slow-build { color: var(--amber); border-color: var(--amber); }
.badge.phase-escalation { color: var(--ember); border-color: var(--ember); }
.badge.phase-fury { color: var(--red); border-color: var(--red); }
.badge.phase-stinger { color: var(--gold); border-color: var(--gold); }

.shot-strip-media {
  width: 240px;
  height: 135px;
  background: var(--bg-0);
  position: relative;
  overflow: hidden;
}

.shot-strip-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shot-strip-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shot-strip-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border-light);
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: border-color 0.1s, color 0.1s;
}

.shot-strip-empty.drag-over {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

.shot-strip-info {
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--border);
}

.shot-strip-id {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.shot-strip-moment {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.3;
  margin-bottom: 4px;
}

.shot-strip-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.shot-strip-palette {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

.shot-strip-actions {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.shot-copy-btn {
  flex: 1;
  padding: 4px 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.shot-copy-btn:hover, .shot-copy-btn.active {
  background: var(--ember-dim);
  color: var(--ember);
  border-color: var(--ember);
}

.shot-refs-btn:hover {
  background: var(--gold-dim);
  color: var(--gold);
  border-color: var(--gold);
}

.shot-upload-btn:hover {
  background: var(--gold-dim);
  color: var(--gold);
  border-color: var(--gold);
}

.shot-strip-refs {
  padding: 6px 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.shot-ref-item {
  position: relative;
  width: 48px;
  height: 48px;
}

.shot-ref-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid var(--border);
}

.shot-ref-thumb:hover {
  border-color: var(--gold);
}

.shot-ref-reveal {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 16px;
  height: 16px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s;
}

.shot-ref-item:hover .shot-ref-reveal {
  opacity: 1;
}

.shot-ref-reveal:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.shot-strip-canon {
  padding: 4px 10px 6px;
}

.shot-canon-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 2px 0;
}

.shot-canon-toggle:hover {
  color: var(--amber);
}

.shot-canon-text {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.4;
  margin-top: 2px;
  padding-left: 0;
}

/* Timeline beat with spec indicator */
.beat-block.has-spec::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
}

/* ── Trailer scene blocks — nested collapsibles ───────────────────── */
.trailer-scene-block > .collapsible-section {
  border: none;
  margin: 0;
  border-radius: 0;
  border-top: 1px solid var(--border);
}
.trailer-scene-block > .collapsible-section:first-of-type {
  border-top: none;
}
.trailer-scene-block > .collapsible-section .section-toggle {
  padding: 6px 12px;
  font-size: 10px;
}
.trailer-scene-block > .collapsible-section .section-content {
  padding: 8px 12px;
}

/* ── Reduced Motion ────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Scrollbar base ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* Firefox scrollbar support */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ── Score Badges ──────────────────────────────────────────────────── */

.frame-cell-wrapper {
  display: contents;
}

.score-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font: 600 10px/1 var(--mono);
  padding: 2px 5px;
  background: rgba(12, 11, 10, 0.8);
  border-radius: 2px;
  cursor: pointer;
  z-index: 2;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.score-badge:hover {
  background: rgba(12, 11, 10, 0.95);
}

/* ── Diagnostic Panel ─────────────────────────────────────────────── */

.diagnostic-panel {
  grid-column: 1 / -1;
  padding: 8px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin: 2px 0 6px;
}

.diag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.diag-label {
  font: 600 9px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  width: 70px;
  flex-shrink: 0;
}

.diag-bar-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.diag-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.15s ease;
}

.diag-value {
  font: 600 10px/1 var(--mono);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Top Picks Strip ──────────────────────────────────────────────── */

.top-picks {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.top-picks-label {
  font: 600 9px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.top-picks-strip {
  display: flex;
  gap: 8px;
}

.top-pick {
  position: relative;
  width: 120px;
  cursor: pointer;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color 0.1s;
}
.top-pick:hover {
  border-color: var(--gold);
}
.top-pick img {
  width: 100%;
  display: block;
}

.top-pick-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font: 600 9px/1 var(--mono);
  padding: 1px 4px;
  background: rgba(12, 11, 10, 0.85);
  border-radius: 2px;
}

.top-pick-label {
  position: absolute;
  top: 2px;
  left: 2px;
  font: 500 8px/1 var(--mono);
  padding: 1px 3px;
  background: rgba(12, 11, 10, 0.7);
  color: var(--muted);
  border-radius: 2px;
  text-transform: uppercase;
}

.top-picks-hero-rank {
  display: block;
  font: 400 10px/1.4 var(--mono);
  color: var(--muted);
  margin-top: 4px;
}

/* ── Asset Search ─────────────────────────────────────────────────── */

.asset-search {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.asset-search-input {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--fg);
  font: 11px/1.4 var(--mono);
  outline: none;
  box-sizing: border-box;
}
.asset-search-input:focus {
  border-color: var(--gold);
}
.asset-search-input::placeholder {
  color: var(--muted);
}

.asset-search-loading {
  font: 10px/1.4 var(--mono);
  color: var(--muted);
  padding: 4px 0;
}

.asset-search-results {
  max-height: 280px;
  overflow-y: auto;
  margin-top: 4px;
}

.asset-search-result {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  cursor: pointer;
  border-radius: 3px;
}
.asset-search-result:hover {
  background: var(--bg-raised);
}
.asset-search-result img {
  width: 40px;
  height: 30px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}

.asset-search-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  font: 10px/1.2 var(--mono);
  overflow: hidden;
}

.asset-search-score {
  color: var(--gold);
  font-weight: 600;
}

.asset-search-scene {
  color: var(--fg);
}

.asset-search-type {
  font: 600 8px/1 var(--mono);
  text-transform: uppercase;
  color: var(--muted);
  padding: 1px 3px;
  background: var(--border);
  border-radius: 2px;
}

.asset-search-empty {
  font: 10px/1.4 var(--mono);
  color: var(--muted);
  padding: 4px 0;
}

/* ── Consistency Timeline ─────────────────────────────────────────── */

.consistency-timeline {
  border-bottom: 1px solid var(--border);
}

.consistency-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--fg);
  cursor: pointer;
  font: 600 10px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.consistency-header:hover {
  background: var(--bg-raised);
}

.consistency-label { color: var(--muted); }
.consistency-alert { color: var(--ember); }
.consistency-mild { color: var(--amber); }
.consistency-chevron { margin-left: auto; color: var(--muted); }

.consistency-strip {
  display: flex;
  align-items: center;
  overflow-x: auto;
  padding: 8px 12px 12px;
  gap: 0;
}

.consistency-item {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.consistency-frame {
  text-align: center;
}
.consistency-frame img {
  width: 64px;
  height: 36px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid var(--border);
  display: block;
}
.consistency-placeholder {
  width: 64px;
  height: 36px;
  background: var(--border);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}
.consistency-scene-id {
  font: 500 8px/1 var(--mono);
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.consistency-connector {
  width: 24px;
  height: 3px;
  border-radius: 2px;
  position: relative;
  flex-shrink: 0;
}
.consistency-sim {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  font: 500 7px/1 var(--mono);
  color: var(--muted);
  white-space: nowrap;
}

/* ── Assets Browser ───────────────────────────────────────────────── */

.assets-browser {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Toolbar */
.assets-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  flex-shrink: 0;
}

.assets-search-input {
  min-width: 160px;
  flex: 1;
  max-width: 280px;
  padding: 5px 10px;
  font-size: 12px;
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.1s;
}
.assets-search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(212,160,23,0.3), 0 0 8px rgba(212,160,23,0.1);
}
.assets-search-input::placeholder { color: var(--text-muted); }

.assets-toolbar-tabs {
  display: flex;
  gap: 2px;
  margin-left: 4px;
}

.assets-toolbar-tab {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-0);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.1s;
}
.assets-toolbar-tab:hover { border-color: var(--border-light); color: var(--text); }
.assets-toolbar-tab.active {
  background: linear-gradient(180deg, rgba(212,160,23,0.2), rgba(212,160,23,0.08));
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 8px rgba(212,160,23,0.2), inset 0 1px 0 rgba(212,160,23,0.15);
  text-shadow: 0 0 6px rgba(212,160,23,0.3);
}

.assets-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.assets-sort-select {
  font-size: 11px;
  padding: 4px 8px;
  background: var(--bg-0);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.assets-view-toggle {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-0);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.1s;
}
.assets-view-toggle:hover { border-color: var(--border-light); color: var(--text); }

/* Filters row */
.asset-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  flex-shrink: 0;
  min-height: 32px;
}

.asset-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  color: var(--text);
}
.asset-filter-chip.similar-chip {
  background: linear-gradient(135deg, rgba(212,160,23,0.15), rgba(212,160,23,0.08));
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 10px rgba(212,160,23,0.15);
  text-shadow: 0 0 6px rgba(212,160,23,0.3);
}
.asset-filter-chip-label { color: var(--text-muted); }
.asset-filter-chip-x {
  font-size: 12px;
  line-height: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  min-width: 24px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.asset-filter-chip-x:hover { color: var(--text); }

.asset-filter-add-btn {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border: 1px dashed var(--border-light);
  border-radius: 12px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.1s;
}
.asset-filter-add-btn:hover { border-color: var(--text-muted); color: var(--text-dim); }

.asset-filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  margin-top: 4px;
  min-width: 140px;
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  padding: 4px 0;
}

.asset-filter-dropdown-menu {
  display: flex;
  flex-direction: column;
}

.asset-filter-dropdown-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 11px;
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.08s;
}
.asset-filter-dropdown-item:hover { background: var(--bg-hover); }

.asset-filter-dropdown-back {
  display: block;
  width: 100%;
  padding: 5px 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
}
.asset-filter-dropdown-back:hover { color: var(--text); }

.asset-filter-clear-all {
  font-size: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  padding: 0 4px;
}
.asset-filter-clear-all:hover { color: var(--text); }

/* Browser body — content + inspector side by side */
.assets-browser-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.assets-browser-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 16px;
}

/* Grid view */
.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
}

.asset-card {
  animation: cardFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Asset card */
.asset-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s ease-out, box-shadow 0.15s ease-out;
}
.asset-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}
.asset-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 20px rgba(212,160,23,0.15);
}

.asset-card-image {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-0);
  overflow: hidden;
}
.asset-card-image img,
.asset-card-image video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.15s ease-out;
}
.asset-card:hover .asset-card-image img,
.asset-card:hover .asset-card-image video {
  filter: brightness(1.08);
}
.asset-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 10px;
}

.asset-card-world-dot {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.4);
  box-shadow: 0 0 6px currentColor;
}

.asset-card-source-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  background: rgba(0,0,0,0.65);
  color: var(--text-dim);
  border-radius: 3px;
}

.asset-card-score-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  padding: 2px 6px;
  background: rgba(0,0,0,0.75);
  border-radius: 3px;
  letter-spacing: -0.02em;
  text-shadow: 0 0 8px currentColor;
}

.asset-card-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  gap: 4px;
  min-height: 22px;
}

.asset-card-scene {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.asset-card-slot {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  flex: 1;
  min-width: 0;
}

/* List view */
.assets-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.asset-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  background: var(--bg-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.08s;
}
.asset-list-row:hover { background: var(--bg-hover); border-color: var(--border); }
.asset-list-row.selected { border-color: var(--gold); background: var(--gold-dim); }

.asset-list-thumb {
  width: 48px;
  height: 27px;
  flex-shrink: 0;
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg-0);
}
.asset-list-thumb img,
.asset-list-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.asset-list-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 10px;
}

.asset-list-name {
  font-size: 11px;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-list-scene {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-muted);
  min-width: 56px;
}

.asset-list-world {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  min-width: 56px;
}

.world-dot-sm {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.asset-list-source {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  min-width: 36px;
}

.asset-list-score {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  min-width: 36px;
  text-align: right;
}

/* Asset inspector */
.asset-inspector {
  position: relative;
  width: 320px;
  flex-shrink: 0;
  border-left: 2px solid var(--gold);
  background: var(--bg-1);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  padding-top: 40px; /* space for absolute close button */
  display: none;
  box-shadow: -8px 0 24px rgba(0,0,0,0.3);
}

.assets-browser.inspector-open .asset-inspector {
  display: block;
  animation: inspectorSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes inspectorSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.asset-inspector-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
}
.asset-inspector-close:hover { color: var(--text); border-color: var(--border-light); }

.asset-inspector > * + * {
  margin-top: 12px;
}

.asset-inspector-preview {
  cursor: zoom-in;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-0);
}
.asset-inspector-preview img,
.asset-inspector-preview video {
  width: 100%;
  display: block;
  border-radius: 3px;
  cursor: zoom-in;
  transition: filter 0.15s ease-out;
}
.asset-inspector-preview:hover img,
.asset-inspector-preview:hover video {
  filter: brightness(1.05);
}

.asset-inspector-identity {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.inspector-scene-id {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--gold);
}

.inspector-source-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
}

.inspector-world-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.asset-inspector-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

/* Inspector scores */
.inspector-scores {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.inspector-composite {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.inspector-composite-value {
  font-size: 32px;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
}
.inspector-composite-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.inspector-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inspector-score-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  min-width: 46px;
  font-family: var(--font-mono);
}

.inspector-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-0);
  border-radius: 3px;
  overflow: hidden;
}

.inspector-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 4px currentColor;
}

.inspector-score-val {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  min-width: 32px;
  text-align: right;
}

.inspector-no-scores {
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  font-style: italic;
}

.inspector-scores-loading {
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px;
}

/* Inspector sections */
.inspector-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.inspector-scene-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.inspector-scene-chip {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-0);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.1s;
}
.inspector-scene-chip:hover {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 8px rgba(212,160,23,0.2);
  transform: translateY(-1px);
}

.inspector-similar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.inspector-similar-thumb {
  aspect-ratio: 16 / 9;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-0);
  border: 1px solid var(--border);
}
.inspector-similar-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.inspector-similar-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 10px;
}

/* Inspector: partial score label */
.inspector-partial-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--amber);
  padding: 4px 8px;
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

/* Inspector: animation prompt */
.inspector-generate-btn {
  width: 100%;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, rgba(196,90,44,0.15), rgba(196,90,44,0.08));
  border: 1px solid var(--ember);
  border-radius: var(--radius-sm);
  color: var(--ember);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.inspector-generate-btn:hover {
  background: linear-gradient(180deg, rgba(196,90,44,0.25), rgba(196,90,44,0.12));
  box-shadow: 0 0 10px rgba(196,90,44,0.2);
  transform: translateY(-1px);
}

.inspector-prompt-loading {
  font-size: 10px;
  color: var(--ember);
  padding: 8px 0;
  animation: promptPulse 1.5s ease-in-out infinite;
}

@keyframes promptPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.inspector-prompt-source {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-bottom: 4px;
}

.inspector-prompt-error {
  font-size: 10px;
  color: var(--ember);
  padding: 4px 0;
}

.inspector-prompt-result {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inspector-prompt-text {
  font-size: 10px;
  font-family: var(--font);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
}

.inspector-prompt-actions {
  display: flex;
  gap: 4px;
}

/* Inspector actions */
.inspector-actions {
  display: flex;
  gap: 6px;
}

.inspector-action-btn {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-0);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.1s;
  text-decoration: none;
  text-align: center;
}
.inspector-action-btn:hover {
  border-color: var(--ember);
  color: var(--ember);
  box-shadow: 0 0 8px rgba(196,90,44,0.2);
  transform: translateY(-1px);
}

/* Inspector metadata */
.inspector-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.inspector-meta-row {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  word-break: break-all;
}

/* Loading / empty / load more */
.assets-browser-loading {
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.assets-browser-empty {
  padding: 48px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.assets-browser-loadmore {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.1s;
}
.assets-browser-loadmore:hover { border-color: var(--border-light); color: var(--text); }

.assets-browser-count {
  padding: 8px 0;
  text-align: center;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Veo prompt section: elevated */
.inspector-veo-section {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--ember);
  border-radius: var(--radius);
  padding: 10px;
  margin: 0 -12px;
  width: calc(100% + 24px);
}
.inspector-veo-section .inspector-section-title {
  color: var(--ember);
}

/* ── Animations: Forge-heat micro-interactions ────────────────────── */

/* Card: staggered entrance using nth-child delay */
.assets-grid .asset-card:nth-child(n+5) { animation-delay: 0.04s; }
.assets-grid .asset-card:nth-child(n+9) { animation-delay: 0.08s; }
.assets-grid .asset-card:nth-child(n+13) { animation-delay: 0.12s; }
.assets-grid .asset-card:nth-child(n+17) { animation-delay: 0.16s; }
.assets-grid .asset-card:nth-child(n+21) { animation-delay: 0.20s; }

/* World dot: intensify glow on card hover */
.asset-card:hover .asset-card-world-dot {
  box-shadow: 0 0 10px currentColor, 0 0 3px currentColor;
  transition: box-shadow 0.15s ease-out;
}

/* Filter chip: enter with scale */
.asset-filter-chip {
  animation: chipEnter 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes chipEnter {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

/* Inspector score bars: animate width from 0 on mount */
.inspector-bar-fill {
  animation: barGrow 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes barGrow {
  from { width: 0 !important; }
}

/* Inspector composite: fade in with slight scale */
.inspector-composite-value {
  animation: compositeReveal 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.1s;
}

@keyframes compositeReveal {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Inspector similar thumbnails: staggered entrance */
.inspector-similar-thumb {
  animation: simThumbIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.inspector-similar-thumb:nth-child(2) { animation-delay: 0.05s; }
.inspector-similar-thumb:nth-child(3) { animation-delay: 0.1s; }
.inspector-similar-thumb:nth-child(4) { animation-delay: 0.15s; }

@keyframes simThumbIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Scene suggestion chips: staggered entrance */
.inspector-scene-chip {
  animation: chipEnter 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.inspector-scene-chip:nth-child(2) { animation-delay: 0.05s; }
.inspector-scene-chip:nth-child(3) { animation-delay: 0.1s; }

/* Source badge: fade in on card load */
.asset-card-source-badge {
  animation: badgeFadeIn 0.2s ease-out 0.1s both;
}

@keyframes badgeFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Toolbar tab: active state transition */
.assets-toolbar-tab {
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Load more button: pulse hint */
.assets-browser-loadmore {
  animation: loadMorePulse 2s ease-in-out infinite;
}

@keyframes loadMorePulse {
  0%, 100% { border-color: var(--border); }
  50% { border-color: var(--border-light); }
}

/* Inspector backdrop — mobile only (dark overlay + tap-to-close).
   On desktop, close via Esc key or close button — no backdrop needed. */
.asset-inspector-backdrop {
  display: none;
}

@media (max-width: 1024px) {
  .assets-browser.inspector-open .asset-inspector-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(0,0,0,0.5);
  }
}

/* ── Assets Browser: Tablet (< 1024px) ───────────────────────────── */
@media (max-width: 1024px) {
  /* Inspector becomes a slide-over overlay instead of side-by-side */
  .asset-inspector {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 340px;
    z-index: 200;
    box-shadow: -12px 0 40px rgba(0,0,0,0.5);
  }
  .assets-browser.inspector-open .assets-browser-content {
    /* Grid stays full width — inspector overlays */
    flex: 1;
  }

  /* Toolbar wraps search to its own line */
  .assets-toolbar {
    flex-wrap: wrap;
    gap: 6px;
  }
  .assets-search-input {
    width: 100%;
    order: -1;
  }

  /* Grid: 3 columns at most */
  .assets-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 5px;
  }
}

/* ── Assets Browser: Phone (< 768px) ─────────────────────────────── */
@media (max-width: 768px) {
  /* Inspector goes full-screen */
  .asset-inspector {
    width: 100%;
    left: 0;
  }

  /* Grid: 2 columns */
  .assets-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  /* Toolbar tabs scroll horizontally */
  .assets-toolbar-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .assets-toolbar-tabs::-webkit-scrollbar { display: none; }

  /* Tabs and controls: larger touch targets */
  .assets-toolbar-tab {
    padding: 6px 12px;
    font-size: 11px;
    flex-shrink: 0;
  }
  .assets-sort-select {
    padding: 6px 10px;
    font-size: 12px;
  }
  .assets-view-toggle {
    padding: 6px 10px;
    font-size: 11px;
  }

  /* Filter chips: larger touch targets */
  .asset-filter-chip {
    padding: 4px 10px;
    font-size: 11px;
  }
  .asset-filter-chip-x {
    font-size: 14px;
    padding: 2px 4px;
  }
  .asset-filter-add-btn {
    padding: 4px 10px;
    font-size: 11px;
  }

  /* Card info bar: slightly larger text */
  .asset-card-info {
    padding: 5px 8px;
    min-height: 26px;
  }
  .asset-card-scene { font-size: 10px; }
  .asset-card-slot { font-size: 10px; }

  /* Score badge: larger for touch */
  .asset-card-score-badge {
    font-size: 12px;
    padding: 3px 7px;
  }

  /* List row: taller for touch */
  .asset-list-row {
    padding: 8px 10px;
    gap: 8px;
  }
  .asset-list-thumb {
    width: 56px;
    height: 32px;
  }

  /* Inspector: full-screen with close button more prominent */
  .asset-inspector-close {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }

  /* Inspector composite: still dominant */
  .inspector-composite-value {
    font-size: 28px;
  }

  /* Inspector actions: fill width */
  .inspector-actions {
    flex-wrap: wrap;
  }
  .inspector-action-btn {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    font-size: 11px;
  }

  /* List view: hide less important columns */
  .asset-list-world,
  .asset-list-source {
    display: none;
  }
}

/* ── Assets Browser: Very small phone (< 400px) ──────────────────── */
@media (max-width: 400px) {
  .assets-grid {
    grid-template-columns: 1fr;
  }
  .assets-toolbar-right {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }
}

/* ── Reduced motion ───────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .asset-card,
  .asset-filter-chip,
  .inspector-bar-fill,
  .inspector-composite-value,
  .inspector-similar-thumb,
  .inspector-scene-chip,
  .asset-card-source-badge,
  .asset-card-score-badge,
  .assets-browser-loadmore {
    animation: none !important;
  }
  .asset-card:hover,
  .inspector-scene-chip:hover,
  .inspector-action-btn:hover {
    transform: none !important;
  }
  .assets-browser.inspector-open .asset-inspector {
    animation: none !important;
  }
  .inspector-bar-fill {
    transition: none !important;
  }
  .ref-card,
  .refs-view.inspector-open .ref-inspector,
  .ref-inspector > *,
  .refs-skeleton-card,
  .refs-skeleton-row,
  .ref-inspector-preview.upload-success {
    animation: none !important;
  }
  .ref-card:hover {
    transform: none !important;
  }
  .ref-inspector-upload-progress {
    animation: none !important;
  }
}

/* ── Refs View — Canon Manager ──────────────────────────────────── */

.refs-view {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.refs-sidebar {
  width: 160px;
  flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 8px 0;
}

.refs-sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  border-left: 2px solid transparent;
}
.refs-sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.refs-sidebar-item.active {
  border-left-color: var(--gold);
  background: var(--gold-dim);
  color: var(--gold);
  box-shadow: inset 2px 0 8px rgba(212,160,23,0.08);
}
.refs-sidebar-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.refs-sidebar-count {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-muted);
  min-width: 20px;
  text-align: right;
}
.refs-sidebar-item.active .refs-sidebar-count {
  color: var(--gold);
}

.refs-sidebar-divider {
  border-top: 1px solid var(--border);
  margin: 8px 12px;
}

.refs-sidebar-filter {
  padding: 4px 12px;
}
.refs-filter-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.refs-filter-select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 10px;
  padding: 4px 6px;
}
.refs-filter-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 0;
}
.refs-filter-checkbox input[type="checkbox"] {
  accent-color: var(--gold);
  cursor: pointer;
}

/* Refs main content area */
.refs-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 12px 16px;
}

.refs-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  color: var(--text-dim);
  font-size: 12px;
}

.refs-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-align: center;
}

/* Skeleton loading — forge shimmer */
.refs-skeleton {
  padding: 16px;
}
.refs-skeleton-row {
  height: 14px;
  width: 120px;
  background: var(--bg-3);
  border-radius: 3px;
  margin-bottom: 12px;
  animation: forgeShimmer 1.4s ease-in-out infinite;
}
.refs-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.refs-skeleton-card {
  aspect-ratio: 1 / 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: forgeShimmer 1.4s ease-in-out infinite;
}
.refs-skeleton-card:nth-child(2) { animation-delay: 0.1s; }
.refs-skeleton-card:nth-child(3) { animation-delay: 0.2s; }
.refs-skeleton-card:nth-child(4) { animation-delay: 0.3s; }
.refs-skeleton-card:nth-child(5) { animation-delay: 0.4s; }
.refs-skeleton-card:nth-child(6) { animation-delay: 0.5s; }
@keyframes forgeShimmer {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* Refs grid */
.refs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

/* Category section headings (All view) */
.refs-category-section {
  margin-bottom: 20px;
}
.refs-category-heading {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.refs-category-count {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ── Ref Card ────────────────────────────────────────────────────── */

.ref-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.15s ease-out;
  animation: refCardEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes refCardEnter {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.ref-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35), 0 0 0 1px rgba(212,160,23,0.06);
}
.ref-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 20px rgba(212,160,23,0.15);
}
.ref-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.ref-card-image {
  position: relative;
  background: var(--bg-0);
  overflow: hidden;
}
.ref-card-image.square {
  aspect-ratio: 1 / 1;
}
.ref-card-image.landscape {
  aspect-ratio: 16 / 9;
}
.ref-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.15s ease-out;
}
.ref-card:hover .ref-card-image img {
  filter: brightness(1.08);
}
.ref-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 10px;
}

.ref-card-canon-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  background: rgba(0,0,0,0.65);
  color: var(--gold);
  border-radius: 3px;
}

.ref-card-scene-count {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  background: rgba(0,0,0,0.65);
  color: var(--text-dim);
  border-radius: 3px;
}
.ref-card-scene-count.unlinked {
  color: var(--ember);
}

.ref-card-info {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ref-card-name {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ref-card-category {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.ref-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ref-card-versions {
  font-size: 9px;
  color: var(--text-dim);
}
.ref-card-scenes-summary {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.ref-card-overrides {
  font-size: 8px;
  font-weight: 600;
  color: var(--amber);
  letter-spacing: 0.02em;
}

/* ── Ref Inspector ───────────────────────────────────────────────── */

.ref-inspector {
  position: relative;
  width: 320px;
  flex-shrink: 0;
  border-left: 2px solid var(--gold);
  background: var(--bg-1);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  padding-top: 40px;
  display: none;
  box-shadow: -8px 0 24px rgba(0,0,0,0.3);
}

.refs-view.inspector-open .ref-inspector {
  display: block;
  animation: inspectorSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Inspector section cascade — staggered reveal */
.ref-inspector > * {
  animation: inspectorSectionEnter 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ref-inspector > *:nth-child(1) { animation-delay: 0s; }
.ref-inspector > *:nth-child(2) { animation-delay: 0.04s; }
.ref-inspector > *:nth-child(3) { animation-delay: 0.08s; }
.ref-inspector > *:nth-child(4) { animation-delay: 0.12s; }
.ref-inspector > *:nth-child(5) { animation-delay: 0.16s; }
.ref-inspector > *:nth-child(6) { animation-delay: 0.2s; }
.ref-inspector > *:nth-child(n+7) { animation-delay: 0.24s; }
@keyframes inspectorSectionEnter {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

.ref-inspector > * + * {
  margin-top: 12px;
}

.ref-inspector-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
}
.ref-inspector-close:hover {
  color: var(--text);
  border-color: var(--border-light);
}

.ref-inspector-preview {
  cursor: zoom-in;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-0);
}
.ref-inspector-preview.broken {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  cursor: default;
}
.ref-inspector-no-image {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ref-inspector-preview img {
  width: 100%;
  display: block;
  border-radius: 3px;
  cursor: zoom-in;
  transition: filter 0.15s ease-out;
}
.ref-inspector-preview:hover img {
  filter: brightness(1.05);
}
/* Upload success flash — gold heat pulse */
.ref-inspector-preview.upload-success {
  animation: uploadSuccessFlash 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes uploadSuccessFlash {
  0% { box-shadow: 0 0 0 0 rgba(212,160,23,0); }
  30% { box-shadow: 0 0 0 3px rgba(212,160,23,0.5), 0 0 20px rgba(212,160,23,0.2); }
  100% { box-shadow: 0 0 0 0 rgba(212,160,23,0); }
}

.ref-inspector-identity {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ref-inspector-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  word-break: break-word;
}
.ref-inspector-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ref-inspector-category-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
}
.ref-inspector-canon-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  background: var(--gold-dim);
  border: 1px solid rgba(212,160,23,0.3);
  border-radius: 3px;
  color: var(--gold);
}

.ref-inspector-unlinked {
  font-size: 11px;
  color: var(--ember);
  padding: 8px;
  background: var(--ember-dim);
  border: 1px solid rgba(196,90,44,0.2);
  border-radius: var(--radius);
  text-align: center;
}

/* Ref inspector: versions row */
.ref-inspector-versions {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.ref-inspector-version-thumb {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-0);
  border: 1px solid var(--border);
  cursor: zoom-in;
  transition: border-color 0.1s;
}
.ref-inspector-version-thumb:hover {
  border-color: var(--border-light);
}
.ref-inspector-version-thumb.current {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}
.ref-inspector-version-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ref-version-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 10px;
  font-family: var(--font-mono);
}

/* Ref inspector: related chips */
.ref-inspector-related {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ref-inspector-related-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-0);
  color: var(--text-dim);
}

/* Ref inspector: overrides list */
.ref-inspector-overrides {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ref-inspector-override-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ref-override-scene {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-dim);
  min-width: 56px;
}
.ref-override-thumb {
  width: 48px;
  height: 27px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg-0);
  border: 1px solid var(--border);
}
.ref-override-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Ref inspector: upload area */
.ref-inspector-upload {
  padding: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ref-inspector-upload-label {
  font-size: 10px;
  color: var(--text-dim);
  cursor: pointer;
}
.ref-inspector-upload-label input[type="file"] {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-muted);
}
.ref-inspector-upload-cancel {
  align-self: flex-start;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-3);
  color: var(--text-muted);
  cursor: pointer;
}
.ref-inspector-upload-cancel:hover {
  border-color: var(--border-light);
  color: var(--text);
}
.ref-inspector-upload-progress {
  font-size: 10px;
  color: var(--gold);
  text-align: center;
  padding: 8px 0;
  animation: uploadPulse 1.2s ease-in-out infinite;
}
@keyframes uploadPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
/* Override scene chips — amber accent */
.inspector-scene-chip.override {
  border-color: rgba(251,191,36,0.3);
  color: var(--amber);
}
.inspector-scene-chip.override:hover {
  border-color: var(--amber);
  color: var(--amber);
  box-shadow: 0 0 8px rgba(251,191,36,0.2);
}
/* Secondary action button — lower visual weight */
.inspector-action-btn.secondary {
  border-color: transparent;
  color: var(--text-muted);
  background: transparent;
}
.inspector-action-btn.secondary:hover {
  border-color: var(--border);
  color: var(--text-dim);
  box-shadow: none;
  transform: none;
}
.inspector-action-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ── Refs View: Responsive ──────────────────────────────────────── */

@media (max-width: 900px) {
  .refs-sidebar {
    width: 120px;
  }
  .refs-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

@media (max-width: 640px) {
  .refs-view {
    flex-direction: column;
  }
  .refs-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 6px;
    gap: 4px;
  }
  .refs-sidebar-item {
    padding: 4px 8px;
    border-left: none;
    border-bottom: 2px solid transparent;
  }
  .refs-sidebar-item.active {
    border-left-color: transparent;
    border-bottom-color: var(--gold);
  }
  .refs-sidebar-divider {
    display: none;
  }
  .refs-sidebar-filter {
    padding: 2px 6px;
  }
  .ref-inspector {
    width: 100%;
    border-left: none;
    border-top: 2px solid var(--gold);
    max-height: 50vh;
  }
}
