/* Cutflux beat timeline — studio UI */
:root {
  --sb-bg: #06080f;
  --sb-panel: #0c1018;
  --sb-panel-2: #121820;
  --sb-border: rgba(255, 255, 255, 0.08);
  --sb-text: #eef2f8;
  --sb-dim: #8b95a8;
  --sb-accent: #3d8ef0;
  --sb-accent-2: #6b5cff;
  --sb-warn: #f5a623;
  --sb-ok: #3fcb7e;
  --sb-pink: #ff4d8d;
  --sb-blue: #4a9cf5;
  --sb-yellow: #f0c030;
  --sb-mono: "JetBrains Mono", ui-monospace, monospace;
  --sb-track-label: 52px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--sb-bg);
  color: var(--sb-text);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse 720px 420px at 50% -8%, rgba(74, 139, 232, 0.14), transparent 68%),
    var(--sb-bg);
}

a {
  color: var(--sb-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.sb-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 18px 48px;
}

.sb-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 14px;
  margin-bottom: 20px;
  border-radius: 12px;
  border: 1px solid rgba(74, 139, 232, 0.35);
  background: rgba(74, 139, 232, 0.08);
  font-size: 13px;
  line-height: 1.45;
}

.sb-banner strong {
  color: #7db0f0;
}

.sb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.sb-brand span {
  opacity: 0.55;
  font-weight: 600;
}

h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.sb-sub {
  margin: 0 0 20px;
  color: var(--sb-dim);
  font-size: 14px;
  line-height: 1.5;
}

.sb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--sb-accent), #1e3a6b);
  color: #fff;
}

.sb-btn.secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--sb-border);
  color: var(--sb-text);
}

.sb-log {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--sb-border);
  font-family: var(--sb-mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
}

/* Beat timeline panels */
.sb-bt-layout {
  max-width: 1200px;
}

.sb-bt-grid {
  display: grid;
  gap: 14px;
}

@media (min-width: 900px) {
  .sb-bt-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.sb-bt-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--sb-dim);
  margin-bottom: 6px;
}

.sb-bt-field input[type="file"] {
  width: 100%;
  font-size: 13px;
  color: var(--sb-dim);
}

.sb-bt-field input[type="range"] {
  width: 100%;
}

.sb-bt-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.sb-bt-steps .sb-btn {
  flex: 1 1 auto;
  min-width: 140px;
}

.sb-bt-steps .sb-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sb-bt-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 10px 0 0;
}

.sb-bt-progress > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--sb-accent), var(--sb-ok));
  transition: width 0.2s;
}

.sb-bt-preview-stack {
  margin-top: 16px;
  border-radius: 12px;
  border: 1px solid var(--sb-border);
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.sb-bt-preview {
  position: relative;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
  max-height: min(72vh, 760px);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.sb-bt-vlayer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  opacity: 0;
  z-index: 1;
  /* 16ms ≈ one frame at 60Hz: long enough to hide A/B-buffer swap flicker,
     short enough that beat-synced cuts feel snappy instead of soft-faded. */
  transition: opacity 0.016s linear;
  /* will-change: opacity hints the compositor to keep this on its own GPU
     layer without forcing a 3D rendering context (translateZ + backface-
     hidden) which can sub-pixel-blur the video texture on some GPUs. */
  will-change: opacity;
  pointer-events: none;
  /* Ask the browser for crisp downscaling rather than the default bilinear
     mush. high-quality lands on lanczos-ish on Chrome ≥87; the -webkit
     fallback nudges Safari toward sharper sampling. */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: high-quality;
}

.sb-bt-vlayer--active {
  opacity: 1;
  z-index: 2;
  pointer-events: none;
  /* Perceptual sharpening: a tiny contrast + saturation bump reads as a
     much sharper picture without actually upscaling the source. Keeps the
     compressed YouTube look from feeling washed-out at preview scale. */
  filter: contrast(1.04) saturate(1.06) brightness(1.01);
}

/* ── Anime4K-style preview upscaler (beat-timeline-upscale.js) ────────
   When CutfluxUpscale is enabled it appends #cfUpscaleCanvas to the
   #previewStage and adds .cf-upscale-on. We hide the underlying <video>
   layers visually (opacity 0) but keep them in the layout so they keep
   decoding frames + firing requestVideoFrameCallback. Remove this block
   and the module file to revert cleanly. */
.cf-upscale-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  background: transparent;
}
.sb-bt-preview.cf-upscale-on .sb-bt-vlayer {
  opacity: 0 !important;
}
.sb-bt-preview.cf-upscale-on .sb-bt-vlayer--active {
  opacity: 0 !important;
  filter: none;
}

.sb-bt-preview[data-fill="1"] .sb-bt-vlayer,
.sb-bt-player-card--fill .sb-bt-vlayer {
  object-fit: cover;
}

/* Pop-In (pip-pop) transition: snap-in inset on beat 1 over the still-playing
   outgoing clip; on beat 2 the sync engine removes these classes and the SAME
   clip snaps to fullscreen (no animation — instant, per the "snap not pop"
   spec). The slot at beat 2 is skipped; the pip clip occupies both beats. */
.sb-bt-vlayer--keep-behind {
  opacity: 1;
  z-index: 2;
}
.sb-bt-vlayer--pip-pop {
  z-index: 4;
  opacity: 1;
  /* Stay full-stage with the same object-fit as the base layer (so the video
     looks identical, just smaller) — scale the whole thing down from center.
     Using transform avoids adding any letterbox/background area, so it reads
     as "the video itself, just smaller" rather than a framed inset. */
  transform: translateZ(0) scale(0.42);
  transform-origin: center center;
}

/* 3-clip stagger pops (pip-diag-3 / pip-row-3 / pip-col-3).
   The active video layer gets one of `--pip-stagger-<layout>-<n>` (n=1..3)
   to pin it to that slot at 35% size. Previous slots show frozen frames
   via the ghost canvases below. Tile background is dark so the empty
   slots don't show whatever was on stage before the sequence began. */
.sb-bt-preview:has(.sb-bt-vlayer--pip-stagger),
.sb-bt-preview:has(.sb-bt-vghost--show) {
  background: #000;
}
@keyframes bt-pip-stagger-in {
  0%   { transform: scale(0.78); opacity: 0; }
  60%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}
.sb-bt-vlayer--pip-stagger {
  z-index: 5;
  opacity: 1;
  object-fit: cover;
  transition: none;
  animation: none;
}
.sb-bt-vlayer--pip-stagger-diag-1 { inset: 6% auto auto 6%;  width: 36%; height: 36%; }
.sb-bt-vlayer--pip-stagger-diag-2 { inset: 32% auto auto 32%;width: 36%; height: 36%; }
.sb-bt-vlayer--pip-stagger-diag-3 { inset: 58% auto auto 58%;width: 36%; height: 36%; }

.sb-bt-vlayer--pip-stagger-row-1  { inset: 30% auto auto 3%; width: 30%; height: 40%; }
.sb-bt-vlayer--pip-stagger-row-2  { inset: 30% auto auto 35%;width: 30%; height: 40%; }
.sb-bt-vlayer--pip-stagger-row-3  { inset: 30% auto auto 67%;width: 30%; height: 40%; }

.sb-bt-vlayer--pip-stagger-col-1  { inset: 3% auto auto 30%; width: 40%; height: 30%; }
.sb-bt-vlayer--pip-stagger-col-2  { inset: 35% auto auto 30%;width: 40%; height: 30%; }
.sb-bt-vlayer--pip-stagger-col-3  { inset: 67% auto auto 30%;width: 40%; height: 30%; }

/* Frozen-frame ghosts that hold the previous pip's last frame. Default
   hidden; only visible while a stagger sequence is in flight. */
.sb-bt-vghost {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
  background: #000;
  object-fit: cover;
  display: block;
}
.sb-bt-vghost--show { opacity: 1; }

.sb-bt-vghost--diag-1 { inset: 6% auto auto 6%;  width: 36%; height: 36%; }
.sb-bt-vghost--diag-2 { inset: 32% auto auto 32%;width: 36%; height: 36%; }
.sb-bt-vghost--diag-3 { inset: 58% auto auto 58%;width: 36%; height: 36%; }

.sb-bt-vghost--row-1  { inset: 30% auto auto 3%; width: 30%; height: 40%; }
.sb-bt-vghost--row-2  { inset: 30% auto auto 35%;width: 30%; height: 40%; }
.sb-bt-vghost--row-3  { inset: 30% auto auto 67%;width: 30%; height: 40%; }

.sb-bt-vghost--col-1  { inset: 3% auto auto 30%; width: 40%; height: 30%; }
.sb-bt-vghost--col-2  { inset: 35% auto auto 30%;width: 40%; height: 30%; }
.sb-bt-vghost--col-3  { inset: 67% auto auto 30%;width: 40%; height: 30%; }

/* Live-playback ghost videos — replace the frozen canvas frames so all three
   tiles of a row/col/diag stagger keep playing simultaneously. Default
   hidden; the sync engine flips them on/off per step. */
.sb-bt-vghost-vid {
  position: absolute;
  display: none;
  z-index: 4;
  background: #000;
  object-fit: cover;
  pointer-events: none;
  transform-origin: center center;
}
.sb-bt-vghost-vid.is-live { display: block; }
.sb-bt-vghost-vid--diag-1 { inset: 6% auto auto 6%;  width: 36%; height: 36%; }
.sb-bt-vghost-vid--diag-2 { inset: 32% auto auto 32%;width: 36%; height: 36%; }
.sb-bt-vghost-vid--diag-3 { inset: 58% auto auto 58%;width: 36%; height: 36%; }
.sb-bt-vghost-vid--row-1  { inset: 30% auto auto 3%; width: 30%; height: 40%; }
.sb-bt-vghost-vid--row-2  { inset: 30% auto auto 35%;width: 30%; height: 40%; }
.sb-bt-vghost-vid--row-3  { inset: 30% auto auto 67%;width: 30%; height: 40%; }
.sb-bt-vghost-vid--col-1  { inset: 3% auto auto 30%; width: 40%; height: 30%; }
.sb-bt-vghost-vid--col-2  { inset: 35% auto auto 30%;width: 40%; height: 30%; }
.sb-bt-vghost-vid--col-3  { inset: 67% auto auto 30%;width: 40%; height: 30%; }

.sb-bt-compose-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 640px;
  height: 360px;
  visibility: hidden;
  pointer-events: none;
  z-index: -1;
}

.sb-bt-compose-canvas--recording {
  visibility: hidden;
}

.sb-bt-compose-canvas--recording-visible {
  position: fixed;
  left: 0;
  top: 0;
  width: 2px;
  height: 2px;
  opacity: 0.02;
  visibility: visible;
  pointer-events: none;
  z-index: 0;
}

.sb-bt-preview-audio {
  display: block;
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 8px 8px;
  box-sizing: border-box;
}

.sb-bt-timeline-wrap {
  margin-top: 18px;
}

.sb-bt-timeline-wrap h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--sb-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sb-bt-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 4px 14px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  min-height: 108px;
  border-radius: 12px;
  border: 1px solid var(--sb-border);
  background: rgba(0, 0, 0, 0.25);
}

.sb-bt-rail.beats {
  min-height: 96px;
  background: rgba(74, 139, 232, 0.06);
}

.sb-bt-clip {
  flex: 0 0 auto;
  width: 88px;
  scroll-snap-align: start;
  cursor: pointer;
  border-radius: 10px;
  border: 2px solid transparent;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  transition: border-color 0.15s, transform 0.15s;
}

.sb-bt-clip:hover {
  transform: translateY(-2px);
}

.sb-bt-clip.selected {
  border-color: var(--sb-accent);
  box-shadow: 0 0 0 1px rgba(74, 139, 232, 0.35);
}

.sb-bt-clip:not(.selected) {
  opacity: 0.45;
}

.sb-bt-clip img {
  display: block;
  width: 88px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
  background: #111;
}

.sb-bt-clip .meta {
  margin-top: 4px;
  font-size: 10px;
  color: var(--sb-dim);
  font-family: var(--sb-mono);
  line-height: 1.3;
}

.sb-bt-slot {
  flex: 0 0 auto;
  width: 72px;
  scroll-snap-align: start;
  text-align: center;
}

.sb-bt-slot img {
  width: 72px;
  height: 41px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid rgba(74, 139, 232, 0.5);
  background: #111;
}

.sb-bt-slot .beat {
  font-size: 9px;
  color: #7db0f0;
  margin-top: 4px;
  font-family: var(--sb-mono);
}

.sb-bt-slot .dur {
  font-size: 9px;
  color: var(--sb-dim);
}

.sb-bt-hint {
  font-size: 12px;
  color: var(--sb-dim);
  margin: 8px 0 0;
  line-height: 1.45;
}

/* Fixed build strip — always visible (verify deploy without scrolling) */
body.sb-bt-page {
  padding-bottom: 52px;
}

.sb-bt-live-badge {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  padding: 10px 14px;
  font-family: var(--sb-mono);
  font-size: 12px;
  color: #c8d8f0;
  background: rgba(8, 14, 28, 0.96);
  border-top: 2px solid rgba(74, 139, 232, 0.55);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.sb-bt-live-pill {
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(74, 139, 232, 0.25);
  border: 1px solid rgba(74, 139, 232, 0.5);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.sb-bt-live-pill strong {
  color: #fff;
  font-size: 14px;
}

.sb-bt-live-detail strong {
  color: #8eb8f0;
}

.sb-bt-cloud-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  margin-left: 8px;
  vertical-align: middle;
  letter-spacing: 0.02em;
  font-family: var(--sb-mono);
}
.sb-bt-cloud-status--on {
  color: #b8f5d4;
  background: rgba(63, 203, 126, 0.15);
  border: 1px solid rgba(63, 203, 126, 0.4);
}
.sb-bt-cloud-status--off {
  color: #fecaca;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.sb-bt-header-build {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: var(--sb-mono);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: rgba(74, 139, 232, 0.35);
  border: 1px solid rgba(74, 139, 232, 0.55);
  vertical-align: middle;
}

.sb-bt-beat-focus {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sb-bt-beat-focus-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--sb-dim);
  margin-right: 4px;
}

.sb-bt-focus-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--sb-text);
  cursor: pointer;
  user-select: none;
}

.sb-bt-focus-chip input {
  accent-color: #5b9cf5;
}

.sb-bt-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  font-size: 13px;
  color: var(--sb-dim);
  margin-top: 12px;
}

.sb-bt-meta-row strong {
  color: var(--sb-text);
}

/* Two-column workspace: clips (larger) left, beats right */
.sb-bt-workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 20px;
  align-items: start;
}

@media (min-width: 960px) {
  .sb-bt-workspace {
    grid-template-columns: minmax(320px, 1fr) minmax(300px, 380px);
  }
}

.sb-bt-col h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--sb-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sb-bt-hint-tight {
  margin: 0 0 14px;
}

.sb-bt-clip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--sb-border);
  background: rgba(0, 0, 0, 0.28);
  min-height: 200px;
  max-height: min(62vh, 720px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sb-bt-clip-card {
  border-radius: 12px;
  border: 2px solid var(--sb-border);
  background: rgba(14, 20, 34, 0.85);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, opacity 0.15s;
}

.sb-bt-clip-card.selected {
  border-color: var(--sb-accent);
  box-shadow: 0 0 0 1px rgba(74, 139, 232, 0.35);
}

.sb-bt-clip-card:not(.selected) {
  opacity: 0.5;
}

.sb-bt-clip-card .sb-bt-clip-toggle {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
}

.sb-bt-clip-card .sb-bt-clip-toggle img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #111;
}

.sb-bt-clip-card .sb-bt-clip-meta {
  padding: 8px 10px 6px;
  font-size: 11px;
  color: var(--sb-dim);
  font-family: var(--sb-mono);
  line-height: 1.35;
}

.sb-bt-clip-drag {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #7db0f0;
  background: rgba(74, 139, 232, 0.1);
  border-top: 1px solid var(--sb-border);
  cursor: grab;
  user-select: none;
}

.sb-bt-clip-drag:active {
  cursor: grabbing;
}

