/* Scenes — pill tabs in header, create menu, transitions panel.
   Matches the existing app vocabulary: monospace eyebrows, teal accent
   on selection, var(--bg-*) surfaces, var(--border-*) hairlines. */

/* ---------- Scene tabs ---------- */
.scene-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid var(--border-1);
  min-width: 0;
  /* Fill remaining header width so chips have room to lay out. When
     they overflow, wrap to a new row below — header grows with content. */
  flex: 1 1 0;
  flex-wrap: wrap;
  row-gap: 6px;
}

.scene-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px;
  height: 22px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--fg-2);
  transition: background var(--dur-fast), border-color var(--dur-fast),
              color var(--dur-fast), transform var(--dur-fast);
  white-space: nowrap;
  user-select: none;
  max-width: 200px;
  flex: none;
}
.scene-tab.dragging {
  opacity: 0.45;
  cursor: grabbing;
}
.scene-tab.drop-target {
  border-color: var(--teal-400);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--teal-400) 35%, transparent);
}
.scene-tab:hover { background: var(--bg-3); color: var(--fg-1); }
.scene-tab.active {
  background: color-mix(in oklab, var(--teal-400) 14%, var(--bg-2));
  border-color: var(--teal-400);
  color: var(--fg-0);
}
/* Only tighten the right padding when there's actually a close button
   inside the active tab — otherwise the chip stays symmetric. */
.scene-tab.active:has(.scene-tab-close) { padding-right: 6px; }
.scene-tab-name {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.scene-tab.auto .scene-tab-name { letter-spacing: 0.005em; }
/* While the agent is analyzing, the chip text rotates through stage
   labels. Soft fade keeps the cycling from feeling jumpy. */
.scene-tab-name.thinking {
  font-style: italic;
  opacity: 0.85;
  transition: opacity 0.18s ease;
}

.scene-tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--fg-3);
  flex: none;
}
.scene-tab-dot.analyzing {
  background: var(--teal-400);
  animation: scenePulse 1.2s ease-in-out infinite;
}
.scene-tab-dot.ready { background: var(--teal-400); }
.scene-tab-dot.error { background: var(--color-danger, #e25555); }
@keyframes scenePulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

.scene-tab-input {
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--fg-0);
  font: inherit;
  width: 130px;
  padding: 0;
}

.scene-tab-close {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--fg-2);
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  margin-left: 2px;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.scene-tab-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg-0);
}

.scene-tab-plus {
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  flex: none;
  background: transparent;
  border: 1px dashed var(--border-2);
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast),
              color var(--dur-fast);
}
.scene-tab-plus:hover,
.scene-tab-plus.open {
  border-color: var(--teal-400);
  color: var(--teal-400);
  background: color-mix(in oklab, var(--teal-400) 8%, transparent);
}

/* ---------- Create-scene popdown ---------- */
.scene-create-menu {
  z-index: 60;
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 12px;
  width: 480px;
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(12px);
}

.scene-create-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.scene-create-card {
  appearance: none;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  cursor: pointer;
  color: var(--fg-1);
  transition: background var(--dur-fast), border-color var(--dur-fast),
              transform var(--dur-fast);
}
.scene-create-card:hover {
  background: var(--bg-3);
  border-color: var(--teal-400);
  transform: translateY(-1px);
}
/* Guest mode disables the Automated card. Locks the card visually
   (dimmer, no hover lift, padlock cursor) and the click handler short-
   circuits in JS. The server-side /SceneAgent endpoint also requires
   an OAuth session, so even DevTools can't actually run the agent. */
.scene-create-card.locked,
.scene-create-card.locked:hover {
  background: var(--bg-2);
  border-color: var(--border-1);
  color: var(--fg-3);
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}
.scene-create-card.locked .scene-create-title {
  color: var(--fg-3);
}
.scene-create-card.locked .scene-create-sub {
  color: var(--fg-4);
}
.scene-create-card.locked .scene-create-icon {
  background: var(--bg-1);
  color: var(--fg-4);
}

.scene-create-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-0);
  border: 1px solid var(--border-1);
  color: var(--teal-400);
  margin-bottom: 2px;
}

.scene-create-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-0);
}
.scene-create-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-3);
  line-height: 1.45;
}

.scene-create-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scene-create-form-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 2px;
}
.scene-create-form-title::before { content: '// '; color: var(--fg-4); }

.scene-create-input {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  color: var(--fg-1);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 10px;
  outline: 0;
}
.scene-create-input:focus { border-color: var(--teal-400); }
.scene-create-input::placeholder { color: var(--fg-4); }

.scene-create-form-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-3);
  line-height: 1.5;
  padding: 2px 2px 4px;
}
.scene-create-form-hint::before { content: '// '; color: var(--fg-4); }

