:root {
  --bg: #07140f;
  --bg-2: #0d2219;
  --panel: #10291f;
  --line: #24483a;
  --text: #fbf6ec;
  --muted: #a9c2b5;
  --gold: #f2c14e;
  --board: #0f4a30;
  --board-hi: #17663f;
  --red: #d7263d;
  --green: #2e9e5b;
  --festive: 'Mountains of Christmas', 'Oswald', serif;
  --radius: 14px;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(900px 500px at 15% -10%, #6b0f1a55 0%, transparent 60%),
    radial-gradient(900px 500px at 85% -10%, #0f4a3088 0%, transparent 60%),
    radial-gradient(1400px 700px at 50% 120%, #10291f 0%, var(--bg) 70%) fixed;
  background-color: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { font-family: 'Oswald', 'Inter', sans-serif; letter-spacing: 0.02em; margin: 0 0 0.5em; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.hidden { display: none !important; }

button, input, textarea, select { font: inherit; color: inherit; }
button {
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: 0.7em 1.1em;
  background: var(--panel);
  border: 1px solid var(--line);
  font-weight: 600;
  transition: transform 0.05s, background 0.15s, opacity 0.15s;
}
button:hover:not(:disabled) { background: #173a2c; }
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--gold); color: #1a1300; border-color: transparent; }
button.primary:hover:not(:disabled) { background: #f3c95e; }
button.good { background: var(--green); border-color: transparent; }
button.good:hover:not(:disabled) { background: #37b56a; }
button.bad { background: var(--red); border-color: transparent; }
button.bad:hover:not(:disabled) { background: #ea3a50; }
button.small { padding: 0.35em 0.7em; font-size: 0.85em; }

input, textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75em 0.9em;
}
input:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
textarea { font-family: ui-monospace, Menlo, monospace; font-size: 0.8em; min-height: 260px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2em; }
.stack > * + * { margin-top: 0.8em; }
.row { display: flex; gap: 0.6em; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--gold); padding: 0.8em 1.2em; border-radius: 10px;
  z-index: 100; box-shadow: 0 10px 30px #0008; max-width: calc(100vw - 32px);
}
.toast.error { border-color: var(--red); }

.conn-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); display: inline-block; }
.conn-dot.on { background: #3ddc84; }

/* ---------- Jeopardy board (host + screen) ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), 1fr);
  gap: 8px;
}
.board .cat, .board .cell {
  background: linear-gradient(160deg, var(--board-hi), var(--board) 70%);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 0.6em;
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 2px #f2c14e33, inset 0 -6px 12px #0005;
}
.board .cat {
  font-size: 1.05em; min-height: 3.6em; letter-spacing: 0.04em;
  background: linear-gradient(160deg, #b51d30, #7d1020 75%);
  box-shadow: inset 0 0 0 2px #f2c14e66, inset 0 -6px 12px #0005;
}
.board .cell { color: var(--gold); font-size: 2em; font-weight: 700; min-height: 2.4em; text-shadow: 2px 2px 0 #0008; }
.board .cell.used { color: transparent; text-shadow: none; background: #0a2a1c; box-shadow: inset 0 0 0 2px #0004; }
.board button.cell { border: 0; }
.board button.cell:hover:not(:disabled) { background: linear-gradient(160deg, #1f8050, var(--board-hi)); }

/* ---------- Team chips ---------- */
.teams { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.team {
  border-radius: var(--radius);
  padding: 0.8em 1em;
  background: var(--panel);
  border: 2px solid var(--team, var(--line));
  position: relative;
}
.team .name { font-weight: 700; font-family: 'Oswald', sans-serif; font-size: 1.2em; }
.team .score { font-family: 'Oswald', sans-serif; font-size: 2em; font-weight: 700; }
.team .players { font-size: 0.85em; color: var(--muted); }
.team.answering { box-shadow: 0 0 0 4px var(--team), 0 0 40px var(--team); }
.team.locked { opacity: 0.45; }
.player-chip { display: inline-flex; align-items: center; gap: 0.35em; margin-right: 0.6em; }
.player-chip .conn-dot { width: 7px; height: 7px; }

/* ---------- Christmas decorations ---------- */
.festive { font-family: var(--festive); font-weight: 700; letter-spacing: 0.01em; }

#snow { position: fixed; inset: 0; pointer-events: none; z-index: 30; }

/* A string of blinking lights along the top edge. */
.lights {
  position: fixed; top: 0; left: 0; right: 0; height: 34px; z-index: 31; pointer-events: none;
  display: flex; justify-content: space-around; overflow: hidden;
  background: radial-gradient(ellipse 60px 18px at 50% -6px, transparent 16px, #1c2b22 17px, #1c2b22 19px, transparent 20px) 0 0 / 60px 34px repeat-x;
}
.lights i {
  width: 10px; height: 16px; margin-top: 10px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--c); box-shadow: 0 2px 14px 2px var(--c); position: relative;
  animation: twinkle 1.6s ease-in-out infinite; animation-delay: var(--d);
}
.lights i::before { content: ''; position: absolute; top: -4px; left: 2px; width: 6px; height: 5px; background: #3a3a3a; border-radius: 2px; }
@keyframes twinkle { 50% { opacity: 0.35; box-shadow: 0 2px 4px 0 var(--c); } }

@media (prefers-reduced-motion: reduce) {
  .lights i { animation: none; }
}
