:root {
  --bg: #12141a;
  --card: #1c1f28;
  --text: #e8eaf0;
  --muted: #8a90a3;
  --accent: #4f8cff;
  --good: #3ecf8e;
  --ok: #e8c65a;
  --bad: #ef6a6a;
  --key-white: #f2f3f5;
  --key-black: #23262f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
}

header { text-align: center; margin-bottom: 0.5rem; }
h1 { margin: 0; font-size: 1.6rem; }
.subtitle { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9rem; }

main { width: 100%; max-width: 960px; display: flex; flex-direction: column; gap: 0.8rem; }

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 1rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
  align-items: flex-end;
}

.control { display: flex; flex-direction: column; gap: 0.3rem; }
.control label { font-size: 0.75rem; color: var(--muted); }
.control.checkbox label { font-size: 0.85rem; color: var(--text); display: flex; align-items: center; gap: 0.4rem; }

select, input[type="range"] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid #333846;
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
}
input[type="range"] { padding: 0; height: 2rem; }

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
button.primary.running { background: var(--bad); }

.stage { text-align: center; }

.beats { display: flex; justify-content: center; gap: 0.5rem; margin-bottom: 0.5rem; min-height: 14px; }
.beat-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: #333846;
  transition: background 0.05s;
}
.beat-dot.on { background: var(--accent); }
.beat-dot.accent.on { background: var(--good); }

.chord-display .current {
  font-size: 4.5rem;
  font-weight: 700;
  line-height: 1.1;
  min-height: 5rem;
}
.chord-display .current.retry { color: var(--ok); }
.chord-display .next { color: var(--muted); font-size: 1.2rem; margin-top: 0.2rem; }
.chord-display .next span { color: var(--text); font-weight: 600; }

.feedback {
  min-height: 1.6rem;
  font-size: 1rem;
  font-weight: 600;
  margin: 0.4rem 0;
  transition: opacity 0.3s;
}
.feedback.good { color: var(--good); }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--bad); }

.keyboard-wrap { margin-top: 0.5rem; overflow-x: auto; }
#keyboard { width: 100%; min-width: 500px; height: auto; }

#keyboard rect.white { fill: var(--key-white); stroke: #999; stroke-width: 0.5; }
#keyboard rect.black { fill: var(--key-black); stroke: #000; stroke-width: 0.5; }
#keyboard rect.target { fill: var(--accent); }
#keyboard rect.held-good { fill: var(--good); }
#keyboard rect.held-bad { fill: var(--bad); }

.hint-notes { color: var(--muted); font-size: 0.95rem; min-height: 1.3rem; margin-top: 0.3rem; }
.hint-notes b { color: var(--text); }

.stats { display: flex; justify-content: space-around; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.stat-num { font-size: 1.6rem; font-weight: 700; }
.stat-label { font-size: 0.75rem; color: var(--muted); }

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

@media (max-width: 600px) {
  .chord-display .current { font-size: 3rem; min-height: 3.4rem; }
  .controls { gap: 0.6rem; }
}
