/* ============================================================================
 * Studio — Looper im Vintage-Tonstudio-Stil
 *
 * Etappe 2: Transport, Tempo, Bars, Metronom, Pre-Count
 * Vintage-Polish (Holz, Messing, Roehre, Amber-LEDs) folgt in spaeterer
 * Etappe — jetzt erstmal sauberes Layout im Site-Stil.
 * ========================================================================= */

.studio-page-root {
  --wood-dark: #2a1a10;
  --wood: #3a2818;
  --wood-light: #5a4030;
  --brass: #c9a064;
  --brass-dark: #8a6940;
  --cream: #e8ddc0;
  --amber: #ffa84a;
  --amber-dim: rgba(255, 168, 74, 0.6);
  --tube-glow: rgba(255, 140, 60, 0.6);
  --vu-green: #6abf6a;
  --vu-yellow: #d8c84a;
  --vu-red: #e85040;

  display: block;
  color: var(--paper);
  font-family: var(--mono);
}
.studio-page-root * { box-sizing: border-box; }

/* ---- Frame + Head ---- */
.studio-frame {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.section-head {
  padding-bottom: 28px;
  padding-top: 64px;
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--grey-3);
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  margin-bottom: 0;
}
.eyebrow::before {
  content: "";
  width: 36px;
  height: 1px;
  background: var(--paper);
}
.section-head h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(40px, 5vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin-top: 18px;
}
.section-head h1 em {
  font-style: italic;
  color: var(--grey-3);
}

/* ---- Section: Holz-Paneel mit Maserung + Messing-Schrauben + Roehren-Glow ---- */
.studio-section {
  background:
    repeating-linear-gradient(91deg,
      rgba(0,0,0,0.16) 0 1px, transparent 1px 4px,
      rgba(255,180,120,0.018) 4px 5px, transparent 5px 9px),
    linear-gradient(180deg, #2e1f15 0%, #1c130c 100%);
  border: 1px solid #0a0606;
  border-radius: 4px;
  padding: 18px 22px 22px;
  position: relative;
  /* Roehren-Glow ist INSET (nicht aussen) und bleibt staendig da als
     warmes Glimmen. Animiert mit unregelmaessigen Keyframes — die meisten
     Cycle-Anteile sind in "Basis-Glimmen", nur einzelne kurze Momente
     glimmen heller, an unterschiedlichen Stellen im Zyklus. */
  box-shadow:
    0 1px 0 rgba(255,180,120,0.10) inset,
    0 -1px 0 rgba(0,0,0,0.5) inset,
    0 0 28px rgba(255, 130, 50, 0.09),
    0 12px 28px rgba(0,0,0,0.5);
  animation: studioTubeBreath 38s ease-in-out infinite;
}

/* Jede Section faengt an einer anderen Stelle des Zyklus an —
   so glimmen sie nie synchron */
.studio-transport { animation-delay: -2.4s; }
.studio-bandmaschine { animation-delay: -7.1s; }
.studio-mischpult { animation-delay: -12.6s; }
.studio-settings { animation-delay: -4.8s; }
.studio-tools-section { animation-delay: -14.9s; }

@keyframes studioTubeBreath {
  /* Basis-Glimmen — strahlt weiter, bleibt aber subtil. Roehren pulsieren
     ja nicht, der Atem ist nur die laaaangsame Drift. Daher: blur
     erhoeht, Alpha nur leicht — der PEAK (58%) bleibt unveraendert. */
  0%, 14%, 30%, 50%, 72%, 88%, 100% {
    box-shadow:
      0 1px 0 rgba(255,180,120,0.08) inset,
      0 -1px 0 rgba(0,0,0,0.5) inset,
      0 0 28px rgba(255, 130, 50, 0.09),
      0 12px 28px rgba(0,0,0,0.5);
  }
  20% {
    box-shadow:
      0 1px 0 rgba(255,180,120,0.10) inset,
      0 -1px 0 rgba(0,0,0,0.5) inset,
      0 0 32px rgba(255, 140, 60, 0.12),
      0 12px 28px rgba(0,0,0,0.5);
  }
  58% {
    box-shadow:
      0 1px 0 rgba(255,200,140,0.12) inset,
      0 -1px 0 rgba(0,0,0,0.5) inset,
      0 0 30px rgba(255, 160, 70, 0.16),
      0 12px 28px rgba(0,0,0,0.5);
  }
  80% {
    box-shadow:
      0 1px 0 rgba(255,180,120,0.09) inset,
      0 -1px 0 rgba(0,0,0,0.5) inset,
      0 0 30px rgba(255, 140, 55, 0.10),
      0 12px 28px rgba(0,0,0,0.5);
  }
}
/* Zwei Messing-Schrauben in den oberen Ecken */
.studio-section::before,
.studio-section::after {
  content: '';
  position: absolute;
  width: 9px; height: 9px;
  top: 7px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #e8b97a 0%, #b88a4a 35%, #6a4a20 80%, #2a1a05 100%);
  box-shadow:
    0 0 1px rgba(0,0,0,0.9),
    0 1px 1px rgba(0,0,0,0.55),
    0 0 4px rgba(255,180,90,0.18);
  z-index: 2;
}
.studio-section::before { left: 8px; }
.studio-section::after { right: 8px; }
.studio-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  padding: 0 10px 10px;
  border-bottom: 1px solid rgba(180, 130, 80, 0.18);
  /* Header ueber dem Transport-Grid stacken, damit das
     Settings-Tooltip nicht hinter Mic-Status/Tempo-Buttons
     verschwindet. Der Button selbst oeffnet wegen filter:drop-shadow
     einen eigenen Stacking-Context — sein interner z-index wirkt nur
     dort. Erst der hier gesetzte Header-z-index hebt den ganzen
     Subtree ueber das Geschwister-Grid. */
  position: relative;
  z-index: 10;
  /* untere Highlight-Linie */
  box-shadow: 0 1px 0 rgba(255,180,120,0.06);
}
.studio-section-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #d8b888;
  text-shadow: 0 1px 0 rgba(0,0,0,0.6);
}

/* ---- Transport ---- */
.studio-transport-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

/* MIC PEGEL: horizontaler Pegel-Strip rechts vom Status. Gruen→Gelb→Rot. */
.studio-mic-pegel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.studio-mic-pegel-strip {
  width: 140px;
  height: 14px;
  background: #050608;
  border: 1px solid #000;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 -1px 4px rgba(0,0,0,0.6) inset;
}
.studio-mic-pegel-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg,
    var(--vu-green) 0%, var(--vu-green) 65%,
    var(--vu-yellow) 78%, var(--vu-yellow) 88%,
    var(--vu-red) 100%);
  transition: width 0.05s linear;
}
.studio-mic-pegel-fill.is-loud {
  box-shadow: 0 0 6px rgba(232, 80, 64, 0.65);
}
.studio-mic-pegel-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--grey-3);
}