.scene-create-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}
.scene-create-btn,
.scene-create-btn-ghost {
  appearance: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--r-sm);
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast),
              color var(--dur-fast);
}
.scene-create-btn {
  background: var(--teal-400);
  border: 1px solid var(--teal-400);
  color: var(--bg-0);
  font-weight: 600;
}
.scene-create-btn:hover:not(:disabled) {
  background: var(--teal-500, var(--teal-400));
}
.scene-create-btn:disabled {
  background: var(--bg-3);
  border-color: var(--border-2);
  color: var(--fg-4);
  cursor: not-allowed;
}
.scene-create-btn-ghost {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--fg-2);
}
.scene-create-btn-ghost:hover {
  border-color: var(--fg-2);
  color: var(--fg-0);
}
.scene-create-btn-ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.scene-create-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* OR divider between the URL input and the ZIP drop zone. */
.scene-create-or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--fg-4);
}
.scene-create-or::before,
.scene-create-or::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--border-2);
}

/* ZIP drop zone — dashed-border target with icon + two-line hint. */
.scene-create-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 12px;
  background: var(--bg-0);
  border: 1px dashed var(--border-2);
  border-radius: var(--r-sm);
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  outline: 0;
  transition: border-color var(--dur-fast), color var(--dur-fast),
              background var(--dur-fast);
}
.scene-create-dropzone:hover,
.scene-create-dropzone:focus-visible,
.scene-create-dropzone.over {
  border-color: var(--teal-400);
  color: var(--fg-1);
  background: rgba(45, 212, 160, 0.04);
}
.scene-create-dropzone svg { color: var(--teal-400); }
.scene-create-dropzone-primary {
  font-size: 12px;
  color: var(--fg-1);
  letter-spacing: 0.04em;
}
.scene-create-dropzone-secondary {
  font-size: 10.5px;
  color: var(--fg-4);
}

/* Selected-file chip shown after a ZIP is dropped/picked. */
.scene-create-zipchip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 10px;
  background: var(--bg-0);
  border: 1px solid var(--teal-400);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-1);
}
.scene-create-zipchip-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scene-create-zipchip-size {
  flex: 0 0 auto;
  color: var(--fg-3);
  font-size: 10.5px;
}
.scene-create-zipchip-x {
  flex: 0 0 auto;
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--fg-3);
  font-size: 16px;
  line-height: 1;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  cursor: pointer;
}
.scene-create-zipchip-x:hover:not(:disabled) {
  background: var(--bg-3);
  color: var(--fg-0);
}
.scene-create-zipchip-x:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.scene-create-form-error {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #ff8b9c;
  padding: 0 2px;
}

/* ---------- Scene transitions panel (below right rail) ---------- */
/* The panel publishes its actual rendered height to --bb-anim-panel-h
   on <html> via ResizeObserver. The rail's bottom edge tracks the
   panel's top minus a constant 12px gap — so the visual gap between
   the two panels stays identical whether the panel is collapsed or
   expanded, regardless of how tall the open panel actually is. */
.right-rail.with-transitions {
  bottom: calc(20px + var(--bb-anim-panel-h, 45px) + 12px);
  height: auto;
  transition: bottom var(--dur-med) var(--ease-out);
}

.scene-transitions {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 320px;
  z-index: 25;
  background: rgba(17, 22, 29, 0.92);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(12px);
  overflow: hidden;
  /* Cap so a tall list doesn't push the rail off-screen. */
  max-height: 60vh;
  display: flex;
  flex-direction: column;
}

.scene-transitions-header {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.scene-transitions.open .scene-transitions-header {
  border-bottom-color: var(--border-1);
}
.scene-transitions-header:hover { background: rgba(45, 212, 160, 0.04); }

.scene-transitions-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-1);
  flex: 1;
}
.scene-transitions-title::before { content: '// '; color: var(--fg-3); }

.scene-transitions-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-3);
}

.scene-transitions-caret {
  display: inline-flex;
  color: var(--fg-3);
  transition: transform var(--dur-med) var(--ease-out);
}
.scene-transitions:not(.open) .scene-transitions-caret { transform: rotate(-90deg); }

.scene-transitions-body {
  padding: 12px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.scene-transitions-from {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-3);
  margin-bottom: 2px;
}
.scene-transitions-from strong { color: var(--fg-0); font-weight: 600; }

/* The // Export panel's title bar is now static (no toggle) — just shows
   the panel name. Apply hover-disable so it doesn't read as clickable. */
.scene-transitions-header.static {
  cursor: default;
}
.scene-transitions-header.static:hover { background: transparent; }

/* Accordion subsections inside the // Export panel — STATIC + ANIMATED.
   Header styling mirrors .rail-section-header in the right rail (teal
   monospace title, caret rotates on closed). At most one open at a time. */
.scene-transitions-sub + .scene-transitions-sub {
  border-top: 1px solid var(--border-1);
}
.scene-transitions-sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 36px;
  padding: 0 4px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  transition: background var(--dur-fast) var(--ease-out);
}
.scene-transitions-sub-header:hover { background: rgba(45, 212, 160, 0.04); }
.scene-transitions-sub-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-400);
}
.scene-transitions-sub-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-3);
  transform: rotate(0deg);
  transition: transform var(--dur-med) var(--ease-out), color var(--dur-fast);
}
.scene-transitions-sub.closed .scene-transitions-sub-caret { transform: rotate(-90deg); }
.scene-transitions-sub-header:hover .scene-transitions-sub-caret { color: var(--teal-400); }
.scene-transitions-sub-body {
  padding: 4px 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scene-transitions-empty {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  padding: 8px 4px;
  border: 1px dashed var(--border-1);
  border-radius: var(--r-sm);
  text-align: center;
}

.scene-transition-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--border-1);
}
.scene-transition-row:first-of-type { border-top: 0; padding-top: 4px; }

