:root {
  --bg: #11151c;
  --panel: #1b212b;
  --ink: #e8edf2;
  --muted: #9aa7b4;
  --accent: #ffb454;
  --good: #4caf50;
  --bad: #e5534b;
  --line: #2c3543;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}
header { text-align: center; padding: 1.5rem 1rem 0.5rem; }
h1 { margin: 0; letter-spacing: 0.04em; font-size: 2rem; }
.tagline { color: var(--muted); margin: 0.35rem 0 0; font-size: 0.95rem; }
main { width: min(560px, 94vw); padding: 1rem; }

.stage { display: flex; flex-direction: column; align-items: center; margin: 0 0 1rem; }

#play-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #1a1206;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 1rem;
}
#play-btn svg.hidden { display: none; }

.snippet-track {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: visible;
}
.snippet-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 6px;
  background: var(--accent);
  transition: width 0.4s ease;
}
.snippet-ticks { position: absolute; inset: 0; }
.tick {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 16px;
  background: var(--line);
}
.snippet-label {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.pips { display: flex; gap: 6px; justify-content: center; margin-top: 0.8rem; }
.pip {
  width: 26px; height: 8px; border-radius: 4px;
  background: var(--line);
}
.pip.used { background: var(--bad); }
.pip.win { background: var(--good); }

#guess-form { display: flex; gap: 8px; }
#guess-input {
  flex: 1;
  padding: 0.7rem 0.8rem;
  font-size: 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}
#guess-input:focus { outline: 2px solid var(--accent); }
#guess-btn, #skip-btn {
  padding: 0 1.1rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
#guess-btn { background: var(--accent); color: #1a1206; }
#skip-btn { background: var(--panel); border: 1px solid var(--line); color: var(--ink); }
#guess-btn:disabled, #skip-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.history { list-style: none; padding: 0; margin: 0.9rem 0 0; }
.history li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.55rem 0.75rem;
  margin-bottom: 6px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.history li .mark { font-weight: 700; }
.history li.miss .mark { color: var(--bad); }
.history li.hit .mark { color: var(--good); }

.result { margin-top: 1.2rem; text-align: center; }
.result h2 { margin: 0 0 0.3rem; }
#result-answer { color: var(--muted); margin: 0 0 0.8rem; }
#full-play-btn, #share-btn {
  padding: 0.6rem 1.2rem; font-weight: 600; border: none; border-radius: 10px;
  cursor: pointer; margin: 0 4px;
}
#full-play-btn { background: var(--panel); border: 1px solid var(--line); color: var(--ink); }
#share-btn { background: var(--good); color: #06210a; }
.stats { margin-top: 1rem; display: grid; gap: 4px; text-align: left; }
.bar-row { display: grid; grid-template-columns: 1.5rem 1fr; gap: 8px; align-items: center; font-size: 0.85rem; }
.bar { background: var(--accent); color: #1a1206; padding: 1px 6px; border-radius: 4px; min-width: 1.4rem; text-align: right; }
.bar.zero { background: var(--line); color: var(--muted); }

.board { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: 0.8rem; }
.board summary { cursor: pointer; font-weight: 600; }
.name-row { display: flex; gap: 8px; align-items: center; margin: 0.7rem 0; font-size: 0.9rem; color: var(--muted); }
.name-row input { flex: 1; padding: 0.4rem 0.6rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
#leaderboard { margin: 0; padding-left: 1.4rem; color: var(--ink); }
#leaderboard li { margin-bottom: 4px; }
#leaderboard .streak { color: var(--accent); font-weight: 600; }

footer { color: var(--muted); font-size: 0.8rem; padding: 1.5rem; text-align: center; }
.hidden { display: none; }