/* Mic-Release-Wrap: Button + Label, rechts aussen im Transport-Grid. */
.studio-mic-release-wrap {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}
.studio-mic-release-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--grey-3);
}
/* Hover-/Focus-Trigger fuer die generische .studio-info-popover-Klasse.
   Drei Buttons teilen sich denselben Tooltip-Stil: Settings-Zahnrad,
   Mic-Status und Tempo-Display (BPM). Aenderungen am Aussehen passieren
   ausschliesslich an .studio-info-popover (siehe weiter unten). */
.studio-config-btn:hover .studio-info-popover,
.studio-config-btn:focus-visible .studio-info-popover,
.studio-mic-release-wrap:hover .studio-info-popover,
.studio-mic-release-wrap:focus-within .studio-info-popover,
.studio-tempo-display:not(.bpm-open):hover .studio-info-popover,
.studio-tempo-display:not(.bpm-open):focus-visible .studio-info-popover {
  opacity: 1;
}

/* Mic-Release: runder Knopf rechts. Leuchtet blau wenn Mic-Stream offen.
   Klick gibt das Mikro frei, sodass andere Apps Zugriff haben. */
.studio-mic-release {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: linear-gradient(180deg, #2a2c30 0%, #16181c 100%);
  border: 1px solid #050608;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.10) inset,
    0 -1px 0 rgba(0,0,0,0.55) inset,
    0 2px 4px rgba(0,0,0,0.45);
  transition: transform 0.08s;
}
.studio-mic-release:hover { transform: scale(1.04); }
.studio-mic-release:active { transform: scale(0.96); }
.studio-mic-release-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #555 0%, #2a2a2a 80%);
  box-shadow: 0 1px 0 rgba(0,0,0,0.5) inset;
  transition: background 0.15s, box-shadow 0.2s;
}
.studio-mic-release.is-on .studio-mic-release-dot {
  background: radial-gradient(circle at 35% 30%, #9fd0ff 0%, #4080d0 60%, #1f4080 100%);
  box-shadow:
    0 0 0 1px rgba(150, 200, 255, 0.6),
    0 0 10px rgba(80, 150, 240, 0.85),
    0 0 18px rgba(80, 150, 240, 0.45);
}

.studio-transport-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 76px;
  height: 64px;
  background:
    linear-gradient(180deg, #45464a 0%, #28292d 50%, #14151a 100%);
  border: 1px solid #050608;
  border-radius: 3px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.18) inset,
    0 -1px 0 rgba(0,0,0,0.55) inset,
    0 2px 4px rgba(0,0,0,0.5);
  color: var(--grey-3);
  cursor: pointer;
  padding: 0;
  transition: transform 0.08s, color 0.15s, background 0.15s;
  font-family: var(--mono);
}
.studio-transport-btn:hover { color: var(--paper); }
.studio-transport-btn:active {
  transform: translateY(1px);
  background: linear-gradient(180deg, #28292d 0%, #14151a 60%, #0a0a0c 100%);
}
.studio-transport-btn .studio-btn-icon { font-size: 22px; line-height: 1; }
.studio-transport-btn .studio-btn-label {
  font-size: 8.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.studio-btn-play .studio-btn-icon { color: var(--vu-green); text-shadow: 0 0 6px rgba(106,191,106,0.5); }
.studio-btn-stop .studio-btn-icon { color: var(--vu-red); text-shadow: 0 0 6px rgba(232,80,64,0.4); }

/* Tempo-Display: LED-Style — klickbar, oeffnet BPM-Popover */
.studio-tempo-display {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 20px;
  background: #050608;
  border: 1px solid #000;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05) inset, 0 0 12px rgba(255,168,74,0.15) inset;
  min-width: 100px;
  cursor: pointer;
  outline: none;
  transition: box-shadow 0.15s;
}
.studio-tempo-display:hover,
.studio-tempo-display:focus-visible {
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06) inset,
    0 0 14px rgba(255,168,74,0.30) inset,
    0 0 0 1px rgba(201, 160, 100, 0.45);
}

/* BPM-Popover: erscheint direkt unter dem Tempo-Display */
.studio-bpm-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 7000;
  min-width: 240px;
  padding: 14px 16px;
  background:
    linear-gradient(180deg, #2e1f15 0%, #1c130c 100%);
  border: 1px solid #0a0606;
  border-radius: 5px;
  box-shadow:
    0 1px 0 rgba(255,200,150,0.10) inset,
    0 8px 24px rgba(0,0,0,0.55),
    0 0 0 1px rgba(201, 160, 100, 0.25);
  cursor: default;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.studio-bpm-popover[hidden] { display: none; }
.studio-bpm-popover-head {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--brass);
}
.studio-bpm-popover-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.studio-bpm-popover-row input[type="range"] {
  flex: 1;
}
.studio-bpm-popover-value {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--amber);
  min-width: 36px;
  text-align: right;
}
.studio-bpm-popover .studio-tap-btn {
  align-self: stretch;
}
.studio-tempo-readout {
  font-family: var(--mono);
  font-size: 32px;
  color: var(--amber);
  text-shadow: 0 0 10px var(--amber-dim);
  letter-spacing: 0.05em;
  line-height: 1;
}
.studio-tempo-unit {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--grey-3);
}

/* Beat-Row: Kaestchen pro Beat, aktive Zelle leuchtet */
.studio-beat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
  padding: 8px 10px;
  background: #050608;
  border: 1px solid #000;
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 0 8px rgba(0,0,0,0.5) inset;
  min-height: 48px;
}
.studio-beat-cell {
  width: 18px;
  height: 28px;
  background: rgba(237,237,234,0.08);
  border: 1px solid rgba(237,237,234,0.12);
  border-radius: 2px;
  transition: background 0.1s, box-shadow 0.1s;
}
.studio-beat-cell.is-bar-start {
  background: rgba(237,237,234,0.16);
}
.studio-beat-cell.is-active {
  background: var(--amber);
  border-color: var(--amber);
  box-shadow: 0 0 8px var(--amber-dim), 0 0 16px rgba(255,168,74,0.3);
}
.studio-beat-cell.is-bar-start.is-active {
  background: #ffd060;
  box-shadow: 0 0 10px rgba(255,200,90,0.7), 0 0 22px rgba(255,200,90,0.35);
}

/* ---- Settings-Controls ---- */
.studio-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 28px;
  align-items: end;
}

.studio-slider {
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}
.studio-slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.studio-slider-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--grey-3);
}
.studio-slider-value {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--cream);
}
.studio-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: linear-gradient(180deg, #0a0606, #1a1208);
  outline: none;
  border-radius: 2px;
  margin: 4px 0;
  box-shadow: 0 1px 0 rgba(255,180,120,0.06), 0 -1px 0 rgba(0,0,0,0.6) inset;
}
.studio-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  background: linear-gradient(180deg, #d8d0b8, #8a7a55);
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid #000;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.studio-slider input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  background: linear-gradient(180deg, #d8d0b8, #8a7a55);
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid #000;
}

