:root {
  color-scheme: dark;
  --bg: #1b140f;
  --wood: #3a2417;
  --wood-light: #4e3220;
  --fret: #d8c9a3;
  --string: #e8e2d0;
  --accent: #e8a33d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #2a1e17, var(--bg));
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #f0e9db;
}

#app {
  max-width: 940px;
  width: 100%;
  padding: 24px;
  text-align: center;
}

h1 {
  margin: 0 0 4px;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.hint {
  margin: 0 0 16px;
  color: #cbbfa9;
  font-size: 0.95rem;
}

#guitar {
  background: linear-gradient(180deg, var(--wood-light), var(--wood));
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  user-select: none;
}

#fretboard {
  width: 100%;
  height: auto;
  display: block;
  cursor: crosshair;
  border-radius: 8px;
  touch-action: none;
}

#controls {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

#instrument-select {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

#instrument-select button {
  background: transparent;
  color: #cbbfa9;
  border: 1px solid var(--wood-light);
}

#instrument-select button.active {
  background: var(--accent);
  color: #211508;
  border-color: var(--accent);
}

button {
  background: var(--accent);
  color: #211508;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.08);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

#record-tab.recording {
  background: #e05a5a;
  color: #2b0d0d;
  animation: record-pulse 1s ease-in-out infinite;
}

@keyframes record-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

#rhythm-result {
  margin: 10px 0 0;
  color: var(--accent);
  font-weight: 600;
  min-height: 1.2em;
}

#rhythm-song {
  background: #120d09;
  color: #efe7d2;
  border: 1px solid var(--wood-light);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.85rem;
}

#jam-session {
  margin-top: 28px;
  text-align: left;
}

#jam-session h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  color: var(--accent);
}

#jam-controls {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

#jam-status {
  color: #cbbfa9;
  font-size: 0.9rem;
}

#jam-peers {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.jam-peer {
  background: var(--wood-light);
  color: #efe7d2;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cbbfa9;
  font-size: 0.9rem;
}

#sheet-music {
  margin-top: 28px;
  text-align: left;
}

#sheet-music h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  color: var(--accent);
}

#tab-input {
  width: 100%;
  min-height: 140px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--wood-light);
  background: #120d09;
  color: #efe7d2;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  resize: vertical;
}

#tab-controls {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

#tuning {
  margin-top: 28px;
  text-align: left;
}

#tuning h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  color: var(--accent);
}

#tuning-presets {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#tuning-presets button {
  padding: 8px 14px;
  font-size: 0.85rem;
}

#tuning-pegs {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.peg-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.peg-label {
  width: 1.4em;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

.peg-slider {
  flex: 1;
}

.peg-note {
  width: 9em;
  text-align: right;
  color: #cbbfa9;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
