:root {
  --bg: #0f0e17;
  --surface: #1a1927;
  --surface-2: #252336;
  --text: #f4f3fa;
  --muted: #9a97b0;
  --accent: #ff5e7e;
  --accent-2: #7c5cff;
  --good: #3ddc97;
  --bad: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -200px, #2a1d4a 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, sans-serif;
}

main { max-width: 520px; margin: 0 auto; padding: 24px 16px 48px; }

.brand { font-weight: 700; font-size: 22px; display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.brand .leave { margin-left: auto; padding: 8px 12px; font-size: 14px; }
.logo {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.screen { display: flex; flex-direction: column; gap: 16px; }
.screen[hidden] { display: none; }

.lead { color: var(--muted); line-height: 1.5; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1 { margin: 0; text-align: center; }
h2 { margin: 0 0 12px; font-size: 17px; }

.card { background: var(--surface); border-radius: var(--radius); padding: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.artist-field { position: relative; margin-bottom: 12px; }

input {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface-2); border: 2px solid transparent; border-radius: 10px; outline: none;
}
input:focus { border-color: var(--accent-2); }
input:disabled { opacity: 0.5; }

button {
  font: inherit; font-weight: 500; font-size: 16px; padding: 12px 18px; border-radius: 10px;
  border: 0; cursor: pointer; background: var(--surface-2); color: var(--text);
  transition: transform 0.08s, opacity 0.2s;
}
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); width: 100%; }
button.ghost { background: transparent; border: 1px solid var(--surface-2); color: var(--muted); }
button.is-ready { background: var(--good); color: #0b1f16; }

.row { display: flex; gap: 8px; }
.code-input { text-transform: uppercase; letter-spacing: 6px; font-weight: 700; text-align: center; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--surface-2); }

.results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10; margin: 4px 0 0; padding: 6px;
  list-style: none; background: var(--surface-2); border-radius: 10px; box-shadow: 0 12px 30px #0008;
  max-height: 320px; overflow-y: auto;
}
.results li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--text); }
.results li:hover, .results li.active { background: #ffffff12; }
.results img, .picked img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.picked { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-weight: 500; }

.artist-banner { display: flex; align-items: center; gap: 14px; }
.artist-banner img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.artist-name { font-size: 24px; font-weight: 700; }

.share { text-align: center; }
.big-code { font-size: 44px; font-weight: 700; letter-spacing: 10px; margin: 4px 0 12px; }

.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.players li { display: flex; justify-content: space-between; background: var(--surface); padding: 12px 16px; border-radius: 10px; }
.players .waiting { color: var(--muted); font-style: italic; }
.tag-ready { color: var(--good); }

.scoreboard { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.score-card { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.score-card.me { outline: 2px solid var(--accent-2); }
.score-card .pname { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pips { display: flex; gap: 6px; margin-top: 8px; }
.pip { width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); transition: background 0.3s; }
.pip.on { background: var(--accent); box-shadow: 0 0 12px var(--accent); }

.round-label { text-align: center; color: var(--muted); font-size: 14px; }

.stage {
  height: 200px; background: var(--surface); border-radius: var(--radius);
  display: grid; place-items: center; padding: 16px; overflow: hidden;
}
.countdown { font-size: 80px; font-weight: 700; }
.countdown:empty { display: none; }

.eq { display: flex; gap: 8px; align-items: flex-end; height: 90px; }
.eq[hidden] { display: none; }
.eq i { width: 14px; border-radius: 4px; background: linear-gradient(var(--accent), var(--accent-2)); animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.3s; }
.eq i:nth-child(3) { animation-delay: -0.6s; }
.eq i:nth-child(4) { animation-delay: -0.15s; }
.eq i:nth-child(5) { animation-delay: -0.45s; }
@keyframes eq { 0%, 100% { height: 15%; } 50% { height: 100%; } }

.reveal { display: flex; align-items: center; gap: 16px; width: 100%; }
.reveal[hidden] { display: none; }
.reveal img { width: 120px; height: 120px; border-radius: 10px; flex-shrink: 0; }
.reveal-title { font-size: 20px; font-weight: 700; }
.reveal-winner { margin-top: 10px; font-weight: 500; }
.reveal-winner.win { color: var(--good); }
.reveal-winner.lose { color: var(--bad); }

.progress { height: 6px; background: var(--surface); border-radius: 3px; overflow: hidden; }
#progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.guess { display: flex; gap: 8px; }
.guess button.primary { width: auto; }
.guess.shake { animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.guess + .feedback + #skip { align-self: center; }
.feedback { min-height: 20px; text-align: center; font-size: 14px; color: var(--muted); }
.volume { display: flex; align-items: center; gap: 8px; justify-content: center; }
.volume input { width: 140px; padding: 0; accent-color: var(--accent-2); }

.trophy { font-size: 72px; text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--surface-2); padding: 12px 18px; border-radius: 10px; box-shadow: 0 8px 24px #0008;
  max-width: calc(100% - 32px);
}

@media (max-width: 420px) {
  .reveal img { width: 84px; height: 84px; }
  .big-code { font-size: 36px; }
}

.song-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.song-list li { display: flex; align-items: center; gap: 12px; }
.song-list img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.song-info { flex: 1; min-width: 0; }
.song-title, .song-info .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-result { font-size: 14px; font-weight: 500; flex-shrink: 0; }
.song-result.win { color: var(--good); }
.song-result.lose { color: var(--bad); }