/* Switch-Reihe: Checkbox + Label */
.studio-switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.studio-switch-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 30px;
  height: 16px;
  background: #0a0a0d;
  border: 1px solid #000;
  border-radius: 9px;
  position: relative;
  cursor: pointer;
  outline: none;
  box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 -1px 0 rgba(0,0,0,0.5) inset;
  transition: background 0.2s;
}
.studio-switch-row input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 12px;
  height: 12px;
  background: linear-gradient(180deg, #aaa, #555);
  border-radius: 50%;
  transition: left 0.18s, background 0.18s;
}
.studio-switch-row input[type="checkbox"]:checked::before {
  left: 16px;
  background: linear-gradient(180deg, #ffd07a, #ff8a30);
  box-shadow: 0 0 6px var(--amber-dim);
}
.studio-switch-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--grey-3);
}
.studio-switch-row input[type="checkbox"]:checked + .studio-switch-label {
  color: var(--cream);
}

/* ---- Tempo-Row (Slider + Tap-Button) ---- */
.studio-tempo-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.studio-tempo-row input[type="range"] { flex: 1; }
.studio-tap-btn {
  flex-shrink: 0;
  width: 56px;
  height: 28px;
  background: linear-gradient(180deg, #45464a 0%, #28292d 50%, #14151a 100%);
  border: 1px solid #050608;
  border-radius: 3px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.16) inset,
    0 -1px 0 rgba(0,0,0,0.5) inset,
    0 1px 2px rgba(0,0,0,0.4);
  color: var(--cream);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  transition: transform 0.06s, color 0.15s, background 0.15s;
}
.studio-tap-btn:hover { color: var(--amber); }
.studio-tap-btn.is-tapping {
  background: linear-gradient(180deg, #5a4830 0%, #382818 100%);
  color: var(--amber);
  transform: translateY(1px);
  box-shadow: 0 0 8px var(--amber-dim);
}

/* ---- Tools-Buttons (Tuner + Klangraum extern oeffnen) ---- */
.studio-tools-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.studio-tool-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 12px 18px;
  background: linear-gradient(180deg, #3a2818 0%, #1f1410 100%);
  border: 1px solid #050608;
  border-radius: 3px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.1) inset,
    0 -1px 0 rgba(0,0,0,0.5) inset,
    0 2px 4px rgba(0,0,0,0.4);
  color: var(--cream);
  cursor: pointer;
  font-family: var(--mono);
  transition: transform 0.08s, color 0.15s, background 0.15s, box-shadow 0.15s;
}
.studio-tool-btn:hover {
  background: linear-gradient(180deg, #5a4030 0%, #2f2010 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.14) inset,
    0 -1px 0 rgba(0,0,0,0.5) inset,
    0 0 8px var(--amber-dim);
}
.studio-tool-btn:active { transform: translateY(1px); }
.studio-tool-btn-label {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
}
.studio-tool-btn-hint {
  font-size: 8.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--grey-3);
  margin-top: 2px;
}

/* ---- Recording-Sektion ---- */
.studio-config-btn {
  position: relative;
  background: transparent;
  border: none;
  color: var(--brass);
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  filter: drop-shadow(0 0 4px rgba(201, 160, 100, 0.35));
  transition: color 0.15s, transform 0.3s, filter 0.15s;
}
.studio-config-btn svg { width: 20px; height: 20px; }
.studio-config-btn:hover {
  color: #e8c894;
  filter: drop-shadow(0 0 6px rgba(232, 200, 148, 0.55));
  transform: rotate(45deg);
}
/* ---- Info-Popover: gemeinsamer Hover-Tooltip-Stil ----
   Verwendet ueber dem Settings-Zahnrad, dem Mic-Status und der BPM-Anzeige.
   Positionsmodifier --above / --below positionieren das Popover relativ
   zum Container. Sichtbarkeit per :hover am direkten Parent-Container. */
.studio-info-popover {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 9000;
  background: linear-gradient(180deg, #2e1f15 0%, #1c130c 100%);
  border: 1px solid rgba(201, 160, 100, 0.35);
  border-radius: 3px;
  padding: 8px 12px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.55);
  white-space: nowrap;
  text-align: center;
}
.studio-info-popover--below {
  top: calc(100% + 8px);
}
.studio-info-popover--above {
  bottom: calc(100% + 8px);
}
.studio-info-popover-action {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cream);
  display: block;
}
.studio-info-popover-detail {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--brass);
  margin-top: 4px;
  display: block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Warnzustand des Mic-Status-Popovers ("Mikrofon nicht freigegeben"):
   das Wort "nicht" wird unterstrichen + leicht in Amber-Glow gezeigt,
   damit auf einen Blick klar wird, weshalb der Pegel still bleibt. */
.studio-info-popover-action.is-warning {
  color: var(--cream);
}
.studio-info-popover-emph {
  position: relative;
  color: var(--amber);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-shadow:
    0 0 4px var(--amber-dim),
    0 0 10px var(--tube-glow);
}

.studio-rec-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}
.studio-rec-grid .studio-rec-state {
  flex: 1;
  min-width: 200px;
}

.studio-btn-rec .studio-rec-icon {
  color: var(--vu-red);
  text-shadow: 0 0 6px rgba(232,80,64,0.4);
  font-size: 20px;
}
.studio-page-root.is-armed .studio-btn-rec,
.studio-page-root.is-precount .studio-btn-rec {
  background: linear-gradient(180deg, #4a2a2a 0%, #281414 100%);
}
.studio-page-root.is-recording .studio-btn-rec {
  background: linear-gradient(180deg, #8a2020 0%, #5a1010 100%);
  animation: studioRecPulse 0.8s ease-in-out infinite alternate;
}
.studio-page-root.is-recording .studio-rec-icon {
  text-shadow: 0 0 14px rgba(232,80,64,1), 0 0 30px rgba(232,80,64,0.85);
}
@keyframes studioRecPulse {
  from { box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 -1px 0 rgba(0,0,0,0.55) inset, 0 0 8px rgba(232,80,64,0.45); }
  to   { box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 -1px 0 rgba(0,0,0,0.55) inset, 0 0 22px rgba(232,80,64,0.9); }
}

.studio-rec-state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 14px;
  background: #050608;
  border: 1px solid #000;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04) inset, 0 0 8px rgba(0,0,0,0.4) inset;
  min-width: 240px;
  height: 64px;
}
.studio-rec-state-label {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--grey-3);
  margin-bottom: 4px;
}
.studio-rec-state-value {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--cream);
}
.studio-page-root.is-recording .studio-rec-state-value { color: var(--vu-red); }
.studio-page-root.is-precount .studio-rec-state-value { color: var(--amber); }

.studio-rec-hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  line-height: 1.5;
  color: var(--grey-3);
  grid-column: span 3;
  padding-top: 6px;
}

