:root {
  --bg: #0b0f14;
  --panel: rgba(255, 255, 255, 0.05);
  --panel-hover: rgba(255, 255, 255, 0.08);
  --panel-active: rgba(255, 255, 255, 0.12);
  --stroke: rgba(255, 255, 255, 0.1);
  --stroke-glow: rgba(124, 196, 255, 0.3);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #7cc4ff;
  --accent2: #9bffcf;
  --accent3: #ffd27a;
  --accent-pink: #f472b6;
  --root-color: #f59e0b;
  --chord-color: #3b82f6;
  --scale-color: #10b981;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --radius: 14px;
}

body {
  margin: 0;
  background: 
    radial-gradient(circle at 0% 0%, rgba(124, 196, 255, 0.08), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(155, 255, 207, 0.06), transparent 45%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

/* ==========================================================================
   Typography & Structure
   ========================================================================== */
.mainContent {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 18px 60px;
}

h2 {
  font-size: 1.25rem;
  margin-top: 0;
  margin-bottom: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
}

h3 {
  font-size: 1.05rem;
  margin: 0;
  color: #fff;
}

p {
  color: var(--muted);
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

li {
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.panel:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Info Callout */
.infoCallout {
  background: rgba(124, 196, 255, 0.06);
  border: 1px solid rgba(124, 196, 255, 0.15);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.infoCallout .calloutHeader {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--accent);
}

.infoCallout p {
  color: var(--text);
  font-size: 0.92rem;
  margin-bottom: 8px;
}

.infoCallout p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

/* Grid Layout */
.theoryGrid {
  display: grid;
  grid-template-columns: 1fr minmax(640px, 1.35fr);
  gap: 24px;
  margin-bottom: 24px;
  align-items: start;
}

.visualizerPanel {
  position: sticky;
  top: 96px;
  align-self: start;
}

@media (max-width: 1180px) {
  .theoryGrid {
    grid-template-columns: 1fr;
  }
  
  .visualizerPanel {
    position: relative;
    top: 0;
  }
}

/* ==========================================================================
   Controls Sidebar
   ========================================================================== */
/* ==========================================================================
   Consolidated Workstation Header
   ========================================================================== */
.workstationHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--stroke);
  flex-wrap: wrap;
}

.controlGroupRow {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.rightControls {
  justify-content: flex-end;
  flex: 1;
}

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

.controlItem label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

select {
  background: var(--bg);
  border: 1px solid var(--stroke);
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

select option {
  background: var(--bg);
  color: #fff;
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124, 196, 255, 0.2);
}

/* Toggle Buttons */
.toggleContainer {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.toggleBtn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggleBtn:hover {
  color: #fff;
}

.toggleBtn.active {
  background: var(--accent);
  color: #0b0f14;
  font-weight: 600;
}

/* Volume Slider */
.sliderWrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sliderWrap input[type="range"] {
  width: 80px;
  background: rgba(255, 255, 255, 0.1);
  height: 5px;
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.sliderWrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.sliderWrap input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

#volumeValue {
  font-size: 0.8rem;
  color: var(--muted);
  width: 32px;
  text-align: right;
}

/* Buttons */
.primaryBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(124, 196, 255, 0.1);
  color: var(--accent);
  border: 1px solid rgba(124, 196, 255, 0.2);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primaryBtn:hover {
  background: var(--accent);
  color: #0b0f14;
  border-color: var(--accent);
  transform: translateY(-1px);
}

.compactPlayBtn {
  height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.parentScaleInfo {
  margin-top: 0;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.015);
  border-left: 3px solid var(--accent3);
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.parentScaleInfo strong {
  color: #fff;
}

/* ==========================================================================
   Visualizer Panel & Tabs
   ========================================================================== */
.visualizerPanel {
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.vizTabs {
  display: flex;
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 24px;
  gap: 16px;
}

.vizTab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 4px 12px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.vizTab:hover {
  color: #fff;
}

.vizTab.active {
  color: var(--accent);
  font-weight: 600;
}

.vizTab.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.tabContent {
  display: none;
  flex: 1;
}

.tabContent.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Note Wheel Styling */
.wheelContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

#noteWheel svg {
  max-width: 320px;
  height: auto;
}

.wheelLegend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.legendItem {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.legendColor {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.rootColor { background: var(--root-color); }
.scaleColor { background: var(--scale-color); }
.chordColor { background: var(--chord-color); }

/* SVG elements in Wheel */
.wheel-bg-circle {
  fill: rgba(0, 0, 0, 0.2);
  stroke: var(--stroke);
  stroke-width: 1px;
}

.wheel-chord-shape {
  fill: rgba(59, 130, 246, 0.15);
  stroke: var(--chord-color);
  stroke-width: 2px;
  stroke-linejoin: round;
  transition: all 0.3s ease;
}

.wheel-chord-line {
  stroke: var(--chord-color);
  stroke-width: 2px;
  stroke-dasharray: 2 2;
}

.wheel-node-link {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1px;
}

.wheel-node {
  cursor: pointer;
  transition: transform 0.2s ease, fill 0.2s ease;
  transform-origin: center;
  transform-box: fill-box;
}

.wheel-node:hover {
  transform: scale(1.15);
}

.wheel-label {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

/* Piano Keyboard SVG Styling */
.keyboardContainer {
  width: 100%;
  max-width: 600px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid var(--stroke);
}

#pianoKeyboard svg {
  width: 100%;
  height: auto;
}

.piano-key.white {
  fill: #f8fafc;
  stroke: #1e293b;
  stroke-width: 1.5px;
  cursor: pointer;
  transition: fill 0.2s ease;
}

.piano-key.black {
  fill: #0f172a;
  stroke: #1e293b;
  stroke-width: 1px;
  cursor: pointer;
  transition: fill 0.2s ease;
  z-index: 10;
}

.piano-key.white:hover {
  fill: #e2e8f0;
}

.piano-key.black:hover {
  fill: #1e293b;
}

/* Guitar Fretboard Styling */
.fretboardContainer {
  width: 100%;
  max-width: 700px;
  padding: 16px;
  background: rgba(26, 18, 12, 0.6); /* Warm wooden brown hint */
  border-radius: 8px;
  border: 1px solid rgba(139, 92, 26, 0.2);
}

#guitarFretboard svg {
  width: 100%;
  height: auto;
}

.fret-line {
  stroke: #94a3b8;
  stroke-width: 2px;
}

.string-line {
  stroke: #cbd5e1;
  transition: stroke-width 0.2s;
}

.fretboard-nut {
  stroke: #e2e8f0;
  stroke-width: 6px;
}

.fret-marker {
  fill: #475569;
  opacity: 0.6;
}

.fretboard-note-marker {
  cursor: pointer;
  transition: transform 0.2s ease;
  transform-origin: center;
  transform-box: fill-box;
}

.fretboard-note-marker:hover {
  transform: scale(1.2);
}

.fretboard-label {
  font-size: 10px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  fill: #0f172a;
}

/* ==========================================================================
   Harmonized Scale Rows (Table Layout)
   ========================================================================== */
.rowsPanel {
  margin-bottom: 24px;
}

.rowsPanel .panelHeader {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}

.rowsPanel h2 {
  margin-bottom: 4px;
}

.rowsPanel .instructions {
  font-size: 0.85rem;
  color: var(--muted);
}

.rowsContainer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scaleRow {
  display: grid;
  grid-template-columns: 40px 110px 1fr 48px;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 12px 18px;
  transition: all 0.2s ease;
}

@media (max-width: 768px) {
  .scaleRow {
    grid-template-columns: 50px 1fr auto;
    grid-template-areas: 
      "degree chord play"
      "notes notes notes";
    gap: 12px;
    padding: 14px;
  }
  
  .rowDegree { grid-area: degree; }
  .rowChord { grid-area: chord; }
  .rowNotesTrack { 
    grid-area: notes; 
    margin-top: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .rowAction { grid-area: play; justify-self: end; }
}

.scaleRow:hover, .scaleRow.active {
  background: var(--panel-hover);
  border-color: rgba(124, 196, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateX(4px);
}

.scaleRow.active {
  border-color: var(--accent);
  background: rgba(124, 196, 255, 0.04);
}

/* Degree badge */
.rowDegree {
  font-family: serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
}

/* Chord Title Info */
.rowChord {
  display: flex;
  flex-direction: column;
}

.rowChordName {
  font-weight: 600;
  color: #fff;
  font-size: 0.95rem;
}

.rowChordFormula {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

/* Notes Track */
.rowNotesTrack {
  display: flex;
  align-items: center;
  position: relative;
  padding: 10px 0;
  height: 48px;
  overflow: visible;
}

.notesLine {
  display: flex;
  justify-content: space-between;
  width: 400px;
  position: relative;
}

/* Individual notes in track */
.trackNote {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  border-radius: 50%;
  background: transparent;
  transition: all 0.2s ease;
  z-index: 2;
}

.trackNote.active-scale {
  color: #fff;
}

.trackNote.active-chord-note {
  background: var(--chord-color);
  color: #fff;
  box-shadow: 0 0 8px var(--chord-color);
}

.trackNote.active-chord-root {
  background: var(--root-color);
  color: #0b0f14;
  box-shadow: 0 0 8px var(--root-color);
}

/* SVG bracket/connectors overlay */
.svgOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 400px;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.svgOverlay path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5px;
  stroke-linecap: round;
  opacity: 0.65;
}

.svgOverlay path.chord-bracket {
  stroke: var(--chord-color);
}

.scaleRow:hover .svgOverlay path,
.scaleRow.active .svgOverlay path {
  opacity: 1;
  stroke-width: 2px;
}

/* Play Button inside row */
.playBtn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.playBtn:hover {
  background: var(--accent);
  color: #0b0f14;
  border-color: var(--accent);
  transform: scale(1.08);
}

.playBtn svg {
  fill: currentColor;
}

/* ==========================================================================
   Educational Section
   ========================================================================== */
.eduGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 18px;
}

.eduCard {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 20px;
}

.eduCard h3 {
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--accent3);
}

.eduCard p {
  line-height: 1.6;
  margin-bottom: 10px;
}

.eduCard p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  margin-top: 40px;
  border-top: 1px solid var(--stroke);
  padding: 24px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.footInner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footLinks {
  display: flex;
  gap: 20px;
}

.footLinks a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footLinks a:hover {
  color: #fff;
}

/* ==========================================================================
   Flat Visual Header Layout overrides
   ========================================================================== */
.visualHeader {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 8px 18px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(11, 15, 20, 0.95), rgba(11, 15, 20, 0.85));
  border-bottom: 1px solid var(--stroke);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  min-height: 64px;
  box-sizing: border-box;
}

.leftHead {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.leftHead .titleblock {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.leftHead h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.leftHead .mutedLine {
  margin: 2px 0 0 0 !important;
  font-size: 0.8rem !important;
  color: var(--muted) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.visualHeader .burgerWrap {
  position: relative;
  display: flex;
  align-items: center;
}

/* Compensate layout top margin */
.mainContent {
  margin-top: 24px;
}
