:root {
  color-scheme: dark;
  --bg: #15121a;
  --panel: #211c2a;
  --panel-2: #2c2436;
  --text: #f3eef8;
  --muted: #b2a8c2;
  --accent: #ff5c7a;
  --accent-2: #ffb020;
  --good: #3ddc84;
  --bad: #ff5c7a;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#root {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#root:has(.game-layout) {
  max-width: 700px;
}

.game-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Narrow/medium screens: main content first, then scoreboard, then room code,
   stacked normally (no room yet to pin anything to the browser's edges). */
.game-main { order: -1; flex: 1 1 auto; min-width: 0; }
.game-side-right { order: 0; flex: none; }
.game-side-left { order: 1; flex: none; }

@media (min-width: 900px) {
  /* Wide screens: pin the room code and scoreboard to the browser window's
     actual edges, well clear of the question card, instead of sitting next to it. */
  .game-side-left, .game-side-right {
    position: fixed;
    top: 110px;
    width: 220px;
  }
  .game-side-left { left: 32px; }
  .game-side-right { right: 32px; }
}

h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; color: var(--muted); line-height: 1.5; }

.card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

button, .btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  min-height: 56px;
  padding: 0 18px;
  cursor: pointer;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: default; }

button.primary { background: var(--accent); color: #1a0e12; }
button.ghost { background: transparent; border: 1px solid var(--panel-2); }
button.small { min-height: 40px; padding: 0 12px; font-size: 14px; }
button.danger { background: var(--bad); color: #250009; }

input, select {
  background: var(--panel-2);
  border: 1px solid #3a314a;
  color: var(--text);
  border-radius: 10px;
  padding: 14px;
  font-size: 16px;
  min-height: 56px;
}

label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 15px;
  color: var(--text);
}
.check input { width: 22px; height: 22px; min-height: unset; flex: none; margin-top: 2px; }

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--panel-2);
  color: var(--muted);
}
.pill.heavy { background: #4a1b23; color: #ff9db0; }
.pill.offline { background: #3a1b1b; color: #ff9d9d; }

.answer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.answer-btn {
  text-align: left;
  white-space: normal;
  min-height: 56px;
  padding: 14px 16px;
  line-height: 1.3;
}
.answer-btn.picked { outline: 2px solid var(--accent); }
.answer-btn.correct { background: var(--good); color: #022; }
.answer-btn.wrong { background: var(--bad); color: #220; opacity: 0.85; }

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
}

.score-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #3a314a; }
.score-row:last-child { border-bottom: none; }
.score-row.me { color: var(--accent-2); font-weight: 700; }
.score-row.offline { color: var(--muted); opacity: 0.7; }

.error-banner {
  background: #4a1b23;
  color: #ffd2dc;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
}

.center { text-align: center; }
.muted { color: var(--muted); font-size: 13px; }
.code { font-size: 32px; font-weight: 800; letter-spacing: 6px; }