/* ---- Track-Strip-Liste (vorlaeufiges Layout, Vintage-Mixer in Etappe 7) ---- */
.studio-tracks {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.studio-tracks-empty {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--grey-3);
  padding: 14px 0;
}
.studio-track-row {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 12px;
  background:
    repeating-linear-gradient(91deg,
      rgba(0,0,0,0.12) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #1f1510 0%, #120c08 100%);
  border: 1px solid #0a0606;
  border-radius: 3px;
  padding: 10px 14px;
  align-items: center;
  box-shadow:
    0 1px 0 rgba(255,180,120,0.05) inset,
    0 -1px 0 rgba(0,0,0,0.4) inset,
    0 1px 3px rgba(0,0,0,0.3);
}
.studio-track-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.studio-track-name {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cream);
}
.studio-track-btn {
  width: 24px;
  height: 22px;
  background: rgba(8,10,14,0.6);
  border: 1px solid #000;
  border-radius: 2px;
  color: var(--grey-3);
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 -1px 0 rgba(0,0,0,0.5) inset;
}
.studio-track-btn:hover { color: var(--cream); }
.studio-track-mute.is-active {
  background: rgba(232,80,64,0.18);
  border-color: rgba(232,80,64,0.7);
  color: rgba(255,180,170,1);
}
.studio-track-solo.is-active {
  background: rgba(255,168,74,0.18);
  border-color: rgba(255,168,74,0.7);
  color: var(--amber);
}
.studio-track-del:hover { color: rgba(232,80,64,0.95); }

.studio-track-faders {
  display: flex;
  gap: 10px;
}
.studio-mini-slider {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.studio-mini-label {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--grey-3);
}
.studio-mini-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: rgba(237,237,234,0.18);
  outline: none;
}
.studio-mini-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px; height: 10px;
  background: linear-gradient(180deg, #d8d0b8, #8a7a55);
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid #000;
}
.studio-mini-slider input[type="range"]::-moz-range-thumb {
  width: 10px; height: 10px;
  background: linear-gradient(180deg, #d8d0b8, #8a7a55);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.studio-track-waveform {
  background: #050608;
  border: 1px solid #000;
  border-radius: 2px;
  height: 56px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 0 8px rgba(0,0,0,0.5) inset;
}
.studio-track-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.studio-track-playhead {
  position: absolute;
  top: 0; bottom: 0;
  width: 3px;
  left: 0;
  /* Translate-X(-50%) zentriert den Strich auf die gesetzte Position —
     sonst stuende die linke Kante auf der Position, was an Loop-Anfang
     und -Ende asymmetrisch wirkt. */
  transform: translateX(-50%);
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber-dim), 0 0 16px rgba(255,168,74,0.3);
  pointer-events: none;
  opacity: 0;
  /* KEINE Transition fuer `left`: sonst animiert der Browser den
     Loop-Wrap (~99% → 0%) ueber 80 ms rueckwaerts durch die ganze
     Wellenform. Der Scheduler tickt alle 25 ms, das reicht fuer einen
     glatten Lauf. */
  transition: opacity 0.2s;
}

/* VU-Meter neben den Mixer-Buttons */
.studio-track-meter {
  width: 8px;
  height: 22px;
  margin-left: auto;
  background: #050608;
  border: 1px solid #000;
  border-radius: 1px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 -1px 0 rgba(0,0,0,0.6) inset;
  position: relative;
  overflow: hidden;
}
.studio-track-meter-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(0deg, var(--vu-green) 0%, var(--vu-green) 60%, var(--vu-yellow) 80%, var(--vu-red) 100%);
  transition: height 0.05s linear;
}
.studio-track-meter-fill.is-loud {
  box-shadow: 0 0 6px rgba(232,80,64,0.6);
}

