/* =========================================================================
   TUNEABLE'R — PRODUCTION STUDIO DESIGN SYSTEM (PRECISION BUTTONS, MIXER, ARRANGER & STEP SEQ)
   Palette: Full Pure Black (#000000) | Pure White (#FFFFFF) |
   Studio Red (#DC2626) | Dark Forest Green (#059669) | Deep Navy Blue (#1D4ED8)
   ========================================================================= */
:root {
  --bg: #000000;
  --panel: #000000;
  --panel-elevated: #0a0a0a;
  --panel-hover: #141414;
  --panel-active: #1f1f1f;

  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.26);
  --border-focus: #ffffff;

  --text: #ffffff;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --c-white: #ffffff;
  --c-red: #dc2626;
  --c-red-bright: #ef4444;
  --c-red-soft: rgba(220, 38, 38, 0.20);
  --c-green: #059669;
  --c-green-dark: #064e3b;
  --c-green-bright: #10b981;
  --c-green-soft: rgba(5, 150, 105, 0.20);
  --c-navy: #1d4ed8;
  --c-navy-deep: #1e3a8a;
  --c-navy-bright: #3b82f6;
  --c-navy-soft: rgba(29, 78, 216, 0.24);

  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12.5px;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

button, select, input {
  font-family: inherit;
}

/* =========================================================================
   SITE HEADER (Locked Center Title — Never Shifts)
   ========================================================================= */
.site-header {
  height: 38px;
  min-height: 38px;
  border-bottom: 1px solid var(--border);
  background: #000000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 40;
}

.site-brand {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--c-white);
  transition: opacity 0.15s ease;
}

.site-brand:hover {
  opacity: 0.8;
}

.product-title-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--c-white);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.tri-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tri-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.tri-dots .d-red   { background: var(--c-red-bright); box-shadow: 0 0 8px var(--c-red); }
.tri-dots .d-green { background: var(--c-green-bright); box-shadow: 0 0 8px var(--c-green); }
.tri-dots .d-navy  { background: var(--c-navy-bright); box-shadow: 0 0 8px var(--c-navy); }

.site-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.lang-btn {
  height: 24px;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.lang-btn:hover {
  color: var(--c-white);
  border-color: var(--border-strong);
}

/* =========================================================================
   MAIN 3-COLUMN WORKSPACE SHELL (168px Left | Flexible Center | 376px Right)
   ========================================================================= */
.app-shell {
  flex: 1;
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr) 308px;
  overflow: hidden;
  min-height: 0;
  width: 100%;
  background: #000000;
}

/* LEFT RAIL: Workspace Mode Switcher + Loop Library + Hotkeys */
.left-rail {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
  gap: 8px;
  overflow-y: auto;
  min-width: 0;
}

.rail-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rail-caption {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 2px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.view-btn {
  height: 30px;
  background: #000000;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  padding: 0 9px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.view-btn:hover {
  background: var(--panel-hover);
  color: var(--c-white);
  border-color: var(--border);
}

.view-btn.active {
  background: var(--c-navy-soft);
  border-color: var(--c-navy-bright);
  border-left: 3px solid var(--c-white);
  color: var(--c-white);
  font-weight: 700;
}

.kbd-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  background: #000000;
  line-height: 1.2;
}

/* Loop Library Panel */
.library-box {
  flex: 1;
  min-height: 90px;
  position: static;
  inset: auto;
  margin: 0;
  width: auto;
  max-width: none;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: var(--panel);
  color: var(--text);
  padding: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.library-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.loop-card {
  background: #000000;
  border: 1px solid var(--border);
  border-left: 3px solid var(--c, var(--c-navy-bright));
  border-radius: 5px;
  padding: 6px 8px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.loop-card:hover {
  background: var(--panel-hover);
  border-color: var(--border-strong);
}

.loop-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--c-white);
}

.loop-card-meta {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.loop-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 26px;
  gap: 4px;
  margin-top: 2px;
}

/* Unified Mini Button */
.mini-btn {
  height: 22px;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 0 7px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1;
  transition: all 0.12s ease;
}