.sb-bt-beat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--sb-border);
  background: rgba(74, 139, 232, 0.06);
  min-height: 200px;
  max-height: min(62vh, 720px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sb-bt-plan-slot {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(140, 180, 250, 0.35);
  background: rgba(0, 0, 0, 0.2);
  font-family: var(--sb-mono);
  font-size: 12px;
  color: var(--sb-dim);
  cursor: copy;
}

.sb-bt-plan-slot .plan-ix {
  font-weight: 800;
  color: var(--sb-accent);
}

.sb-bt-slot {
  display: grid;
  grid-template-columns: 36px 120px 1fr 70px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(74, 139, 232, 0.45);
  background: rgba(10, 14, 32, 0.75);
  cursor: default;
  transition: background 0.15s, border-color 0.15s;
}

.sb-bt-slot:hover {
  border-color: rgba(98, 212, 255, 0.55);
}

.sb-bt-slot.sb-bt-slot--dragover {
  outline: 2px solid var(--sb-ok);
  background: rgba(63, 203, 126, 0.12);
}

.sb-bt-slot .slot-grip {
  font-size: 16px;
  color: var(--sb-dim);
  text-align: center;
  user-select: none;
  cursor: grab;
}

.sb-bt-slot .slot-grip:active {
  cursor: grabbing;
}

.sb-bt-slot.sb-bt-slot--pinned {
  border-color: rgba(63, 203, 126, 0.55);
}

.sb-bt-slot img {
  width: 120px;
  height: 68px;
  object-fit: cover;
  border-radius: 8px;
  background: #111;
  display: block;
}

.sb-bt-slot .slot-beat-meta {
  font-family: var(--sb-mono);
  font-size: 11px;
  line-height: 1.4;
  color: var(--sb-dim);
}

.sb-bt-slot .slot-beat-meta strong {
  display: block;
  color: #7db0f0;
  font-size: 12px;
}

.sb-analyzing .sb-bt-progress > i {
  animation: sb-pulse-bar 1.2s ease-in-out infinite;
}

.sb-bt-building .sb-bt-progress > i {
  animation: sb-pulse-bar 1.2s ease-in-out infinite;
}

.sb-bt-build-status {
  margin: 8px 0 0;
  font-size: 13px;
  color: #8ec8ff;
  font-weight: 600;
}

.sb-bt-beat-toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100001;
  max-width: min(92vw, 420px);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  color: #e8f0ff;
  background: rgba(12, 22, 44, 0.96);
  border: 1px solid rgba(90, 160, 255, 0.45);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.sb-bt-beat-toast--ok {
  border-color: rgba(63, 203, 126, 0.55);
  color: #b8f5d4;
}
.sb-bt-beat-toast--err {
  border-color: rgba(248, 113, 113, 0.55);
  color: #fecaca;
}
.sb-bt-beat-toast[hidden] {
  display: none !important;
}

.sb-bt-output {
  margin: 16px 0;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(120, 180, 255, 0.35);
  background: rgba(8, 18, 32, 0.85);
}

.sb-bt-output-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.sb-bt-output-head h3 {
  margin: 0;
  font-size: 15px;
}

.sb-bt-output-meta {
  font-size: 12px;
  color: var(--sb-dim);
  font-family: var(--sb-mono);
}

.sb-bt-output-player {
  width: 100%;
  max-height: 360px;
  border-radius: 8px;
  background: #000;
}

.sb-bt-download-btn {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 16px 20px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
}

.sb-bt-download-hint {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--sb-dim);
  text-align: center;
}

.sb-bt-output-player {
  margin-bottom: 10px;
}

.sb-bt-output-dismiss {
  display: block;
  width: 100%;
  margin-top: 4px;
}

@media (max-width: 720px) {
  .sb-bt-output {
    padding: 16px;
  }

  .sb-bt-download-btn {
    padding: 18px 20px;
    font-size: 18px;
  }

  .sb-bt-output-player {
    max-height: 220px;
  }
}

@keyframes sb-pulse-bar {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

/* ─── Studio shell (v17) ─── */
html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
body.sb-bt-page {
  padding-bottom: 24px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body.sb-bt-page::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* Hide scrollbar chrome — scroll still works (wheel, touch, trackpad) */
body.sb-bt-page .sb-bt-clip-list,
body.sb-bt-page .sb-bt-track-scroll,
body.sb-bt-page .sb-bt-beat-list,
body.sb-bt-page .sb-bt-log,
body.sb-bt-page .sb-bt-main,
body.sb-bt-page .sb-bt-app,
body.sb-bt-page .sb-bt-sidebar,
body.sb-bt-page .sb-bt-timeline-panel,
body.sb-bt-page .sb-bt-tracks {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body.sb-bt-page .sb-bt-clip-list::-webkit-scrollbar,
body.sb-bt-page .sb-bt-track-scroll::-webkit-scrollbar,
body.sb-bt-page .sb-bt-beat-list::-webkit-scrollbar,
body.sb-bt-page .sb-bt-log::-webkit-scrollbar,
body.sb-bt-page .sb-bt-main::-webkit-scrollbar,
body.sb-bt-page .sb-bt-app::-webkit-scrollbar,
body.sb-bt-page .sb-bt-sidebar::-webkit-scrollbar,
body.sb-bt-page .sb-bt-timeline-panel::-webkit-scrollbar,
body.sb-bt-page .sb-bt-tracks::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
  background: transparent;
}

.sb-bt-app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 100%;
}

.sb-bt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--sb-border);
  background: rgba(8, 12, 20, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.sb-bt-toolbar-left,
.sb-bt-toolbar-center,
.sb-bt-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sb-bt-toolbar-center {
  flex: 1;
  justify-content: center;
}

.sb-bt-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.03em;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  line-height: 1;
}

.sb-bt-brand-bolt {
  width: 18px;
  height: 18px;
  color: #5AA0FF;
  filter: drop-shadow(0 0 6px rgba(90, 160, 255, 0.55));
  flex: 0 0 auto;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.sb-bt-brand-name {
  background: linear-gradient(135deg, #5AA0FF 0%, #c9defc 55%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.sb-bt-brand:hover {
  text-decoration: none;
}

.sb-bt-brand:hover .sb-bt-brand-bolt {
  transform: rotate(-8deg) scale(1.05);
  filter: drop-shadow(0 0 10px rgba(90, 160, 255, 0.85));
}

.sb-bt-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  background: linear-gradient(135deg, #ff8a4c, #ff4d6d);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.sb-bt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  color: var(--sb-text);
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.sb-bt-btn--primary {
  background: linear-gradient(135deg, var(--sb-accent), #2563b8);
  color: #fff;
  border-color: rgba(90, 160, 255, 0.4);
  box-shadow: 0 4px 20px rgba(61, 142, 240, 0.35);
}

.sb-bt-btn--upscale {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.35);
  font-weight: 700;
}

.sb-bt-btn--upscale:hover:not(:disabled) {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  box-shadow: 0 6px 22px rgba(124, 58, 237, 0.45);
}

.sb-bt-btn--ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--sb-border);
}

.sb-bt-btn--link {
  text-decoration: none;
  padding: 8px 12px;
  font-size: 13px;
}

.sb-bt-btn--sm {
  padding: 8px 14px;
  font-size: 13px;
}

.sb-bt-btn--xs {
  padding: 5px 10px;
  font-size: 12px;
}

.sb-bt-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.sb-bt-btn--primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #4d9bff, #2d6fd4);
}

.sb-bt-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sb-bt-btn-icon {
  font-size: 15px;
}

.sb-bt-progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.sb-bt-progress > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--sb-accent), var(--sb-ok));
  transition: width 0.2s;
}

.sb-bt-setup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--sb-border);
  background: rgba(0, 0, 0, 0.2);
}

.sb-bt-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--sb-border);
  background: var(--sb-panel);
  font-size: 12px;
  cursor: pointer;
  max-width: min(220px, 42vw);
}

.sb-bt-file-chip input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.sb-bt-file-chip-label {
  font-weight: 700;
  color: var(--sb-dim);
  flex-shrink: 0;
}

.sb-bt-file-chip-name {
  color: var(--sb-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--sb-mono);
  font-size: 11px;
}

.sb-bt-studio {
  display: grid;
  grid-template-columns: var(--bt-clips-w, 300px) 6px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  align-items: start;
}

@media (max-width: 900px) {
  .sb-bt-studio {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .sb-bt-sidebar {
    max-height: 280px;
    width: 100% !important;
    border-bottom: 1px solid var(--sb-border);
  }

  .sb-bt-clip-list {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }

  .sb-bt-resizer {
    display: none !important;
  }
}

.sb-bt-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: calc(100dvh - 80px);
  overflow: hidden;
  position: sticky;
  top: 12px;
  background: var(--sb-panel);
  border-right: 1px solid var(--sb-border);
}

.sb-bt-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 8px;
}

.sb-bt-sidebar-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.sb-bt-sidebar-count {
  font-family: var(--sb-mono);
  font-size: 12px;
  color: var(--sb-dim);
}

.sb-bt-sidebar-tools {
  padding: 0 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sb-bt-search {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border-radius: 8px;
  border: 1px solid var(--sb-border);
  background: rgba(0, 0, 0, 0.35) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b95a8'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") 10px center no-repeat;
  color: var(--sb-text);
  font: inherit;
  font-size: 13px;
}

.sb-bt-sidebar-bulk {
  display: flex;
  gap: 6px;
}

.sb-bt-clip-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 12px;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  align-content: start;
}

.sb-bt-sidebar-hint {
  margin: 0;
  padding: 8px 12px 12px;
  font-size: 11px;
  color: var(--sb-dim);
  line-height: 1.4;
}

.sb-bt-clip-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.12s;
  min-width: 0;
}

.sb-bt-clip-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sb-bt-clip-row.selected {
  border-color: rgba(74, 139, 232, 0.55);
  background: rgba(74, 139, 232, 0.1);
}

.sb-bt-clip-row:not(.selected) {
  opacity: 0.58;
}

.sb-bt-clip-row.sb-bt-clip-row--hidden {
  display: none;
}

.sb-bt-clip-row-visual {
  position: relative;
  width: 100%;
}

.sb-bt-clip-row-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
  background: #1a2030;
  display: block;
}

.sb-bt-clip-row-meta {
  min-width: 0;
  text-align: center;
  padding: 0 2px;
}

.sb-bt-clip-row-name {
  display: block;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-bt-clip-row-dur {
  display: block;
  font-family: var(--sb-mono);
  font-size: 10px;
  color: var(--sb-dim);
  margin-top: 2px;
}

.sb-bt-clip-row-src {
  display: block;
  font-size: 9px;
  color: var(--sb-accent);
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.sb-bt-add-more-clips {
  width: 100%;
  margin: -4px 0 8px;
  text-align: center;
  font-size: 12px;
}

.sb-bt-clip-row-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.sb-bt-clip-row.selected .sb-bt-clip-row-check {
  background: var(--sb-ok);
  border-color: var(--sb-ok);
  color: #041208;
  font-weight: 800;
}

.sb-bt-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 12px 16px 20px;
  gap: 12px;
  overflow: hidden;
}

.sb-bt-split-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  flex: 1;
}

.sb-bt-split-vertical .sb-bt-player-card {
  flex-shrink: 0;
}

.sb-bt-split-vertical .sb-bt-timeline-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sb-bt-split-vertical .sb-bt-tracks {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.sb-bt-player-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  font-size: 12px;
  color: var(--sb-dim);
  font-family: var(--sb-mono);
}

.sb-bt-meta-chip strong {
  color: var(--sb-text);
}

.sb-bt-meta-sep {
  margin: 0 8px;
  opacity: 0.4;
}

.sb-bt-player-card {
  border-radius: 14px;
  border: 1px solid var(--sb-border);
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.sb-bt-player-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6px var(--bt-rail-w, 280px);
  align-items: start;
  min-height: 0;
}

/* Stretch the rail to match the tall preview height in portrait orientations
 * so the right Editor Panel reaches the bottom of the player. */
.sb-bt-player-card--portrait .sb-bt-player-body {
  align-items: stretch;
}

@media (max-width: 900px) {
  .sb-bt-player-body {
    grid-template-columns: 1fr;
  }

  .sb-bt-player-rail {
    border-top: 1px solid var(--sb-border);
  }
}

.sb-bt-player-visual {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sb-bt-player-rail {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  min-height: 0;
  max-height: calc(min(52vh, 560px) + 48px);
  padding: 0;
  border-left: 1px solid var(--sb-border);
  background: linear-gradient(180deg, rgba(14, 20, 34, 0.95), rgba(8, 12, 22, 0.98));
  overflow: hidden;
}

/* Portrait orientations (TikTok / Reels / IG 4:5) make the preview tall —
 * let the rail extend to match so the right column doesn't look cut off
 * halfway down the player. */
.sb-bt-player-card--portrait .sb-bt-player-rail {
  max-height: min(86vh, 900px);
}

.sb-bt-rail-tabs {
  display: flex;
  flex-shrink: 0;
  gap: 0;
  padding: 10px 10px 0;
  border-bottom: 1px solid var(--sb-border);
}

.sb-bt-rail-tab {
  flex: 1;
  margin: 0;
  padding: 8px 10px;
  border: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--sb-dim);
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.sb-bt-rail-tab:hover {
  color: var(--sb-text);
}

.sb-bt-rail-tab--active {
  color: var(--sb-text);
  background: rgba(74, 139, 232, 0.14);
  box-shadow: inset 0 -2px 0 var(--sb-accent);
}

.sb-bt-rail-panes {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sb-bt-rail-pane {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sb-bt-rail-pane::-webkit-scrollbar { width: 0; height: 0; display: none; }

.sb-bt-rail-pane[hidden] {
  display: none !important;
}

.sb-bt-rail-pane--setup .sb-bt-rail-foot {
  margin: 0;
  padding-top: 4px;
}

.sb-bt-rail-captions-link {
  width: 100%;
  margin-top: 4px;
  text-align: center;
}

.sb-bt-rail-back {
  align-self: flex-start;
  margin: 0 0 4px;
  padding: 4px 0;
  border: none;
  background: none;
  color: #9ec4f5;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.sb-bt-rail-back:hover {
  color: #c5dcff;
}

.sb-bt-rail-title {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sb-dim);
}

.sb-bt-rail-title--steps {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--sb-border);
}

.sb-bt-beta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(245, 183, 59, 0.55);
  background: rgba(245, 183, 59, 0.12);
  color: #f5b73b;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  vertical-align: middle;
  line-height: 1.4;
}
.sb-bt-beta-pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #f5b73b;
  box-shadow: 0 0 6px #f5b73b;
}

.sb-bt-rail-sub {
  margin: 0 0 4px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--sb-dim);
}

.sb-bt-caption-layout-grid--rail {
  flex: 0 0 auto;
  min-height: 0;
  max-height: 52vh;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 4px;
  padding-bottom: 4px;
  overflow-y: auto;
  align-content: start;
}

.sb-bt-rail-media {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sb-bt-rail-foot {
  margin: auto 0 0;
  padding-top: 10px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--sb-dim);
}

.sb-bt-rail-foot b {
  color: #9ec4f5;
}

.sb-bt-player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--sb-border);
  font-size: 12px;
}

.sb-bt-length-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sb-dim);
  font-weight: 600;
}

.sb-bt-length-control input[type="range"] {
  width: 120px;
  accent-color: var(--sb-accent);
}

.sb-bt-timecode {
  font-family: var(--sb-mono);
  font-size: 12px;
  color: var(--sb-text);
}

.sb-bt-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  max-height: min(52vh, 560px);
  background: #000;
  overflow: hidden;
  flex-shrink: 0;
  margin-left: auto;
  margin-right: auto;
}

.sb-bt-player-card--portrait .sb-bt-preview {
  max-height: min(82vh, 860px);
  max-width: min(100%, 460px);
}

.sb-bt-player-empty {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 24px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(61, 142, 240, 0.14), transparent),
    rgba(6, 10, 18, 0.97);
  text-align: center;
  color: inherit;
}

.sb-bt-player-empty--btn {
  appearance: none;
  border: none;
  font: inherit;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.15s ease;
}

.sb-bt-player-empty--btn:hover,
.sb-bt-player-empty--btn:focus-visible {
  outline: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(61, 142, 240, 0.28), transparent),
    rgba(6, 10, 18, 0.97);
}

.sb-bt-player-empty--btn:active {
  transform: scale(0.985);
}

.sb-bt-player-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(61, 142, 240, 0.15);
  border: 1.5px dashed rgba(125, 176, 240, 0.55);
  color: #cfe0ff;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 0 24px rgba(61, 142, 240, 0.25);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.sb-bt-player-empty--btn:hover .sb-bt-player-empty-icon,
.sb-bt-player-empty--btn:focus-visible .sb-bt-player-empty-icon {
  background: rgba(61, 142, 240, 0.28);
  border-color: rgba(125, 176, 240, 0.85);
  box-shadow: 0 0 32px rgba(61, 142, 240, 0.45);
}

.sb-bt-player-card--ready .sb-bt-player-empty {
  display: none;
}

.sb-bt-player-empty-title {
  display: block;
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.sb-bt-player-empty-sub {
  display: block;
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--sb-dim);
}

