:root {
  --bg: #14161c;
  --panel: #1c1f28;
  --border: #2c303c;
  --grid-line: #565c70;
  --text: #ececf0;
  --text-dim: #9498a6;
  --accent: #e0a640;
  --accent-dim: #4a4030;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.version-badge {
  position: fixed;
  top: 12px;
  right: 16px;
  font-size: 0.75rem;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  z-index: 10;
}

header {
  text-align: center;
  padding: 2.5rem 1rem 1rem;
}

header .brand {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

header .brand a {
  color: var(--accent);
  text-decoration: none;
}

header h1 {
  margin: 0.4rem 0 0;
  font-size: 2.2rem;
  letter-spacing: 0.02em;
}

.tagline {
  color: var(--text-dim);
  margin: 0.4rem 0 0;
}

.page-nav {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
}

.page-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  padding-bottom: 0.2rem;
  border-bottom: 2px solid transparent;
}

.page-nav a:hover {
  color: var(--text);
}

.page-nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

main.wide {
  max-width: 1400px;
}

.builder {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.builder-group + .builder-group {
  margin-top: 1.25rem;
}

.builder-group h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0 0 0.6rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.pill:hover {
  border-color: var(--accent);
}

.pill.selected {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.result h2 {
  font-size: 1.6rem;
  margin: 0 0 1rem;
}

.diagram-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.25rem;
}

.progression-grid {
  margin-bottom: 1.5rem;
}

.progression-card-label {
  margin-bottom: 0.4rem;
  text-align: center;
}

.progression-card-label .degree-roman {
  font-size: 0.95rem;
  color: var(--text);
}

.progression-card-label .degree-chord {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-left: 0.35rem;
}

/* Songs page */

.song-header {
  margin-bottom: 1.5rem;
}

.song-header h2 {
  margin: 0 0 0.3rem;
}

.song-meta {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin: 0;
}

.song-structure {
  margin-top: 2rem;
}

.song-section {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.song-section:first-child {
  border-top: none;
}

.song-section h3 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  color: var(--text-dim);
}

.chord-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chord-pill {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.chord-pill:hover {
  border-color: var(--accent);
}

.chord-arrow {
  color: var(--text-dim);
}

.repeat-tag {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-left: 0.25rem;
}

.section-note {
  margin: 0.6rem 0 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.lyrics-note {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
}

.quality-select {
  display: block;
  width: 100%;
  margin-bottom: 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.quality-select:hover {
  border-color: var(--text-dim);
}

.quality-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.diagram-card {
  display: block;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.diagram-card:hover {
  border-color: var(--text-dim);
}

.diagram-card:active {
  transform: scale(0.98);
}

.diagram-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@keyframes chord-card-pulse {
  0% { border-color: var(--accent); }
  100% { border-color: var(--border); }
}

.diagram-card.playing {
  animation: chord-card-pulse 1.7s ease-out;
}

.diagram-title {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.play-icon {
  font-size: 0.7em;
  opacity: 0.6;
}

/* Diatonic key page */

.degree-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.degree-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  text-decoration: none;
  min-width: 64px;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, opacity 0.15s;
}

.degree-chip:hover {
  border-color: var(--accent);
}

.degree-chip.disabled {
  opacity: 0.4;
}

.degree-roman {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
}

.degree-chord {
  font-size: 1.05rem;
  color: var(--text);
  font-weight: 600;
}

.chord-sections {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.chord-section h3 {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 1.3rem;
  margin: 0 0 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.chord-section h3 .degree-roman {
  font-size: 0.9rem;
}

.chord-section:first-child h3 {
  border-top: none;
  padding-top: 0;
}

/* Key zones page */

.zone-row {
  margin-bottom: 1.5rem;
}

.legend-static {
  margin-bottom: 1.5rem;
}

.playback-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.playback-row-label {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.play-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.play-scale-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  color: #14161c;
  border: none;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  margin: 0 0 1.5rem;
  transition: opacity 0.15s, transform 0.1s;
}

.play-scale-btn:hover {
  opacity: 0.88;
}

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

.play-scale-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.note-dot.playing,
.note-dot-open.playing {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(1.35);
  filter: drop-shadow(0 0 5px rgba(224, 166, 64, 0.85));
}

.legend-static .legend-item {
  cursor: default;
  pointer-events: none;
}

.zone-band {
  fill: #ffffff;
  fill-opacity: 0.035;
  stroke: var(--border);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.fret-diagram {
  width: 100%;
  height: auto;
}

.grid-line {
  stroke: var(--grid-line);
  stroke-width: 1.5;
}

.nut {
  stroke: var(--text);
  stroke-width: 4;
}

.barre {
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  opacity: 0.35;
}

.note-dot {
  fill: var(--accent);
}

.open-marker {
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 1.5;
}

.string-marker {
  fill: var(--text-dim);
  font-size: 11px;
}

.degree-label {
  fill: #14161c;
  font-size: 9px;
  font-weight: 600;
}

.degree-label.long {
  font-size: 6.5px;
}

.fret-label {
  fill: var(--text-dim);
  font-size: 10px;
}

.empty {
  color: var(--text-dim);
}

/* Full fretboard page */

.legend {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.7rem 0.3rem 0.5rem;
  cursor: pointer;
  transition: opacity 0.15s, border-color 0.15s;
}

.legend-item:hover {
  border-color: var(--text-dim);
}

.legend-item.disabled {
  color: var(--text-dim);
  opacity: 0.45;
}

.legend-item.disabled .swatch {
  opacity: 0.5;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.fretboard-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 1rem;
  overflow-x: auto;
}

.full-fretboard {
  width: 100%;
  min-width: 800px;
  height: auto;
  display: block;
}

.fretboard-plate {
  fill: #20232d;
  stroke: none;
}

.inlay {
  fill: #2c303c;
}

.shape-box {
  fill: #ffffff;
  fill-opacity: 0.035;
  stroke-opacity: 0.55;
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.shape-box-label {
  font-size: 13px;
  font-weight: 600;
}

.fret-line {
  stroke: var(--grid-line);
  stroke-width: 1.5;
}

.nut {
  stroke: var(--text);
  stroke-width: 5;
}

.fret-number {
  fill: var(--text-dim);
  font-size: 11px;
}

.string-line {
  stroke: #aeb4c2;
  stroke-opacity: 0.65;
}

.string-name {
  fill: var(--text-dim);
  font-size: 12px;
  text-anchor: end;
}

.note-dot {
  stroke-width: 2.5;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.note-dot-open {
  stroke-width: 2.5;
}

.full-fretboard .degree-label {
  fill: #14161c;
  font-size: 10px;
  font-weight: 700;
}

.full-fretboard .degree-label-open {
  fill: #ececf0;
  font-size: 10px;
  font-weight: 700;
}

.full-fretboard .degree-label.long,
.full-fretboard .degree-label-open.long {
  font-size: 7.5px;
}

/* Arpeggios page: slightly larger circle text, same circle size */
.full-fretboard.arpeggios-fretboard .degree-label,
.full-fretboard.arpeggios-fretboard .degree-label-open {
  font-size: 12px;
}

.full-fretboard.arpeggios-fretboard .degree-label.long,
.full-fretboard.arpeggios-fretboard .degree-label-open.long {
  font-size: 9px;
}

footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 1rem;
}
