/* SongGuesser: dark stage theme, red accent */

@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,500;0,600;0,700;0,800;0,900;1,900&display=swap');

:root {
  --bg: #060707;
  --surface: #101114;
  --surface-2: #17181d;
  --surface-3: #202228;
  --hairline: #1a1c20;
  --text: #eceded;
  --muted: #8a8e98;
  --faint: #565a63;
  --red: #ed2737;
  --red-hover: #ff3b49;
  --red-dim: rgba(237, 39, 55, 0.12);
  --green: #46c266;
  --green-dim: rgba(70, 194, 102, 0.12);
  --amber: #f5a524;
  --amber-dim: rgba(245, 165, 36, 0.12);
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* soft stage spotlight falling from the top */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 52% 44% at 50% -6%, rgba(255, 255, 255, 0.05), transparent 68%),
    radial-gradient(ellipse 30% 26% at 50% -4%, rgba(237, 39, 55, 0.055), transparent 70%);
}

::selection { background: var(--red-dim); }

/* ---------- layout ---------- */

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; position: relative; }
.wrap-narrow { max-width: 480px; margin: 0 auto; padding: 0 20px; position: relative; }

header.top { background: transparent; }
header.top .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}

.brand {
  font-weight: 900; font-style: italic; font-size: 19px; letter-spacing: -0.01em;
  text-decoration: none; color: var(--text);
  display: flex; align-items: center;
  user-select: none;
}
.brand .accent { color: var(--red); }
.brand .logo { height: 30px; width: auto; margin-right: 10px; display: block; }

.top-meta {
  display: flex; align-items: center; gap: 4px;
  color: var(--muted); font-size: 13px; font-weight: 800;
}
.top-meta .status { font-weight: 600; margin-right: 10px; }
.top-meta a {
  color: var(--muted); text-decoration: none;
  padding: 6px 13px; border-radius: 999px;
}
.top-meta a:hover { color: var(--text); background: var(--surface-2); }
.top-meta a.on { color: var(--text); background: var(--surface-2); }

main { padding: 28px 0 80px; }

/* faint stage wordmark */
.ghost {
  text-align: center;
  font-weight: 900; font-style: italic;
  font-size: 56px; letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.035);
  user-select: none;
  line-height: 1;
  margin: 8px 0 26px;
}

/* ---------- type ---------- */

h1 { font-size: 23px; font-weight: 900; margin: 0 0 6px; }
h2 { font-size: 16px; font-weight: 800; margin: 0 0 12px; }

.label {
  display: block;
  font-size: 11px; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint);
  margin: 0 0 8px;
}

.sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.mono { font-family: var(--mono); }

/* ---------- controls ---------- */

input[type=text], input[type=password], select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  padding: 10px 14px;
  outline: none;
}
input:focus, select:focus { border-color: var(--surface-3); background: var(--surface-3); }
input::placeholder { color: var(--faint); }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238a8e98' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
}

input[type=checkbox], input[type=radio] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px; height: 16px;
  margin: 0;
  background: var(--surface-3);
  cursor: pointer;
  flex: none;
  vertical-align: -3px;
}
input[type=checkbox] { border-radius: 5px; }
input[type=checkbox]:checked {
  background-color: var(--red);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5 6.5 11.5 12.5 4.5' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px;
}
input[type=radio] { border-radius: 50%; }
input[type=radio]:checked {
  background: radial-gradient(circle, var(--red) 0 4.5px, var(--surface-3) 5px);
}

.choice {
  display: flex; align-items: center; gap: 9px;
  cursor: pointer; user-select: none;
}
.choice + .choice { margin-top: 8px; }

/* custom dropdown */
.dd { position: relative; }
.dd-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  text-align: left;
}
.dd-btn:hover { background: var(--surface-3); }
.dd-btn::after {
  content: '';
  width: 12px; height: 12px; flex: none;
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.15s;
}
.dd.open .dd-btn::after { transform: rotate(180deg); }
.dd-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  z-index: 30;
  max-height: 260px;
  overflow-y: auto;
}
.dd-opt {
  padding: 9px 13px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
}
.dd-opt:hover, .dd-opt.sel { background: var(--surface-3); color: var(--text); }
.dd-opt .count { font-family: var(--mono); font-size: 12px; color: var(--faint); }