.sb-bt-add-media {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 12px;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  text-align: left;
  width: 100%;
}

.sb-bt-add-media--rail {
  padding: 12px 12px;
}

.sb-bt-yt-import {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sb-bt-yt-import-input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 7px 10px;
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.sb-bt-yt-import-input:focus {
  border-color: rgba(255, 70, 70, 0.55);
}
.sb-bt-yt-import-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}
.sb-bt-yt-import-status {
  flex-basis: 100%;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.6);
  min-height: 14px;
}
.sb-bt-yt-import-status.is-error { color: rgba(255, 120, 130, 0.95); }
.sb-bt-yt-import-status.is-ok { color: rgba(120, 230, 160, 0.95); }
.sb-bt-yt-import.is-busy .sb-bt-yt-import-input { opacity: 0.6; }

.sb-bt-add-media--rail .sb-bt-add-media-text strong {
  font-size: 14px;
}

.sb-bt-add-media input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.sb-bt-add-media:hover {
  border-color: rgba(90, 160, 255, 0.55);
  background: rgba(74, 139, 232, 0.1);
  transform: translateY(-2px);
}

.sb-bt-add-media--video:hover {
  border-color: rgba(255, 120, 160, 0.5);
}

.sb-bt-add-media--music:hover {
  border-color: rgba(120, 180, 255, 0.55);
}

.sb-bt-add-media--done {
  border-style: solid;
  border-color: rgba(63, 203, 126, 0.45);
  background: rgba(63, 203, 126, 0.08);
}

.sb-bt-add-media-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.sb-bt-add-media-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.sb-bt-add-media-text strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--sb-text);
}

.sb-bt-add-media-hint {
  font-size: 12px;
  color: var(--sb-dim);
  font-family: var(--sb-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-bt-workflow {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sb-bt-btn--workflow {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 14px;
  min-height: 0;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid rgba(90, 160, 255, 0.3);
  background: linear-gradient(135deg, rgba(61, 142, 240, 0.18), rgba(30, 55, 100, 0.35));
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  text-align: left;
}

.sb-bt-btn--workflow:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(77, 155, 255, 0.28), rgba(40, 75, 140, 0.45));
  border-color: rgba(120, 180, 255, 0.5);
  transform: translateX(2px);
}

.sb-bt-btn--workflow-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--sb-border);
  box-shadow: none;
}

.sb-bt-btn--workflow-primary {
  border-color: rgba(120, 180, 255, 0.55);
  background: linear-gradient(135deg, rgba(74, 139, 232, 0.32), rgba(40, 85, 165, 0.48));
  box-shadow: 0 3px 16px rgba(20, 50, 110, 0.32);
}
.sb-bt-btn--workflow-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(95, 160, 250, 0.42), rgba(55, 110, 195, 0.58));
  border-color: rgba(150, 200, 255, 0.7);
}
.sb-bt-btn--workflow-primary .sb-bt-workflow-step {
  background: rgba(255, 255, 255, 0.18);
}

.sb-bt-rail-sub--quiet {
  margin: 2px 4px 4px;
  font-size: 11px;
  color: var(--sb-dim);
  line-height: 1.35;
}

.sb-bt-advanced-steps {
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 6px;
}
.sb-bt-advanced-steps[open] {
  padding-bottom: 4px;
}
.sb-bt-advanced-steps-summary {
  cursor: pointer;
  list-style: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--sb-dim);
  padding: 6px 4px;
  border-radius: 6px;
  user-select: none;
}
.sb-bt-advanced-steps-summary::-webkit-details-marker { display: none; }
.sb-bt-advanced-steps-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s ease;
}
.sb-bt-advanced-steps[open] > .sb-bt-advanced-steps-summary::before {
  transform: rotate(90deg);
}
.sb-bt-advanced-steps-summary:hover {
  color: var(--sb-text);
  background: rgba(255, 255, 255, 0.04);
}
.sb-bt-advanced-steps > *:not(summary) {
  margin-top: 6px;
}

.sb-bt-rail-more {
  margin: 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 4px 0;
}
.sb-bt-rail-more-summary {
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--sb-dim);
  padding: 8px 4px;
  border-radius: 6px;
  user-select: none;
}
.sb-bt-rail-more-summary::-webkit-details-marker { display: none; }
.sb-bt-rail-more-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s ease;
}
.sb-bt-rail-more[open] > .sb-bt-rail-more-summary::before {
  transform: rotate(90deg);
}
.sb-bt-rail-more-summary:hover {
  color: var(--sb-text);
  background: rgba(255, 255, 255, 0.04);
}

.sb-bt-workflow-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sb-bt-workflow-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sb-bt-workflow-copy strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--sb-text);
}

.sb-bt-workflow-copy span {
  font-size: 11px;
  font-weight: 500;
  color: var(--sb-dim);
  line-height: 1.3;
}

/** Analyze beats row: primary action + Deep beat toggle */
.sb-bt-beats-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
}
.sb-bt-beats-row > .sb-bt-btn--workflow {
  flex: 1 1 220px;
  min-width: 200px;
}
.sb-bt-deep-beats-switch {
  flex: 1 1 150px;
  max-width: 220px;
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(120, 170, 255, 0.22);
  background: rgba(6, 10, 20, 0.45);
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
@media (hover: hover) {
  .sb-bt-deep-beats-switch:hover {
    border-color: rgba(150, 200, 255, 0.45);
    background: rgba(20, 40, 80, 0.35);
  }
}
.sb-bt-deep-beats-switch:focus-within {
  outline: 2px solid rgba(93, 173, 255, 0.55);
  outline-offset: 2px;
}
.sb-bt-deep-beats-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.sb-bt-deep-beats-visual {
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  transition: background 0.18s ease;
}
.sb-bt-deep-beats-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(240, 246, 255, 0.92);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, background 0.2s;
}
.sb-bt-deep-beats-checkbox:checked + .sb-bt-deep-beats-visual {
  background: linear-gradient(90deg, #3d8ef0, #5ec4ff);
}
.sb-bt-deep-beats-checkbox:checked + .sb-bt-deep-beats-visual .sb-bt-deep-beats-thumb {
  transform: translateX(18px);
  background: #fff;
}
.sb-bt-deep-beats-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sb-bt-deep-beats-meta strong {
  font-size: 12px;
  font-weight: 800;
  color: var(--sb-text);
  line-height: 1.25;
}
.sb-bt-deep-beats-meta small {
  font-size: 10px;
  font-weight: 500;
  color: var(--sb-dim);
  line-height: 1.35;
}

/* Every-beat deep-dive: secondary button under Analyze beats. Triggers a
   thorough scan that creates one rail slot per detected beat; the rail then
   shows per-slot × toggles to drop beats while keeping music sync. */
.sb-bt-btn--every-beat {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(120, 180, 255, 0.5);
  background: linear-gradient(135deg, rgba(74, 139, 232, 0.14), rgba(40, 70, 130, 0.22));
  color: var(--sb-text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.18s ease;
}
.sb-bt-btn--every-beat:hover:not(:disabled) {
  border-color: rgba(150, 200, 255, 0.85);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(20, 50, 110, 0.22);
}
.sb-bt-btn--every-beat:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.sb-bt-btn--every-beat.is-active {
  border-style: solid;
  border-color: rgba(150, 200, 255, 0.95);
  background: linear-gradient(135deg, rgba(95, 160, 250, 0.32), rgba(55, 110, 195, 0.48));
}
.sb-bt-every-beat-icon {
  font-size: 14px;
  letter-spacing: 1px;
  color: rgba(120, 200, 255, 0.95);
  line-height: 1;
}
.sb-bt-every-beat-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sb-bt-every-beat-copy strong {
  font-size: 13px;
  font-weight: 700;
}
.sb-bt-every-beat-copy span {
  font-size: 10px;
  color: var(--sb-dim);
  line-height: 1.3;
}

/* Per-slot drop toggle (× button) shown only in every-beat mode. */
.sb-bt-slot-drop {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 5;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0.9;
}
.sb-bt-slot-drop:hover {
  background: rgba(220, 60, 60, 0.85);
  border-color: rgba(255, 255, 255, 0.6);
  opacity: 1;
}
.sb-bt-slot--dropped {
  opacity: 0.32;
  filter: grayscale(0.7);
}
.sb-bt-slot--dropped .sb-bt-slot-drop {
  background: rgba(220, 60, 60, 0.85);
}
.sb-bt-slot--dropped .sb-bt-slot-drop::after {
  content: "";
}

.sb-bt-player-card--ready .sb-bt-play-fab {
  z-index: 5;
}

body:not(.sb-bt-has-media) .sb-bt-play-fab {
  display: none;
}

.sb-bt-play-fab {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s, opacity 0.15s;
}

.sb-bt-play-fab:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sb-bt-play-fab:not(:disabled):hover {
  transform: translate(-50%, -50%) scale(1.06);
}

.sb-bt-play-fab-icon {
  display: block;
  width: 0;
  height: 0;
  margin: 0 auto;
  border-style: solid;
  border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent #0a1020;
  transform: translateX(3px);
}

body.sb-bt-previewing:not(.sb-bt-preview-playing) .sb-bt-play-fab,
body.sb-bt-preview-paused .sb-bt-play-fab {
  opacity: 1;
  pointer-events: auto;
}

body.sb-bt-preview-playing .sb-bt-play-fab {
  opacity: 0;
  pointer-events: none;
}

.sb-bt-preview-transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px 10px;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid var(--sb-border);
}

.sb-bt-transport-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--sb-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--sb-text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.sb-bt-transport-btn:not(:disabled):hover {
  background: rgba(74, 139, 232, 0.18);
  border-color: rgba(74, 139, 232, 0.45);
}

.sb-bt-transport-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sb-bt-transport-btn--main {
  width: 48px;
  height: 40px;
  background: rgba(74, 139, 232, 0.22);
  border-color: rgba(74, 139, 232, 0.5);
}

.sb-bt-transport-icon {
  display: block;
}

.sb-bt-transport-icon--play {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 9px 0 9px 14px;
  border-color: transparent transparent transparent #e8f0ff;
  transform: translateX(2px);
}

.sb-bt-transport-icon--pause {
  display: none;
  width: 14px;
  height: 16px;
  border-left: 4px solid #e8f0ff;
  border-right: 4px solid #e8f0ff;
  box-sizing: border-box;
}

body.sb-bt-preview-playing .sb-bt-transport-icon--play {
  display: none;
}

body.sb-bt-preview-playing .sb-bt-transport-icon--pause {
  display: block;
}

body.sb-bt-preview-playing .sb-bt-play-fab-icon {
  border-width: 0;
  width: 18px;
  height: 20px;
  border-left: 5px solid #0a1020;
  border-right: 5px solid #0a1020;
  transform: none;
}

.sb-bt-preview-audio,
.sb-bt-preview-music-video {
  display: none;
}

.sb-bt-timeline-panel {
  border-radius: 14px;
  border: 1px solid var(--sb-border);
  background: rgba(8, 12, 22, 0.85);
  overflow: hidden;
}

.sb-bt-resizer--row {
  height: 6px;
  cursor: row-resize;
  margin: 2px 0;
  flex-shrink: 0;
}

.sb-bt-resizer--rail {
  margin: 0;
}

/* ─── Panel resize handles (optional drag — default layout unchanged) ─── */
.sb-bt-resizer {
  position: relative;
  z-index: 30;
  touch-action: none;
  user-select: none;
  background: transparent;
  transition: background 0.15s;
}

.sb-bt-resizer--col {
  width: 6px;
  cursor: col-resize;
}

.sb-bt-resizer:hover,
.sb-bt-resizer:focus-visible,
.sb-bt-resizer.sb-bt-resizer--active {
  background: rgba(61, 142, 240, 0.22);
}

.sb-bt-resizer::before {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.15s;
}

.sb-bt-resizer--col::before {
  left: 50%;
  top: 12%;
  bottom: 12%;
  width: 3px;
  transform: translateX(-50%);
}

.sb-bt-resizer--row::before {
  top: 50%;
  left: 12%;
  right: 12%;
  height: 3px;
  transform: translateY(-50%);
}

.sb-bt-resizer:hover::before,
.sb-bt-resizer:focus-visible::before,
.sb-bt-resizer--active::before {
  opacity: 1;
}

.sb-bt-resizer::after {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  color: #b8d4ff;
  background: rgba(8, 14, 28, 0.92);
  border: 1px solid rgba(90, 160, 255, 0.45);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 1;
}

.sb-bt-resizer--col::after {
  content: "↔";
  padding: 10px 4px;
  letter-spacing: -2px;
}

.sb-bt-resizer--row::after {
  content: "↕";
  padding: 4px 10px;
}

.sb-bt-resizer:hover::after,
.sb-bt-resizer:focus-visible::after,
.sb-bt-resizer--active::after {
  opacity: 1;
}

body.sb-bt-resizing {
  cursor: col-resize;
  user-select: none;
}

body.sb-bt-resizing--y {
  cursor: row-resize;
}

body.sb-bt-resizing * {
  cursor: inherit !important;
}

.sb-bt-waveform {
  height: 48px;
  background:
    linear-gradient(180deg, rgba(61, 142, 240, 0.12), transparent),
    repeating-linear-gradient(
      90deg,
      rgba(74, 156, 245, 0.35) 0,
      rgba(74, 156, 245, 0.35) 2px,
      transparent 2px,
      transparent 14px
    );
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  opacity: 0.85;
}

.sb-bt-tracks {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sb-bt-track {
  display: grid;
  grid-template-columns: var(--sb-track-label) 1fr;
  align-items: stretch;
  border-top: 1px solid var(--sb-border);
  min-height: 52px;
}

.sb-bt-track[hidden] {
  display: none !important;
}

.sb-bt-track-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--sb-dim);
  cursor: pointer;
  user-select: none;
  border-right: 1px solid var(--sb-border);
  overflow: hidden;
}

.sb-bt-track-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  font-size: 15px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: -0.02em;
}