.mini-btn:hover {
  color: var(--c-white);
  border-color: var(--border-strong);
  background: var(--panel-hover);
}

.mini-btn.active-lock {
  background: var(--c-green-soft);
  border-color: var(--c-green-bright);
  color: var(--c-white);
}

.mini-btn.navy-active {
  background: var(--c-navy);
  border-color: var(--c-navy-bright);
  color: var(--c-white);
}

.mini-btn.danger-active {
  background: var(--c-red);
  border-color: var(--c-red-bright);
  color: var(--c-white);
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.45);
}

.hotkey-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 4px 2px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-muted);
}

.hk-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* =========================================================================
   CENTER WORKSPACE: 3-Row Uncrushed Top Bar + Stage + Bottom Timelapse
   ========================================================================= */
.center-workspace {
  display: flex;
  flex-direction: column;
  background: #000000;
  min-width: 0;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

.workspace-top-bar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  gap: 5px;
  min-width: 0;
  width: 100%;
}

/* Row 1: 16 Instruments */
.top-row-instruments {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-row-instruments::-webkit-scrollbar {
  display: none;
}

.inst-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  width: 100%;
  min-width: 0;
  scrollbar-width: none;
}

.inst-bar::-webkit-scrollbar {
  display: none;
}

.inst-chip {
  height: 26px;
  background: #000000;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.inst-chip svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.inst-chip:hover {
  background: var(--panel-hover);
  color: var(--c-white);
  border-color: var(--border-strong);
}

.inst-chip.active {
  background: var(--panel-active);
  border-color: var(--c, var(--c-white));
  color: var(--c-white);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--c, var(--c-white));
}

.inst-chip.active svg {
  stroke: var(--c, var(--c-white));
}

/* Row 2: 12 Musical Style / Genre Presets (Full Width, Never Crushed) */
.top-row-styles {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-row-styles::-webkit-scrollbar {
  display: none;
}

.taste-pills {
  display: flex;
  align-items: center;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px;
  gap: 3px;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.taste-pills::-webkit-scrollbar {
  display: none;
}

.taste-btn {
  flex: 1;
  min-width: 54px;
  height: 22px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  padding: 0 6px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.14s ease;
}

.taste-btn:hover {
  color: var(--c-white);
  background: var(--panel-hover);
}

.taste-btn.active {
  background: var(--c-navy);
  border-color: var(--c-navy-bright);
  color: var(--c-white);
  font-weight: 700;
}

/* Row 3: Transport Controls + Spectrum Visualizer */
.top-row-transport {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
}

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

.transport-cluster::-webkit-scrollbar {
  display: none;
}

.t-btn {
  height: 27px;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  color: var(--c-white);
  padding: 0 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
  transition: all 0.14s ease;
}

.t-btn:hover {
  background: var(--panel-hover);
  border-color: var(--border-strong);
}

.t-btn:active {
  transform: scale(0.97);
}

.t-btn.play-active {
  background: var(--c-green);
  border-color: var(--c-green-bright);
  color: var(--c-white);
  box-shadow: 0 0 10px rgba(5, 150, 105, 0.45);
}

.t-btn.rec-active {
  background: var(--c-red);
  border-color: var(--c-red-bright);
  color: var(--c-white);
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
}

.t-btn.beat-active {
  background: var(--c-navy);
  border-color: var(--c-navy-bright);
  color: var(--c-white);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

#spectrumCanvas {
  width: 96px;
  height: 26px;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.note-readout-badge {
  height: 26px;
  min-width: 44px;
  padding: 0 7px;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--c-white);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* =========================================================================
   STAGE CONTAINER & LEFT-SIDE VERTICAL PIANO KEYS + CANVAS
   ========================================================================= */
.stage-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #000000;
}

.stage-view {
  display: none;
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  background: #000000;
}

.stage-view.active {
  display: flex;
  flex-direction: column;
}

/* Canvas View is a horizontal row: Left Vertical Piano Keys + Right Black Canvas */
#canvasView.stage-view.active {
  flex-direction: row;
  overflow: hidden;
}

.left-keys-sidebar {
  width: 68px;
  min-width: 68px;
  height: 100%;
  background: #000000;
  border-right: 1px solid var(--border-strong);
  display: flex;
  flex-direction: row;
  overflow: hidden;
  z-index: 10;
  flex-shrink: 0;
}

.left-keys-sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
}