/* ---- Config-Dialog: Holz-Look, mittig auf dem Viewport ---- */
.studio-config-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  background:
    repeating-linear-gradient(91deg,
      rgba(0,0,0,0.16) 0 1px, transparent 1px 4px,
      rgba(255,180,120,0.018) 4px 5px, transparent 5px 9px),
    linear-gradient(180deg, #2e1f15 0%, #1c130c 100%);
  color: var(--paper);
  border: 1px solid #0a0606;
  border-radius: 6px;
  padding: 0;
  width: 460px;
  max-width: calc(100vw - 32px);
  box-shadow:
    0 1px 0 rgba(255,200,150,0.10) inset,
    0 18px 60px rgba(0,0,0,0.65),
    0 0 0 1px rgba(201, 160, 100, 0.20);
}
.studio-config-dialog::backdrop {
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.45), rgba(0,0,0,0.85));
  backdrop-filter: blur(2px);
}
.studio-config-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px 14px;
  border-bottom: 1px solid rgba(201, 160, 100, 0.18);
}
.studio-config-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 22px;
  color: var(--cream);
  letter-spacing: -0.01em;
}
.studio-config-close {
  background: none;
  border: 1px solid rgba(201, 160, 100, 0.25);
  color: var(--brass);
  font-size: 14px;
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.studio-config-close:hover {
  color: #f0e0bc;
  background: rgba(201, 160, 100, 0.12);
  border-color: rgba(201, 160, 100, 0.55);
}
.studio-config-body {
  padding: 22px 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.studio-config-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.studio-config-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--brass);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.studio-config-label > span:last-child {
  color: var(--amber);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.studio-config-field select {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(8,6,4,0.7);
  border: 1px solid rgba(201, 160, 100, 0.22);
  color: var(--cream);
  padding: 10px 12px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), inset 0 -1px 4px rgba(0,0,0,0.4);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.studio-config-field select:hover,
.studio-config-field select:focus {
  border-color: rgba(201, 160, 100, 0.55);
  outline: none;
}
.studio-config-hint {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--grey-2);
}

/* ---- BeatStrip (Bandmaschine): pillenfoermige Slots pro Beat ----
   Akzent-Slot (warm-grau) markiert jeden Bar-Start. Restliche Beats sind
   dunkelrot. Aktiver Beat ist heller und leuchtet leicht.
   Layout: flex-wrap mit 4er-Gruppen pro Bar (kleine Luecke zwischen Slots,
   groessere Luecke zwischen Bars). */
.studio-beat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
  margin-top: 16px;
  padding: 14px 16px;
  background: #0a0709;
  border: 1px solid #000;
  border-radius: 4px;
  box-shadow:
    0 1px 0 rgba(255,180,120,0.04) inset,
    0 0 14px rgba(0,0,0,0.6) inset;
}
.studio-beat-strip-bar {
  display: flex;
  gap: 4px;
}
.studio-beat-slot {
  width: 26px;
  height: 38px;
  border-radius: 5px;
  background: linear-gradient(180deg, #4a2a26 0%, #2a1612 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,180,170,0.08),
    inset 0 -2px 4px rgba(0,0,0,0.55),
    0 1px 2px rgba(0,0,0,0.6);
  transition: background 0.08s linear, box-shadow 0.12s ease-out;
}
.studio-beat-slot--accent {
  background: linear-gradient(180deg, #6a6055 0%, #38302a 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,240,220,0.14),
    inset 0 -2px 4px rgba(0,0,0,0.5),
    0 1px 2px rgba(0,0,0,0.6);
}
.studio-beat-slot--active {
  background: linear-gradient(180deg, #d05858 0%, #7a3838 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,210,200,0.30),
    inset 0 -1px 2px rgba(0,0,0,0.35),
    0 0 14px rgba(232,90,80,0.50);
}
.studio-beat-slot--accent.studio-beat-slot--active {
  background: linear-gradient(180deg, #e8dcc0 0%, #998870 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,250,235,0.45),
    inset 0 -1px 2px rgba(0,0,0,0.3),
    0 0 16px rgba(255,220,170,0.55);
}

/* ---- Mini-Transport (fixed, erscheint beim Scrollen) ---- */
.studio-mini-transport {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 8000;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: linear-gradient(180deg, #2e1f15 0%, #1c130c 100%);
  border: 1px solid #0a0606;
  border-radius: 22px;
  box-shadow:
    0 1px 0 rgba(255,180,120,0.10) inset,
    0 -1px 0 rgba(0,0,0,0.6) inset,
    0 8px 20px rgba(0,0,0,0.55),
    0 0 18px rgba(255, 130, 50, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.studio-mini-transport.is-pinned {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.studio-mini-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #45464a 0%, #28292d 50%, #14151a 100%);
  border: 1px solid #050608;
  border-radius: 50%;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.14) inset,
    0 -1px 0 rgba(0,0,0,0.55) inset;
  color: var(--cream);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  transition: transform 0.08s, color 0.15s;
}
.studio-mini-btn:hover { color: var(--amber); }
.studio-mini-btn:active { transform: scale(0.94); }
/* Rec-Variante: rot, leicht angeglueht. Wird zur Laufzeit per
   .is-recording / .is-armed / .is-precount Klassen am Root weiter
   akzentuiert (siehe Haupt-Rec-Button). */
.studio-mini-btn-rec { color: #e85040; }
.studio-mini-btn-rec:hover { color: #ff6a5e; }
.studio-page-root.is-recording .studio-mini-btn-rec,
.studio-page-root.is-precount .studio-mini-btn-rec,
.studio-page-root.is-armed .studio-mini-btn-rec {
  color: #ff6a5e;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.14) inset,
    0 -1px 0 rgba(0,0,0,0.55) inset,
    0 0 10px rgba(232,80,64,0.55);
}
.studio-mini-bpm, .studio-mini-bar {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--cream);
}
.studio-mini-bpm small, .studio-mini-bar small {
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--grey-3);
}

/* Mini-Transport: kompakter auf schmalen Screens — versteckt die
   beschreibenden "small"-Labels, nur Zahl + Buttons bleiben. */
@media (max-width: 560px) {
  .studio-mini-transport {
    gap: 6px;
    padding: 6px 12px;
  }
  .studio-mini-btn { width: 26px; height: 26px; font-size: 10px; }
  .studio-mini-bpm small, .studio-mini-bar small { display: none; }
  .studio-mini-bpm, .studio-mini-bar { font-size: 10px; }
}

/* ---- Zurück-Button im Transport ---- */
.studio-btn-back .studio-btn-icon { color: var(--cream); }

/* ---- Ghost-Track-Row (leerer Slot) ---- */
.studio-track-ghost {
  background:
    repeating-linear-gradient(91deg,
      rgba(0,0,0,0.10) 0 1px, transparent 1px 6px),
    linear-gradient(180deg, rgba(46,31,21,0.6) 0%, rgba(28,19,12,0.6) 100%);
  border: 1px dashed rgba(255,180,120,0.20);
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.2s, border-color 0.2s, background 0.2s;
}
.studio-track-ghost:hover {
  opacity: 1;
  border-color: rgba(255,180,120,0.55);
}
.studio-track-ghost-name {
  color: var(--amber);
  opacity: 0.7;
}
.studio-track-ghost-hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 11px;
  color: var(--grey-3);
  margin-top: 2px;
}
.studio-track-ghost-wave {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.4em;
  color: var(--grey-2);
  text-align: center;
  width: 100%;
}
.studio-tracks-max {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--grey-3);
  padding: 12px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 3px;
}

/* ---- Play-Glow: wenn der Transport laeuft, sanftes (NICHT pulsierendes)
   gruenes Glimmen am Play-Button — Pendant zum roten Rec-Pulse, aber statisch. */
.studio-page-root.is-playing .studio-btn-play {
  background: linear-gradient(180deg, #1f3a1f 0%, #142814 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.22) inset,
    0 -1px 0 rgba(0,0,0,0.55) inset,
    0 0 14px rgba(106,191,106,0.85),
    0 0 28px rgba(106,191,106,0.45);
}
.studio-page-root.is-playing .studio-btn-play .studio-btn-icon {
  text-shadow: 0 0 12px rgba(106,191,106,1), 0 0 24px rgba(106,191,106,0.85);
}

/* ---- Transport-Toggles (Metronom / Pre-Count / Click-Filter Reihe) ---- */
.studio-transport-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  padding: 6px 10px;
  margin-left: 4px;
}
.studio-transport-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--grey-3);
  cursor: pointer;
}
.studio-transport-toggles input[type="checkbox"] {
  accent-color: var(--amber);
}

/* ---- Bandmaschine: kompakter Ghost-Button (statt Ghost-Row) ----
   In der Bandmaschine geht es nur um Wellenform + Loeschen — der Ghost
   ist daher ein einzeiliger einladender Buttonstreifen, kein Mini-Channel. */
.studio-track-ghost-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  margin-top: 8px;
  background:
    repeating-linear-gradient(91deg,
      rgba(0,0,0,0.10) 0 1px, transparent 1px 6px),
    linear-gradient(180deg, rgba(46,31,21,0.5) 0%, rgba(28,19,12,0.5) 100%);
  border: 1px dashed rgba(255,180,120,0.22);
  border-radius: 3px;
  color: var(--grey-3);
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s, border-color 0.2s, color 0.2s;
}
.studio-track-ghost-btn:hover {
  opacity: 1;
  border-color: rgba(255,180,120,0.55);
  color: var(--cream);
}
.studio-track-ghost-btn .studio-ghost-plus {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--amber);
  text-shadow: 0 0 6px var(--amber-dim);
}

/* ---- Mischpult: Cubase-Style vertikale Channel-Strips ----
   Eine Reihe gleicher schmaler Streifen nebeneinander, jeweils:
     [M | S]
     [Pan-Slider + Readout]
     [Vertikaler Fader  +  Stereo-VU (2 schmale Streifen)]
     [dB-Readout]
     [Kanalname]
   Faderspur ist post-fader, post-panning. */