.sb-bt-track--beat .sb-bt-track-icon { color: var(--sb-pink); }
.sb-bt-track--transitions .sb-bt-track-icon { color: #7ad6ff; }
.sb-bt-track--captionwords .sb-bt-track-icon { color: #f7d36a; font-size: 13px; font-weight: 800; }
.sb-bt-track--edit .sb-bt-track-icon { color: #b9ffb6; }

.sb-bt-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sb-bt-track-head--static {
  cursor: default;
}

.sb-bt-track-toggle {
  appearance: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.sb-bt-track-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.sb-bt-track-toggle:checked {
  background: var(--sb-pink);
}

.sb-bt-track--bass .sb-bt-track-toggle:checked {
  background: var(--sb-blue);
}

.sb-bt-track--snare .sb-bt-track-toggle:checked {
  background: #5b8cff;
}

.sb-bt-track--clap .sb-bt-track-toggle:checked {
  background: var(--sb-yellow);
}

.sb-bt-track-toggle:checked::after {
  transform: translateX(16px);
}

.sb-bt-track-head--static .sb-bt-track-name {
  padding-left: 44px;
}

.sb-bt-track-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 10px;
  -webkit-overflow-scrolling: touch;
}

.sb-bt-type-lane,
.sb-bt-montage-lane {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
  min-height: 36px;
  align-items: stretch;
}

.sb-bt-type-pill {
  flex: 0 0 44px;
  height: 32px;
  border-radius: 8px;
  opacity: 0.9;
}

.sb-bt-type-pill--empty {
  flex: 0 0 44px;
  height: 32px;
}

.sb-bt-type-pill--beat {
  background: linear-gradient(135deg, #ff6b4a, #ff3d8a);
}

.sb-bt-type-pill--bass {
  background: linear-gradient(135deg, #4a7cff, #7b5cff);
}

.sb-bt-type-pill--snare {
  background: linear-gradient(135deg, #3d9eff, #5b6cff);
}

.sb-bt-type-pill--clap {
  background: linear-gradient(135deg, #f0c030, #ff8a40);
}

.sb-bt-type-pill--transitions {
  background: linear-gradient(135deg, #00d6c4, #2ba6ff);
  color: #06121b;
  font-weight: 600;
  font-size: 10px;
  line-height: 32px;
  text-align: center;
  padding: 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 0;
  cursor: grab;
  user-select: none;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.sb-bt-type-pill--transitions:hover {
  box-shadow: 0 0 0 1px rgba(0, 214, 196, .55), 0 4px 12px rgba(0, 200, 220, .3);
}
.sb-bt-type-pill--transitions:active { cursor: grabbing; }
.sb-bt-type-pill--dragging {
  opacity: .35;
  transform: scale(.96);
}
.sb-bt-type-pill--dragover {
  outline: 2px dashed #2ba6ff;
  outline-offset: 2px;
  background: rgba(43, 166, 255, .18);
}

.sb-bt-type-lane--captionwords {
  gap: 4px;
  flex-wrap: wrap;
  min-height: 32px;
  align-items: center;
}
.sb-bt-words-empty {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  font-style: italic;
  padding: 4px 8px;
  line-height: 1.4;
}

.sb-bt-word-chip {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.05s;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-bt-word-chip:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sb-bt-word-chip:active {
  transform: scale(0.96);
}

.sb-bt-word-chip--hidden {
  opacity: 0.4;
  text-decoration: line-through;
  background: rgba(255, 80, 80, 0.16);
  border-color: rgba(255, 80, 80, 0.3);
}

.sb-bt-word-chip--emphasis {
  background: linear-gradient(135deg, rgba(255, 60, 138, 0.35), rgba(255, 107, 74, 0.35));
  border-color: rgba(255, 107, 138, 0.5);
}

.sb-bt-track--edit {
  min-height: 72px;
  background: rgba(0, 0, 0, 0.25);
}

.sb-bt-track-scroll--montage {
  padding: 10px 12px;
}

.sb-bt-montage-lane {
  gap: 8px;
  min-height: 52px;
}

/* `.sb-bt-slot` is reused for both the legacy beat-list row (4-col grid
   with padding 10px 12px, gap 10px, align-items: center — declared earlier
   in the file) and the compact rail cells here. Source-order cascade keeps
   the legacy padding/gap/align-items on the rail slot, which squeezes the
   thumbnail down to a sliver. Reset them with a higher-specificity rule. */
.sb-bt-montage-lane > .sb-bt-slot {
  padding: 0;
  gap: 0;
  align-items: stretch;
}

/* Promote duration label above the thumb (img is absolute inset:0 and would
   otherwise paint over it) and tuck it into the bottom-right corner. */
.sb-bt-montage-lane > .sb-bt-slot > .slot-dur {
  position: absolute;
  bottom: 0;
  right: 0;
  left: auto;
  padding: 1px 4px;
  background: rgba(0, 0, 0, 0.62);
  border-radius: 6px 0 0 0;
  z-index: 3;
  font-size: 9px;
}

/* Mobile timeline: let slots flex to fill the rail so the strip actually
   spans the screen instead of leaving dead space on the right when there
   are few clips. min-width keeps each cell tappable; large libraries still
   scroll horizontally once the total min-width exceeds the viewport. */
@media (max-width: 720px) {
  .sb-bt-track-scroll--montage {
    padding: 8px 10px;
  }
  .sb-bt-montage-lane {
    width: 100%;
    gap: 4px;
  }
  .sb-bt-montage-lane > .sb-bt-slot {
    flex: 1 1 0;
    min-width: 40px;
    width: auto;
  }
  /* On mobile the duration label competes with the tiny thumb area —
     hide it; users can read durations from the beat ladder instead. */
  .sb-bt-montage-lane > .sb-bt-slot > .slot-dur {
    display: none;
  }
}

.sb-bt-playhead {
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--sb-yellow);
  box-shadow: 0 0 8px var(--sb-yellow);
  z-index: 4;
  pointer-events: none;
  left: 0;
  /* JS sets transform: translateX(...) every preview frame. Pinning the
     element on its own compositor layer means the playhead moves without
     triggering layout/paint — just a compositor transform per frame. */
  will-change: transform;
  transform: translateX(12px);
}

.sb-bt-slot {
  flex: 0 0 auto;
  width: 56px;
  min-height: 52px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  position: relative;
  cursor: default;
  display: flex;
  flex-direction: column;
  background: var(--sb-panel-2);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.sb-bt-slot:hover {
  border-color: rgba(98, 180, 255, 0.55);
}

.sb-bt-slot.sb-bt-slot--dragover {
  outline: 2px solid var(--sb-ok);
  box-shadow: 0 0 0 3px rgba(63, 203, 126, 0.25);
}

.sb-bt-slot.sb-bt-slot--pinned {
  border-color: rgba(63, 203, 126, 0.6);
}

.sb-bt-slot--beat .sb-bt-cell-fill {
  background: linear-gradient(145deg, #ff6b4a, #ff3d8a);
}

.sb-bt-slot--bass .sb-bt-cell-fill {
  background: linear-gradient(145deg, #4a7cff, #7b5cff);
}

.sb-bt-slot--snare .sb-bt-cell-fill {
  background: linear-gradient(145deg, #3d9eff, #5b6cff);
}

.sb-bt-slot--clap .sb-bt-cell-fill {
  background: linear-gradient(145deg, #f0c030, #ff8a40);
}

.sb-bt-cell-fill {
  flex: 1;
  min-height: 36px;
  background-size: cover;
  background-position: center;
}

.sb-bt-slot img.sb-bt-cell-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.sb-bt-slot .slot-grip {
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  cursor: grab;
  z-index: 2;
  padding: 2px;
  line-height: 1;
}

.sb-bt-slot .slot-dur {
  font-family: var(--sb-mono);
  font-size: 8px;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
  padding: 2px;
  background: rgba(0, 0, 0, 0.5);
}

.sb-bt-plan-slot {
  flex: 0 0 auto;
  width: 56px;
  min-height: 52px;
  border-radius: 10px;
  border: 2px dashed rgba(140, 180, 250, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--sb-mono);
  font-size: 9px;
  color: var(--sb-dim);
  text-align: center;
  padding: 4px;
  cursor: copy;
}

.sb-bt-plan-slot .plan-ix {
  font-weight: 800;
  color: var(--sb-accent);
  font-size: 11px;
}

.sb-bt-timeline-hint {
  margin: 0;
  padding: 10px 14px;
  font-size: 11px;
  color: var(--sb-dim);
  border-top: 1px solid var(--sb-border);
}

.sb-bt-log-panel {
  margin-top: 4px;
}

.sb-bt-log-panel summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--sb-dim);
  font-weight: 600;
  padding: 6px 0;
}

.sb-bt-log-panel .sb-log {
  margin-top: 8px;
  max-height: 160px;
}

.sb-bt-live-badge {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  padding: 8px 14px;
  font-family: var(--sb-mono);
  font-size: 11px;
  color: #c8d8f0;
  background: rgba(8, 14, 28, 0.96);
  border-top: 1px solid rgba(74, 139, 232, 0.4);
  pointer-events: none;
}

.sb-bt-header-build {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 6px;
  font-family: var(--sb-mono);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(74, 139, 232, 0.35);
  border: 1px solid rgba(74, 139, 232, 0.45);
  vertical-align: middle;
}

.sb-bt-build-status {
  margin: 0;
  padding: 6px 18px;
  font-size: 12px;
  color: #8ec8ff;
  font-weight: 600;
  background: rgba(61, 142, 240, 0.08);
}

.sb-bt-output {
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(120, 180, 255, 0.35);
  background: rgba(8, 18, 32, 0.85);
}

.sb-bt-download-btn {
  width: 100%;
  margin-bottom: 10px;
  padding: 16px;
  font-size: 16px;
}

.sb-bt-analyzing .sb-bt-progress > i,
.sb-bt-building .sb-bt-progress > i {
  animation: sb-pulse-bar 1.2s ease-in-out infinite;
}

/* ── Lyric captions ── */
.sb-bt-caption-overlay {
  position: absolute;
  z-index: 8;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: grab;
  text-align: center;
  line-height: 1.15;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  padding: 0 4px;
}

.sb-bt-caption-overlay--dragging {
  cursor: grabbing;
}

.sb-bt-caption-canvas {
  position: absolute;
  inset: 0;
  z-index: 8;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}
.sb-bt-caption-canvas--dragging {
  cursor: grabbing;
}
.sb-bt-caption-canvas[style*="display: none"],
.sb-bt-caption-canvas[style*="display:none"] {
  pointer-events: none;
}

.sb-bt-output-video-wrap {
  position: relative;
  width: 100%;
  margin-bottom: 10px;
}

.sb-bt-output-video-wrap .sb-bt-output-player {
  margin-bottom: 0;
  display: block;
}

.sb-bt-caption-overlay--output {
  z-index: 3;
}

.sb-bt-caption-canvas--output {
  z-index: 3;
}

.sb-bt-captions-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.sb-bt-caption-enable {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--sb-text);
  cursor: pointer;
}

.sb-bt-caption-enable input {
  accent-color: var(--sb-accent);
}

.sb-bt-upscale-control {
  margin: 4px 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(74, 139, 232, 0.22);
  background: rgba(74, 139, 232, 0.06);
}

.sb-bt-music-start {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.07);
}

.sb-bt-music-start-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.sb-bt-music-start-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sb-dim);
}

.sb-bt-music-start-val {
  font-family: var(--sb-mono);
  font-size: 13px;
  font-weight: 700;
  color: #fcd34d;
}

.sb-bt-music-start-slider {
  width: 100%;
  accent-color: #f59e0b;
}

.sb-bt-music-start-hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--sb-dim);
}

.sb-bt-upscale-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sb-dim);
  margin: 0 0 8px;
}

.sb-bt-upscale-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sb-bt-upscale-pill {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--sb-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--sb-dim);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sb-bt-upscale-pill:hover {
  border-color: rgba(120, 180, 255, 0.45);
  color: var(--sb-text);
}

.sb-bt-upscale-pill--active {
  border-color: rgba(120, 180, 255, 0.7);
  background: linear-gradient(135deg, rgba(74, 139, 232, 0.22), rgba(45, 95, 175, 0.32));
  color: #e8f1ff;
  box-shadow: 0 0 0 1px rgba(74, 139, 232, 0.3);
}

.sb-bt-upscale-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--sb-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--sb-text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.sb-bt-upscale-hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--sb-dim);
}

/* Anime4K-style preview sharpener toggle (More options block).
   Delete this rule + the matching markup + beat-timeline-upscale.js
   to remove the feature entirely. */
.cf-upscale-toggle {
  margin: 12px 0 0;
  padding: 10px 11px 11px;
  border-radius: 10px;
  border: 1px solid rgba(120, 180, 255, 0.22);
  background: linear-gradient(135deg, rgba(74, 139, 232, 0.08), rgba(40, 70, 130, 0.14));
}
.cf-upscale-toggle[hidden] { display: none; }
.cf-upscale-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.cf-upscale-toggle-row input[type="checkbox"] {
  margin: 3px 0 0;
  accent-color: #4a8be8;
  width: 16px;
  height: 16px;
}
.cf-upscale-toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.cf-upscale-toggle-copy strong {
  font-size: 12.5px;
  font-weight: 700;
  color: #e8f1ff;
  letter-spacing: 0.01em;
}
.cf-upscale-toggle-copy span {
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--sb-dim);
}
.cf-upscale-toggle-status {
  margin: 8px 0 0;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  color: #bfd9ff;
  background: rgba(74, 139, 232, 0.14);
}
.cf-upscale-toggle-status[hidden] { display: none; }

.sb-bt-aspect-control {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

.sb-bt-aspect-control--hero {
  padding: 4px 0 0;
}

.sb-bt-aspect-label {
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ec4f5;
  margin: 0 0 10px;
}

.sb-bt-aspect-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sb-bt-aspect-pills--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sb-bt-aspect-pills--grid > .sb-bt-aspect-pill:first-child {
  grid-column: 1 / -1;
}

.sb-bt-aspect-pill {
  flex: 1;
  min-width: 3.2rem;
  padding: 10px 10px 9px;
  border-radius: 10px;
  border: 1px solid var(--sb-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--sb-dim);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s;
}

.sb-bt-aspect-pills--grid .sb-bt-aspect-pill {
  padding: 12px 10px 10px;
}

.sb-bt-aspect-pill:hover {
  border-color: rgba(120, 180, 255, 0.45);
  color: var(--sb-text);
  transform: translateY(-1px);
}

.sb-bt-aspect-pill--active {
  border-color: rgba(120, 180, 255, 0.7);
  background: linear-gradient(135deg, rgba(74, 139, 232, 0.22), rgba(45, 95, 175, 0.32));
  color: #e8f1ff;
  box-shadow: 0 0 0 1px rgba(74, 139, 232, 0.3), 0 4px 14px rgba(45, 95, 175, 0.28);
}

.sb-bt-aspect-pill-icon {
  display: block;
  width: 22px;
  height: 22px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  opacity: 0.75;
  margin: 1px 0 2px;
}

.sb-bt-aspect-pill-icon[data-shape="portrait"] { width: 14px; height: 22px; }
.sb-bt-aspect-pill-icon[data-shape="portrait45"] { width: 17px; height: 22px; }
.sb-bt-aspect-pill-icon[data-shape="landscape"] { width: 24px; height: 14px; }
.sb-bt-aspect-pill-icon[data-shape="square"] { width: 20px; height: 20px; }
.sb-bt-aspect-pill-icon[data-shape="auto"] {
  width: 22px;
  height: 14px;
  border-style: dashed;
}

.sb-bt-aspect-pill--active .sb-bt-aspect-pill-icon { opacity: 1; }

.sb-bt-aspect-pill-name {
  display: block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.sb-bt-aspect-pill-ratio {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.7;
  line-height: 1.1;
}

.sb-bt-aspect-hint {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--sb-dim);
}

.sb-bt-fill-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0 0;
  padding: 9px 11px 10px;
  border-radius: 10px;
  border: 1px solid rgba(120, 180, 255, 0.22);
  background: linear-gradient(135deg, rgba(74, 139, 232, 0.08), rgba(40, 70, 130, 0.14));
  cursor: pointer;
  font-size: 12px;
  color: #e8f1ff;
}

.sb-bt-fill-toggle input {
  margin: 3px 0 0;
  accent-color: #4a8be8;
}

.sb-bt-fill-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.35;
}

.sb-bt-fill-toggle-text strong {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.sb-bt-fill-toggle-hint {
  font-size: 10.5px;
  color: var(--sb-dim);
}

.sb-bt-smart-reframe {
  margin: 12px 0 0;
  padding: 10px 11px 11px;
  border-radius: 10px;
  border: 1px solid rgba(120, 180, 255, 0.28);
  background: linear-gradient(135deg, rgba(74, 139, 232, 0.10), rgba(40, 70, 130, 0.18));
}

.sb-bt-smart-reframe[hidden] {
  display: none;
}

.sb-bt-smart-reframe-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #e8f1ff;
  cursor: pointer;
}

.sb-bt-smart-reframe-toggle input {
  margin: 0;
  accent-color: #4a8be8;
}

.sb-bt-smart-reframe-title {
  letter-spacing: 0.01em;
}

.sb-bt-smart-reframe-hint {
  margin: 6px 0 0;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--sb-dim);
}

.sb-bt-sfx-control {
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(120, 180, 255, 0.22);
  background: linear-gradient(135deg, rgba(74, 139, 232, 0.08), rgba(40, 70, 130, 0.14));
}

.sb-bt-sfx-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.sb-bt-sfx-exp-pill {
  display: inline-block;
  padding: 2px 8px;
  margin-left: 6px;
  border-radius: 999px;
  border: 1px solid rgba(245, 183, 59, 0.55);
  background: rgba(245, 183, 59, 0.12);
  color: #f5b73b;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
  line-height: 1.4;
}

.sb-bt-sfx-feedback {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(120, 180, 255, 0.28);
  background: rgba(10, 14, 26, 0.55);
}

.sb-bt-sfx-feedback-title {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: #eaf0ff;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sb-bt-sfx-feedback-text {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(120, 180, 255, 0.22);
  background: #06080f;
  color: #eaf0ff;
  font: inherit;
  font-size: 12px;
  resize: vertical;
  min-height: 56px;
}

.sb-bt-sfx-feedback-text:focus {
  outline: none;
  border-color: #5aa0ff;
  box-shadow: 0 0 0 2px rgba(90, 160, 255, 0.25);
}

.sb-bt-sfx-feedback-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.sb-bt-sfx-enable {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sb-text);
  cursor: pointer;
}

.sb-bt-sfx-enable input {
  width: 16px;
  height: 16px;
  accent-color: #4a8be8;
}

.sb-bt-sfx-hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--sb-dim);
}

.sb-bt-sfx-volume-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--sb-dim);
}

.sb-bt-sfx-volume-label input[type="range"] {
  flex: 1;
  min-width: 80px;
}

.sb-bt-sfx-cats-label {
  margin: 10px 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--sb-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sb-bt-sfx-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.sb-bt-sfx-cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--sb-text);
  cursor: pointer;
}

.sb-bt-sfx-cat input {
  accent-color: #22c55e;
}

.sb-bt-sfx-cue-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  max-height: 120px;
  overflow-y: auto;
}

