:root {
  color-scheme: dark;
  --bg: #0c0b12;
  --panel: #14131d;
  --panel-2: #1b1926;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f6f2ff;
  --muted: #aaa4bb;
  --soft: #77718a;
  --accent: #a56bff;
  --accent-2: #27e0c1;
  --danger: #ff6b89;
  --gold: #f5c15b;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 58% 0%, rgba(165, 107, 255, 0.22), transparent 36%),
    linear-gradient(145deg, #09080d 0%, #11101a 45%, #0b0d12 100%);
  color: var(--text);
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 0;
  color: var(--text);
  cursor: pointer;
}

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.app {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: rgba(11, 10, 17, 0.86);
  backdrop-filter: blur(18px);
}

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

.brand h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
}

.brand span, .eyebrow {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.search span, .sidebar h2 {
  display: block;
  margin: 18px 0 8px;
  color: var(--soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f0e16;
  color: var(--text);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
  min-height: 110px;
}

.preset-list, .chip-list, .mini-list {
  display: grid;
  gap: 8px;
}

.preset-item, .chip, .mini-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
}

.preset-item.active {
  border-color: rgba(165, 107, 255, 0.8);
  background: rgba(165, 107, 255, 0.16);
  box-shadow: inset 3px 0 0 var(--accent);
}

.preset-item small, .mini-item small {
  color: var(--muted);
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.title-row h2 {
  margin: 2px 0 0;
  font-size: clamp(26px, 3.2vw, 44px);
  letter-spacing: 0;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--gold);
  font-size: 22px;
}

.top-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.top-controls label, .inline-controls label, .transport label, .setup-panel label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.top-controls input, .top-controls select {
  min-width: 92px;
}

.ghost, .accent, .transport-btn, .setup-actions button, .mobile-controls button {
  min-height: 40px;
  border-radius: var(--radius);
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.accent, .play {
  background: linear-gradient(135deg, #8f58ff, #c05cff);
  box-shadow: 0 12px 34px rgba(165, 107, 255, 0.24);
}

.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d0c13;
}

.segmented button {
  padding: 9px 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: var(--panel-2);
  color: var(--text);
}

.practice-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
}

.center-stage, .coach-panel, .setup-panel {
  min-width: 0;
}

.chord-strip {
  display: grid;
  grid-template-columns: 0.8fr 1.25fr 0.8fr;
  gap: 12px;
  align-items: stretch;
}

.chord-card {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(20, 19, 29, 0.88);
  box-shadow: var(--shadow);
  min-height: 185px;
}

.chord-card.current {
  border-color: rgba(165, 107, 255, 0.88);
  background: linear-gradient(180deg, rgba(165, 107, 255, 0.22), rgba(24, 22, 36, 0.95));
}

.chord-card h3 {
  margin: 4px 0 2px;
  font-size: clamp(34px, 5vw, 72px);
  letter-spacing: 0;
}

.chord-card:not(.current) h3 {
  font-size: clamp(25px, 3vw, 42px);
}

.chord-card .role {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tone-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.tone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.tone.target, .note-dot.target {
  color: #06110f;
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.transport, .fretboard-card, .suggestions, .mixer, .coach-panel section, .setup-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(20, 19, 29, 0.82);
  box-shadow: var(--shadow);
}

.transport {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 14px;
}

.transport-status,
.transport-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.transport-status {
  flex: 1 1 280px;
}

.transport-actions {
  margin-left: auto;
  justify-content: flex-end;
}

.play {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  font-size: 24px;
}

.loop-toggle {
  display: flex !important;
  grid-auto-flow: column;
  align-items: center;
}

.loop-toggle input {
  width: auto;
}

.beat-row {
  display: flex;
  gap: 8px;
}

.beat {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #363242;
  border: 1px solid var(--line);
}

.beat.active {
  background: var(--accent-2);
  box-shadow: 0 0 22px rgba(39, 224, 193, 0.8);
}

.counters {
  display: flex;
  min-width: 220px;
  justify-content: space-between;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.fretboard-card {
  padding: 16px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.section-head h3 {
  margin: 0;
  font-size: 18px;
}

.compact {
  align-items: center;
  margin-bottom: 10px;
}

.inline-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: end;
}

.fretboard-wrap {
  overflow-x: auto;
  padding-bottom: 8px;
}

.fret-labels {
  display: grid;
  grid-template-columns: 54px repeat(16, minmax(48px, 1fr));
  min-width: 860px;
  color: var(--soft);
  font-size: 11px;
  margin-bottom: 4px;
}

.fret-labels span {
  text-align: center;
}

.fretboard {
  min-width: 860px;
  display: grid;
  grid-template-rows: repeat(6, 48px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(90deg, #21190f, #33200f);
}

.string-row {
  display: grid;
  grid-template-columns: 54px repeat(16, minmax(48px, 1fr));
  position: relative;
}

.string-name {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.25);
  border-right: 3px solid #d9c5a4;
  font-weight: 700;
}

.fret-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
}

.fret-cell::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(245, 242, 232, 0.72);
}

.note-dot {
  position: relative;
  z-index: 2;
  width: 39px;
  min-height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 2px 4px;
  background: rgba(246, 242, 255, 0.12);
  border: 1px solid rgba(246, 242, 255, 0.18);
  font-size: 11px;
  color: var(--text);
}

.note-dot.root {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.note-dot.fifth {
  background: rgba(245, 193, 91, 0.95);
  border-color: var(--gold);
  color: #181008;
}

.note-dot.seventh {
  background: rgba(255, 107, 137, 0.92);
  border-color: var(--danger);
  color: #17050a;
}

.bottom-panels {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 14px;
}

.suggestions, .mixer {
  padding: 14px;
}

.suggestion-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.suggestion {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
}

.mixer {
  display: grid;
  gap: 8px;
}

.mixer label {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.mixer span {
  color: var(--soft);
  font-size: 11px;
}

.coach-panel section {
  padding: 15px;
}

.coach-panel h3 {
  margin: 4px 0 8px;
}

.target-notes, .voice-list, .stats-grid {
  display: grid;
  gap: 8px;
}

.target-note, .voice-item, .stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.target-note strong, .voice-item strong, .stat strong {
  display: block;
}

.target-note span, .voice-item span, .stat span, .validation {
  color: var(--muted);
  font-size: 12px;
}

.setup-panel {
  padding: 16px;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.setup-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.mobile-controls {
  display: none;
}

.performance .sidebar,
.performance .coach-panel,
.performance .setup-panel,
.performance .top-controls .ghost,
.performance .segmented {
  display: none;
}

.performance.app {
  grid-template-columns: 1fr;
}

.performance .workspace {
  max-width: 1520px;
  margin: 0 auto;
  width: 100%;
}

.performance .practice-grid {
  grid-template-columns: 1fr;
}

.performance .chord-strip {
  grid-template-columns: 0.55fr 1.7fr 0.8fr;
}

.performance .chord-card.current h3 {
  font-size: clamp(72px, 11vw, 150px);
}

.performance .fretboard {
  grid-template-rows: repeat(6, 60px);
}

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .practice-grid {
    grid-template-columns: 1fr;
  }
  .coach-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .coach-panel section {
    margin-top: 0;
  }
}

@media (max-width: 820px) {
  .app {
    display: block;
    padding-bottom: 78px;
  }
  .sidebar {
    position: static;
    height: auto;
    max-height: 360px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .workspace {
    padding: 14px;
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .top-controls {
    width: 100%;
    justify-content: flex-start;
  }
  .chord-strip {
    grid-template-columns: 1fr;
  }
  .chord-card {
    min-height: auto;
  }
  .chord-card.prev {
    display: none;
  }
  .transport {
    gap: 8px;
  }
  .transport-actions {
    margin-left: 0;
  }
  .beat-row {
    order: 8;
    width: 100%;
    margin-left: 0;
  }
  .bottom-panels, .setup-grid, .suggestion-list, .coach-panel {
    grid-template-columns: 1fr;
  }
  .section-head {
    display: block;
  }
  .inline-controls {
    justify-content: start;
    margin-top: 10px;
  }
  .mobile-controls {
    position: fixed;
    z-index: 40;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr 92px auto;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(11, 10, 17, 0.92);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
  }
  .mobile-controls label {
    color: var(--muted);
    font-size: 11px;
  }
  .mobile-controls input[type="number"] {
    padding: 8px;
  }
  .mobile-controls input[type="checkbox"] {
    width: auto;
  }
}

@media (max-width: 430px) {
  .brand h1 {
    font-size: 28px;
  }
  .title-row h2 {
    font-size: 25px;
  }
  .top-controls label:nth-child(2),
  .top-controls .ghost,
  .top-controls .segmented {
    display: none;
  }
  .play {
    width: 54px;
    height: 54px;
  }
  .fret-labels, .fretboard {
    min-width: 720px;
  }
  .fret-labels, .string-row {
    grid-template-columns: 42px repeat(16, minmax(42px, 1fr));
  }
  .fretboard {
    grid-template-rows: repeat(6, 43px);
  }
  .note-dot {
    width: 34px;
    min-height: 29px;
    font-size: 10px;
  }
  .mobile-controls {
    grid-template-columns: 1fr 1fr 78px auto;
  }
}