.piano-dock {
  width: 36px;
  height: 100%;
  background: #000000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.piano-dock::-webkit-scrollbar {
  display: none;
}

.piano-key {
  flex: 1;
  min-height: 12px;
  width: 100%;
  background: linear-gradient(90deg, #161616 0%, #0c0c0c 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 4px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.06s ease;
}

.piano-key.black-key {
  background: linear-gradient(90deg, #000000 0%, #050505 75%, #0e0e0e 100%);
  color: var(--text-dim);
  border-right: 2px solid var(--c-navy);
}

.piano-key:hover {
  background: var(--c-navy-deep);
  color: var(--c-white);
}

.piano-key.pressed {
  background: var(--c-green);
  color: var(--c-white);
  font-weight: 700;
}

.pitch-rail {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 3px;
  background: #000000;
  overflow-y: auto;
  scrollbar-width: none;
}

.pitch-rail::-webkit-scrollbar {
  display: none;
}

.pitch-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
  padding: 1px 2px;
  border-radius: 2px;
}

.pitch-tag:hover {
  background: var(--c-navy);
  color: var(--c-white);
}

.pitch-tag.root {
  color: var(--c-white);
  font-weight: 700;
  border-left: 2px solid var(--c-red-bright);
}

#drawCanvas {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
  background: #000000;
}

/* =========================================================================
   BOTTOM ARRANGEABLE & DRAG-DELETE TIMELAPSE BAR
   ========================================================================= */
.timelapse-bar {
  height: 76px;
  min-height: 76px;
  background: #000000;
  border-top: 1px solid var(--border-strong);
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  align-items: stretch;
  overflow: hidden;
}

.timelapse-controls {
  padding: 7px 10px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  background: var(--panel);
}

.tl-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: nowrap;
}

.tl-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tl-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--c-white);
  text-transform: uppercase;
}

.tl-time-readout {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--c-green-bright);
  font-weight: 700;
  white-space: nowrap;
}

.tl-mode-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tl-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  flex-wrap: nowrap;
}

.tl-sec-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #000000;
  border: 1px solid var(--c-navy-bright);
  border-radius: 4px;
  padding: 0 5px;
  height: 24px;
}

.tl-sec-input {
  width: 36px;
  background: transparent;
  border: none;
  color: var(--c-white);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  outline: none;
}

.tl-preset-btn {
  flex: 1;
  height: 24px;
  background: #000000;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 0 5px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.12s ease;
}

.tl-preset-btn:hover,
.tl-preset-btn.active {
  background: var(--c-navy);
  border-color: var(--c-navy-bright);
  color: var(--c-white);
}

.timelapse-track-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000000;
  overflow: hidden;
}

#timelapseCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  touch-action: none;
}

/* =========================================================================
   CONFIRM DELETE ALL MODAL (Ctrl+Backspace / Clear)
   ========================================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: #000000;
  border: 1px solid var(--c-red-bright);
  box-shadow: 0 0 28px rgba(220, 38, 38, 0.35);
  border-radius: 8px;
  padding: 18px 20px;
  width: 340px;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--c-white);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* =========================================================================
   SECONDARY VIEWS: ARRANGER, STEP SEQ, FX MIXER, SCORE/TAB, SAMPLER
   ========================================================================= */
.arranger-wrap, .score-wrap, .subview-sheet {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  background: #000000;
  height: 100%;
}

.arranger-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}

.arranger-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.timeline-board {
  border: 1px solid var(--border-strong);
  background: #000000;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.timeline-ruler {
  height: 28px;
  background: var(--panel-elevated);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 156px 1fr;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.ruler-Corner {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-right: 1px solid var(--border);
  color: var(--c-white);
}

.ruler-bars {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
}

.ruler-bar-cell {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  padding-left: 8px;
}

.track-row {
  display: grid;
  grid-template-columns: 156px 1fr;
  height: 62px;
  border-bottom: 1px solid var(--border);
}

.track-row:last-child {
  border-bottom: none;
}

.track-head {
  border-right: 1px solid var(--border);
  background: var(--panel);
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.track-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--c-white);
}