.sb-bt-sfx-cue-btn {
  width: 100%;
  text-align: left;
  padding: 5px 8px;
  margin: 0 0 4px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--sb-dim);
  font-size: 11px;
  cursor: pointer;
}

.sb-bt-sfx-cue-btn:hover {
  background: rgba(34, 197, 94, 0.15);
  color: #bbf7d0;
}

.sb-bt-btn--caption {
  width: 100%;
}

.sb-bt-caption-status {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--sb-dim);
}

.sb-bt-caption-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.sb-bt-caption-controls label {
  display: block;
  font-size: 11px;
  color: var(--sb-dim);
  font-weight: 600;
}

.sb-bt-caption-controls input[type="range"] {
  width: 100%;
  margin-top: 4px;
  accent-color: var(--sb-accent);
}

.sb-bt-caption-custom {
  margin-top: 4px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 8px 10px;
}
.sb-bt-caption-custom > summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--sb-dim);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  outline: none;
}
.sb-bt-caption-custom[open] > summary { margin-bottom: 8px; }
.sb-bt-caption-custom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
}
.sb-bt-caption-custom-grid label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
  color: var(--sb-dim);
  font-weight: 600;
}
.sb-bt-caption-custom-grid select,
.sb-bt-caption-custom-grid input[type="color"] {
  background: #11151f;
  color: #e8ecf3;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
}
.sb-bt-caption-custom-grid input[type="color"] {
  height: 28px;
  padding: 0;
  cursor: pointer;
}
.sb-bt-caption-custom-toggle {
  grid-column: 1 / -1;
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  padding: 6px 8px;
  margin-top: 4px;
  background: rgba(95, 252, 255, 0.06);
  border: 1px solid rgba(95, 252, 255, 0.22);
  border-radius: 6px;
  font-size: 11px !important;
  color: #d6f7ff !important;
  cursor: pointer;
}
.sb-bt-caption-custom-toggle input[type="checkbox"] {
  margin: 0;
  accent-color: #5ffcff;
  cursor: pointer;
}
.sb-bt-caption-custom-toggle small {
  color: var(--sb-dim);
  font-weight: 500;
}

.sb-bt-caption-style-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #d6e4f5;
}

.sb-bt-caption-style-count {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  font-size: 10px;
  color: rgba(170, 200, 255, 0.7);
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(120, 200, 255, 0.08);
  border: 1px solid rgba(120, 200, 255, 0.18);
}

.sb-bt-caption-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  flex: 1;
  min-height: 120px;
  max-height: 560px;
  overflow-y: auto;
  padding: 4px 6px 6px 2px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sb-bt-caption-template-grid::-webkit-scrollbar { width: 0; height: 0; display: none; }

.sb-bt-caption-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, rgba(22, 28, 42, 0.95) 0%, rgba(8, 10, 16, 0.98) 100%);
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.16s cubic-bezier(0.2, 0.9, 0.3, 1.1),
    box-shadow 0.2s ease;
  user-select: none;
}

.sb-bt-caption-tile:hover {
  border-color: rgba(120, 200, 255, 0.55);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(120, 200, 255, 0.18);
}

.sb-bt-caption-tile input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
}

.sb-bt-caption-tile:has(input:checked) {
  border-color: rgba(95, 252, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(95, 252, 255, 0.55), 0 12px 28px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(95, 252, 255, 0.18);
}
.sb-bt-caption-tile:has(input:checked)::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 3;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #5ffcff;
  color: #001a1f;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(95, 252, 255, 0.55);
}

.sb-bt-caption-tile-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 108px;
  overflow: hidden;
  isolation: isolate;
}

