:root {
  --bg: #fbf6ff;
  --bg-2: #eaf8f6;
  --card: #ffffff;
  --ink: #2a1d3d;
  --muted: #6a5d7e;
  --line: #e4daf0;
  --purple: #7b3fe4;
  --purple-soft: #f1e9ff;
  --teal: #0f9d8f;
  --good: #128a4c;
  --good-soft: #e3f7ea;
  --bad: #c62e47;
  --bad-soft: #fde7eb;
  --shadow: 0 2px 4px rgba(42, 29, 61, .05), 0 12px 32px rgba(42, 29, 61, .1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171222;
    --bg-2: #0f1c1d;
    --card: #221b31;
    --ink: #f3edfc;
    --muted: #b3a7c7;
    --line: #3a3050;
    --purple: #b48cff;
    --purple-soft: #2e2445;
    --teal: #4fd1c1;
    --good: #5fdc95;
    --good-soft: #173826;
    --bad: #ff7d93;
    --bad-soft: #3d1a23;
    --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(160deg, var(--bg), var(--bg-2));
  color: var(--ink);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--purple); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap { max-width: 680px; margin: 0 auto; padding: 24px 16px 40px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(20px, 5vw, 36px);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0;
  color: var(--purple);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
h1 { margin: 4px 0 12px; font-size: clamp(32px, 8vw, 46px); line-height: 1.05; letter-spacing: -0.02em; }
h2 { font-size: 20px; margin: 24px 0 10px; }
.lead { margin: 0 0 12px; color: var(--muted); }
.crew-line { margin: 0; }
.small { margin: 16px 0 0; font-size: 14px; color: var(--muted); }

.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.who {
  padding: 12px 10px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--purple-soft);
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s, border-color .1s;
}
.who:hover, .who:focus-visible { border-color: var(--purple); transform: translateY(-2px); }
.who:last-child { background: transparent; font-weight: 600; color: var(--muted); }

.progress-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); font-weight: 600; }
.progress { height: 8px; margin: 6px 0 18px; border-radius: 99px; background: var(--purple-soft); overflow: hidden; }
#progress-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--purple), var(--teal)); transition: width .3s ease; }

.dedication {
  display: inline-block;
  margin: 0 0 6px;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--purple-soft);
  color: var(--purple);
  font-size: 14px;
  font-weight: 700;
}
.question { margin: 8px 0 18px; font-size: clamp(20px, 4.6vw, 24px); line-height: 1.35; outline: none; }

.choices { display: grid; gap: 10px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  cursor: pointer;
  transition: border-color .1s, background .1s;
}
.choice:hover:not(:disabled) { border-color: var(--purple); }
.choice:disabled { cursor: default; }
.letter {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--purple-soft);
  color: var(--purple);
  font-weight: 800;
  font-size: 14px;
}
.choice.correct { border-color: var(--good); background: var(--good-soft); }
.choice.correct .letter { background: var(--good); color: #fff; }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); }
.choice.wrong .letter { background: var(--bad); color: #fff; }
.choice:disabled:not(.correct):not(.wrong) { opacity: .55; }

.feedback { margin-top: 18px; }
.verdict { margin: 0 0 6px; font-weight: 800; font-size: 18px; }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); }
.why { margin: 0 0 16px; color: var(--muted); }

.button {
  padding: 12px 20px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  font-weight: 700;
  cursor: pointer;
}
.button.primary {
  border-color: var(--purple);
  background: var(--purple);
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  .button.primary { color: #1b1328; }
}
.button:hover { filter: brightness(1.06); }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.final-score { margin: 0; font-size: clamp(56px, 16vw, 84px); font-weight: 900; line-height: 1; color: var(--purple); }
.rank { margin: 6px 0 8px; font-size: 26px; }

.shoutout {
  margin-top: 20px;
  padding: 18px;
  border-radius: 16px;
  background: var(--purple-soft);
}
.shoutout h3 { margin: 0 0 10px; }
.shoutout p { margin: 10px 0 0; color: var(--muted); }
.crew { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.crew li {
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--card);
  font-weight: 700;
}
.crew li.me { background: var(--purple); color: #fff; }

footer { margin-top: 24px; text-align: center; font-size: 13px; color: var(--muted); }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 10; }
.bit {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