.track-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}

.track-lane {
  position: relative;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent calc(12.5% - 1px),
      rgba(255, 255, 255, 0.06) calc(12.5% - 1px),
      rgba(255, 255, 255, 0.06) 12.5%
    ),
    #000000;
  overflow: hidden;
  cursor: pointer;
}

.track-lane:hover {
  background-color: #000000;
}

.track-lane.drag-over {
  background-color: var(--c-navy-soft);
  box-shadow: inset 0 0 0 1px var(--c-navy-bright);
}

.timeline-clip {
  position: absolute;
  top: 7px;
  bottom: 7px;
  background: rgba(29, 78, 216, 0.34);
  border: 1px solid var(--c, var(--c-navy-bright));
  border-left: 3px solid var(--c, var(--c-white));
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  cursor: grab;
  overflow: hidden;
  min-width: 36px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.timeline-clip:active {
  cursor: grabbing;
}

.clip-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--c-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.clip-del {
  background: rgba(220, 38, 38, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--c-white);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 3;
  flex-shrink: 0;
}

.clip-del:hover {
  background: var(--c-red-bright);
}

.clip-handle-l, .clip-handle-r {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  background: rgba(255, 255, 255, 0.18);
  cursor: ew-resize;
  z-index: 2;
}

.clip-handle-l:hover, .clip-handle-r:hover {
  background: rgba(255, 255, 255, 0.45);
}

.clip-handle-l { left: 0; }
.clip-handle-r { right: 0; }

.arranger-playhead {
  position: absolute;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--c-white);
  box-shadow: 0 0 8px var(--c-white);
  pointer-events: none;
  z-index: 15;
}

/* 8-Row x 16-Step Matrix Sequencer */
.seq-grid-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.seq-header-row {
  display: grid;
  grid-template-columns: 128px repeat(16, 1fr);
  gap: 4px;
  align-items: center;
  padding-bottom: 2px;
}

.seq-step-num {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-dim);
  text-align: center;
}

.seq-step-num.beat-head {
  color: var(--c-white);
}

.seq-row {
  display: grid;
  grid-template-columns: 128px repeat(16, 1fr);
  gap: 4px;
  align-items: center;
}

.seq-row-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--c-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 6px;
}

.seq-cell {
  height: 30px;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.1s ease;
}

.seq-cell:hover {
  border-color: var(--border-strong);
  background: var(--panel-hover);
}

.seq-cell:nth-child(4n + 2) {
  border-left: 2px solid rgba(255, 255, 255, 0.28);
}

.seq-cell.on {
  background: var(--c, var(--c-red));
  border-color: var(--c-white);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.18);
}

.seq-cell.current-step {
  outline: 2px solid var(--c-white);
  outline-offset: -1px;
}

/* Mixer Rack (16 Channels — Wide Horizontal Fader Cards) */
.mixer-strip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 8px;
}

.mixer-channel {
  background: #000000;
  border: 1px solid var(--border);
  border-top: 3px solid var(--c, var(--c-navy-bright));
  border-radius: 5px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mixer-ch-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.mixer-ch-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--c-white);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.mixer-ch-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c, var(--c-navy-bright));
}

.mixer-ch-val {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.vu-meter {
  width: 100%;
  height: 7px;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.vu-fill {
  height: 100%;
  width: 8%;
  background: linear-gradient(90deg, var(--c-navy-bright) 0%, var(--c-green-bright) 65%, var(--c-red-bright) 100%);
  transition: width 0.06s linear;
}

.mixer-ch-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.score-sheet-box {
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 12px;
  overflow-x: auto;
}

#scoreSvgContainer svg {
  width: 100%;
  min-width: 680px;
  height: auto;
  display: block;
}

.card-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-white);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

#sampleWaveCanvas {
  width: 100%;
  height: 76px;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: block;
}

/* Interactive Status & Plain-English Help Bar Below Stage */
.workspace-bottom-bar {
  height: 28px;
  min-height: 28px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  gap: 12px;
}

