:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --accent: #e94560;
  --accent2: #0f3460;
  --text: #eaeaea;
  --text-muted: #888;
  --in-tune: #4ecca3;
  --sharp: #e94560;
  --flat: #f5a623;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
}

header {
  position: fixed;
  top: 0;
  width: 100%;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
}

header span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Meter ── */
.meter-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.note-display {
  font-size: 7rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  min-width: 120px;
  text-align: center;
  transition: color 0.2s;
}

.note-display.in-tune  { color: var(--in-tune); }
.note-display.sharp    { color: var(--sharp); }
.note-display.flat     { color: var(--flat); }

.octave {
  font-size: 2rem;
  font-weight: 400;
  vertical-align: super;
  color: var(--text-muted);
}

.cents-bar-wrap {
  width: 280px;
  position: relative;
}

.cents-bar-track {
  height: 8px;
  background: var(--surface);
  border-radius: 4px;
  position: relative;
  overflow: visible;
}

.cents-center-tick {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -4px;
  width: 2px;
  height: 16px;
  background: var(--text-muted);
  border-radius: 1px;
}

.cents-needle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  transition: left 0.1s, background 0.2s;
}

.cents-needle.in-tune { background: var(--in-tune); }
.cents-needle.sharp   { background: var(--sharp); }
.cents-needle.flat    { background: var(--flat); }

.cents-label {
  text-align: center;
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
  min-height: 1.2em;
}

.freq-display {
  font-size: 1rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* ── Reference strings ── */
.strings {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.string-btn {
  background: var(--surface);
  border: 1.5px solid var(--accent2);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.string-btn:hover  { border-color: var(--accent); }
.string-btn.active { border-color: var(--in-tune); background: var(--accent2); }

/* ── Start button ── */
.start-btn {
  margin-top: 8px;
  padding: 14px 40px;
  border: none;
  border-radius: 50px;
  background: var(--accent);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 1px;
  transition: opacity 0.2s;
}

.start-btn:hover   { opacity: 0.85; }
.start-btn.active  { background: #555; }

footer {
  position: fixed;
  bottom: 12px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ── Simulation panel (only shown with ?sim) ── */
.sim-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px dashed var(--flat);
  border-radius: 10px;
}

.sim-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--flat);
  border: 1px solid var(--flat);
  border-radius: 4px;
  padding: 2px 5px;
}

.sim-select {
  background: var(--accent2);
  color: var(--text);
  border: none;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.9rem;
}

.sim-slider { width: 160px; accent-color: var(--accent); }

.sim-readout {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 150px;
  text-align: center;
}