.sb-bt-caption-tile-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 20% 30%, #4a8be8 0%, transparent 55%),
    radial-gradient(circle at 75% 70%, #c7b8ff 0%, transparent 50%),
    radial-gradient(circle at 50% 90%, #ff9ec4 0%, transparent 55%),
    linear-gradient(135deg, #1a2240 0%, #2d1438 100%);
  filter: saturate(1.05) brightness(0.95);
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.4s ease;
}
.sb-bt-caption-tile:hover .sb-bt-caption-tile-bg {
  opacity: 1;
  transform: scale(1.08);
}
.sb-bt-caption-tile-stage--featured {
  height: 150px;
}
.sb-bt-caption-tile-stage--featured .sb-bt-caption-tile-bg {
  background:
    radial-gradient(circle at 25% 35%, #ff3d7f 0%, transparent 50%),
    radial-gradient(circle at 78% 25%, #ffd166 0%, transparent 45%),
    radial-gradient(circle at 50% 85%, #5ffcff 0%, transparent 55%),
    linear-gradient(120deg, #0b1a3a 0%, #2a063a 60%, #3a1010 100%);
  opacity: 0.95;
  animation: btCapTileBgShift 6s ease-in-out infinite;
}

.sb-bt-caption-tile-sample {
  position: relative;
  z-index: 2;
  display: inline-block;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0.02em;
  paint-order: stroke fill;
  pointer-events: none;
  white-space: nowrap;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
  transform-origin: center;
  will-change: transform, opacity, filter, clip-path;
}
.sb-bt-caption-tile-stage--featured .sb-bt-caption-tile-sample {
  font-size: 52px;
  letter-spacing: 0.05em;
}

.sb-bt-caption-tile-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 10px 8px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.7) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.sb-bt-caption-tile-name {
  font-size: 11px;
  font-weight: 700;
  color: #e8eef8;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-bt-caption-tile-motion {
  font-size: 9px;
  font-weight: 600;
  color: rgba(170, 200, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(120, 200, 255, 0.08);
  border: 1px solid rgba(120, 200, 255, 0.18);
  white-space: nowrap;
  flex-shrink: 0;
}

.sb-bt-caption-tile:has(input:checked) .sb-bt-caption-tile-name {
  color: #d6f7ff;
}

.sb-bt-caption-tile--featured {
  grid-column: span 2;
}
.sb-bt-caption-tile--featured .sb-bt-caption-tile-name::before {
  content: "★ ";
  color: #ffd36a;
}
.sb-bt-caption-tile--featured .sb-bt-caption-tile-motion {
  background: rgba(255, 211, 106, 0.12);
  border-color: rgba(255, 211, 106, 0.32);
  color: #ffd98a;
}

.sb-bt-caption-tile--premium {
  position: relative;
}
.sb-bt-caption-tile--premium::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(232, 170, 60, 0.5);
  pointer-events: none;
  box-shadow: inset 0 0 14px rgba(232, 170, 60, 0.12);
}
.sb-bt-caption-tile-lock {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 4;
  font-size: 11px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 5px;
  background: linear-gradient(120deg, #f7c648 0%, #e8a020 100%);
  color: #1a0d00;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 8px rgba(232, 170, 60, 0.32);
  pointer-events: none;
}

@keyframes btCapTileBgShift {
  0%, 100% { transform: scale(1) translate(0, 0); }
  50% { transform: scale(1.12) translate(-2%, 1%); }
}

/* Instant tap feedback on tile pick — user sees confirmation before the
   canvas repaint completes on slow devices, so they don't double-tap. */
@keyframes btCapApplyPulse {
  0%   { box-shadow: 0 0 0 0 rgba(90,160,255,0.55); }
  60%  { box-shadow: 0 0 0 10px rgba(90,160,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(90,160,255,0); }
}
.sb-bt-caption-tile.is-applying {
  animation: btCapApplyPulse 320ms ease-out 1;
}

/* Hover and selected tiles both trigger animations — JS .is-playing re-triggers on subsequent hover */
.sb-bt-caption-tile:hover .sb-bt-caption-tile-sample,
.sb-bt-caption-tile.is-playing .sb-bt-caption-tile-sample,
.sb-bt-caption-tile:focus-within .sb-bt-caption-tile-sample {
  animation-duration: 0.7s;
  animation-timing-function: cubic-bezier(0.2, 0.9, 0.2, 1.1);
  animation-fill-mode: both;
  animation-iteration-count: 1;
}

.sb-bt-caption-tile--m-pop:hover .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-pop.is-playing .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-pop:focus-within .sb-bt-caption-tile-sample { animation-name: btCapMotionPop; }
.sb-bt-caption-tile--m-slide-up:hover .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-slide-up.is-playing .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-slide-up:focus-within .sb-bt-caption-tile-sample { animation-name: btCapMotionSlideUp; }
.sb-bt-caption-tile--m-slide-down:hover .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-slide-down.is-playing .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-slide-down:focus-within .sb-bt-caption-tile-sample { animation-name: btCapMotionSlideDown; }
.sb-bt-caption-tile--m-fade-up:hover .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-fade-up.is-playing .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-fade-up:focus-within .sb-bt-caption-tile-sample { animation-name: btCapMotionFadeUp; }
.sb-bt-caption-tile--m-zoom:hover .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-zoom.is-playing .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-zoom:focus-within .sb-bt-caption-tile-sample { animation-name: btCapMotionZoom; }
.sb-bt-caption-tile--m-bounce:hover .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-bounce.is-playing .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-bounce:focus-within .sb-bt-caption-tile-sample { animation-name: btCapMotionBounce; animation-duration: 0.85s; }
.sb-bt-caption-tile--m-wave:hover .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-wave.is-playing .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-wave:focus-within .sb-bt-caption-tile-sample { animation-name: btCapMotionWave; animation-duration: 0.95s; }
.sb-bt-caption-tile--m-shake:hover .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-shake.is-playing .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-shake:focus-within .sb-bt-caption-tile-sample { animation-name: btCapMotionShake; animation-duration: 0.6s; }
.sb-bt-caption-tile--m-blur:hover .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-blur.is-playing .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-blur:focus-within .sb-bt-caption-tile-sample { animation-name: btCapMotionBlur; }
.sb-bt-caption-tile--m-glitch:hover .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-glitch.is-playing .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-glitch:focus-within .sb-bt-caption-tile-sample { animation-name: btCapMotionGlitch; animation-duration: 0.65s; }
.sb-bt-caption-tile--m-flip:hover .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-flip.is-playing .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-flip:focus-within .sb-bt-caption-tile-sample { animation-name: btCapMotionFlip; }
.sb-bt-caption-tile--m-type:hover .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-type.is-playing .sb-bt-caption-tile-sample,
.sb-bt-caption-tile--m-type:focus-within .sb-bt-caption-tile-sample { animation-name: btCapMotionType; animation-timing-function: steps(8, end); }

/* Same keyframes also drive live caption overlays during playback */
/* Inner span receives the animation so the outer overlay's centering
   transform (translate(-50%, -50%)) is never overridden. */
.sb-bt-caption-inner {
  display: inline-block;
  transform-origin: center center;
  will-change: transform, opacity, filter;
}
.sb-bt-caption-inner.sb-bt-caption-motion--pop { animation: btCapMotionPop 0.35s cubic-bezier(0.2, 0.9, 0.2, 1.1) both; }
.sb-bt-caption-inner.sb-bt-caption-motion--slide-up { animation: btCapMotionSlideUp 0.32s cubic-bezier(0.2, 0.9, 0.2, 1.1) both; }
.sb-bt-caption-inner.sb-bt-caption-motion--slide-down { animation: btCapMotionSlideDown 0.32s cubic-bezier(0.2, 0.9, 0.2, 1.1) both; }
.sb-bt-caption-inner.sb-bt-caption-motion--fade-up { animation: btCapMotionFadeUp 0.32s ease-out both; }
.sb-bt-caption-inner.sb-bt-caption-motion--zoom { animation: btCapMotionZoom 0.32s cubic-bezier(0.18, 0.9, 0.2, 1.1) both; }
.sb-bt-caption-inner.sb-bt-caption-motion--bounce { animation: btCapMotionBounce 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.sb-bt-caption-inner.sb-bt-caption-motion--wave { animation: btCapMotionWave 0.5s ease-out both; }
.sb-bt-caption-inner.sb-bt-caption-motion--shake { animation: btCapMotionShake 0.35s ease-out both; }
.sb-bt-caption-inner.sb-bt-caption-motion--blur { animation: btCapMotionBlur 0.35s ease-out both; }
.sb-bt-caption-inner.sb-bt-caption-motion--glitch { animation: btCapMotionGlitch 0.4s ease-out both; }
.sb-bt-caption-inner.sb-bt-caption-motion--flip { animation: btCapMotionFlip 0.4s cubic-bezier(0.2, 0.9, 0.2, 1.1) both; }
.sb-bt-caption-inner.sb-bt-caption-motion--type { animation: btCapMotionType 0.3s steps(6, end) both; }

@keyframes btCapMotionPop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes btCapMotionSlideUp {
  0% { transform: translateY(22px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes btCapMotionSlideDown {
  0% { transform: translateY(-22px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes btCapMotionFadeUp {
  0% { transform: translateY(10px); opacity: 0; filter: blur(2px); }
  100% { transform: translateY(0); opacity: 1; filter: blur(0); }
}
@keyframes btCapMotionZoom {
  0% { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes btCapMotionBounce {
  0% { transform: scale(0.5) translateY(-12px); opacity: 0; }
  40% { transform: scale(1.18) translateY(0); opacity: 1; }
  70% { transform: scale(0.92) translateY(0); }
  100% { transform: scale(1) translateY(0); }
}
@keyframes btCapMotionWave {
  0% { transform: rotate(-6deg) translateY(8px); opacity: 0; }
  40% { transform: rotate(4deg) translateY(0); opacity: 1; }
  70% { transform: rotate(-2deg); }
  100% { transform: rotate(0); opacity: 1; }
}
@keyframes btCapMotionShake {
  0%, 100% { transform: translateX(0); opacity: 1; }
  15% { transform: translateX(-5px); }
  30% { transform: translateX(5px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}
@keyframes btCapMotionBlur {
  0% { filter: blur(10px); opacity: 0; transform: scale(1.05); }
  100% { filter: blur(0); opacity: 1; transform: scale(1); }
}
@keyframes btCapMotionGlitch {
  0% { transform: translateX(0) skewX(0); opacity: 0; filter: hue-rotate(0deg); }
  20% { transform: translateX(-3px) skewX(-6deg); opacity: 1; filter: hue-rotate(40deg); }
  40% { transform: translateX(3px) skewX(4deg); filter: hue-rotate(-30deg); }
  60% { transform: translateX(-2px) skewX(-2deg); filter: hue-rotate(20deg); }
  100% { transform: translateX(0) skewX(0); filter: hue-rotate(0); }
}
@keyframes btCapMotionFlip {
  0% { transform: rotateX(90deg); opacity: 0; }
  60% { transform: rotateX(-10deg); opacity: 1; }
  100% { transform: rotateX(0); opacity: 1; }
}
@keyframes btCapMotionType {
  0% { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}

.sb-bt-caption-drag-hint {
  margin: 0;
  font-size: 10px;
  color: var(--sb-dim);
  line-height: 1.35;
}

/* Display mode picker — how words play out (orthogonal to style) */
.sb-bt-caption-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 6px;
}
.sb-bt-mode-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 10px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(22, 28, 42, 0.95) 0%, rgba(8, 10, 16, 0.98) 100%);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.18s ease;
}
.sb-bt-mode-tile:hover {
  border-color: rgba(120, 200, 255, 0.5);
  transform: translateY(-1px);
}
.sb-bt-mode-tile input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  margin: 0;
}
.sb-bt-mode-tile:has(input:checked) {
  border-color: rgba(95, 252, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(95, 252, 255, 0.45), 0 0 18px rgba(95, 252, 255, 0.16);
}
.sb-bt-mode-tile-sample {
  font-size: 18px;
  font-weight: 900;
  color: #d6f7ff;
  letter-spacing: 0.04em;
  line-height: 1;
}
.sb-bt-mode-tile-name {
  font-size: 11px;
  font-weight: 700;
  color: #e8eef8;
}
.sb-bt-mode-tile-desc {
  font-size: 9px;
  color: rgba(170, 200, 255, 0.7);
  line-height: 1.3;
}

/* Caption layout picker — 60 creative ways the words appear */
.sb-bt-caption-layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 6px;
  margin-bottom: 8px;
  max-height: 22rem;
  overflow-y: auto;
  padding: 2px 4px 2px 0;
}
.sb-bt-layout-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  background: rgba(12, 18, 30, 0.85);
  border: 1px solid rgba(120, 170, 255, 0.18);
  border-radius: 10px;
  cursor: pointer;
  font-size: 11px;
  color: #e8eef8;
  overflow: hidden;
  isolation: isolate;
  transition: border-color .14s, transform .14s, box-shadow .14s;
}
.sb-bt-layout-tile:hover {
  border-color: rgba(120, 200, 255, 0.55);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.sb-bt-layout-tile:has(input:checked) {
  border-color: rgba(95, 252, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(95, 252, 255, 0.45), 0 0 18px rgba(95, 252, 255, 0.18);
}
.sb-bt-layout-tile input { position: absolute; inset: 0; opacity: 0; pointer-events: none; margin: 0; }
.sb-bt-layout-tile-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 9px 7px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.65) 100%);
  border-top: 1px solid rgba(80, 130, 200, 0.18);
}
.sb-bt-layout-tile-name {
  font-weight: 700;
  font-size: 11px;
  color: #d6f7ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}
.sb-bt-layout-tile:has(input:checked) .sb-bt-layout-tile-name {
  color: #5ffcff;
}
.sb-bt-layout-tile-fam {
  flex-shrink: 0;
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(95, 252, 255, 0.10);
  color: rgba(170, 220, 255, 0.85);
}
.sb-bt-layout-tile:has(input:checked) .sb-bt-layout-tile-fam {
  background: rgba(95, 252, 255, 0.22);
  color: #d6f7ff;
}
.sb-bt-layout-tile-mini {
  position: relative;
  height: 96px;
  margin: 0;
  background:
    radial-gradient(circle at 22% 28%, rgba(74, 139, 232, 0.55) 0%, transparent 55%),
    radial-gradient(circle at 78% 72%, rgba(199, 184, 255, 0.45) 0%, transparent 52%),
    radial-gradient(circle at 50% 95%, rgba(255, 158, 196, 0.30) 0%, transparent 55%),
    linear-gradient(135deg, #1a2240 0%, #2d1438 100%);
  border-bottom: 1px solid rgba(80, 130, 200, 0.18);
  overflow: hidden;
  transition: filter .18s;
}
.sb-bt-layout-tile:hover .sb-bt-layout-tile-mini,
.sb-bt-layout-tile.is-playing .sb-bt-layout-tile-mini {
  filter: saturate(1.2) brightness(1.08);
}
.sb-bt-layout-tile:has(input:checked) .sb-bt-layout-tile-mini {
  box-shadow: inset 0 0 0 1px rgba(95, 252, 255, 0.35), inset 0 0 22px rgba(95, 252, 255, 0.12);
}
.sb-bt-layout-tile-mini-text {
  transition: transform .18s, color .18s, text-shadow .18s, opacity .18s;
}
.sb-bt-layout-tile-mini-text.is-active {
  color: #FFD400 !important;
  text-shadow: 0 0 8px rgba(255, 212, 0, 0.85), 0 0 14px rgba(255, 212, 0, 0.45) !important;
  z-index: 2;
}
.sb-bt-layout-tile.is-playing .sb-bt-layout-tile-mini-text {
  animation: sbBtLayoutWordPop .26s ease-out;
}
.sb-bt-layout-tile.is-playing .sb-bt-layout-tile-mini-text.is-active {
  animation: sbBtLayoutWordEmph .32s ease-out;
}
@keyframes sbBtLayoutWordPop {
  0%   { opacity: 0; transform: translate(var(--tx, 0), 6px) scale(0.85); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translate(var(--tx, 0), 0) scale(1); }
}
@keyframes sbBtLayoutWordEmph {
  0%   { opacity: 0; transform: translate(var(--tx, 0), 0) scale(0.6); }
  55%  { transform: translate(var(--tx, 0), 0) scale(1.25); }
  100% { opacity: 1; transform: translate(var(--tx, 0), 0) scale(1.1); }
}
.sb-bt-layout-tile-mini-dot {
  position: absolute;
  height: 9px;
  border-radius: 3px;
  background: linear-gradient(90deg, #5ffcff, #c9ff5f);
  box-shadow: 0 0 6px rgba(95, 252, 255, 0.45);
}
/* In-tile preview word — inherits the active caption template's font, color,
   and hollow/transparent treatment so the layout picker visualizes how the
   selected style will render at that anchor position. */
.sb-bt-layout-tile-mini-text {
  position: absolute;
  white-space: nowrap;
  line-height: 1;
  pointer-events: none;
  letter-spacing: 0.02em;
}

/* Words-on-timeline strip — click a word pill to hide it from the caption (audio still plays) */
.sb-bt-word-strip-wrap {
  margin-top: 10px;
  padding: 8px;
  background: rgba(8, 14, 24, 0.65);
  border: 1px solid rgba(80, 130, 200, 0.2);
  border-radius: 8px;
}
.sb-bt-word-strip-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(170, 200, 255, 0.75);
  margin-bottom: 5px;
}
.sb-bt-word-strip {
  position: relative;
  height: 32px;
  background: rgba(20, 30, 45, 0.55);
  border-radius: 6px;
  overflow: hidden;
}
.sb-bt-word-pill {
  position: absolute;
  top: 4px;
  height: 24px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(95, 252, 255, 0.22);
  color: #d6f7ff;
  border: 1px solid rgba(95, 252, 255, 0.4);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background .12s, opacity .12s;
  user-select: none;
}
.sb-bt-word-pill:hover { background: rgba(255, 100, 100, 0.35); border-color: rgba(255, 130, 130, 0.7); }
.sb-bt-word-pill--hidden {
  background: rgba(80, 80, 90, 0.18);
  color: rgba(180, 180, 200, 0.55);
  border-color: rgba(120, 120, 140, 0.3);
  text-decoration: line-through;
  opacity: 0.6;
}
.sb-bt-word-pill--hidden:hover { background: rgba(95, 252, 255, 0.2); border-color: rgba(95, 252, 255, 0.5); }
.sb-bt-word-pill--emphasis::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 4px;
  box-shadow: 0 0 6px rgba(255, 200, 90, 0.6);
  pointer-events: none;
}
.sb-bt-word-pill--active { background: rgba(255, 230, 90, 0.35); border-color: rgba(255, 230, 90, 0.7); }

/* Captions pane inside the left sidebar (tab next to Clips / Transitions) */
.sb-bt-sb-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sb-bt-sb-pane[hidden] {
  display: none !important;
}

.sb-bt-sb-pane--captions {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.sb-bt-captions-panel--sidebar {
  padding: 0 14px 14px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sb-bt-captions-panel--sidebar::-webkit-scrollbar { width: 0; height: 0; display: none; }
.sb-bt-captions-panel--sidebar .sb-bt-caption-template-grid {
  max-height: none;
  min-height: 0;
  flex: 0 0 auto;
  overflow: visible;
}

/* Auth, settings, owner secret taps */
.sb-bt-auth-loading {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(6, 8, 14, 0.92);
  color: var(--sb-dim);
  font-size: 14px;
  /* Let Setup / Analyze beats work while Firebase auth finishes. */
  pointer-events: none;
}

.sb-bt-auth-loading[hidden] {
  display: none;
}

.sb-bt-auth-spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--sb-accent);
  animation: sb-bt-spin 0.8s linear infinite;
}

@keyframes sb-bt-spin {
  to {
    transform: rotate(360deg);
  }
}

.sb-bt-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sb-bt-user-bar,
.sb-bt-guest-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.sb-bt-user-bar[hidden],
.sb-bt-guest-bar[hidden] {
  display: none !important;
}

.sb-bt-uname {
  font-size: 13px;
  font-weight: 700;
  color: var(--sb-text);
  cursor: default;
  user-select: none;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-bt-premium-badge {
  font-size: 11px;
  color: #e8a000;
}

.sb-bt-premium-badge[hidden] {
  display: none !important;
}

.sb-bt-gem-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px 3px 7px;
  margin-left: 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(98, 212, 255, 0.14), rgba(58, 107, 255, 0.18));
  border: 1px solid rgba(98, 212, 255, 0.45);
  color: #cfe8ff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: help;
  box-shadow: 0 1px 8px rgba(58, 107, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.sb-bt-gem-badge[hidden] { display: none !important; }
.sb-bt-gem-badge .cf-gem-ic { font-size: 12px; line-height: 1; filter: drop-shadow(0 0 6px rgba(98, 212, 255, 0.6)); }
.sb-bt-gem-badge.is-low { background: linear-gradient(135deg, rgba(255, 96, 96, 0.18), rgba(255, 64, 96, 0.22)); border-color: rgba(255, 110, 130, 0.55); color: #ffd9d9; }
.sb-bt-gem-badge.is-low .cf-gem-ic { filter: drop-shadow(0 0 6px rgba(255, 110, 130, 0.7)); }

.sb-bt-secret-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 5rem;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
}

.sb-bt-secret-modal.active {
  opacity: 1;
  pointer-events: all;
}

.sb-bt-secret-modal .secret-modal-inner {
  background: #060616;
  border: 1px solid rgba(0, 220, 255, 0.25);
  border-radius: 12px;
  padding: 1.4rem 1.6rem;
  width: 100%;
  max-width: 300px;
  box-shadow: 0 0 40px rgba(0, 220, 255, 0.16);
  font-family: var(--sb-mono);
  transform: translateY(-18px);
  transition: transform 0.22s;
}

.sb-bt-secret-modal.active .secret-modal-inner {
  transform: none;
}

.sb-bt-secret-modal .secret-modal-inner.shake {
  animation: sb-bt-sm-shake 0.45s ease both;
}

@keyframes sb-bt-sm-shake {
  0%,
  100% {
    transform: none;
  }
  20% {
    transform: translateX(-9px);
  }
  40% {
    transform: translateX(9px);
  }
  60% {
    transform: translateX(-6px);
  }
  80% {
    transform: translateX(6px);
  }
}

.sb-bt-secret-modal .secret-prompt {
  font-size: 0.68rem;
  color: rgba(0, 220, 255, 0.5);
  margin-bottom: 0.65rem;
  letter-spacing: 0.1em;
}

.sb-bt-secret-modal .secret-input-row {
  display: flex;
  gap: 0.5rem;
}

.sb-bt-secret-modal #secret-input {
  flex: 1;
  background: #03030d;
  border: 1px solid rgba(0, 220, 255, 0.38);
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  color: #0df;
  font-family: var(--sb-mono);
  font-size: 1.2rem;
  letter-spacing: 0.25em;
  text-align: center;
  outline: none;
}

.sb-bt-secret-modal #secret-submit {
  background: rgba(0, 220, 255, 0.1);
  border: 1px solid rgba(0, 220, 255, 0.28);
  border-radius: 6px;
  padding: 0.55rem 0.85rem;
  color: #0df;
  cursor: pointer;
  font-size: 0.85rem;
}

.sb-bt-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3.5rem 1.25rem 1.25rem;
  background: rgba(4, 6, 14, 0.78);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.sb-bt-settings-modal.active {
  opacity: 1;
  pointer-events: all;
}

.sb-bt-settings-panel {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--sb-panel);
  border: 1px solid var(--sb-border);
  border-radius: 14px;
  padding: 1.2rem 1.35rem 1.35rem;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.55);
  transform: translateY(-14px);
  transition: transform 0.2s;
}

.sb-bt-settings-modal.active .sb-bt-settings-panel {
  transform: none;
}

.sb-bt-settings-panel h2 {
  font-size: 1.08rem;
  font-weight: 800;
  margin: 0 2rem 0.85rem 0;
}

.sb-bt-settings-section {
  margin-bottom: 1rem;
}

.sb-bt-settings-section h3 {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--sb-dim);
  margin: 0 0 0.4rem;
}

.sb-bt-settings-email {
  font-size: 0.86rem;
  word-break: break-word;
}

.sb-bt-settings-hint {
  font-size: 0.8rem;
  color: var(--sb-dim);
  margin: 0 0 0.7rem;
  line-height: 1.45;
}

.sb-bt-settings-billing {
  width: 100%;
}

.sb-bt-settings-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 2.1rem;
  height: 2.1rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--sb-dim);
  font-size: 1.4rem;
  cursor: pointer;
}

.sb-bt-settings-signout {
  width: 100%;
  padding: 0.58rem;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--sb-border);
  border-radius: 10px;
  background: transparent;
  color: #f87171;
  cursor: pointer;
}

.sb-bt-settings-actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--sb-border);
}

/* Stock footage panel */
.sb-bt-stock-panel {
  margin: 0.65rem 0 0.5rem;
  padding: 0.65rem 0.55rem;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.12), rgba(15, 23, 42, 0.5));
}
.sb-bt-stock-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--sb-text);
}
.sb-bt-stock-toggle input {
  margin-top: 0.15rem;
}
.sb-bt-stock-body {
  margin-top: 0.55rem;
}
.sb-bt-stock-lead {
  margin: 0 0 0.5rem;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--sb-dim);
}
.sb-bt-stock-label {
  margin: 0.35rem 0 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sb-dim);
}
.sb-bt-stock-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  max-height: 7.2rem;
  overflow-y: auto;
  padding-right: 0.15rem;
}
.sb-bt-stock-genre {
  cursor: pointer;
}
.sb-bt-stock-genre input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.sb-bt-stock-genre-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.22rem 0.42rem;
  border-radius: 999px;
  border: 1px solid var(--sb-border);
  background: rgba(15, 23, 42, 0.65);
  font-size: 0.65rem;
  font-weight: 600;
}
.sb-bt-stock-genre input:checked + .sb-bt-stock-genre-inner {
  border-color: rgba(129, 140, 248, 0.9);
  background: rgba(99, 102, 241, 0.28);
  color: #e0e7ff;
}
.sb-bt-stock-genre-emoji {
  font-size: 0.85rem;
  line-height: 1;
}
.sb-bt-stock-templates {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  max-height: 8.5rem;
  overflow-y: auto;
}
.sb-bt-stock-template {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  padding: 0.38rem 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--sb-border);
  background: rgba(15, 23, 42, 0.55);
  color: var(--sb-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.sb-bt-stock-template strong {
  font-size: 0.72rem;
}
.sb-bt-stock-template span {
  font-size: 0.62rem;
  color: var(--sb-dim);
  line-height: 1.3;
}
.sb-bt-stock-template.is-selected {
  border-color: rgba(129, 140, 248, 0.85);
  background: rgba(99, 102, 241, 0.22);
}
.sb-bt-stock-sliders {
  margin: 0.45rem 0 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.68rem;
  color: var(--sb-dim);
}
.sb-bt-stock-sliders label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.sb-bt-stock-sliders input[type="range"] {
  width: 100%;
}
.sb-bt-btn--stock {
  margin-top: 0.25rem;
  border-color: rgba(129, 140, 248, 0.5);
}
.sb-bt-btn--stock.sb-bt-stock-building {
  opacity: 0.92;
  animation: sb-bt-stock-pulse 1.1s ease-in-out infinite;
}
@keyframes sb-bt-stock-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(129, 140, 248, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(129, 140, 248, 0.12);
  }
}
.sb-bt-btn--stock:disabled {
  opacity: 0.55;
}
.sb-bt-stock-status {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.72rem;
  color: var(--sb-dim);
  line-height: 1.35;
}
.sb-bt-stock-status--live {
  min-height: 2.2em;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.65);
  color: #c7d2fe;
  font-weight: 600;
}
.sb-bt-stock-status--live.sb-bt-stock-status--busy {
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.35);
}
.sb-bt-stock-status--live.sb-bt-stock-status--err {
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.35);
}
.sb-bt-btn--stock.sb-bt-stock-building,
.sb-bt-btn--stock[aria-busy="true"] {
  opacity: 1;
  cursor: wait;
}
.sb-bt-page--stock-mode .sb-bt-add-media--video {
  opacity: 0.45;
  pointer-events: none;
}
.sb-bt-stock-panel--pulse {
  animation: sb-bt-stock-panel-pulse 0.9s ease-out 1;
}
@keyframes sb-bt-stock-panel-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(129, 140, 248, 0.55);
  }
  100% {
    box-shadow: 0 0 0 10px rgba(129, 140, 248, 0);
  }
}
.sb-bt-clip-thumb--stock {
  background-size: cover;
  background-position: center;
  background-color: #1e293b;
}

/* ──────────────────────────────────────────────────────────────────────────
   Liquid glass overlay (v1)
   Frosted surfaces, soft inset highlights, ambient gradient,
   smoothed transitions. Layered on top of existing rules.
   ────────────────────────────────────────────────────────────────────────── */
:root {
  --lg-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --lg-fast: 160ms;
  --lg-med: 240ms;
  --lg-slow: 380ms;
  --lg-tint: rgba(74, 139, 232, 0.06);
  --lg-tint-2: rgba(107, 92, 255, 0.05);
  --lg-edge: rgba(255, 255, 255, 0.08);
  --lg-edge-strong: rgba(255, 255, 255, 0.14);
  --lg-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --lg-shadow-soft: 0 4px 18px rgba(0, 0, 0, 0.22);
  --lg-glow: 0 0 24px rgba(74, 139, 232, 0.18);
  --lg-radius-sm: 10px;
  --lg-radius: 14px;
  --lg-radius-lg: 20px;
}