.status-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.status-cluster strong {
  color: var(--c-white);
}

.help-banner {
  flex: 1;
  text-align: center;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-sans);
  font-size: 11px;
}

/* =========================================================================
   WIDENED RIGHT RAIL: SURGICAL PRECISION CONTROL & FX PANEL (376px)
   ========================================================================= */
.right-rail {
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  overflow-y: auto;
  min-width: 0;
}

.right-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inst-scope-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--c-white);
  background: var(--c-navy);
  border: 1px solid var(--c-navy-bright);
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1.2;
}

.cp-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px;
  gap: 3px;
}

.cp-tab {
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
  transition: all 0.12s ease;
}

.cp-tab:hover {
  color: var(--c-white);
  background: var(--panel-hover);
}

.cp-tab.active {
  background: var(--c-navy);
  border-color: var(--c-navy-bright);
  color: var(--c-white);
}

.cp-pane {
  display: none;
  flex-direction: column;
  gap: 7px;
}

.cp-pane.active {
  display: flex;
}

.tool-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.tool-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tool-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.tool-grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }

.r-btn {
  height: 28px;
  background: #000000;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  line-height: 1;
  transition: all 0.12s ease;
}

.r-btn:hover {
  background: var(--panel-hover);
  color: var(--c-white);
  border-color: var(--border-strong);
}

.r-btn.active {
  background: var(--c-navy-soft);
  border-color: var(--c-navy-bright);
  color: var(--c-white);
  font-weight: 700;
}

.r-btn.danger-btn:hover {
  background: var(--c-red-soft);
  border-color: var(--c-red-bright);
  color: var(--c-white);
}

.s-box {
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.s-box:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.s-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  min-height: 20px;
}

.s-val-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.s-head strong {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--c-white);
  min-width: 44px;
  text-align: right;
}

.nudge-btn {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  color: var(--c-white);
  width: 20px;
  height: 18px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nudge-btn:hover {
  background: var(--c-navy);
  color: var(--c-white);
  border-color: var(--c-navy-bright);
}

.s-box input[type="range"] {
  width: 100%;
  accent-color: var(--c-navy-bright);
  cursor: pointer;
  height: 15px;
}

.s-box select {
  background: var(--panel-elevated);
  color: var(--c-white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 500;
  outline: none;
  width: 100%;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
  }
  .left-rail {
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 44px;
    padding: 4px 8px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .rail-group {
    flex-direction: row;
    gap: 4px;
  }
  .rail-caption, .library-box, .hotkey-list {
    display: none;
  }
  .view-btn {
    padding: 0 8px;
    height: 28px;
    font-size: 11px;
    white-space: nowrap;
  }
  .view-btn .kbd-tag {
    display: none;
  }
  .timelapse-bar {
    grid-template-columns: 230px minmax(0, 1fr);
    height: 68px;
    min-height: 68px;
  }
  .right-rail {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 225px;
    padding: 8px 10px;
  }
}

/* Thinner Left & Right Panels + Centered Transport + Metronome + Wide Note Shower Graph */
.left-rail {
  padding: 6px;
  gap: 6px;
}
.view-btn {
  height: 27px;
  padding: 0 7px;
  font-size: 11px;
}
.right-rail {
  padding: 8px 9px;
  gap: 8px;
}
.cp-tab {
  height: 26px;
  font-size: 9.8px;
  padding: 0 2px;
}
.r-btn {
  height: 26px;
  font-size: 10.5px;
  padding: 0 5px;
}
.s-box {
  padding: 6px 8px;
  gap: 4px;
}

/* 3-Zone Top Transport Bar: Left Quick Tools | Dead-Center Play/Stop/Metronome/BPM | Right Wide Note Graph */
.top-row-transport {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-self: start;
}

.transport-cluster {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  gap: 5px;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
}

.metro-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  display: inline-block;
  transition: background 0.05s ease, box-shadow 0.05s ease;
}

.t-btn.metro-active {
  background: var(--c-navy);
  border-color: var(--c-navy-bright);
  color: var(--c-white);
}

.t-btn.metro-active .metro-led {
  background: var(--c-green-bright);
  box-shadow: 0 0 8px var(--c-green-bright);
}

.metro-led.flash {
  background: var(--c-red-bright) !important;
  box-shadow: 0 0 10px var(--c-red-bright) !important;
}

.top-bpm-box {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #000000;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 0 5px;
  height: 27px;
}

.top-bpm-input {
  width: 42px;
  background: transparent;
  border: none;
  color: var(--c-white);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}

.top-bpm-input::-webkit-outer-spin-button,
.top-bpm-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.top-bpm-unit {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Wide Note Shower Graph in the Play/Stop Section */
.top-bar-right {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 6px;
}

#spectrumCanvas {
  width: 224px;
  min-width: 150px;
  height: 27px;
  background: #000000;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  cursor: pointer;
}

/* Inline Loop Rename Input */
.loop-name-text {
  cursor: text;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 86px;
}
.loop-name-text:hover {
  text-decoration: underline;
  text-decoration-color: var(--c-navy-bright);
}
.loop-rename-input {
  width: 100%;
  background: #000000;
  border: 1px solid var(--c-navy-bright);
  color: var(--c-white);
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  outline: none;
}

/* Wide Popup Modals for Guide, Step Sequencer, and Score/MIDI Save */
.modal-card.modal-wide {
  width: 760px;
  max-width: 95vw;
  max-height: 88vh;
  border-color: var(--c-navy-bright);
  box-shadow: 0 0 36px rgba(29, 78, 216, 0.35);
  overflow-y: auto;
}

.modal-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.guide-box {
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guide-box h4 {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-navy-bright);
  margin-bottom: 2px;
}

.guide-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.guide-row strong {
  color: var(--c-white);
}

/* Right Panel Compact FX & 15-Channel Mixer */
#cpFx {
  max-height: calc(100vh - 290px);
  overflow-y: auto;
  padding-right: 2px;
}

