/* ============================================================
   style.css — Evocal Studio UI
   Dark instrument aesthetic: black/charcoal + gold/amber accents
   Fonts: JetBrains Mono (values) + Inter (labels)
   Copyright 2026 Blues Prince Media
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:           #080810;
  --surface:      #10101c;
  --surface2:     #16162a;
  --surface3:     #1e1e38;
  --border:       #2a2a4a;
  --border-glow:  #3d3d70;

  --gold:         #d4a017;
  --gold-light:   #f5c542;
  --gold-dim:     #8a6a0a;
  --amber:        #e8821a;

  --text:         #e8e8f0;
  --text-dim:     #7070a0;
  --text-muted:   #3a3a60;

  --active-glow:  0 0 18px rgba(212, 160, 23, 0.45);
  --card-shadow:  0 4px 24px rgba(0,0,0,0.5);

  --radius:       6px;
  --radius-lg:    12px;
  --font-mono:    'JetBrains Mono', monospace;
  --font-ui:      'Inter', sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* ── App Layout ─────────────────────────────────────────────── */
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 0 16px 32px;
  overflow-x: hidden;
}

.app-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 0 18px;
  letter-spacing: 0.18em;
}

.logo-mark {
  font-size: 22px;
  color: var(--gold);
  opacity: 0.9;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 8px var(--gold));
}

.logo-text {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.35em;
  color: var(--gold-light);
  text-shadow: 0 0 30px rgba(212, 160, 23, 0.5);
}

.logo-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.25em;
  margin-top: 4px;
}

.logo-byline {
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 3px;
  font-weight: 300;
}

.app-main {
  width: 100%;
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Cards / Panels ─────────────────────────────────────────── */
section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  box-shadow: var(--card-shadow);
}

/* ── Labels ─────────────────────────────────────────────────── */
.ctrl-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}

/* ── Pitch Section ──────────────────────────────────────────── */
.pitch-section {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 22px 28px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border-color: var(--border-glow);
}

.pitch-display-wrap {
  flex-shrink: 0;
  text-align: center;
}

.pitch-display-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.note-display {
  font-family: var(--font-mono);
  font-size: 64px;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  transition: color 0.1s, text-shadow 0.1s;
  min-width: 120px;
}

.note-display.detected {
  color: var(--gold-light);
  text-shadow: 0 0 30px rgba(212, 160, 23, 0.6);
}

.freq-display {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.pitch-meters {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cents-row, .level-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meter-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  width: 28px;
  flex-shrink: 0;
}

.pitch-meter-track {
  flex: 1;
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  position: relative;
  overflow: visible;
}

.pitch-meter-center {
  position: absolute;
  left: 50%;
  top: -2px;
  width: 2px;
  height: 10px;
  background: var(--border-glow);
  transform: translateX(-50%);
  border-radius: 1px;
}

.pitch-meter-fill {
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--gold);
  border-radius: 3px;
  transition: left 0.08s, width 0.08s;
  /* JS sets style.left and style.width directly each frame */
  left: 50%;
  width: 2px;
}

.cents-readout {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--gold);
  min-width: 36px;
  text-align: right;
}

.level-canvas {
  flex: 1;
  border-radius: 3px;
  display: block;
  background: var(--surface3);
}

/* ── Controls Section (Key + Mode) ─────────────────────────── */
.controls-section {
  display: flex;
  gap: 20px;
}

.control-group {
  flex: 1;
}

.ctrl-select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237070a0' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ctrl-select:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.15);
}

.ctrl-select option {
  background: var(--surface2);
}

/* ── Button Group Controls ──────────────────────────────────── */
.btn-controls-section {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.btn-group-wrap {
  flex: 1;
  min-width: 160px;
}

.btn-group {
  display: flex;
  gap: 4px;
}

.btn-toggle {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 7px 6px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.03em;
}

.btn-toggle:hover {
  border-color: var(--border-glow);
  color: var(--text);
  background: var(--surface3);
}

.btn-toggle.active {
  background: rgba(212, 160, 23, 0.12);
  border-color: var(--gold-dim);
  color: var(--gold-light);
  box-shadow: var(--active-glow);
}

/* ── Voice Cards ─────────────────────────────────────────────── */
.voice-cards-section {
  padding: 16px;
}

.voice-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 600px) {
  .voice-cards-grid { grid-template-columns: repeat(2, 1fr); }
}

