:root {
  color-scheme: dark;
  --bg: #0A0D14;
  --surface: #121824;
  --card: #1A2233;
  --card-elevated: #212B40;
  --border: #28354D;
  --silver: #CBD5E1;
  --text-primary: #F1F5F9;
  --text-muted: #8A99B0;
  --cyan: #38BDF8;
  --gold: #F59E0B;
  --rec-red: #EF4444;
  --emerald: #10B981;
  --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  accent-color: var(--cyan);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.35;
  height: 100%;
  overscroll-behavior-y: contain;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.cyan { color: var(--cyan); }
.gold { color: var(--gold); }
.muted { color: var(--text-muted); }
.hidden { display: none !important; }

button {
  font-family: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ==================== APP SHELL ==================== */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: max(4px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  gap: 5px;
  overflow: hidden;
}

.top-collapsible {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.studio-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.brand-title {
  color: var(--cyan);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.project-title {
  color: var(--silver);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.platform-pill {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--gold);
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 999px;
  padding: 1px 6px;
}

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

.top-chip,
.icon-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 11px;
  color: var(--text-primary);
}

.icon-chip {
  padding: 5px 7px;
  color: var(--silver);
}

/* Mode Bar */
.mode-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}

.mode-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.mode-tab.active {
  background: var(--card-elevated);
  color: var(--text-primary);
  border-color: rgba(56, 189, 248, 0.6);
}

.mode-tab[data-mode="sync"].active {
  border-color: rgba(245, 158, 11, 0.65);
}

.tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.mode-tab.active .tab-dot.cyan { background: var(--cyan); }
.mode-tab.active .tab-dot.gold { background: var(--gold); }

/* Collapsed Top Pill */
.top-expand-row {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.top-expand-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 10px;
  color: var(--silver);
}

/* ==================== WORKSPACE ==================== */
.workspace {
  flex: 1;
  min-height: 0;
  display: flex;
}

.record-workspace {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.stage-column {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Guide Strip */
.guide-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.guide-strip::-webkit-scrollbar { display: none; }

.guide-file-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 8px;
  padding: 4px 8px;
  flex-shrink: 0;
  max-width: 215px;
}

.guide-load-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-primary);
  min-width: 0;
}

#refFileNameLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-icon-btn {
  font-size: 12px;
  padding: 1px 4px;
  border-radius: 4px;
  color: var(--silver);
}

.guide-mode-group {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}

.pill-btn {
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--silver);
  white-space: nowrap;
  flex-shrink: 0;
}

.pill-btn.active {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--bg);
  font-weight: 700;
}

.pill-btn.limiter.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--emerald);
  color: var(--emerald);
}

.earphone-hint {
  font-size: 10px;
  color: var(--gold);
  background: var(--surface);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  padding: 4px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==================== RECORD STAGE ==================== */
.record-stage {
  position: relative;
  flex: 1;
  min-height: 220px;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.record-stage.mode-split .guide-pane {
  position: relative;
  flex: 0 0 45%;
  width: 100%;
  min-height: 90px;
  background: #05080F;
  overflow: hidden;
  z-index: 2;
}

.record-stage.mode-split .camera-pane {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 110px;
  overflow: hidden;
  z-index: 1;
}

.record-stage.mode-pip .camera-pane {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}

.record-stage.mode-pip .guide-pane {
  position: absolute;
  top: 10px;
  left: 10px;
  width: clamp(132px, 34%, 210px);
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  border: 1.5px solid rgba(245, 158, 11, 0.85);
  background: #05080F;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  overflow: hidden;
  z-index: 8;
  touch-action: none;
}

.guide-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.audio-blue-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 25%, #2563EB 0%, #1E3A8A 48%, #09132C 100%);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 8px 10px;
}

.audio-blue-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.audio-blue-title {
  color: var(--text-primary);
  font-size: 11px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.waveform-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  z-index: 3;
}

.waveform-eye-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(10, 13, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--silver);
  font-size: 12px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pip-drag-grip {
  position: absolute;
  bottom: 2px;
  right: 2px;
  padding: 5px;
  font-size: 13px;
  color: var(--gold);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  z-index: 7;
  display: none;
}

.record-stage.mode-pip .pip-drag-grip {
  display: block;
}

.split-resizer {
  height: 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: row-resize;
  touch-action: none;
  flex-shrink: 0;
  z-index: 5;
}

.resizer-bar {
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: var(--silver);
  opacity: 0.45;
}

/* Camera Pane */
.camera-pane {
  touch-action: none;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center center;
  will-change: transform;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #141C2B 0%, #0A0D14 100%);
  z-index: 4;
}

.placeholder-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 22px;
  background: rgba(18, 24, 36, 0.92);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.placeholder-icon { font-size: 28px; }
.placeholder-title { font-size: 13px; color: var(--silver); }

.cam-badge {
  position: absolute;
  z-index: 6;
  background: rgba(10, 13, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 11px;
  color: var(--text-primary);
}

.cam-badge.bottom-left {
  left: 10px;
  bottom: 10px;
}

.cam-top-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 9;
}

.cam-ctrl-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(10, 13, 20, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.cam-ctrl-btn.active {
  border-color: var(--cyan);
  color: var(--cyan);
}

.zoom-reset-btn {
  background: rgba(10, 13, 20, 0.8);
  border: 1px solid var(--cyan);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--cyan);
}

.rec-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 10, 14, 0.84);
  border: 1px solid var(--rec-red);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  color: #fff;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rec-red);
  animation: pulseDot 1s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.mic-meter {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.meter-bar {
  width: 3px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
}

.meter-bar.on { background: var(--emerald); }
.meter-bar.warn.on { background: var(--gold); }
.meter-bar.hot.on { background: var(--rec-red); }

.lim-tag {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--bg);
  background: var(--gold);
  border-radius: 4px;
  padding: 1px 4px;
}