.scene-transition-target {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--fg-1);
  font-weight: 500;
}

.scene-transition-controls {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 56px auto;
  gap: 6px;
  align-items: center;
}

.scene-transition-select,
.scene-transition-num {
  appearance: none;
  background: var(--bg-0);
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  color: var(--fg-1);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 7px;
  outline: 0;
}
.scene-transition-select:focus,
.scene-transition-num:focus { border-color: var(--teal-400); }

.scene-transition-num {
  width: 100%;
  text-align: right;
  -moz-appearance: textfield;
}
.scene-transition-num::-webkit-outer-spin-button,
.scene-transition-num::-webkit-inner-spin-button { display: none; }

.scene-transition-unit {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
}

.scene-transitions-export {
  appearance: none;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 0;
  padding: 8px 12px;
  background: color-mix(in oklab, var(--teal-400) 12%, var(--bg-2));
  border: 1px solid var(--teal-400);
  border-radius: var(--r-sm);
  color: var(--fg-0);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.scene-transitions-export:hover:not(:disabled) {
  background: color-mix(in oklab, var(--teal-400) 22%, var(--bg-2));
}
.scene-transitions-export:disabled {
  cursor: not-allowed;
}
.scene-transitions-export.scene-transitions-assembly:disabled {
  opacity: 0.45;
  border-style: dashed;
}
.scene-transitions-export.scene-transitions-disassembly:disabled {
  /* Disassembly is disabled while in flight — keep it looking active so
     the progress bar reads as the primary affordance. */
  opacity: 1;
}
.scene-transitions-export svg { color: var(--teal-400); }
.scene-transitions-export-content {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.scene-transitions-progress {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: color-mix(in oklab, var(--teal-400) 28%, transparent);
  z-index: 0;
  pointer-events: none;
}

/* ---------- Scene preview animations ---------- */
/* Per-block orchestrated transition. App.jsx drives a RAF tick that:
   - lerps canvas.W/D/H so the wireframe frame morphs smoothly;
   - tags each block with a `_previewRole` (exit/persist/enter) and
     applies inline transform+opacity on a wrapper <g>.
   The CSS here is mostly for the wrapper performance hint and the
   preview-mode "frame" affordance. */

.stage-anim {
  position: relative;
  transform-origin: 50% 50%;
}

.bb-block-anim {
  will-change: transform, opacity;
}
.bb-block-exit,
.bb-block-enter {
  /* Inline style on each <g> sets transform/opacity per-frame; this
     class just hints to the GPU. */
  pointer-events: none;
}

/* Preview button — primary accent, like Export was. */
.scene-transitions-export svg polygon { fill: var(--teal-400); }

/* ---- Webflow export subsection ---- */
.scene-transitions-webflow {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.webflow-attr-input,
.webflow-scene-name {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--ink-100, #e6e6e6);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  font-size: 12px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.webflow-attr-input:focus,
.webflow-scene-name:focus {
  border-color: var(--teal-400, #2dd4a0);
}
.webflow-scenes-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.webflow-scene-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.webflow-scene-row.off .webflow-scene-label,
.webflow-scene-row.off .webflow-scene-name { opacity: 0.45; }
.webflow-scene-check {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  min-width: 0;
}
.webflow-scene-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scene-transitions-webflow-export {
  margin-top: 4px;
}
.webflow-embed-fonts {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  cursor: pointer;
}
.webflow-embed-fonts-label {
  white-space: nowrap;
}
.webflow-embed-fonts-help {
  font-size: 11px;
  line-height: 1.4;
  color: rgba(230,230,230,0.55);
}
.webflow-logo-url-input {
  font-size: 11px;
  text-overflow: ellipsis;
}

/* ---- Webflow export result modal ---- */
.bb-webflow-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}
.bb-webflow-modal-card {
  background: #16181c;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  width: min(900px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.bb-webflow-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.bb-webflow-modal-instructions {
  padding: 10px 16px;
  font-size: 12px;
  color: rgba(230,230,230,0.7);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  line-height: 1.5;
}
.bb-webflow-modal-instructions code {
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 4px;
}
.bb-webflow-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 16px;
  overflow: auto;
}
.bb-webflow-modal-textarea {
  width: 100%;
  height: 360px;
  background: #0e1014;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: #cfcfcf;
  padding: 10px;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
  box-sizing: border-box;
}
.bb-webflow-modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.bb-webflow-modal-btn {
  background: rgba(255,255,255,0.04);
  color: var(--ink-100, #e6e6e6);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 12px;
  cursor: pointer;
}
.bb-webflow-modal-btn.primary {
  background: var(--teal-400, #2dd4a0);
  color: #0d1114;
  border-color: transparent;
}
.bb-webflow-modal-btn:hover { filter: brightness(1.1); }
