:root {
  --bg: #1a1410;
  --wood: #3d2b1f;
  --wood-light: #5a3d2b;
  --fret: #8c7355;
  --string-color: #d4a84b;
  --text: #f0e6d8;
  --text-dim: #a89880;
  --accent: #e8a838;
  --surface: rgba(255,255,255,0.06);
  --shadow: rgba(0,0,0,0.4);
  --glow: rgba(232,168,56,0.3);
}

html[data-theme="light"] {
  --bg: #f5f0e8;
  --wood: #c9a96e;
  --wood-light: #dbbf8a;
  --fret: #a08050;
  --string-color: #8b6914;
  --text: #2a1f14;
  --text-dim: #7a6a55;
  --accent: #b8860b;
  --surface: rgba(0,0,0,0.05);
  --shadow: rgba(0,0,0,0.15);
  --glow: rgba(216,160,40,0.25);
}

@media (prefers-color-scheme: light) {
  html:not([data-theme]) {
    --bg: #f5f0e8;
    --wood: #c9a96e;
    --wood-light: #dbbf8a;
    --fret: #a08050;
    --string-color: #8b6914;
    --text: #2a1f14;
    --text-dim: #7a6a55;
    --accent: #b8860b;
    --surface: rgba(0,0,0,0.05);
    --shadow: rgba(0,0,0,0.15);
    --glow: rgba(216,160,40,0.25);
  }
}

html { color-scheme: dark light; }

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

#app {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-size: 14px;
  background: var(--surface);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.stats {
  display: flex;
  gap: 16px;
  color: var(--text-dim);
  font-size: 12px;
}

.stats b {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.fretboard {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  margin: 0 -4px;
  padding: 20px 0;
  background:
    repeating-linear-gradient(90deg,
      transparent, transparent 28px,
      rgba(0,0,0,0.15) 28px, rgba(0,0,0,0.15) 30px
    ),
    linear-gradient(135deg, var(--wood) 0%, var(--wood-light) 50%, var(--wood) 100%);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px var(--shadow), inset 0 1px 0 rgba(255,255,255,0.08);
  touch-action: none;
  cursor: grab;
}

.fretboard:active {
  cursor: grabbing;
}

.nut {
  position: absolute;
  left: 16px;
  top: 0;
  bottom: 0;
  width: 6px;
  background: linear-gradient(to bottom, #e8dcc8, #c8b898, #e8dcc8);
  border-radius: 2px;
  z-index: 2;
  box-shadow: 1px 0 3px rgba(0,0,0,0.3);
}

.frets {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  pointer-events: none;
}

.frets > div {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 2px solid var(--fret);
  border-left-width: 1.5px;
}

.frets > div:first-child {
  border-left: none;
}

.fret-marker {
  position: absolute;
  width: 10px;
  height: 10px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  z-index: 3;
  pointer-events: none;
}

.fret-marker.double-1::before,
.fret-marker.double-2::before,
.fret-marker.double-3::before {
  content: "";
  position: absolute;
  top: -14px;
  width: 10px;
  height: 10px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
}

.fret-marker[data-fret="12"],
.fret-marker[data-fret="15"],
.fret-marker[data-fret="24"] {
  background: rgba(255,255,255,0.18);
}

.strings {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  padding: 16px 0;
  z-index: 1;
}

.string {
  position: relative;
  width: 100%;
  height: auto;
  cursor: pointer;
  touch-action: none;
}

.string::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: var(--thick);
  background: linear-gradient(to bottom,
    rgba(255,255,255,0.8),
    var(--string-color),
    rgba(255,255,255,0.6)
  );
  transform: translateY(-50%);
  border-radius: 1px;
  box-shadow: 0 0 2px rgba(0,0,0,0.4);
  transition: filter 0.05s;
}

.string.plucked::after {
  animation: pluck 0.15s ease-out;
}

@keyframes pluck {
  0%   { transform: translateY(-50%) scaleY(1); }
  25%  { transform: translateY(-50%) scaleY(4); }
  50%  { transform: translateY(-50%) scaleY(1.8); }
  80%  { transform: translateY(-50%) scaleY(1.1); }
  100% { transform: translateY(-50%) scaleY(1); }
}

.ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  animation: ripple-out 0.4s ease-out forwards;
  pointer-events: none;
  z-index: 5;
}

@keyframes ripple-out {
  0%   { width: 10px; height: 10px; opacity: 1; }
  100% { width: 80px; height: 80px; opacity: 0; margin-left: -40px; margin-top: -40px; }
}

.note-labels {
  position: absolute;
  right: 8px;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  padding: 16px 0;
  z-index: 4;
}

.note-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-align: right;
  letter-spacing: 0.5px;
  opacity: 0.6;
}

.chords {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  flex-wrap: wrap;
}

.chords button {
  padding: 10px 18px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  backdrop-filter: blur(6px);
  user-select: none;
  -webkit-user-select: none;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chords button:hover {
  background: rgba(232,168,56,0.15);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--shadow);
}

.chords button:active {
  transform: translateY(0) scale(0.96);
  background: rgba(232,168,56,0.25);
}

@media (max-width: 360px) {
  .hud { padding: 10px 12px; font-size: 12px; }
  .title { font-size: 14px; }
  .stats { gap: 10px; font-size: 11px; }
  .chords { gap: 6px; padding: 12px; }
  .chords button { padding: 8px 14px; font-size: 13px; }
}

