:root {
  --bg: #0b1020;
  --panel: #141b31;
  --panel-2: #1b2442;
  --ink: #e8ecf8;
  --dim: #8b93ad;
  --accent: #5ee1a0;
  --c1: #4ade80;
  --c2: #60a5fa;
  --c3: #fbbf24;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

button {
  font: inherit;
  border: 0;
  border-radius: 12px;
  padding: 12px 28px;
  font-weight: 800;
  cursor: pointer;
  background: var(--accent);
  color: #06281a;
}
button:disabled { opacity: 0.4; cursor: default; }
button.ghost {
  background: transparent;
  color: var(--dim);
  border: 1px solid #2a3560;
}
kbd {
  font: inherit;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 5px;
  padding: 1px 6px;
  margin-left: 6px;
}
.status { color: var(--dim); font-size: 13px; min-height: 18px; }

/* ── Sound picker ─────────────────────────────────────────────────── */
#select {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  overflow-y: auto;
}
#select h1 { margin: 0; font-size: 40px; font-weight: 800; letter-spacing: -0.5px; }
#select h1 .accent { color: var(--accent); }
#select .sub { margin: 0; color: var(--dim); max-width: 480px; text-align: center; }

#chart {
  position: relative;
  width: min(560px, 92vw);
  aspect-ratio: 4 / 3;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid #263159;
  border-radius: 16px;
  flex-shrink: 0;
}
#chart .axis {
  position: absolute;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #4a5578;
  pointer-events: none;
}
#chart .axis.top { top: 8px; left: 50%; transform: translateX(-50%); }
#chart .axis.bottom { bottom: 8px; left: 50%; transform: translateX(-50%); }
#chart .axis.left { left: 10px; top: 50%; transform: translateY(-50%) rotate(-90deg); }
#chart .axis.right { right: 10px; top: 50%; transform: translateY(-50%) rotate(90deg); }

.chip {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1.5px solid #2a3560;
  background: rgba(11, 16, 32, 0.75);
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  transition: border-color 120ms, box-shadow 120ms;
}
.chip .ipa { font-size: 20px; font-weight: 800; line-height: 1.1; }
.chip .word { font-size: 9px; letter-spacing: 1px; color: var(--dim); }
.chip:hover { border-color: #46538a; }
.chip.sel { border-color: var(--chip-c); box-shadow: 0 0 14px color-mix(in srgb, var(--chip-c) 45%, transparent); }
.chip .badge {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--chip-c);
  color: #08101f;
  font-size: 11px;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
}
.chip.sel .badge { display: flex; }

#picker-row { display: flex; align-items: center; gap: 22px; }
#preview { width: 180px; height: 180px; }
#picker-side { display: flex; flex-direction: column; gap: 10px; min-width: 240px; }

#legend { display: flex; flex-direction: column; gap: 6px; }
.leg {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.leg .dot { width: 10px; height: 10px; border-radius: 50%; }
.leg .key { color: var(--dim); font-size: 12px; }
.leg .arrow { font-size: 16px; }
.leg .hear {
  background: none;
  border: none;
  padding: 0 2px;
  cursor: pointer;
  font-size: 14px;
  color: var(--dim);
}
.leg .hear:hover { color: var(--ink); }

#warn {
  color: #fca5a5;
  font-size: 13px;
  max-width: 260px;
}
.leg.active {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}
.chip.heard { border-color: #fff; box-shadow: 0 0 16px rgba(255, 255, 255, 0.5); }

#fakebadge {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: #7f1d1d;
  color: #fecaca;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  pointer-events: none;
}

/* ── Game ─────────────────────────────────────────────────────────── */
#game { position: fixed; inset: 0; }
#arena { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#hud {
  position: absolute;
  top: 14px;
  left: 18px;
  display: flex;
  align-items: baseline;
  gap: 14px;
  pointer-events: none;
}
#score { font-size: 34px; font-weight: 800; }
#best-hud { color: var(--dim); font-size: 14px; }
.saychip {
  font-size: 15px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1.5px solid #2a3560;
  color: var(--dim);
  transition: color 80ms, border-color 80ms;
}

#compass {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 200px;
  height: 200px;
}
#enginestatus { position: absolute; left: 18px; bottom: 12px; }

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 18, 0.45);
}
#overlay-card {
  background: var(--panel);
  border: 1px solid #263159;
  border-radius: 18px;
  padding: 28px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#overlay-title { font-size: 34px; font-weight: 800; }
#overlay-sub { color: var(--dim); }
#overlay-buttons { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }
