:root {
  color-scheme: dark;
  --bg: #080b14;
  --panel: #111827;
  --panel-2: #172033;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #84cc16;
  --accent-2: #38bdf8;
  --line: #27324a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top left, #1e293b, var(--bg) 42rem);
  color: var(--text);
  font: 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 20, .78);
  position: sticky;
  top: 0;
  backdrop-filter: blur(16px);
}
.brand {
  font-size: 1.2rem;
  font-weight: 900;
  text-decoration: none;
}
nav { display: flex; gap: 1rem; color: var(--muted); }
nav a { text-decoration: none; }
main {
  width: min(1120px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}
.hero, .panel, .card, .screen-card {
  background: linear-gradient(145deg, rgba(17, 24, 39, .96), rgba(23, 32, 51, .88));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(1.25rem, 4vw, 3rem);
  box-shadow: 0 24px 80px rgba(0,0,0,.26);
}
.hero h1, .panel h1, .projector h1 {
  font-size: clamp(2.4rem, 8vw, 5.5rem);
  line-height: .95;
  margin: 0 0 1rem;
  letter-spacing: -.06em;
}
.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .18em;
}
.actions, .toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  margin-top: 1.3rem;
}
.toggle-row {
  margin-top: 1rem;
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: .6rem;
  color: var(--muted);
  font-size: .95rem;
}
.toggle-row input {
  width: auto;
}
.join-block {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1rem;
  background: rgba(8, 11, 20, .42);
}
.join-block a {
  display: block;
  margin-top: .25rem;
  color: var(--accent-2);
  overflow-wrap: anywhere;
}
.join-block img {
  width: 112px;
  height: 112px;
  border-radius: 12px;
  background: white;
  padding: .35rem;
}
.button, button {
  border: 0;
  border-radius: 999px;
  padding: .85rem 1.1rem;
  background: var(--accent);
  color: #13210a;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}
button:disabled, .disabled {
  opacity: .45;
  pointer-events: none;
}
.secondary {
  background: #263246;
  color: var(--text);
}
#newGame {
  background: #334155;
  color: var(--text);
}
#newGame::before {
  content: "↻ ";
}
.grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.narrow { width: min(560px, 100%); margin-inline: auto; }
.stack { display: grid; gap: 1rem; }
label { display: grid; gap: .35rem; color: var(--muted); font-weight: 700; }
fieldset {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: .9rem;
}
legend {
  color: var(--muted);
  font-weight: 800;
  padding: 0 .4rem;
}
.avatar-picker {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: .6rem;
}
.avatar-picker label {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .6rem;
  background: #0b1220;
  font-size: 1.35rem;
}
.avatar-picker input {
  width: auto;
}
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  background: #0b1220;
  color: var(--text);
  font: inherit;
}
.notice, .muted { color: var(--muted); }
.hidden { display: none; }
.answer-row, #leaderboard li, #projectorLeaderboard li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--line);
}
.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.answers button {
  border-radius: 20px;
  padding: 1.25rem;
  background: #1d4ed8;
  color: white;
}
.answers button:disabled {
  opacity: .55;
  cursor: default;
}
.answers button.answered-option {
  opacity: 1;
  background: #84cc16;
  color: #13210a;
  box-shadow: 0 0 0 4px rgba(132, 204, 22, .2);
}
.projector {
  min-height: 78vh;
}
.projector h1 {
  color: var(--accent-2);
}
.pin-form {
  display: flex;
  gap: .75rem;
  max-width: 480px;
}
.pin-form input {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: .18em;
}
.screen-card {
  margin-top: 1rem;
}
.screen-card h2 {
  font-size: clamp(2rem, 6vw, 4.5rem);
  line-height: 1;
}
.player-stage {
  min-height: 72vh;
  display: grid;
  align-content: center;
  gap: 1.25rem;
}
.screen-meta {
  position: fixed;
  top: 5.4rem;
  right: clamp(1rem, 4vw, 3rem);
  display: flex;
  gap: .75rem;
  align-items: center;
  color: var(--muted);
  background: rgba(8, 11, 20, .72);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .6rem .9rem;
  backdrop-filter: blur(12px);
  z-index: 2;
}
.screen-meta strong {
  color: var(--text);
}
.question-focus {
  text-align: center;
  width: min(980px, 100%);
  margin: 0 auto;
}
.question-focus h1 {
  font-size: clamp(2.6rem, 7vw, 6rem);
  line-height: .98;
  letter-spacing: -.055em;
  margin: 0;
}
.player-stage .answers {
  width: min(980px, 100%);
  margin: 0 auto;
}
.player-stage .answers button {
  min-height: 5.8rem;
  font-size: clamp(1rem, 2vw, 1.35rem);
}
.player-stage .notice {
  text-align: center;
}
.timer {
  width: min(420px, 100%);
  height: 18px;
  margin: 1.6rem auto 0;
  border: 3px solid #020617;
  border-radius: 999px;
  background: #0b1220;
  position: relative;
  overflow: visible;
}
.timer::before {
  content: "";
  display: block;
  width: var(--progress, 100%);
  height: 100%;
  background: linear-gradient(90deg, #84cc16, #facc15, #fb7185);
  border-radius: inherit;
  transition: width .25s linear;
}
.timer span {
  position: absolute;
  inset: -1.75rem 0 auto;
  text-align: center;
  font-weight: 1000;
  line-height: 1;
  text-shadow: 0 2px 0 #000;
}
.paused-card {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 22px;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  background: rgba(15, 23, 42, .82);
  font-weight: 900;
}
.results-card {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: clamp(1rem, 3vw, 2rem);
  background: rgba(15, 23, 42, .9);
  text-align: left;
}
.results-card h2 {
  margin: 0 0 1rem;
}
.results-card ol {
  margin: 0;
}
ol {
  list-style: decimal;
  padding-left: 1.5rem;
}
@media (max-width: 760px) {
  .two, .three, .answers { grid-template-columns: 1fr; }
  .pin-form { flex-direction: column; }
  .join-block { align-items: flex-start; flex-direction: column; }
  nav { gap: .5rem; font-size: .9rem; }
  .screen-meta {
    position: static;
    justify-content: center;
    margin-bottom: .5rem;
  }
}