.voice-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.voice-card.active {
  border-color: var(--gold-dim);
  box-shadow: 0 0 12px rgba(212, 160, 23, 0.15);
}

.voice-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}

.voice-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.voice-indicator.active {
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

.voice-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  flex: 1;
}

.voice-note {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-light);
  min-width: 28px;
  text-align: right;
}

.voice-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-row label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  min-width: 28px;
  letter-spacing: 0.08em;
}

.voice-wave {
  flex: 1;
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 3px 5px;
  border-radius: 3px;
  cursor: pointer;
}

.voice-detune, .voice-vol {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  cursor: pointer;
  border: none;
}

.voice-detune::-webkit-slider-thumb,
.voice-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(212,160,23,0.5);
  transition: transform 0.1s;
}

.voice-detune::-webkit-slider-thumb:hover,
.voice-vol::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.detune-val {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  min-width: 24px;
  text-align: right;
}

/* ── Mix Section ─────────────────────────────────────────────── */
.mix-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.mix-row .ctrl-label {
  margin: 0;
  min-width: 58px;
}

.mix-end-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  min-width: 24px;
}

.mix-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: linear-gradient(to right, var(--gold-dim), var(--amber));
  border-radius: 2px;
  cursor: pointer;
}

.mix-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold-light);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(212,160,23,0.6);
  transition: transform 0.1s, box-shadow 0.1s;
}

.mix-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 16px rgba(212,160,23,0.8);
}

.slider-val {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--gold);
  min-width: 36px;
  text-align: right;
}

/* FM Toggle */
.fm-row {
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.fm-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  display: flex;
  align-items: center;
  width: 36px;
  height: 20px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: background 0.2s, border-color 0.2s;
}

.toggle-switch input:checked + .toggle-track {
  background: rgba(212, 160, 23, 0.2);
  border-color: var(--gold-dim);
}

.toggle-knob {
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  margin: 0 2px;
  transition: transform 0.2s, background 0.2s;
}

.toggle-switch input:checked + .toggle-track .toggle-knob {
  transform: translateX(16px);
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
}

/* ── Diagnostics Bar ─────────────────────────────────────────── */
.diagnostics-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  margin-top: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  overflow-x: auto;
  white-space: nowrap;
}

.diag-item b {
  color: var(--gold);
  font-weight: 500;
}

.diag-warn {
  color: #ff6b35 !important;
}

.diag-sep {
  color: var(--border-glow);
  font-weight: 300;
}

/* ── Chart Active Toggle ─────────────────────────────────────── */
.chart-active-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Sensitivity Section ──────────────────────────────────────── */
.sensitivity-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sensitivity-header {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* ── Start Button ─────────────────────────────────────────────── */
.start-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 22px;
  background: transparent;
  border: none;
  box-shadow: none;
}

.start-btn {
  width: 200px;
  padding: 16px 0;
  background: transparent;
  border: 2px solid var(--gold-dim);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3em;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.start-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(212,160,23,0.08) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.2s;
}

.start-btn:hover {
  border-color: var(--gold);
  color: var(--gold-light);
  box-shadow: var(--active-glow);
}

.start-btn:hover::before { opacity: 1; }

.start-btn.active {
  border-color: var(--amber);
  color: var(--amber);
  box-shadow: 0 0 24px rgba(232, 130, 26, 0.4);
  animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 18px rgba(232, 130, 26, 0.3); }
  50%       { box-shadow: 0 0 32px rgba(232, 130, 26, 0.6); }
}