/* Ambient body glow — slow drifting blobs behind the studio */
body.sb-bt-page {
  background:
    radial-gradient(circle 520px at 12% 8%, rgba(74, 139, 232, 0.10), transparent 60%),
    radial-gradient(circle 600px at 88% 22%, rgba(107, 92, 255, 0.09), transparent 65%),
    radial-gradient(circle 700px at 50% 110%, rgba(255, 77, 141, 0.06), transparent 60%),
    var(--sb-bg);
  background-attachment: fixed;
}

/* Smooth, consistent transitions on interactive elements */
.sb-bt-btn,
.sb-bt-rail-tab,
.sb-bt-sb-tab,
.sb-bt-clip-row,
.sb-bt-tx-tile,
.sb-bt-caption-tile,
.sb-bt-layout-tile,
.sb-bt-file-chip,
.sb-bt-track-head,
.sb-bt-avatar {
  transition:
    background-color var(--lg-med) var(--lg-ease),
    border-color var(--lg-med) var(--lg-ease),
    box-shadow var(--lg-med) var(--lg-ease),
    color var(--lg-fast) var(--lg-ease),
    transform var(--lg-med) var(--lg-ease) !important;
}

/* Toolbar — frosted top bar with hairline highlight */
.sb-bt-toolbar {
  background: linear-gradient(180deg, rgba(14, 20, 32, 0.72), rgba(10, 14, 24, 0.62)) !important;
  backdrop-filter: blur(22px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(22px) saturate(140%) !important;
  border-bottom: 1px solid transparent !important;
  box-shadow:
    inset 0 1px 0 var(--lg-edge),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04),
    0 6px 24px rgba(0, 0, 0, 0.28);
}

/* Sidebar — vertical frosted glass with soft inset top highlight */
.sb-bt-sidebar {
  background: linear-gradient(180deg, rgba(18, 24, 38, 0.62), rgba(10, 14, 24, 0.55)) !important;
  backdrop-filter: blur(20px) saturate(135%);
  -webkit-backdrop-filter: blur(20px) saturate(135%);
  border-right: 1px solid transparent !important;
  box-shadow:
    inset 0 1px 0 var(--lg-edge),
    inset -1px 0 0 rgba(255, 255, 255, 0.04),
    var(--lg-shadow-soft);
}

/* Player rail (right "Get started" / "Caption Display") */
.sb-bt-player-rail {
  background: linear-gradient(180deg, rgba(18, 24, 38, 0.58), rgba(8, 12, 22, 0.62)) !important;
  backdrop-filter: blur(20px) saturate(135%);
  -webkit-backdrop-filter: blur(20px) saturate(135%);
  border-left: 1px solid transparent !important;
  box-shadow:
    inset 0 1px 0 var(--lg-edge),
    inset 1px 0 0 rgba(255, 255, 255, 0.04),
    var(--lg-shadow-soft);
}

/* Timeline panel — softer surface */
.sb-bt-timeline-panel {
  background: linear-gradient(180deg, rgba(12, 18, 30, 0.52), rgba(8, 12, 22, 0.58)) !important;
  border-top: 1px solid var(--lg-edge);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Output panel */
.sb-bt-output {
  background: linear-gradient(180deg, rgba(18, 24, 38, 0.65), rgba(10, 14, 24, 0.62)) !important;
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  border-radius: var(--lg-radius-lg);
  border: 1px solid var(--lg-edge);
  box-shadow:
    inset 0 1px 0 var(--lg-edge-strong),
    var(--lg-shadow);
}

/* Buttons — glass hover with lift + subtle highlight */
.sb-bt-btn {
  border-radius: var(--lg-radius-sm);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--lg-edge);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.sb-bt-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
  border-color: var(--lg-edge-strong);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 6px 20px rgba(0, 0, 0, 0.28);
}
.sb-bt-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.sb-bt-btn:disabled { opacity: 0.45; }

/* Primary buttons get the accent glow */
.sb-bt-btn--primary {
  background: linear-gradient(180deg, rgba(74, 139, 232, 0.95), rgba(61, 142, 240, 0.85)) !important;
  border-color: rgba(125, 175, 255, 0.5) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 6px 18px rgba(74, 139, 232, 0.32);
}
.sb-bt-btn--primary:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(95, 160, 255, 1), rgba(74, 159, 250, 0.95)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 10px 28px rgba(74, 139, 232, 0.42);
}

/* Clip tiles — glass with subtle hover lift */
.sb-bt-clip-row {
  border-radius: var(--lg-radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)) !important;
  border: 1px solid var(--lg-edge) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.sb-bt-clip-row:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03)) !important;
  border-color: var(--lg-edge-strong) !important;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 6px 18px rgba(0, 0, 0, 0.28);
}
.sb-bt-clip-row.selected {
  background: linear-gradient(180deg, rgba(74, 139, 232, 0.22), rgba(74, 139, 232, 0.08)) !important;
  border-color: rgba(125, 175, 255, 0.45) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 4px 16px rgba(74, 139, 232, 0.22);
}

/* Tab buttons — smoother active treatment */
.sb-bt-sb-tab,
.sb-bt-rail-tab {
  border-radius: 10px 10px 0 0 !important;
}
.sb-bt-sb-tab.is-active,
.sb-bt-rail-tab--active {
  background: linear-gradient(180deg, rgba(74, 139, 232, 0.18), rgba(74, 139, 232, 0.04)) !important;
  box-shadow: inset 0 -2px 0 var(--sb-accent), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* File chip + search input — frosted */
.sb-bt-file-chip,
.sb-bt-search {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--lg-edge) !important;
  border-radius: var(--lg-radius-sm) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.sb-bt-file-chip:hover,
.sb-bt-search:focus {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: var(--lg-edge-strong) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 3px rgba(74, 139, 232, 0.18);
  outline: none;
}

/* Caption template / layout tiles */
.sb-bt-caption-tile,
.sb-bt-layout-tile,
.sb-bt-tx-tile {
  border-radius: var(--lg-radius) !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)) !important;
  border: 1px solid var(--lg-edge) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.sb-bt-caption-tile:hover,
.sb-bt-layout-tile:hover,
.sb-bt-tx-tile:hover {
  border-color: var(--lg-edge-strong) !important;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 6px 16px rgba(0, 0, 0, 0.24);
}

/* Tab strip (sidebar + rail) — glass pill background */
.sb-bt-sidebar-tabs,
.sb-bt-rail-tabs {
  background: rgba(0, 0, 0, 0.22) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 -1px 0 var(--lg-edge);
}

/* Smooth out focus rings globally */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 139, 232, 0.35);
}

/* Output download / dismiss buttons get the same glass treatment */
.sb-bt-download-btn {
  border-radius: var(--lg-radius) !important;
}

@media (prefers-reduced-motion: reduce) {
  .sb-bt-btn,
  .sb-bt-clip-row,
  .sb-bt-caption-tile,
  .sb-bt-layout-tile,
  .sb-bt-tx-tile {
    transition: none !important;
  }
  .sb-bt-btn:hover,
  .sb-bt-clip-row:hover,
  .sb-bt-caption-tile:hover,
  .sb-bt-layout-tile:hover,
  .sb-bt-tx-tile:hover {
    transform: none !important;
  }
}

/* ---- Step 1: Add media launcher (rail) ---- */
.sb-bt-step-add {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid rgba(90, 160, 255, 0.32);
  background: linear-gradient(135deg, rgba(61, 142, 240, 0.18), rgba(30, 55, 100, 0.35));
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  text-align: left;
  color: var(--sb-text);
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.sb-bt-step-add:hover {
  border-color: rgba(120, 180, 255, 0.55);
  background: linear-gradient(135deg, rgba(77, 155, 255, 0.28), rgba(40, 75, 140, 0.48));
  transform: translateX(2px);
}
.sb-bt-step-add .sb-bt-workflow-copy { flex: 1; }
.sb-bt-step-add-chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.sb-bt-step-add--done {
  border-color: rgba(120, 200, 140, 0.45);
  background: linear-gradient(135deg, rgba(90, 200, 130, 0.22), rgba(35, 110, 70, 0.38));
}
.sb-bt-step-add--done .sb-bt-step-add-chev { background: rgba(0, 0, 0, 0.28); }

.sb-bt-step-add--extras {
  margin-top: 8px;
  border-style: dashed;
  border-color: rgba(90, 160, 255, 0.28);
  background: linear-gradient(135deg, rgba(61, 142, 240, 0.10), rgba(30, 55, 100, 0.20));
}
.sb-bt-step-add--extras[data-disabled="1"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: auto;
}
.sb-bt-step-add--extras[data-disabled="1"]:hover {
  transform: none;
  border-color: rgba(90, 160, 255, 0.28);
  background: linear-gradient(135deg, rgba(61, 142, 240, 0.10), rgba(30, 55, 100, 0.20));
}

/* ---- Import Media modal ---- */
.sb-bt-media-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.sb-bt-media-modal[hidden] { display: none; }
.sb-bt-media-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}
.sb-bt-media-modal-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: #08111d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  color: var(--sb-text);
  overflow: hidden;
}
.sb-bt-media-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sb-bt-media-modal-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sb-bt-media-modal-up {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}
.sb-bt-media-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--sb-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.sb-bt-media-modal-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sb-text);
}
.sb-bt-media-modal-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 20px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sb-bt-media-modal-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  color: var(--sb-dim);
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: -1px;
}
.sb-bt-media-modal-tab:hover { color: var(--sb-text); }
.sb-bt-media-modal-tab--active {
  color: #4ea1ff;
  border-bottom-color: #4ea1ff;
}
.sb-bt-media-modal-tab-ico { font-size: 14px; }
.sb-bt-media-modal-pane {
  padding: 22px 24px 16px;
  overflow-y: auto;
}
.sb-bt-media-modal-h3 {
  margin: 4px 0 6px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #4ea1ff;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sb-bt-mim-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #5AA0FF, #3d8ef0);
  color: #04122a;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 0 4px 12px rgba(90, 160, 255, 0.35);
}
.sb-bt-media-modal-sub {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--sb-dim);
}
.sb-bt-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.sb-bt-template-empty {
  grid-column: 1 / -1;
  padding: 28px 14px;
  text-align: center;
  color: var(--sb-dim);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}
.sb-bt-template-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--sb-text);
  overflow: hidden;
  cursor: pointer;
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1),
              border-color 160ms, box-shadow 160ms, background 160ms;
  text-align: left;
}
.sb-bt-template-card:hover {
  transform: translateY(-2px);
  border-color: rgba(120, 170, 255, 0.45);
  background: rgba(120, 170, 255, 0.06);
}
.sb-bt-template-card.is-selected {
  border-color: rgba(90, 160, 255, 0.85);
  box-shadow: 0 0 0 2px rgba(90, 160, 255, 0.30);
}
.sb-bt-template-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #0a0d18;
  display: block;
}
.sb-bt-template-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px 12px;
}
.sb-bt-template-meta strong {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.sb-bt-template-theme {
  display: inline-flex;
  align-self: flex-start;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(245, 166, 35, 0.18);
  border: 1px solid rgba(245, 166, 35, 0.45);
  color: #ffce7a;
}
.sb-bt-template-size {
  font-size: 11px;
  color: var(--sb-dim);
  font-family: monospace;
}
.sb-bt-media-modal-drops {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 520px) {
  .sb-bt-media-modal-drops { grid-template-columns: 1fr; }
}
.sb-bt-media-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 16px;
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.sb-bt-media-drop input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.sb-bt-media-drop:hover {
  border-color: rgba(120, 180, 255, 0.55);
  background: rgba(78, 161, 255, 0.06);
}
.sb-bt-media-drop.sb-bt-add-media--done {
  border-style: solid;
  border-color: rgba(120, 200, 140, 0.55);
  background: rgba(90, 200, 130, 0.08);
}
.sb-bt-media-drop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 18px;
}
.sb-bt-media-drop-title {
  font-size: 14px;
  font-weight: 700;
}
.sb-bt-media-drop-hint {
  font-size: 11px;
  color: var(--sb-dim);
}
.sb-bt-yt-import--modal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.sb-bt-yt-import--modal .sb-bt-yt-import-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  color: var(--sb-text);
  font-size: 14px;
}
.sb-bt-yt-import--modal .sb-bt-yt-import-status {
  font-size: 11px;
  color: var(--sb-dim);
}
.sb-bt-mim-or {
  margin: 14px 0 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
}
.sb-bt-mim-or::before,
.sb-bt-mim-or::after {
  content: "";
  display: inline-block;
  vertical-align: middle;
  width: 28%;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 10px;
}
.sb-bt-yt-import-label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--sb-text);
  margin-bottom: 4px;
}
.sb-bt-yt-import-hint {
  display: block;
  font-size: 11.5px;
  color: var(--sb-dim);
  margin-bottom: 10px;
  line-height: 1.35;
}
.sb-bt-yt-import-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}
.sb-bt-yt-import-row .sb-bt-yt-import-input {
  flex: 1 1 180px;
  min-width: 0;
}
.sb-bt-yt-import-row .sb-bt-btn {
  flex-shrink: 0;
  align-self: center;
}
.sb-bt-media-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.sb-bt-media-modal-status {
  font-size: 12px;
  color: var(--sb-dim);
}
.sb-bt-media-modal-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 24px 16px;
}
.sb-bt-media-modal-steps .sb-bt-btn--workflow { width: 100%; }
.sb-bt-mim-step {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sb-bt-mim-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 4px 0;
  font-size: 12px;
  color: var(--sb-dim);
}
.sb-bt-mim-progress[hidden] { display: none; }
.sb-bt-mim-progress--done { color: #6cd58a; }
.sb-bt-mim-progress-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sb-bt-mim-progress-text {
  flex: 1;
  min-width: 0;
}
.sb-bt-mim-progress-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--sb-text);
  font-size: 13px;
}
.sb-bt-mim-progress-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.sb-bt-mim-progress-bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4a8be8, #6cd58a);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 18px rgba(108, 213, 138, 0.45);
}
.sb-bt-mim-progress--done .sb-bt-mim-progress-bar-fill {
  background: linear-gradient(90deg, #6cd58a, #ffd166);
}

.sb-bt-mim-celebrate {
  margin: 14px 4px 0;
  padding: 22px 18px 20px;
  border-radius: 14px;
  border: 1px solid rgba(108, 213, 138, 0.35);
  background:
    radial-gradient(ellipse 80% 100% at 50% 0%, rgba(108, 213, 138, 0.22), transparent),
    linear-gradient(180deg, rgba(74, 139, 232, 0.12), rgba(30, 60, 110, 0.18));
  text-align: center;
  position: relative;
  z-index: 2;
  animation: sb-bt-mim-pop 0.55s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.sb-bt-mim-celebrate[hidden] { display: none; }
.sb-bt-mim-celebrate-num {
  font-size: 64px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff 0%, #b9e1ff 60%, #6cd58a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 24px rgba(108, 213, 138, 0.3);
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.sb-bt-mim-celebrate-label {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e8f1ff;
}
.sb-bt-mim-celebrate-sub {
  margin-top: 8px;
  font-size: 12px;
  color: var(--sb-dim);
}
@keyframes sb-bt-mim-pop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.sb-bt-mim-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--sb-accent);
  animation: sb-bt-mim-spin 0.8s linear infinite;
}
.sb-bt-mim-progress--done .sb-bt-mim-spinner {
  border: none;
  background: transparent;
  animation: none;
  color: #6cd58a;
  font-weight: 800;
}
.sb-bt-mim-progress--done .sb-bt-mim-spinner::before {
  content: "✓";
  display: inline-block;
  font-size: 13px;
  line-height: 12px;
}
@keyframes sb-bt-mim-spin {
  to { transform: rotate(360deg); }
}
.sb-bt-music-start--modal {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}
.sb-bt-confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}
body.sb-bt-modal-open { overflow: hidden; }

/* ---- Empty-state overlay on the timeline panel ---- */
/* LYRC-style guided empty state: dashed border zone, big circular + button,
   uppercase title, accent format hint. Cutflux accent: #3d8ef0 (blue). */
.sb-bt-timeline-panel { position: relative; }
.sb-bt-timeline-empty {
  position: absolute;
  inset: 12px;
  z-index: 20;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px 24px;
  background: rgba(0, 0, 0, 0.78);
  border: 1.5px dashed rgba(120, 170, 240, 0.32);
  border-radius: 10px;
}
.sb-bt-timeline-panel--empty .sb-bt-timeline-empty { display: flex; }
.sb-bt-timeline-panel--empty .sb-bt-waveform,
.sb-bt-timeline-panel--empty .sb-bt-tracks {
  filter: brightness(0.14) saturate(0.2);
  pointer-events: none;
}
/* Dim adjacent shells so attention lands on the CTA alone.
   The right rail keeps its color — instead we hide the workflow steps
   that aren't usable yet, leaving just orientation + the dark Add-media CTA. */
