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

:root {
  --bg:     #0a0a0a;
  --card:   #141414;
  --border: #252525;
  --text:   #e0e0e0;
  --muted:  #777;
  --green:  #22c55e;
  --yellow: #eab308;
  --red:    #ef4444;
}

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

.app {
  width: 100%;
  max-width: 480px;
  padding: 1.5rem;
}

header {
  text-align: center;
  margin-bottom: 1.5rem;
}

header h1 {
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
}

/* ── Frequency number ─────────────────────── */
.freq-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

#freq-value {
  font-size: 4.5rem;
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1;
}

.freq-unit {
  font-size: 1.2rem;
  color: var(--muted);
  font-weight: 300;
}

/* ── Note name ────────────────────────────── */
#note-display {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--muted);
  min-height: 3.25rem;
  transition: color 0.15s;
}

/* ── Target Hz ─────────────────────────────── */
#target-display {
  font-size: 0.85rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--muted);
  min-height: 1.25rem;
  margin-top: 0.1rem;
  margin-bottom: 1.6rem;
  transition: color 0.15s;
}

/* ── Tuner bar ────────────────────────────── */
.tuner { margin-bottom: 1.5rem; }

.tuner-track {
  position: relative;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 0.5rem 0.6rem;
}

/* centre marker */
.tuner-center {
  position: absolute;
  left: 50%;
  top: -5px;
  transform: translateX(-50%);
  width: 2px;
  height: 14px;
  background: #333;
  border-radius: 1px;
}

/* quarter marks at ±25 ¢ */
.tuner-tick {
  position: absolute;
  top: -3px;
  width: 1px;
  height: 10px;
  background: #2a2a2a;
  transform: translateX(-50%);
}

#needle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: left 0.08s linear, background-color 0.15s;
}

.tuner-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--muted);
  padding: 0 0.25rem;
}

/* ── Waveform ─────────────────────────────── */
#waveform {
  display: block;
  width: 100%;
  height: 72px;
  border-radius: 0.5rem;
  background: #0d0d0d;
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

/* ── Button ───────────────────────────────── */
#start-btn {
  width: 100%;
  padding: 0.8rem;
  background: transparent;
  border: 1px solid #333;
  color: #888;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

#start-btn:not(:disabled):hover {
  border-color: var(--green);
  color: var(--green);
}

#start-btn.listening {
  border-color: var(--red);
  color: var(--red);
}

#start-btn.listening:hover {
  background: #1a0000;
}

#start-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Status line ──────────────────────────── */
#status {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.75rem;
  min-height: 1rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ── Hamburger button ─────────────────────── */
#menu-btn {
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 200;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--muted);
  border-radius: 1px;
  transition: transform 0.25s, opacity 0.2s, background 0.15s;
}

#menu-btn:hover span { background: var(--text); }

#menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); background: var(--text); }
#menu-btn.open span:nth-child(2) { opacity: 0; }
#menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); background: var(--text); }

/* ── Nav overlay ──────────────────────────── */
#nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.97);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#nav-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#nav-overlay ul {
  list-style: none;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

#nav-overlay a {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

#nav-overlay .nav-name {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  transition: color 0.15s;
}

#nav-overlay .nav-name.current { color: var(--green); }

#nav-overlay .nav-sub {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

#nav-overlay a:hover .nav-name { color: var(--green); }

.nav-version {
  position: absolute;
  bottom: 1.5rem;
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  font-family: 'SF Mono', 'Fira Code', monospace;
}