/* icon-only buttons (masked strokes, no glyph text) */
button.icon {
  width: 28px; height: 28px;
  padding: 0;
  border-radius: 8px;
  position: relative;
}
button.icon::before {
  content: '';
  position: absolute; inset: 0; margin: auto;
  width: 12px; height: 12px;
  background: currentColor;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}
button.icon.i-up::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 10 8 5.5 12.5 10' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 10 8 5.5 12.5 10' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
button.icon.i-down::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 6 8 10.5 12.5 6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 6 8 10.5 12.5 6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
button.icon.i-play::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 3.2v9.6c0 .5.55.8 1 .55l7.2-4.8a.65.65 0 0 0 0-1.1L6 2.65c-.45-.25-1 .05-1 .55Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 3.2v9.6c0 .5.55.8 1 .55l7.2-4.8a.65.65 0 0 0 0-1.1L6 2.65c-.45-.25-1 .05-1 .55Z'/%3E%3C/svg%3E");
}
button.icon.i-stop::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='3.5' y='3.5' width='9' height='9' rx='1.5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='3.5' y='3.5' width='9' height='9' rx='1.5'/%3E%3C/svg%3E");
}
button.icon.i-minus::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8 H13' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8 H13' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
button.icon.i-plus::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8 H13 M8 3 V13' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8 H13 M8 3 V13' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
button.icon.i-img::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='2' y='3' width='12' height='10' rx='2' fill='none' stroke='black' stroke-width='1.6'/%3E%3Ccircle cx='5.8' cy='6.4' r='1.1'/%3E%3Cpath d='M4 11.2 7 8.4l2.4 2.2 2-1.8 1.6 1.4' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='2' y='3' width='12' height='10' rx='2' fill='none' stroke='black' stroke-width='1.6'/%3E%3Ccircle cx='5.8' cy='6.4' r='1.1'/%3E%3Cpath d='M4 11.2 7 8.4l2.4 2.2 2-1.8 1.6 1.4' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
button.icon.i-x::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 4 12 12 M12 4 4 12' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 4 12 12 M12 4 4 12' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* volume slider */
input[type=range] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  outline: none;
  cursor: pointer;
  margin: 8px 0;
}
input[type=range]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--red);
  border: 0;
}
input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--red);
  border: 0;
}
input[type=range]::-moz-range-track {
  height: 4px; border-radius: 999px; background: var(--surface-3);
}

button {
  font: inherit; font-weight: 800;
  border-radius: 999px;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 18px;
  cursor: pointer;
}
button:hover { background: var(--surface-3); }
button:disabled { opacity: 0.45; cursor: default; }

button.primary { background: var(--red); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--red-hover); }

button.ghost-btn { background: transparent; color: var(--muted); }
button.ghost-btn:hover { color: var(--text); background: var(--surface-2); }
button.small { padding: 6px 13px; font-size: 13px; }
button.icon { padding: 6px 10px; font-size: 13px; line-height: 1; border-radius: 8px; }

.field { margin-bottom: 18px; }
.row { display: flex; gap: 10px; align-items: center; }

/* ---------- surfaces ---------- */

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

.notice { font-size: 14px; color: var(--muted); }
.notice.error { color: var(--red); }

/* ---------- login ---------- */

.gate {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
}
.gate .card { width: 340px; padding: 32px 28px; }
.gate .brand { justify-content: center; margin-bottom: 26px; font-size: 22px; }
.gate .gate-logo { height: 58px; width: auto; display: block; margin: 0 auto 14px; }

/* ---------- lobby / players ---------- */

.code-display {
  font-family: var(--mono);
  font-size: 56px; font-weight: 700; letter-spacing: 0.3em;
  padding-left: 0.3em;
  text-align: center;
  margin: 18px 0 26px;
  text-shadow: 0 0 34px rgba(237, 39, 55, 0.35);
}

ul.player-list { list-style: none; margin: 0; padding: 0; }
ul.player-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px;
  font-weight: 700;
}
ul.player-list li + li { border-top: 1px solid var(--hairline); }
ul.player-list .spacer { flex: 1; }

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--faint); flex: none;
}
.dot.on { background: var(--green); }

/* ---------- play page stage ---------- */

/* three real columns: spacer, stage, rail — the rail reserves its own
   space so it can never overlap the stage at any zoom level */
.board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 560px) minmax(250px, 1fr);
  column-gap: 36px;
}

.stage { grid-column: 2; max-width: 560px; margin: 0 auto; width: 100%; }

.rail {
  grid-column: 3;
  justify-self: end;
  align-self: start;
  width: 250px;
  background: var(--surface);
  border-radius: 18px;
  padding: 18px 20px 20px;
}
@media (max-width: 1080px) {
  .board { display: block; }
  .rail { width: auto; max-width: 560px; margin: 44px auto 0; }
}
.stage-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 22px;
}

.seg-bar {
  display: flex; gap: 2px;
  height: 12px;
}
.seg {
  position: relative;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.seg.unlocked { background: var(--surface-3); }
.seg .fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: var(--red);
  border-radius: 999px;
}
.seg-times {
  display: flex; gap: 2px;
  font-family: var(--mono); font-size: 10px; color: var(--faint);
  margin: 6px 0 0;
}
.seg-times span { text-align: right; }

.play-row {
  display: flex; align-items: center; justify-content: center; gap: 22px;
  margin: 40px 0 44px;
}
.btn-play {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--red);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex: none;
  padding: 0;
  box-shadow: 0 0 34px rgba(237, 39, 55, 0.45), 0 0 90px rgba(237, 39, 55, 0.18);
}
.btn-play:hover { background: var(--red-hover); }
.btn-play svg { width: 30px; height: 30px; fill: #fff; }
.btn-play.playing { background: var(--surface-3); box-shadow: none; }
.btn-play.playing svg { fill: var(--text); }

.play-meta { text-align: left; }
.play-meta .big {
  font-family: var(--mono); font-weight: 700; font-size: 26px;
  color: var(--red);
}
.play-meta .under { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- game: guesses ---------- */

.guess-row { display: flex; gap: 8px; position: relative; }
.guess-box { flex: 1; position: relative; }
.guess-box input {
  border-radius: 999px;
  padding-left: 40px;
}
.guess-box::before {
  content: '';
  position: absolute; left: 15px; top: 50%;
  width: 14px; height: 14px;
  transform: translateY(-50%);
  background: var(--faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.5' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M10.5 10.5 14 14' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.5' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M10.5 10.5 14 14' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
}

.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  z-index: 20;
  max-height: 260px;
  overflow-y: auto;
}
.suggest .opt {
  padding: 9px 13px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
}
.suggest .opt:hover, .suggest .opt.hl { background: var(--surface-3); color: var(--text); }

ul.attempts { list-style: none; margin: 22px 0 0; padding: 0; }
ul.attempts li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 2px;
  font-size: 14px;
  color: var(--muted);
}
ul.attempts li + li { border-top: 1px solid var(--hairline); }
ul.attempts li .mark {
  width: 20px; height: 20px; flex: none;
  border-radius: 50%;
  background: var(--surface-2);
  position: relative;
}
ul.attempts li .mark::before {
  content: '';
  position: absolute; inset: 0; margin: auto;
  width: 9px; height: 9px;
  background: currentColor;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}
ul.attempts li.wrong .mark { color: var(--red); background: var(--red-dim); }
ul.attempts li.wrong .mark::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 3.5 12.5 12.5 M12.5 3.5 3.5 12.5' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 3.5 12.5 12.5 M12.5 3.5 3.5 12.5' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
}
ul.attempts li.correct { color: var(--text); font-weight: 800; }
ul.attempts li.correct .mark { color: var(--green); background: var(--green-dim); }
ul.attempts li.correct .mark::before {
  width: 10px; height: 10px;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8.5 6.5 12.5 13.5 3.5' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8.5 6.5 12.5 13.5 3.5' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
ul.attempts li.skipped { font-style: italic; color: var(--faint); }
ul.attempts li.skipped .mark { color: var(--faint); }
ul.attempts li.skipped .mark::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8 H13' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8 H13' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ---------- reveal ---------- */

.result { margin-top: 34px; text-align: center; }

.result .reveal-img {
  width: 200px; height: 200px;
  margin: 0 auto 22px;
  border-radius: 18px;
  overflow: hidden;
  animation: reveal-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.result.correct .reveal-img { box-shadow: 0 0 44px rgba(70, 194, 102, 0.35); }
.result.failed .reveal-img { box-shadow: 0 0 44px rgba(237, 39, 55, 0.3); }
.result .reveal-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.result .verdict {
  font-size: 12px; font-weight: 800; letter-spacing: 0.28em;
  text-transform: uppercase;
  animation: reveal-rise 0.4s 0.1s ease-out both;
}
.result.correct .verdict { color: var(--green); }
.result.failed .verdict { color: var(--red); }

.result .answer {
  font-size: 36px; font-weight: 900; margin-top: 6px; line-height: 1.12;
  animation: reveal-rise 0.4s 0.18s ease-out both;
}

.result .stamp {
  display: inline-block;
  margin-top: 18px;
  padding: 7px 20px;
  border: 3px solid;
  border-radius: 999px;
  font-weight: 900; font-size: 17px; letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: rotate(-6deg);
  animation: stamp-slam 0.35s 0.45s cubic-bezier(0.34, 1.8, 0.64, 1) both;
}
.result.correct .stamp { color: var(--green); border-color: var(--green); }
.result.failed .stamp { color: var(--red); border-color: var(--red); }

.result .pts {
  color: var(--muted); margin-top: 16px; font-size: 14px;
  animation: reveal-rise 0.4s 0.7s ease-out both;
}

@keyframes reveal-pop {
  from { opacity: 0; transform: scale(0.55); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes reveal-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes stamp-slam {
  from { opacity: 0; transform: rotate(-6deg) scale(2.4); }
  to   { opacity: 1; transform: rotate(-6deg) scale(1); }
}
.result.failed { animation: reveal-shake 0.4s 0.5s ease-in-out; }
@keyframes reveal-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

/* confetti burst on a correct answer */
.confetti {
  position: fixed;
  top: -14px;
  width: 9px; height: 14px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 60;
  animation: confetti-fall linear both;
}
@keyframes confetti-fall {
  from { transform: translateY(0) rotate(0deg); opacity: 1; }
  85%  { opacity: 1; }
  to   { transform: translateY(105vh) rotate(660deg); opacity: 0; }
}

/* ---------- scoreboard rail ---------- */

table.scores { width: 100%; border-collapse: collapse; font-size: 14px; }
table.scores td { padding: 9px 2px; }
table.scores tr + tr td { border-top: 1px solid var(--hairline); }
table.scores .pts { text-align: right; font-family: var(--mono); font-weight: 700; }
table.scores .st {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em;
}
table.scores .st span {
  padding: 3px 9px; border-radius: 999px;
  color: var(--faint);
}
table.scores .st.correct span { color: var(--green); background: var(--green-dim); }
table.scores .st.failed span { color: var(--red); background: var(--red-dim); }
table.scores .st.playing span { color: var(--amber); background: var(--amber-dim); }

/* ---------- host ---------- */

.host-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.pcard {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px 18px;
}
.pcard .head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pcard .head .name { font-weight: 800; }
.pcard .head .score { margin-left: auto; font-family: var(--mono); color: var(--muted); }
.pcard .answer-line { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.pcard .answer-line b { color: var(--text); }
.pcard .answer-line.blurred b { filter: blur(6px); }
.pcard .answer-line.blurred:hover b { filter: none; }
.pcard ul.attempts { margin-top: 8px; }
.pcard ul.attempts li { padding: 4px 2px; font-size: 13px; }
.pcard .stage-pips { display: flex; gap: 3px; margin: 4px 0 10px; }
.pcard .pip { height: 4px; flex: 1; border-radius: 2px; background: var(--surface-2); }
.pcard .pip.used { background: var(--surface-3); }
.pcard .pip.now { background: var(--red); }
.pcard .statusline { color: var(--muted); font-size: 13px; }
.pcard.correct .statusline { color: var(--green); font-weight: 800; }
.pcard.failed .statusline { color: var(--red); font-weight: 800; }
.pcard .actions { display: flex; gap: 6px; margin-top: 12px; }

.host-controls {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: var(--surface);
  border-radius: 999px;
  position: sticky; top: 12px; z-index: 5;
}
.host-controls .round { font-weight: 900; font-size: 17px; }
.host-controls .spacer { flex: 1; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(237,39,55,0.5); } 50% { box-shadow: 0 0 0 6px rgba(237,39,55,0); } }

/* ---------- standings ---------- */

ol.standings { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
ol.standings li {
  counter-increment: rank;
  display: flex; align-items: baseline; gap: 14px;
  padding: 13px 6px;
  font-size: 17px; font-weight: 800;
}
ol.standings li + li { border-top: 1px solid var(--hairline); }
ol.standings li::before {
  content: counter(rank);
  font-family: var(--mono); color: var(--faint); font-size: 14px;
  width: 20px; text-align: right;
}
ol.standings li:first-child { font-size: 22px; }
ol.standings li:first-child::before { color: var(--red); }
ol.standings li .pts { margin-left: auto; font-family: var(--mono); }

/* ---------- admin ---------- */

.admin-grid { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; }
@media (max-width: 800px) { .admin-grid { grid-template-columns: 1fr; } }

ul.pack-list { list-style: none; margin: 0 0 12px; padding: 0; }
ul.pack-list li {
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  color: var(--muted); font-weight: 700;
}
ul.pack-list li:hover { color: var(--text); }
ul.pack-list li.active { background: var(--surface-2); color: var(--text); }
ul.pack-list li .count { font-family: var(--mono); font-size: 12px; line-height: 1; color: var(--faint); }

.pts-row { display: flex; gap: 6px; margin-bottom: 10px; }
.pts-row .pt { flex: 1; min-width: 0; }
.pts-row .pt .t {
  display: block; text-align: center;
  font-family: var(--mono); font-size: 10px; color: var(--faint);
  margin-bottom: 4px;
}
.pts-row input { padding: 7px 2px; text-align: center; font-size: 13px; border-radius: 9px; }

.rail-sec { margin-top: 28px; }

.dropzone {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  margin: 14px 0 20px;
}
.dropzone:hover { background: var(--surface-2); }
.dropzone.drag { background: var(--red-dim); color: var(--text); }

table.songs { width: 100%; border-collapse: collapse; font-size: 14px; }
table.songs th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--faint); font-weight: 800;
  padding: 6px 8px;
}
table.songs td { padding: 6px 8px; border-top: 1px solid var(--hairline); vertical-align: middle; }
table.songs input { padding: 6px 10px; font-size: 14px; background: transparent; border-radius: 9px; }
table.songs input:hover { background: var(--surface-2); }
table.songs input:focus { background: var(--surface-2); border-color: transparent; }
table.songs .ord { font-family: var(--mono); color: var(--faint); width: 26px; text-align: right; }
table.songs .imgcell { width: 48px; }
.thumb-wrap { position: relative; display: inline-block; vertical-align: middle; }
.thumb-btn {
  width: 28px; height: 28px;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  display: block;
}
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-del {
  position: absolute; top: -5px; right: -5px;
  width: 15px; height: 15px;
  padding: 0;
  border-radius: 50%;
  background: var(--surface-3);
  border: 2px solid var(--bg);
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.12s;
}
.thumb-wrap:hover .thumb-del, .thumb-del:focus-visible { opacity: 1; }
.thumb-del:hover { background: var(--red); color: #fff; }
.thumb-del::before {
  content: '';
  position: absolute; inset: 0; margin: auto;
  width: 6px; height: 6px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 3.5 12.5 12.5 M12.5 3.5 3.5 12.5' stroke='black' stroke-width='2.8' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 3.5 12.5 12.5 M12.5 3.5 3.5 12.5' stroke='black' stroke-width='2.8' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.pcard .answer-thumb {
  width: 30px; height: 30px;
  border-radius: 7px;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 8px;
}
.pcard .answer-line.blurred .answer-thumb { filter: blur(8px); }
.pcard .answer-line.blurred:hover .answer-thumb { filter: none; }
table.songs .tools { white-space: nowrap; text-align: right; }
table.songs .tools button { margin-left: 4px; background: transparent; color: var(--muted); }
table.songs .tools button:hover { background: var(--surface-2); color: var(--text); }

/* ---------- toast ---------- */

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
  max-width: 90vw;
}
#toast.show { opacity: 1; }
#toast.error { color: #ff8b93; }

.hidden { display: none !important; }
.center { text-align: center; }
.mt { margin-top: 20px; }
.muted { color: var(--muted); }