.punch-badge {
  position: absolute;
  top: 44px;
  left: 10px;
  z-index: 9;
  background: rgba(18, 24, 36, 0.82);
  border: 1px solid rgba(56, 189, 248, 0.7);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 10px;
  color: var(--cyan);
}

.count-in-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  background: rgba(10, 13, 20, 0.56);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.count-in-label {
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--gold);
  font-weight: 700;
}

.count-in-number {
  font-size: 74px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}

.visual-flash-border {
  position: absolute;
  inset: 0;
  border: 4px solid transparent;
  border-radius: 14px;
  pointer-events: none;
  z-index: 11;
  transition: border-color 70ms ease-out;
}

.visual-flash-border.beat { border-color: rgba(56, 189, 248, 0.9); }
.visual-flash-border.accent { border-color: rgba(245, 158, 11, 0.95); }

/* Floating Jog Dial (krapht Loop transparent wheel) */
.floating-jog-dial {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 46px;
  height: 46px;
  z-index: 12;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.floating-jog-dial img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.65));
}

.jog-pending-dot {
  position: absolute;
  top: -4px;
  right: -2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Fullscreen Floating Control Dock */
.floating-dock {
  position: absolute;
  right: 64px;
  bottom: 10px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(10, 13, 20, 0.82);
  border: 1px solid var(--border);
}

.dock-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.dock-btn.play {
  width: 36px;
  height: 36px;
  background: var(--card-elevated);
}

.dock-btn.play.active {
  background: var(--cyan);
  color: var(--bg);
}

.dock-btn.rec {
  width: 36px;
  height: 36px;
  background: rgba(239, 68, 68, 0.22);
  border: 1.5px solid var(--rec-red);
  color: var(--rec-red);
}

.dock-btn.rec.active {
  background: var(--rec-red);
  color: #fff;
}

.dock-time {
  font-size: 11px;
  color: var(--silver);
}

/* Section Chips & Parts Strip */
.section-chips-row,
.parts-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.section-chips-row::-webkit-scrollbar,
.parts-strip::-webkit-scrollbar { display: none; }

.section-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--silver);
  white-space: nowrap;
}

.section-chip.active {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.18);
  color: #fff;
}

.part-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--silver);
  white-space: nowrap;
  flex-shrink: 0;
}

.part-chip.selected {
  background: var(--card-elevated);
  border-color: var(--cyan);
  color: var(--cyan);
  font-weight: 600;
}

.part-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
}

.part-dot.recorded { background: var(--emerald); }

.part-edit-btn {
  font-size: 10px;
  color: var(--text-muted);
  padding-left: 2px;
}

/* ==================== SIDE CONTROL PANEL & TRANSPORT BAR ==================== */
.side-control-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.side-collapse-bar {
  display: none;
  justify-content: flex-end;
}

.side-collapse-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-muted);
}

.transport-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.timecode-current { font-size: 15px; color: var(--text-primary); }
.timecode-total { font-size: 10px; color: var(--text-muted); }

/* 3개 버튼 여유 간격 12px */
.transport-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.transport-btn {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 80ms ease;
}

.transport-btn:active { transform: scale(0.94); }

.transport-btn.rewind {
  width: 38px;
  height: 38px;
  background: var(--card);
  color: var(--text-primary);
}

.transport-btn.play {
  width: 42px;
  height: 42px;
  background: var(--card-elevated);
  color: var(--text-primary);
}

.transport-btn.play.active {
  background: var(--cyan);
  color: var(--bg);
}

.transport-btn.record {
  width: 44px;
  height: 44px;
  background: rgba(239, 68, 68, 0.18);
  border: 2px solid var(--rec-red);
  color: var(--rec-red);
  font-size: 18px;
}

.transport-btn.record.active {
  background: var(--rec-red);
  color: #fff;
}

.transport-btn.small {
  width: 34px;
  height: 34px;
  font-size: 14px;
}

.beat-lamp-box {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
}

