/* Cutflux beat timeline tool — layout shell + timeline UI */
:root {
  --sb-bg: #05060b;
  --sb-panel: #0e1422;
  --sb-border: rgba(96, 142, 220, 0.22);
  --sb-text: #e8eef8;
  --sb-dim: #8a95ae;
  --sb-accent: #4a8be8;
  --sb-warn: #f5a623;
  --sb-ok: #3fcb7e;
  --sb-mono: "JetBrains Mono", ui-monospace, monospace;
}

* {
  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: 42vh;
}

.sb-bt-vlayer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  z-index: 1;
  transition: opacity 0.05s ease-out;
  transform: translateZ(0);
  backface-visibility: hidden;
  pointer-events: none;
}

.sb-bt-vlayer--active {
  opacity: 1;
  z-index: 2;
  pointer-events: none;
}

.sb-bt-compose-canvas {
  position: fixed;
  left: -9999px;
  width: 640px;
  height: 360px;
  opacity: 0;
  pointer-events: none;
}

.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-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);
}

.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: grab;
  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;
}

.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;
}

@keyframes sb-pulse-bar {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}