.status-bar {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-align: center;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.app-main > section {
  animation: fadeIn 0.4s ease both;
}

.app-main > section:nth-child(1) { animation-delay: 0.05s; }
.app-main > section:nth-child(2) { animation-delay: 0.10s; }
.app-main > section:nth-child(3) { animation-delay: 0.15s; }
.app-main > section:nth-child(4) { animation-delay: 0.20s; }
.app-main > section:nth-child(5) { animation-delay: 0.25s; }

/* ── Header Layout (auth) ──────────────────────────────────── */
.header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 780px;
  position: relative;
}

.header-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-area {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.auth-btn:hover {
  border-color: var(--gold-dim);
  color: var(--gold);
}

.auth-btn.signed-in {
  border-color: var(--gold-dim);
  color: var(--gold);
}

.auth-user-email {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Modal Overlay ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal-panel {
  background: var(--surface);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  width: 360px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
}

.modal-panel-wide {
  width: 780px;
  max-width: 95vw;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.modal-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--gold);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}

.modal-close:hover { color: var(--text); }

/* ── Auth Form ─────────────────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.15);
}

.auth-error {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #e85454;
  padding: 8px 10px;
  background: rgba(232, 84, 84, 0.08);
  border: 1px solid rgba(232, 84, 84, 0.2);
  border-radius: var(--radius);
}

.auth-error.hidden { display: none; }

.auth-submit {
  width: 100%;
  padding: 12px 0;
  font-size: 13px;
}

.auth-toggle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.text-dim {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.auth-link {
  background: none;
  border: none;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.auth-link:hover { color: var(--gold-light); }

/* ── Patch Editor ──────────────────────────────────────────── */
.patch-editor {
  display: flex;
  gap: 20px;
  min-height: 400px;
}

.patch-sidebar {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.patch-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.patch-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 500px;
}

.patch-list-item {
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.patch-list-item:hover {
  border-color: var(--border-glow);
  color: var(--text);
}

.patch-list-item.active {
  border-color: var(--gold-dim);
  color: var(--gold);
  background: rgba(212, 160, 23, 0.06);
}

.patch-edit-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.patch-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 700px) {
  .patch-editor { flex-direction: column; }
  .patch-sidebar { width: 100%; }
  .patch-section-grid { grid-template-columns: 1fr; }
}

.patch-panel {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ctrl-label-sm {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.effects-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.effect-group {
  flex: 1;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.patch-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.patch-actions-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.patch-public-toggle {
  flex-shrink: 0;
}

/* ── Small Buttons ─────────────────────────────────────────── */
.btn-sm {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-sm:hover {
  border-color: var(--border-glow);
  color: var(--text);
}

.btn-gold {
  border-color: var(--gold-dim);
  color: var(--gold);
}

.btn-gold:hover {
  background: rgba(212, 160, 23, 0.1);
  border-color: var(--gold);
  color: var(--gold-light);
}

.btn-danger {
  border-color: rgba(232, 84, 84, 0.3);
  color: rgba(232, 84, 84, 0.7);
}

.btn-danger:hover {
  background: rgba(232, 84, 84, 0.08);
  border-color: #e85454;
  color: #e85454;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.btn-outline:hover {
  border-color: var(--gold-dim);
  color: var(--gold);
}

/* ── Start Row (patches + start + sessions) ────────────────── */
.start-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* ── Chord Chart Section ───────────────────────────────────── */
.chart-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-header .ctrl-label { margin: 0; }

.chart-tempo-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-tempo-slider {
  width: 80px;
}

/* Text Input */
.chart-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chart-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 14px;
  border-radius: var(--radius);
  resize: vertical;
  min-height: 44px;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chart-input:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.15);
}

.chart-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.chart-input-hint {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* Grid */
.chart-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 60px;
}

.chart-empty {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}

.chart-bar-row {
  display: grid;
  gap: 6px;
}

.chart-bar-cell {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 60px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chart-bar-cell:hover {
  border-color: var(--border-glow);
}

.chart-bar-cell.chart-bar-active {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(212, 160, 23, 0.3);
  background: rgba(212, 160, 23, 0.05);
}

.bar-number {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-muted);
  position: absolute;
  top: 4px;
  left: 6px;
}

.bar-chords {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  padding-top: 6px;
  letter-spacing: 0.02em;
}

.bar-tones {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.05em;
}

/* Section headers */
.chart-section-header {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}

.chart-section-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.chart-label-known {
  color: var(--gold);
  border-left: 3px solid var(--gold-dim);
  padding-left: 8px;
}

.chart-label-custom {
  color: var(--text-dim);
  border-left: 3px solid var(--border);
  padding-left: 8px;
}

/* Repeat brackets */
.chart-repeat-start,
.chart-repeat-end {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-dim);
  padding: 2px 6px;
}

.repeat-dots {
  color: var(--gold-dim);
}

/* Inline cell editing */
.chart-cell-input {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--gold-dim);
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 3px;
  text-align: center;
  outline: none;
  margin-top: 4px;
}

/* Chart controls */
.chart-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.chart-controls .btn-group-wrap {
  min-width: auto;
}

.chart-toggles {
  display: flex;
  gap: 6px;
}

.chart-bar-count-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.chart-bar-count {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
}

.hidden { display: none !important; }

/* ── .ai Branding ──────────────────────────────────────────── */
.logo-dot {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 2px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Top Row: Pitch + Level (side by side) ──────────────────── */
.top-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border-color: var(--border-glow);
}

.pitch-panel {
  text-align: center;
  min-width: 160px;
}

.level-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.level-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}

