:root {
  --bg: #101014;
  --panel: #1a1a20;
  --ink: #f2f0e9;
  --muted: #8a8a94;
  --accent: #d8ff3d;
  --accent-ink: #101014;
  --bad: #ff5c5c;
  --line: #2a2a33;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}
.hidden { display: none !important; }

.top {
  width: 100%; max-width: 480px;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 18px 4px 10px;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 22px; letter-spacing: 0.14em; }
.gamenum { color: var(--accent); margin-left: 10px; font-size: 15px; letter-spacing: 0.05em; }
.streak-chip {
  font-size: 13px; color: var(--muted); border: 1px solid var(--line);
  padding: 3px 10px; border-radius: 999px;
}
.streak-chip::before { content: "streak "; color: var(--muted); }
.streak-chip.hot { color: var(--accent); border-color: var(--accent); }

main { width: 100%; max-width: 480px; flex: 1; padding-top: 22px; }
.tagline { color: var(--muted); text-align: center; font-size: 14px; margin-bottom: 26px; }

.clip-meter { display: flex; gap: 6px; justify-content: center; margin-bottom: 22px; }
.clip-meter .seg {
  width: 44px; height: 8px; border-radius: 4px; background: var(--line);
  position: relative; overflow: hidden;
}
.clip-meter .seg.on { background: var(--accent); }
.clip-meter .seg.current { outline: 1px solid var(--accent); outline-offset: 2px; }
.clip-meter .seg .lab {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 0; /* labels shown via ::after below meter */
}
.clip-labels { display: flex; gap: 6px; justify-content: center; color: var(--muted); font-size: 11px; }
.clip-labels span { width: 44px; text-align: center; }

.playbtn {
  display: block; margin: 0 auto;
  width: 84px; height: 84px; border-radius: 50%;
  border: none; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  transition: transform 0.08s ease;
}
.playbtn:active { transform: scale(0.94); }
.playbtn svg { width: 40px; height: 40px; fill: var(--accent-ink); }
.playbtn:disabled { opacity: 0.35; cursor: default; }

.progress { height: 4px; background: var(--line); border-radius: 2px; margin: 18px 8px 6px; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 2px; transition: width 0.1s linear; }
.clip-hint { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.clip-hint strong { color: var(--ink); }

.guessbox { position: relative; }
#guessInput {
  width: 100%; padding: 14px 16px; font-size: 16px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; outline: none;
}
#guessInput:focus { border-color: var(--accent); }
.results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; max-height: 320px; overflow-y: auto;
}
.result-item {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--line);
}
.result-item:last-child { border-bottom: none; }
.result-item:hover, .result-item.active { background: #23232c; }
.result-item img { width: 40px; height: 40px; border-radius: 6px; }
.result-item .t { font-size: 14px; font-weight: 500; }
.result-item .a { font-size: 12px; color: var(--muted); }

.guess-actions { display: flex; justify-content: center; margin-top: 14px; }
.btn {
  font-family: inherit; font-size: 15px; font-weight: 500;
  padding: 12px 22px; border-radius: 10px; cursor: pointer; border: 1px solid transparent;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn.ghost:hover { color: var(--ink); }

.guesses { list-style: none; margin-top: 26px; }
.guesses li {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 8px; font-size: 14px; background: var(--panel);
}
.guesses li .mark { font-weight: 700; }
.guesses li.wrong .mark { color: var(--bad); }
.guesses li.right { border-color: var(--accent); }
.guesses li.right .mark { color: var(--accent); }
.guesses li.skipped { color: var(--muted); }
.guesses li .sec { margin-left: auto; color: var(--muted); font-size: 12px; }

.verdict { text-align: center; font-size: 26px; font-weight: 700; margin: 12px 0 20px; }
.verdict small { display: block; font-size: 14px; font-weight: 400; color: var(--muted); margin-top: 6px; }
.answer-card {
  display: flex; gap: 16px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px;
}
.answer-card img { width: 84px; height: 84px; border-radius: 10px; }
.answer-title { font-size: 18px; font-weight: 700; }
.answer-artist { color: var(--muted); margin-top: 4px; }

.percentile { text-align: center; margin-top: 18px; color: var(--accent); font-size: 15px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 22px; }
.stat { text-align: center; border: 1px solid var(--line); border-radius: 10px; padding: 12px 4px; }
.stat .v { font-size: 22px; font-weight: 700; }
.stat .k { font-size: 11px; color: var(--muted); margin-top: 4px; }

.share-row { display: flex; gap: 10px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.next { text-align: center; color: var(--muted); font-size: 13px; margin-top: 20px; }

.foot { color: #55555f; font-size: 11px; padding: 18px 0 10px; }
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 500; z-index: 50;
}