.studio-mixer {
  display: flex;
  flex-direction: row;
  gap: 6px;
  padding: 8px;
  overflow-x: auto;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.18) 100%);
  border: 1px solid #000;
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(255,180,120,0.05) inset, 0 0 12px rgba(0,0,0,0.55) inset;
}
/* Leere Slots: alle 10 Kanaele sind ab Werk sichtbar; die ohne aufgenommene
   Spur erscheinen ausgegraut. */
.studio-mixer-channel.is-empty {
  opacity: 0.34;
  pointer-events: none;
  filter: saturate(0.35);
}
.studio-mixer-channel.is-empty .studio-mixer-channel-name {
  color: var(--grey-3);
}
.studio-mixer-channel {
  flex: 0 0 auto;
  width: 78px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 6px 8px;
  background:
    linear-gradient(180deg, #2b2c30 0%, #1a1b1f 60%, #101115 100%);
  border: 1px solid #050608;
  border-radius: 3px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.10) inset,
    0 -1px 0 rgba(0,0,0,0.55) inset,
    0 2px 4px rgba(0,0,0,0.4);
}

/* M/S Buttons in einer Zwei-Spalten-Reihe oben */
.studio-mixer-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.studio-mixer-btns .studio-track-btn {
  width: 100%;
  padding: 4px 0;
  font-size: 10px;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, #3a3b40 0%, #1f2025 100%);
  border: 1px solid #050608;
  border-radius: 2px;
  color: var(--grey-3);
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 -1px 0 rgba(0,0,0,0.5) inset;
  cursor: pointer;
}
.studio-mixer-btns .studio-mixer-mute.is-active {
  color: #fff;
  background: linear-gradient(180deg, #8a2020 0%, #5a1010 100%);
  text-shadow: 0 0 6px rgba(232,80,64,0.6);
}
.studio-mixer-btns .studio-mixer-solo.is-active {
  color: #1a1206;
  background: linear-gradient(180deg, #f5c674 0%, #c98a2a 100%);
  text-shadow: 0 0 6px rgba(255,200,100,0.5);
}

/* Pan: horizontaler kleiner Slider + Readout drueber */
.studio-mixer-pan {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.studio-mixer-pan input[type="range"] {
  width: 100%;
  accent-color: var(--brass);
  height: 6px;
}
.studio-mixer-mini-label {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--grey-3);
}

/* Fader-Zeile: Vertikaler Slider + 2 Stereo-Meter nebeneinander */
.studio-mixer-fader-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
  justify-content: center;
  height: 140px;
  padding: 2px 0;
}
/* Cubase-Style Vertikal-Fader.
   Wir verzichten auf 'appearance: slider-vertical' — Webkit ignoriert
   dann ::-webkit-slider-thumb. Stattdessen writing-mode-Hack +
   appearance:none, so kommen wir an Track und Cap-Griff voll heran. */
.studio-vfader {
  -webkit-appearance: none;
  appearance: none;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 30px;
  height: 100%;
  background: transparent;
  margin: 0;
  cursor: ns-resize;
}
.studio-vfader:focus { outline: none; }

/* Webkit: Track + Thumb */
.studio-vfader::-webkit-slider-runnable-track {
  width: 5px;
  height: 100%;
  background: linear-gradient(90deg, #050608 0%, #1a1c20 50%, #050608 100%);
  border: 1px solid #050608;
  border-radius: 2px;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.85);
}
.studio-vfader::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 22px;
  margin-left: -13px;
  border-radius: 3px;
  border: 1px solid #060708;
  background:
    /* Rillen-Textur (3 dunkle Linien horizontal): */
    linear-gradient(180deg,
      transparent 8px,
      rgba(0,0,0,0.55) 8px, rgba(0,0,0,0.55) 9px,
      transparent 9px, transparent 11px,
      rgba(0,0,0,0.55) 11px, rgba(0,0,0,0.55) 12px,
      transparent 12px, transparent 14px,
      rgba(0,0,0,0.55) 14px, rgba(0,0,0,0.55) 15px,
      transparent 15px),
    /* Basis-Gradient (hellgrau, Highlight in der Mitte): */
    linear-gradient(90deg, #555 0%, #c8c8c8 50%, #555 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -1px 0 rgba(0,0,0,0.4),
    0 2px 4px rgba(0,0,0,0.55);
}
.studio-vfader::-webkit-slider-thumb:hover {
  filter: brightness(1.08);
}
.studio-vfader::-webkit-slider-thumb:active {
  filter: brightness(1.18);
}

/* Firefox: Track + Thumb */
.studio-vfader::-moz-range-track {
  width: 5px;
  background: linear-gradient(90deg, #050608 0%, #1a1c20 50%, #050608 100%);
  border: 1px solid #050608;
  border-radius: 2px;
}
.studio-vfader::-moz-range-thumb {
  width: 28px;
  height: 22px;
  border-radius: 3px;
  border: 1px solid #060708;
  background:
    linear-gradient(180deg,
      transparent 8px,
      rgba(0,0,0,0.55) 8px, rgba(0,0,0,0.55) 9px,
      transparent 9px, transparent 11px,
      rgba(0,0,0,0.55) 11px, rgba(0,0,0,0.55) 12px,
      transparent 12px, transparent 14px,
      rgba(0,0,0,0.55) 14px, rgba(0,0,0,0.55) 15px,
      transparent 15px),
    linear-gradient(90deg, #555 0%, #c8c8c8 50%, #555 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    0 2px 4px rgba(0,0,0,0.55);
}

/* Disabled (leere Mixer-Slots) */
.studio-vfader:disabled::-webkit-slider-thumb,
.studio-vfader:disabled::-moz-range-thumb {
  background: linear-gradient(90deg, #3a3a3a 0%, #5a5a5a 50%, #3a3a3a 100%);
  opacity: 0.5;
}

/* dB-Skala im Cubase-Stil rechts neben jedem Mixer-Fader. */
.studio-fader-scale {
  list-style: none;
  margin: 0;
  padding: 2px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 18px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.04em;
  color: var(--grey-3);
  line-height: 1;
  user-select: none;
}
.studio-fader-scale li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3px;
}
.studio-fader-scale li::before {
  content: '';
  display: block;
  width: 5px;
  height: 1px;
  background: var(--grey-3);
  opacity: 0.45;
}
/* "0" leicht akzentuiert — Unity-Position der Skala (Loop/Master). */
.studio-fader-scale li:nth-child(2) {
  color: var(--brass);
}
.studio-fader-scale li:nth-child(2)::before {
  background: var(--brass);
  opacity: 0.7;
  width: 7px;
}
/* Input-Skala ist bipolar — "0" sitzt in der Mitte (4. von 7). */
.studio-fader-scale-input li {
  color: var(--grey-3);
}
.studio-fader-scale-input li::before {
  background: var(--grey-3);
  opacity: 0.45;
  width: 5px;
}
.studio-fader-scale-input li:nth-child(2),
.studio-fader-scale-input li:nth-child(2)::before { /* +10 */
  /* zuruecksetzen falls ueberschrieben */
  color: var(--grey-3);
}
.studio-fader-scale-input li:nth-child(2)::before {
  background: var(--grey-3);
  opacity: 0.45;
  width: 5px;
}
.studio-fader-scale-input li:nth-child(4) {
  color: #b0d8ff;
}
.studio-fader-scale-input li:nth-child(4)::before {
  background: #b0d8ff;
  opacity: 0.75;
  width: 7px;
}

/* Stereo-Meter im Mixer: zwei schmale Streifen nebeneinander, hoch wie der Fader */
.studio-mixer-meters {
  display: flex;
  gap: 2px;
  height: 100%;
}
.studio-mixer-meters .studio-track-meter {
  width: 6px;
  height: 100%;
  margin-left: 0;
  background: #030405;
  border: 1px solid #000;
  border-radius: 1px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 0 4px rgba(0,0,0,0.7) inset;
  position: relative;
  overflow: hidden;
}

/* dB Readout */
.studio-mixer-readout {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--cream);
  text-align: center;
  padding: 3px 0;
  background: #050608;
  border: 1px solid #000;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(255,168,74,0.08) inset;
}
.studio-mixer-readout [data-gain-readout] { color: var(--amber); }

.studio-mixer-channel-name {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cream);
  text-align: center;
  padding-top: 2px;
  border-top: 1px solid rgba(180,130,80,0.18);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Loop-Zeile (Bandmaschine): Name + [M S] + Gain + Loeschen ----
   Klare Gruppen statt Reihe — M/S als Block links, Gain-Slider als
   flexible Mitte, Loeschen-Knopf als Icon rechts. Vertikal zentriert. */
.studio-track-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}
.studio-track-ms {
  display: flex;
  gap: 4px;
}
.studio-track-knob-wrap {
  flex: 1;
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin: 0;
  min-width: 100px;
}
.studio-track-knob-label {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--brass);
  text-align: center;
}
.studio-track-knob-wrap input[type="range"] {
  width: 100%;
  height: 4px;
  accent-color: var(--brass);
}
.studio-track-del {
  /* gleiche Groesse wie .studio-track-btn (M/S) — 24x22 */
  width: 24px !important;
  height: 22px;
  padding: 0 !important;
  color: var(--grey-3);
  font-size: 10px;
}
.studio-track-del:hover {
  color: #e85040;
  border-color: rgba(232, 80, 64, 0.5);
}
/* Ghost-Row: Platzhalter-Knopf an gleicher Stelle wie der echte
   Loeschen-Button — sorgt fuer ausrichtende Spaltenbreite. */