.beat-lamp-box.running {
  background: var(--card-elevated);
  border-color: rgba(245, 158, 11, 0.7);
}

.beat-lamp {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
}

.beat-lamp:first-child { width: 8px; height: 8px; }
.beat-lamp.active { background: var(--cyan); }
.beat-lamp.accent.active { background: var(--gold); }

.transport-bottom-row {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.transport-bottom-row::-webkit-scrollbar { display: none; }

.chip-btn {
  height: 32px;
  padding: 0 9px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--silver);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chip-btn.highlighted {
  background: var(--card-elevated);
  border-color: rgba(56, 189, 248, 0.5);
  color: var(--cyan);
}

.chip-btn.active {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--bg);
  font-weight: 700;
}

.chip-btn.danger {
  border-color: rgba(239, 68, 68, 0.55);
  color: var(--rec-red);
}

.bpm-pill-btn {
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  background: var(--card-elevated);
  border: 1px solid rgba(245, 158, 11, 0.55);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.quick-parts-overview {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}

.quick-part-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 12px;
}

.quick-part-row.selected {
  background: var(--card-elevated);
  border-color: var(--cyan);
  color: var(--cyan);
}

/* ==================== SYNC WORKSPACE ==================== */
.sync-workspace {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}

.mini-playback-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 7px 10px;
}

.mini-left,
.mini-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-time { font-size: 12px; color: var(--silver); }

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

.sync-video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sync-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  gap: 6px;
}

.sync-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  object-fit: contain;
}

.sync-control-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sync-control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
}

.sync-overlay-canvas {
  width: 100%;
  height: 68px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.sync-dial-row {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
}

.sync-dial-row input[type="range"] {
  flex: 1;
  min-width: 90px;
}

.sync-mix-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.sync-slider-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--silver);
  flex: 1;
  min-width: 140px;
}

.sync-slider-label input[type="range"] { flex: 1; }

/* ==================== BUTTONS & INPUTS ==================== */
.btn-gold {
  padding: 7px 12px;
  border-radius: 9px;
  background: var(--gold);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
}

.btn-cyan-solid {
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--cyan);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
}

.btn-outline,
.btn-outline-cyan {
  padding: 7px 12px;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--silver);
  font-size: 12px;
}

.btn-outline-cyan {
  border-color: rgba(56, 189, 248, 0.55);
  color: var(--cyan);
}

.full-width { width: 100%; }

.text-input {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
}

@supports not (accent-color: #38BDF8) {
  input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
  }

  input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(to right, var(--cyan) var(--progress, 50%), var(--border) var(--progress, 50%));
  }

  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--cyan);
    margin-top: -5px;
  }

  input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: var(--border);
  }

  input[type="range"]::-moz-range-progress {
    height: 6px;
    border-radius: 999px;
    background: var(--cyan);
  }

  input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: var(--cyan);
  }
}

/* ==================== NATIVE <dialog> MODALS (modern-web-guidance) ==================== */
dialog.jam-dialog {
  width: min(94vw, 460px);
  max-height: 88dvh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
}

dialog.jam-dialog.small {
  width: min(92vw, 360px);
}

/* Scope display rules exclusively to dialog[open] */
dialog.jam-dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(6, 9, 15, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

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

.dialog-header h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.dialog-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--silver);
  font-size: 14px;
}

.dialog-body {
  padding: 14px 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-summary-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.session-summary-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--cyan);
}

.session-summary-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
}

.modal-label {
  font-size: 11px;
  color: var(--silver);
}

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

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

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

.modal-inline-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bpm-big {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  min-width: 44px;
  text-align: center;
}

.modal-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.modal-toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.toggle-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 11px;
  cursor: pointer;
}

.lead-in-card {
  background: var(--card);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Toast Banner */
.toast-banner {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  background: rgba(18, 24, 36, 0.96);
  border: 1px solid var(--cyan);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.65);
  max-width: 90vw;
  text-align: center;
}

/* ==================== LANDSCAPE / FOLD WIDE 2-COLUMN STUDIO ==================== */
@media (min-width: 720px) {
  .record-workspace {
    flex-direction: row;
    gap: 10px;
  }

  .stage-column {
    flex: 1.35;
    min-width: 0;
  }

  .side-control-panel {
    flex: 0 0 340px;
    min-height: 0;
  }

  .side-collapse-bar {
    display: flex;
  }

  .quick-parts-overview {
    display: flex;
  }

  .app-shell.side-collapsed .side-control-panel {
    display: none;
  }

  .app-shell.top-collapsed .top-collapsible,
  .app-shell.top-collapsed .guide-strip,
  .app-shell.top-collapsed .parts-strip {
    display: none;
  }
}

@media (max-width: 640px) {
  .sync-preview-grid {
    grid-template-columns: 1fr;
  }

  .modal-btn-grid,
  .modal-toggle-grid {
    grid-template-columns: 1fr;
  }
}