/* ── Compact Controls Bar ──────────────────────────────────── */
.controls-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 14px 18px;
  flex-wrap: wrap;
}

.controls-bar .control-group {
  flex: 0 1 auto;
  min-width: 80px;
}

.controls-bar .btn-group-wrap {
  flex: 0 1 auto;
  min-width: auto;
}

.controls-bar .btn-group {
  gap: 3px;
}

.controls-bar .btn-toggle {
  padding: 6px 8px;
  font-size: 10px;
}

/* ── 2-Column Main Grid (Voice Cards + Mixer) ──────────────── */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 14px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.voice-cards-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--card-shadow);
}

.mixer-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mixer-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mixer-row .ctrl-label {
  margin: 0;
  min-width: 50px;
  font-size: 8px;
}

.voice-type-row {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

.voice-type-row .btn-group {
  gap: 3px;
}

.voice-type-row .btn-toggle {
  padding: 5px 8px;
  font-size: 9px;
}

.sensitivity-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Vowel slider — gradient from warm to cool */
.vowel-slider {
  background: linear-gradient(to right, #e8821a, var(--gold), #5a7aff, #4a4abb) !important;
}

@media (max-width: 700px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .top-row {
    grid-template-columns: 1fr;
  }
  .controls-bar {
    gap: 10px;
  }
}

/* ── Drum Loop Slots ───────────────────────────────────────── */
.drums-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px;
}

.drums-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drums-header .ctrl-label { margin: 0; }

.drums-vol-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drums-vol-slider {
  width: 80px;
}

.drum-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.drum-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-mono);
}

.drum-slot:hover {
  border-color: var(--border-glow);
  background: var(--surface3);
}

.drum-slot.active {
  border-color: var(--gold);
  background: rgba(212, 160, 23, 0.08);
  box-shadow: 0 0 14px rgba(212, 160, 23, 0.25);
}

.drum-slot-icon {
  font-size: 14px;
  color: var(--text-dim);
  transition: color 0.15s;
}

.drum-slot.active .drum-slot-icon {
  color: var(--gold-light);
}

.drum-slot-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  transition: color 0.15s;
}

.drum-slot.active .drum-slot-name {
  color: var(--gold-light);
}

@keyframes pulse-drum {
  0%, 100% { box-shadow: 0 0 12px rgba(212, 160, 23, 0.2); }
  50%       { box-shadow: 0 0 20px rgba(212, 160, 23, 0.45); }
}

.drum-slot.active {
  animation: pulse-drum 1.5s ease-in-out infinite;
}

/* ── MIDI Indicator ────────────────────────────────────────── */
.midi-indicator {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.midi-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.2s, box-shadow 0.2s;
}

.midi-dot.connected {
  background: #4aff6a;
  box-shadow: 0 0 6px #4aff6a;
}

.midi-dot.active {
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
}