.studio-track-del-ghost {
  visibility: hidden;
}

/* ---- Ghost-Track-Row: optisch wie eine echte Spur, nur ausgegraut ----
   Damit der Nutzer schon sieht, wo die naechste Aufnahme erscheint. */
.studio-track-row-ghost {
  opacity: 0.5;
  filter: saturate(0.45);
  border-style: dashed;
  border-color: rgba(255,180,120,0.22);
}
.studio-track-row-ghost:hover { opacity: 0.75; }
.studio-track-row-ghost .studio-track-name { color: var(--grey-3); }
.studio-track-waveform-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.studio-rec-live-canvas {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.studio-track-row-ghost.is-recording .studio-rec-live-canvas { display: block; }
.studio-track-row-ghost.is-recording .studio-track-ghost-hint { display: none; }
.studio-track-row-ghost .studio-track-ghost-hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--grey-3);
}

/* ---- Schutzklappe ueber dem Verwerfen-Button ----
   Geschlossen: transparente Klappe mit Diagonal-Streifen liegt ueber dem
   Button, blockiert den direkten Click. Click auf die Klappe oeffnet sie
   (slide-up + halb-transparent). Erst dann ist der Verwerfen-Button frei. */
.studio-discard-guard {
  position: relative;
  display: inline-block;
  isolation: isolate;
}
/* Glasige, graue Schutzklappe mit Lichtreflexion. Scharniere oben — sie
   klappt nach oben weg (Bottom-Kante kippt nach oben/hinten). */
.studio-discard-flap {
  position: absolute;
  inset: 0;
  background:
    /* Lichtreflexion: schraeg von oben links, leicht versetzt */
    linear-gradient(118deg,
      transparent 0%,
      transparent 22%,
      rgba(255,255,255,0.22) 30%,
      rgba(255,255,255,0.05) 38%,
      transparent 46%,
      transparent 64%,
      rgba(255,255,255,0.10) 70%,
      transparent 78%),
    /* Sanfter Vertikal-Verlauf — oben heller (Glas-Eindruck) */
    linear-gradient(180deg,
      rgba(225,225,230,0.28) 0%,
      rgba(170,170,178,0.18) 50%,
      rgba(120,120,128,0.22) 100%);
  border: 1px solid rgba(220,220,225,0.30);
  border-radius: 3px;
  cursor: pointer;
  /* Scharniere oben → Klappe pivotiert an der OBERkante */
  transform-origin: top center;
  transition: transform 0.36s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.45) inset,
    0 -1px 0 rgba(0,0,0,0.45) inset,
    0 2px 6px rgba(0,0,0,0.4);
  z-index: 3;
  overflow: hidden;
}
/* "SAFTY" am oberen Rand (entspricht dem Hinweis am Klappen-Scharnier) */
.studio-discard-flap::before {
  content: 'SAFTY';
  position: absolute;
  top: 3px;
  left: 0; right: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.32em;
  color: rgba(40,40,46,0.85);
  text-shadow: 0 1px 0 rgba(255,255,255,0.35);
  pointer-events: none;
  z-index: 4;
}
/* Die beiden Scharnier-Nieten links/rechts am oberen Rand */
.studio-discard-flap::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 5px; right: 5px;
  height: 2px;
  background:
    radial-gradient(circle at 0% 50%, rgba(160,160,165,0.85) 0 1.5px, transparent 2px),
    radial-gradient(circle at 100% 50%, rgba(160,160,165,0.85) 0 1.5px, transparent 2px);
  pointer-events: none;
  z-index: 4;
}
.studio-discard-guard[data-state="open"] .studio-discard-flap {
  /* Klappt nach OBEN weg: Bottom-Kante hebt sich, die Klappe steht
     ueber dem Button. Etwas mehr als 90deg fuer einen leicht ueberkippten,
     natuerlichen Endzustand. */
  transform: rotateX(108deg) translateY(-1px);
  opacity: 0.6;
  pointer-events: none;
}
.studio-discard-guard[data-state="open"] .studio-btn-discard {
  background: linear-gradient(180deg, #8a2020 0%, #5a1010 100%);
  color: rgba(255,210,200,1);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.16) inset,
    0 -1px 0 rgba(0,0,0,0.55) inset,
    0 0 14px rgba(232,80,64,0.55);
}
.studio-discard-guard[data-state="open"] .studio-btn-discard .studio-rec-icon,
.studio-discard-guard[data-state="open"] .studio-btn-discard .studio-btn-icon {
  text-shadow: 0 0 8px rgba(232,80,64,0.8);
}