body.sb-bt-empty-mode .sb-bt-source-rail,
body.sb-bt-empty-mode .sb-bt-toolbar,
body.sb-bt-empty-mode .sb-bt-sidebar,
body.sb-bt-empty-mode .sb-bt-player-rail,
body.sb-bt-empty-mode .sb-bt-timeline-panel {
  filter: brightness(0.42) saturate(0.55);
  transition: filter 0.22s ease, opacity 0.22s ease;
  pointer-events: none;
}
body.sb-bt-empty-mode .sb-bt-source-rail:hover,
body.sb-bt-empty-mode .sb-bt-toolbar:hover,
body.sb-bt-empty-mode .sb-bt-sidebar:hover,
body.sb-bt-empty-mode .sb-bt-player-rail:hover,
body.sb-bt-empty-mode .sb-bt-timeline-panel:hover {
  filter: brightness(0.72) saturate(0.85);
  pointer-events: auto;
}
/* Always keep the open-media trigger inside the toolbar fully bright/clickable. */
body.sb-bt-empty-mode #openMediaModalBtn,
body.sb-bt-empty-mode .sb-bt-step-add {
  filter: none !important;
  pointer-events: auto !important;
  position: relative;
  z-index: 5;
}
/* Pulse the empty CTA so it visibly draws the eye. */
body.sb-bt-empty-mode .sb-bt-player-empty--btn {
  animation: sb-bt-empty-pulse 2.4s ease-in-out infinite;
}
body.sb-bt-empty-mode .sb-bt-player-empty--btn .sb-bt-player-empty-icon {
  animation: sb-bt-empty-icon-pulse 2.4s ease-in-out infinite;
}
@keyframes sb-bt-empty-pulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(125, 176, 240, 0.10); }
  50% { box-shadow: inset 0 0 0 1px rgba(125, 176, 240, 0.32), inset 0 0 60px rgba(61, 142, 240, 0.12); }
}
@keyframes sb-bt-empty-icon-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 18px rgba(61, 142, 240, 0.22); }
  50% { transform: scale(1.08); box-shadow: 0 0 36px rgba(61, 142, 240, 0.55); }
}
/* Lift the preview/player card above everything for focus. */
body.sb-bt-empty-mode .sb-bt-player-card {
  position: relative;
  z-index: 4;
  box-shadow: 0 0 0 1px rgba(125, 176, 240, 0.18), 0 24px 80px rgba(61, 142, 240, 0.18);
  border-radius: 16px;
}
body.sb-bt-empty-mode .sb-bt-rail-pane--setup .sb-bt-rail-more,
body.sb-bt-empty-mode .sb-bt-rail-pane--setup .sb-bt-rail-title--steps,
body.sb-bt-empty-mode .sb-bt-rail-pane--setup .sb-bt-workflow,
body.sb-bt-empty-mode .sb-bt-rail-pane--setup .sb-bt-rail-foot,
body.sb-bt-empty-mode .sb-bt-rail-pane--setup .cf-upscale-toggle {
  display: none !important;
}
.sb-bt-timeline-empty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  border: 1px solid rgba(120, 170, 240, 0.42);
  background: radial-gradient(circle at 50% 50%, rgba(61, 142, 240, 0.18), rgba(61, 142, 240, 0.04) 70%, transparent 100%);
  color: var(--sb-accent);
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}
.sb-bt-timeline-empty-btn:hover {
  border-color: var(--sb-accent);
  background: radial-gradient(circle at 50% 50%, rgba(61, 142, 240, 0.26), rgba(61, 142, 240, 0.06) 70%, transparent 100%);
  transform: scale(1.04);
}
.sb-bt-timeline-empty-btn:active { transform: scale(0.98); }
.sb-bt-timeline-empty-plus {
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
  color: var(--sb-accent);
}
.sb-bt-timeline-empty-title {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: #f4f7fb;
}
.sb-bt-timeline-empty-formats {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  color: var(--sb-accent);
}
.sb-bt-timeline-empty-hint {
  margin: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.42);
}
.sb-bt-timeline-empty-steps {
  list-style: none;
  margin: 22px 0 0;
  padding: 14px 18px;
  display: grid;
  gap: 10px;
  max-width: 320px;
  width: 100%;
  border: 1px solid rgba(90, 160, 255, 0.18);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(90, 160, 255, 0.06), rgba(90, 160, 255, 0.02));
  text-align: left;
}
.sb-bt-timeline-empty-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 12px;
  line-height: 1.35;
}
.sb-bt-timeline-empty-step-num {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #5AA0FF;
  color: #0a1224;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}
.sb-bt-timeline-empty-step-txt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: rgba(255, 255, 255, 0.82);
}
.sb-bt-timeline-empty-step-txt b {
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
}
.sb-bt-timeline-empty-step-txt em {
  font-style: normal;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

/* =============================================================
   Display-mode tiles v2 (rail / captions tab)
   ROLLBACK: delete this whole block AND remove the
   "sb-bt-mode-grid--v2" class from #btCaptionModeGrid in HTML.
   ============================================================= */
.sb-bt-mode-grid--v2 {
  grid-template-columns: repeat(auto-fill, minmax(8.4rem, 1fr));
  gap: 8px;
  padding: 4px 2px 2px;
  max-height: 24rem;
}
.sb-bt-mode-grid--v2 .sb-bt-mode-tile {
  position: relative;
  gap: 6px;
  padding: 12px 12px 10px;
  border-radius: 12px;
  border: 1px solid rgba(140, 180, 250, 0.18);
  background:
    radial-gradient(140% 80% at 0% 0%, rgba(98, 212, 255, 0.10), transparent 55%),
    linear-gradient(180deg, rgba(18, 24, 40, 0.96) 0%, rgba(6, 9, 18, 0.98) 100%);
  overflow: hidden;
  isolation: isolate;
  transition:
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.22s ease,
    background 0.22s ease;
}
.sb-bt-mode-grid--v2 .sb-bt-mode-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(135deg, rgba(98, 212, 255, 0) 0%, rgba(90, 160, 255, 0) 100%);
  transition: background 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
}
.sb-bt-mode-grid--v2 .sb-bt-mode-tile > * {
  position: relative;
  z-index: 1;
}
.sb-bt-mode-grid--v2 .sb-bt-mode-tile:hover {
  border-color: rgba(120, 200, 255, 0.55);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(120, 200, 255, 0.18);
}
.sb-bt-mode-grid--v2 .sb-bt-mode-tile:hover::before {
  background: linear-gradient(135deg, rgba(98, 212, 255, 0.12) 0%, rgba(90, 160, 255, 0.06) 100%);
}
.sb-bt-mode-grid--v2 .sb-bt-mode-tile:has(input:checked) {
  border-color: rgba(95, 252, 255, 0.95);
  box-shadow:
    0 0 0 1px rgba(95, 252, 255, 0.55),
    0 0 22px rgba(95, 252, 255, 0.28),
    0 12px 28px rgba(0, 0, 0, 0.5);
}
.sb-bt-mode-grid--v2 .sb-bt-mode-tile:has(input:checked)::before {
  background: linear-gradient(135deg, rgba(95, 252, 255, 0.16) 0%, rgba(61, 142, 240, 0.10) 100%);
}
.sb-bt-mode-grid--v2 .sb-bt-mode-tile:has(input:checked)::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 2;
  font-size: 10px;
  font-weight: 800;
  color: #04050c;
  background: linear-gradient(135deg, #62d4ff, #5aa0ff);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 0 10px rgba(95, 252, 255, 0.6);
}
.sb-bt-mode-grid--v2 .sb-bt-mode-tile-sample {
  font-family: "Anton", "Inter", sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
  background: linear-gradient(180deg, #eaf6ff 0%, #9cc8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 18px rgba(98, 212, 255, 0.2);
}
.sb-bt-mode-grid--v2 .sb-bt-mode-tile-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #eaf0ff;
  text-transform: uppercase;
}
.sb-bt-mode-grid--v2 .sb-bt-mode-tile-desc {
  font-size: 10px;
  color: rgba(182, 194, 230, 0.7);
  line-height: 1.35;
}
.sb-bt-mode-grid--v2 .sb-bt-mode-tile:has(input:checked) .sb-bt-mode-tile-sample {
  background: linear-gradient(180deg, #d6f7ff 0%, #62d4ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* =============================================================
   Font & Style grid v2 (rail / captions tab)
   ROLLBACK: delete this whole block AND remove the
   "sb-bt-caption-custom-grid--v2" class from #btCaptionCustomRail in HTML.
   ============================================================= */
.sb-bt-caption-custom-grid--v2 {
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 2px 0 2px;
  min-width: 0;
}
.sb-bt-caption-custom-grid--v2 label {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 8px 8px;
  border-radius: 10px;
  border: 1px solid rgba(140, 180, 250, 0.18);
  background:
    radial-gradient(140% 80% at 0% 0%, rgba(98, 212, 255, 0.10), transparent 55%),
    linear-gradient(180deg, rgba(18, 24, 40, 0.96) 0%, rgba(6, 9, 18, 0.98) 100%);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(182, 194, 230, 0.75);
  min-width: 0;
  isolation: isolate;
  transition: border-color 0.18s ease, transform 0.15s ease, box-shadow 0.22s ease;
}
.sb-bt-caption-custom-grid--v2 label:hover {
  border-color: rgba(120, 200, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.40), 0 0 0 1px rgba(120, 200, 255, 0.14);
}
.sb-bt-caption-custom-grid--v2 label:focus-within {
  border-color: rgba(95, 252, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(95, 252, 255, 0.45), 0 0 18px rgba(95, 252, 255, 0.22);
}
.sb-bt-caption-custom-grid--v2 select,
.sb-bt-caption-custom-grid--v2 input[type="color"] {
  background: #06080f;
  color: #eaf0ff;
  border: 1px solid rgba(140, 180, 250, 0.18);
  border-radius: 7px;
  padding: 5px 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.sb-bt-caption-custom-grid--v2 select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #62d4ff 50%),
    linear-gradient(135deg, #62d4ff 50%, transparent 50%);
  background-position:
    calc(100% - 11px) 50%,
    calc(100% - 7px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  padding-right: 20px;
  text-overflow: ellipsis;
}
.sb-bt-caption-custom-grid--v2 select:focus,
.sb-bt-caption-custom-grid--v2 input[type="color"]:focus {
  outline: none;
  border-color: #5aa0ff;
  box-shadow: 0 0 0 2px rgba(90, 160, 255, 0.25);
}
.sb-bt-caption-custom-grid--v2 input[type="color"] {
  height: 30px;
  padding: 2px;
  cursor: pointer;
}
.sb-bt-caption-custom-grid--v2 input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.sb-bt-caption-custom-grid--v2 input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }

/* The "use custom" toggle row keeps its full width + accent treatment, just polished */
.sb-bt-caption-custom-grid--v2 .sb-bt-caption-custom-toggle {
  grid-column: 1 / -1;
  padding: 8px 10px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(95, 252, 255, 0.12), rgba(61, 142, 240, 0.08));
  border: 1px solid rgba(95, 252, 255, 0.32);
  font-size: 11px !important;
  letter-spacing: 0.04em;
  text-transform: none;
}
.sb-bt-caption-custom-grid--v2 .sb-bt-caption-custom-toggle:hover {
  background:
    linear-gradient(135deg, rgba(95, 252, 255, 0.18), rgba(61, 142, 240, 0.12));
  border-color: rgba(95, 252, 255, 0.55);
}

/* ---- Every-beat-mode toggle (rail, under Analyze) ---- */
/* Surfaces only when state.everyBeatMode === true. Tap to leave. */
.sb-bt-every-beat-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: -2px 0 4px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 196, 86, 0.18), rgba(255, 124, 86, 0.10));
  border: 1px solid rgba(255, 196, 86, 0.45);
  color: #ffe7bd;
  cursor: pointer;
  user-select: none;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
.sb-bt-every-beat-toggle:hover {
  background: linear-gradient(135deg, rgba(255, 196, 86, 0.26), rgba(255, 124, 86, 0.14));
  border-color: rgba(255, 196, 86, 0.7);
}
.sb-bt-every-beat-toggle:active { transform: translateY(1px); }
.sb-bt-every-beat-toggle input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
  white-space: nowrap;
}
.sb-bt-every-beat-toggle-visual {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 196, 86, 0.32);
  box-shadow: inset 0 0 0 1px rgba(255, 196, 86, 0.55);
  transition: background 0.18s ease;
}
.sb-bt-every-beat-toggle-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffd476;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transform: translateX(14px);
  transition: transform 0.18s ease, background 0.18s ease;
}
.sb-bt-every-beat-toggle input[type="checkbox"]:not(:checked) ~ .sb-bt-every-beat-toggle-visual {
  background: rgba(120, 120, 120, 0.32);
  box-shadow: inset 0 0 0 1px rgba(180, 180, 180, 0.45);
}
.sb-bt-every-beat-toggle input[type="checkbox"]:not(:checked) ~ .sb-bt-every-beat-toggle-visual .sb-bt-every-beat-toggle-thumb {
  transform: translateX(0);
  background: #cfd2d6;
}
.sb-bt-every-beat-toggle-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.sb-bt-every-beat-toggle-copy strong {
  font-size: 12px;
  letter-spacing: 0.02em;
}
.sb-bt-every-beat-toggle-copy small {
  font-size: 10.5px;
  opacity: 0.78;
}

/* Every-beat button when placed inside the import modal steps. */
.sb-bt-btn--every-beat--modal {
  width: 100%;
  margin-top: 8px;
  justify-content: flex-start;
  background: linear-gradient(135deg, rgba(255, 196, 86, 0.12), rgba(255, 124, 86, 0.08));
  border: 1px dashed rgba(255, 196, 86, 0.55);
  color: #ffe7bd;
}
.sb-bt-btn--every-beat--modal:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(255, 196, 86, 0.22), rgba(255, 124, 86, 0.14));
  border-style: solid;
  border-color: rgba(255, 196, 86, 0.85);
}
.sb-bt-btn--every-beat--modal:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ─── Corner tips overlay (in-app how-to) ────────────────────────────── */
.cf-tips {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 6;
  pointer-events: none;
}
.cf-tips-panel,
.cf-tips-fab {
  pointer-events: auto;
}
.cf-tips-fab {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(90, 160, 255, 0.55);
  background: rgba(8, 16, 40, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #cfe0ff;
  font: 700 15px/1 'Plus Jakarta Sans', system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(90, 160, 255, 0.14);
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}
.cf-tips-fab:hover {
  transform: translateY(-1px);
  background: rgba(14, 26, 62, 0.9);
  border-color: rgba(90, 160, 255, 0.85);
}
.cf-tips-panel {
  width: min(260px, 62vw);
  border-radius: 12px;
  border: 1px solid rgba(90, 160, 255, 0.3);
  background: linear-gradient(180deg, rgba(10, 18, 42, 0.92) 0%, rgba(6, 12, 28, 0.92) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(90, 160, 255, 0.12) inset;
  color: #e4ecff;
  padding: 10px 12px 10px;
  font: 500 11.5px/1.45 'Plus Jakarta Sans', system-ui, sans-serif;
  animation: cfTipsIn 240ms cubic-bezier(0.2, 0.9, 0.2, 1.05);
}
@keyframes cfTipsIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cf-tips[data-open="0"] .cf-tips-panel { display: none; }
.cf-tips-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.cf-tips-bolt {
  color: #F5B73B;
  font-size: 14px;
  filter: drop-shadow(0 0 8px rgba(245, 183, 59, 0.55));
}
.cf-tips-title {
  flex: 1;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: #eef4ff;
}
.cf-tips-close {
  background: transparent;
  border: 0;
  color: #a8b8de;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.cf-tips-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.cf-tips-list {
  margin: 0;
  padding-left: 18px;
  color: #cfd9f0;
}
.cf-tips-list li {
  margin: 3px 0;
}
.cf-tips-list b {
  color: #eaf2ff;
  font-weight: 700;
}
.cf-tips-foot {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(90, 160, 255, 0.16);
  color: #9db1de;
  font-size: 10.5px;
}
.cf-tips-foot b { color: #cfe0ff; }
@media (max-width: 640px) {
  .cf-tips { right: 8px; bottom: 8px; }
  .cf-tips-panel { width: min(220px, 78vw); font-size: 10.5px; padding: 8px 10px; }
  .cf-tips-fab { width: 30px; height: 30px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .cf-tips-panel { animation: none; }
}