.rp-mixer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.rp-Readout-title {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 2px 2px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.mixer-channel {
  padding: 6px 7px;
  gap: 4px;
}

.timeline-clip.selected-clip {
  outline: 2px solid var(--c-white);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.55);
}

.clip-wave-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.35;
  pointer-events: none;
}

/* Red Section Titles Across Right & Left Panels */
.rail-caption,
.rp-Readout-title,
.guide-box h4 {
  color: var(--c-red-bright) !important;
  font-weight: 800 !important;
  letter-spacing: 0.06em;
}

.rail-caption span:first-child,
.rp-Readout-title span:first-child {
  color: var(--c-red-bright) !important;
}

/* Smaller Left Timelapse Box (118px) & Bigger Right Time-Controlling Track */
.timelapse-bar {
  height: 64px;
  min-height: 64px;
  grid-template-columns: 118px minmax(0, 1fr) !important;
}

.timelapse-controls {
  padding: 5px 7px !important;
  gap: 4px !important;
  justify-content: center;
}

.tl-top-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start !important;
  gap: 1px !important;
}

.tl-title {
  font-size: 9px !important;
  color: var(--c-red-bright) !important;
  font-weight: 800 !important;
}

.tl-time-readout {
  font-size: 9.5px !important;
}

.tl-bottom-row {
  gap: 3px !important;
}

.tl-sec-wrap {
  height: 20px !important;
  padding: 0 4px !important;
  width: 100%;
  justify-content: space-between;
}

.tl-sec-input {
  width: 38px !important;
  font-size: 10.5px !important;
}