/* ---- Master-Channel-Strip im Mischpult (rot) ---- */
.studio-mixer-master {
  margin-left: 10px;
  background:
    linear-gradient(180deg, #4a1a1a 0%, #2a0a0a 60%, #170505 100%);
  border-color: #200505;
  position: relative;
}
.studio-mixer-master::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 6px; bottom: 6px;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(255,180,120,0.30), transparent);
}
/* Master-Btns-Slot: kein 2-Spalten-Grid, sondern eine durchgaengige
   Zeile, damit das MAIN-Label ueber die volle Breite zentriert sitzt. */
.studio-mixer-master .studio-mixer-btns {
  display: block;
  grid-template-columns: none;
}
.studio-mixer-master .studio-mixer-master-tag {
  display: block;
  width: 100%;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.36em;
  color: #ffb3a0;
  padding: 5px 0;
  background: linear-gradient(180deg, #6a1a1a 0%, #3a0a0a 100%);
  border: 1px solid #200505;
  border-radius: 2px;
  text-shadow: 0 0 6px rgba(232,80,64,0.5);
}
.studio-mixer-master .studio-mixer-readout {
  background: #1a0505;
  box-shadow: 0 0 6px rgba(232,80,64,0.18) inset;
}
.studio-mixer-master .studio-mixer-readout [data-master-gain-readout] {
  color: #ffb3a0;
}
.studio-mixer-master .studio-mixer-channel-name {
  color: #ffb3a0;
  border-top-color: rgba(232,80,64,0.3);
}
/* Master-Fader: roter Cap-Griff. */
.studio-mixer-master .studio-vfader::-webkit-slider-thumb {
  background:
    linear-gradient(180deg,
      transparent 8px,
      rgba(0,0,0,0.55) 8px, rgba(0,0,0,0.55) 9px,
      transparent 9px, transparent 11px,
      rgba(0,0,0,0.55) 11px, rgba(0,0,0,0.55) 12px,
      transparent 12px, transparent 14px,
      rgba(0,0,0,0.55) 14px, rgba(0,0,0,0.55) 15px,
      transparent 15px),
    linear-gradient(90deg, #6a1a1a 0%, #e85040 50%, #6a1a1a 100%);
}
.studio-mixer-master .studio-vfader::-moz-range-thumb {
  background:
    linear-gradient(180deg,
      transparent 8px,
      rgba(0,0,0,0.55) 8px, rgba(0,0,0,0.55) 9px,
      transparent 9px, transparent 11px,
      rgba(0,0,0,0.55) 11px, rgba(0,0,0,0.55) 12px,
      transparent 12px, transparent 14px,
      rgba(0,0,0,0.55) 14px, rgba(0,0,0,0.55) 15px,
      transparent 15px),
    linear-gradient(90deg, #6a1a1a 0%, #e85040 50%, #6a1a1a 100%);
}

/* ---- Input-Channel-Strip im Mischpult (blau) ---- */
.studio-mixer-input {
  margin-left: 10px;
  background: linear-gradient(180deg, #1a2a48 0%, #0a1422 60%, #050a14 100%);
  border-color: #050a14;
  position: relative;
}
.studio-mixer-input::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 6px; bottom: 6px;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(120,180,255,0.30), transparent);
}
.studio-mixer-input .studio-mixer-btns {
  display: block;
}
.studio-mixer-input .studio-mixer-master-tag {
  display: block;
  width: 100%;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.36em;
  color: #b0d8ff;
  padding: 5px 0;
  background: linear-gradient(180deg, #1a3a6a 0%, #0a1a3a 100%);
  border: 1px solid #050a14;
  border-radius: 2px;
  text-shadow: 0 0 6px rgba(80, 140, 232, 0.5);
}
.studio-mixer-input .studio-mixer-readout {
  background: #050a14;
  box-shadow: 0 0 6px rgba(80, 140, 232, 0.18) inset;
}
.studio-mixer-input .studio-mixer-readout [data-input-gain-readout] {
  color: #b0d8ff;
}
.studio-mixer-input .studio-mixer-channel-name {
  color: #b0d8ff;
  border-top-color: rgba(80, 140, 232, 0.3);
}
/* Input-Fader: blauer Cap-Griff. */
.studio-mixer-input .studio-vfader::-webkit-slider-thumb {
  background:
    linear-gradient(180deg,
      transparent 8px,
      rgba(0,0,0,0.55) 8px, rgba(0,0,0,0.55) 9px,
      transparent 9px, transparent 11px,
      rgba(0,0,0,0.55) 11px, rgba(0,0,0,0.55) 12px,
      transparent 12px, transparent 14px,
      rgba(0,0,0,0.55) 14px, rgba(0,0,0,0.55) 15px,
      transparent 15px),
    linear-gradient(90deg, #1a3a6a 0%, #5090e8 50%, #1a3a6a 100%);
}
.studio-mixer-input .studio-vfader::-moz-range-thumb {
  background:
    linear-gradient(180deg,
      transparent 8px,
      rgba(0,0,0,0.55) 8px, rgba(0,0,0,0.55) 9px,
      transparent 9px, transparent 11px,
      rgba(0,0,0,0.55) 11px, rgba(0,0,0,0.55) 12px,
      transparent 12px, transparent 14px,
      rgba(0,0,0,0.55) 14px, rgba(0,0,0,0.55) 15px,
      transparent 15px),
    linear-gradient(90deg, #1a3a6a 0%, #5090e8 50%, #1a3a6a 100%);
}
.studio-mixer-meters-mono .studio-track-meter { width: 8px; }

/* Play-/Rec-Glow expliziter zuruecksetzen, damit Stop wirklich aufraeumt */
.studio-page-root:not(.is-playing) .studio-btn-play,
.studio-page-root:not(.is-recording) .studio-btn-rec {
  /* fallback: lass den Browser den Default-Schatten der Transport-Buttons
     wieder anwenden — keine Override-Regel hier */
}

/* ---- Mobile ---- */
@media (max-width: 700px) {
  /* Transport/Rec sind schon flex-wrap, brauchen keine Grid-Overrides */
  .studio-controls-grid { grid-template-columns: 1fr; }
  /* Track-Row stapelt sich vertikal: Channel-Strip über Wellenform */
  .studio-track-row { grid-template-columns: 1fr; }
  /* Mischpult bleibt scrollbar — Channels werden nur schmaler */
  .studio-mixer-channel { width: 66px; }
  .studio-mixer-fader-row { height: 120px; }
  .studio-mixer-master { margin-left: 6px; }
}