/* Centered Transport & Sliding BPM Number Drawer on Metronome */
.top-row-transport {
  display: grid;
  grid-template-columns: 1fr auto 1fr !important;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.metro-pill {
  display: inline-flex;
  align-items: center;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  height: 27px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.metro-pill.open {
  border-color: var(--c-navy-bright);
  box-shadow: 0 0 10px rgba(29, 78, 216, 0.35);
}

.metro-pill .t-btn {
  border: none !important;
  border-radius: 0 !important;
  height: 100% !important;
}

.metro-slide-box {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #000000;
  height: 100%;
  padding: 0;
  border-left: 0 solid transparent;
  transition: max-width 0.26s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease, padding 0.2s ease;
}

.metro-pill.open .metro-slide-box {
  max-width: 76px;
  opacity: 1;
  padding: 0 6px;
  border-left: 1px solid var(--border-strong);
}


/* =========================================================================
   V8 STUDIO UPGRADES: MATTE FULL BLACK, T U N E + able'r. HEADER,
   DEAD-CENTER TRANSPORT BAR, SLIDEABLE TRACKS & CTRL+RIGHT-CLICK SOUND MIXER
   ========================================================================= */
html, body, .app-shell, .site-header, .left-rail, .center-workspace,
.workspace-top-bar, .stage-container, .stage-view, .timelapse-bar,
.timelapse-controls, .timelapse-track-wrap, .workspace-bottom-bar,
.right-rail, .timeline-board, .timeline-ruler, .track-head {
  background-color: #000000 !important;
}

.product-title-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  pointer-events: none;
  user-select: none;
}

.tune-word {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.tune-word .tune-t { color: #ef4444; }
.tune-word .tune-u { color: #ffffff; }
.tune-word .tune-n { color: #3b82f6; }
.tune-word .tune-e { color: #10b981; }

.abler-word {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

/* Dead-Center Play / Stop / Metronome Bar (With Arranger Context Buttons) */
.top-row-transport {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  min-height: 34px;
}

.top-bar-left {
  justify-self: start;
}

.transport-cluster {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  justify-self: center !important;
  gap: 5px !important;
  background: #000000 !important;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.mid-context-tools {
  display: inline-flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
  padding-top: 5px;
  border-top: 1px solid var(--border);
}

.top-bar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end !important;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

/* Arranger Full-Height Slideable Multi-Track Board (No Header/Description) */
.arranger-wrap {
  padding: 8px !important;
  gap: 0 !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
}

.timeline-board {
  flex: 1 !important;
  min-height: 0 !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  position: relative;
}

.timeline-ruler {
  flex-shrink: 0 !important;
  z-index: 12;
}

#tracksContainer {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scroll-behavior: smooth;
}

#tracksContainer::-webkit-scrollbar {
  width: 7px;
}

#tracksContainer::-webkit-scrollbar-track {
  background: #000000;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

#tracksContainer::-webkit-scrollbar-thumb {
  background: #ef4444;
  border-radius: 4px;
}

.track-row {
  height: 54px !important;
  min-height: 54px !important;
}

/* Ctrl + Right-Click Small Scrollable Per-Sound Mixer Popup */
.sound-mixer-popup {
  position: fixed;
  z-index: 250;
  width: 276px;
  max-height: 332px;
  background: #000000;
  border: 1px solid #ef4444;
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.96), 0 0 18px rgba(239, 68, 68, 0.28);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.sound-mixer-popup.open {
  display: flex;
}

.sm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: #000000;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sm-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #ef4444;
  text-transform: uppercase;
}

.sm-top-controls {
  padding: 6px 10px;
  background: #000000;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.sm-target-select {
  width: 100%;
  height: 24px;
  background: #0a0a0a;
  border: 1px solid var(--border-strong);
  color: #ffffff;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 0 6px;
  outline: none;
}

.sm-btn-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.9fr 0.9fr;
  gap: 4px;
}

.sm-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #000000;
}

.sm-scroll-body::-webkit-scrollbar {
  width: 5px;
}

.sm-scroll-body::-webkit-scrollbar-track {
  background: #000000;
}

.sm-scroll-body::-webkit-scrollbar-thumb {
  background: #ef4444;
  border-radius: 3px;
}

.sm-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: #050505;
}

.sm-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-muted);
}

.sm-row-head strong {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #ffffff;
}

.guide-notes-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.guide-note-pill {
  height: 24px;
  min-width: 34px;
  padding: 0 6px;
  border-radius: 4px;
  background: #0a0a0a;
  border: 1px solid var(--border-strong);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.08s ease;
}

.guide-note-pill.hit {
  background: #10b981 !important;
  border-color: #ffffff !important;
  color: #000000 !important;
  box-shadow: 0 0 10px #10b981;
}

/* Keep transport controls and the loop library available on narrow screens. */
#spectrumCanvas {
  min-width: 0;
  max-width: 100%;
  flex-shrink: 1;
}

.library-heading-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mobile-library-button {
  display: none;
}

.library-box::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.file-picker-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
label:focus-within {
  outline: 2px solid var(--c-white);
  outline-offset: 2px;
}

input, select, textarea {
  user-select: text;
  -webkit-user-select: text;
}

@media (max-width: 960px) {
  .left-rail {
    justify-content: flex-start;
  }

  .left-rail .rail-group,
  .left-rail .view-btn {
    flex-shrink: 0;
  }

  .left-rail > div:last-child {
    padding-top: 0 !important;
    border-top: 0 !important;
    flex-shrink: 0;
  }

  .mobile-library-button {
    display: inline-flex;
  }

  .library-box {
    display: none;
  }

  .library-box:popover-open {
    position: fixed;
    inset: 90px 12px auto;
    display: flex;
    width: auto;
    max-width: 440px;
    min-height: 160px;
    max-height: min(70vh, 520px);
    margin: 0 auto;
    padding: 12px;
    border: 1px solid var(--c-navy-bright);
    border-radius: 8px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.9);
  }

  .library-box .rail-caption {
    display: flex;
  }

  .library-box .library-list {
    min-height: 0;
  }

  .library-box .loop-name-text {
    max-width: 260px;
  }
}

@media (max-width: 680px), (min-width: 961px) and (max-width: 1160px) {
  .top-row-transport {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 6px !important;
  }

  .top-bar-left {
    display: none;
  }

  .top-bar-right {
    justify-self: stretch !important;
    justify-content: center;
  }

  .guide-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .guide-row {
    gap: 8px;
  }
}

/* Tuneable'r identity and compact site navigation. */
.product-title-center { margin: 0; align-items: center; line-height: 1; }
.product-logo { display: block; object-fit: contain; flex: 0 0 auto; }
.site-info-menu { position: relative; font: 11px var(--font-sans); }
.site-info-menu summary { cursor: pointer; border: 1px solid var(--border); border-radius: 4px; padding: 3px 7px; color: var(--text); }
.site-info-menu nav { position: absolute; top: calc(100% + 8px); right: 0; z-index: 100; display: flex; flex-direction: column; min-width: 155px; padding: 6px; gap: 3px; background: #080808; border: 1px solid var(--border-strong); border-radius: 6px; box-shadow: 0 8px 24px #000; }
.site-info-menu nav a { display: block; padding: 7px 10px; color: var(--text); border-radius: 3px; white-space: nowrap; }
.site-info-menu nav a:hover, .site-info-menu nav a:focus-visible { background: var(--panel-hover); }
@media (max-width: 440px) { .product-title-center { gap: 3px; font-size: 12px; } .product-logo { width: 24px; height: 24px; } .site-header { padding: 0 8px; } .site-right { gap: 4px; } }

/* Stacked TUNE / able'r wordmark, left of the centered note. */
.site-header { height: 54px; min-height: 54px; }
.studio-wordmark { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; margin: 0; line-height: 1; min-width: 0; }
.studio-wordmark .wordmark { font-family: system-fallback, "Segoe UI", Arial, sans-serif; font-size: 29px; font-weight: 750; line-height: 1; letter-spacing: -2.2px; text-decoration: none; color: #fff; }
.studio-wordmark .wordmark > span:first-child, .studio-wordmark .brand-dot { color: #a97135; }
.studio-wordmark .tune-word { font-size: 18px; gap: 0; letter-spacing: 0; line-height: 1; }
.product-logo-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 72px; height: 54px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-logo-center .product-logo { width: 68px; height: 68px; max-width: none; }
.studio-noscript { position: fixed; inset: 54px 0 auto; z-index: 100; padding: 20px; background: #000; color: #fff; }
@media (max-width: 600px) {
  .studio-wordmark { gap: 0; }
  .studio-wordmark .wordmark { font-size: 29px; letter-spacing: -2.2px; }
  .studio-wordmark .tune-word { font-size: 18px; gap: 0; letter-spacing: 0; }
}
