:root {
  --red: #d7263d;
  --red-dark: #a01a2d;
  --blue: #1b6ca8;
  --blue-dark: #134e78;
  --bg: #0f1626;
  --panel: #1a2238;
  --panel-2: #232d4a;
  --text: #e8ecf5;
  --muted: #97a0b8;
  --gold: #f2c14e;
  --ok: #2ecc71;
  --line: #313c5e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 50% 0%, #1a2440 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}
.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* ---- Login ---- */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--panel);
  padding: 40px 36px;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.logo {
  font-size: 40px;
  letter-spacing: 8px;
  margin: 0 0 6px;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}
.tagline { color: var(--muted); font-size: 13px; margin: 0 0 28px; }
form input {
  display: block;
  width: 100%;
  padding: 13px 14px;
  margin-bottom: 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
form input:focus { outline: none; border-color: var(--blue); }
button {
  cursor: pointer;
  border: none;
  border-radius: 9px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  background: var(--blue);
  color: #fff;
  width: 100%;
  transition: filter .15s;
}
button:hover { filter: brightness(1.1); }
button.ghost { background: transparent; border: 1px solid var(--line); width: auto; padding: 8px 14px; font-size: 13px; }
button.danger { background: var(--red); }
button.gold { background: var(--gold); color: #1a1a1a; }
button:disabled { opacity: .45; cursor: not-allowed; }
.error { color: #ff8a8a; font-size: 13px; min-height: 16px; margin: 8px 0 0; }

/* ---- Topbar ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; letter-spacing: 4px; color: var(--gold); }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 14px; }

/* ---- Scoreboard ---- */
.scoreboard {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 14px;
  align-items: center;
  padding: 22px;
  max-width: 1000px;
  margin: 0 auto;
}
.team-score {
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  border: 2px solid transparent;
}
.team-score.red { background: linear-gradient(160deg, var(--red), var(--red-dark)); }
.team-score.blue { background: linear-gradient(160deg, var(--blue), var(--blue-dark)); }
.team-score.active { border-color: var(--gold); box-shadow: 0 0 24px rgba(242,193,78,.5); }
.team-label { font-size: 14px; letter-spacing: 3px; opacity: .85; }
.score-num { font-size: 52px; font-weight: 800; line-height: 1; }
.center-status { text-align: center; }
#phase-line { font-size: 18px; font-weight: 700; }
.turn-line { color: var(--gold); font-size: 14px; margin-top: 6px; min-height: 18px; }

/* ---- Main ---- */
main { max-width: 1000px; margin: 0 auto; padding: 0 22px 30px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 18px; }
.card h3 { margin: 0 0 10px; font-size: 15px; color: var(--muted); }

/* Word reveal */
.word-box {
  text-align: center;
  padding: 30px 20px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 2px dashed var(--line);
}
.word-box .label { color: var(--muted); font-size: 13px; letter-spacing: 2px; }
.word-box .word {
  font-size: 46px;
  font-weight: 800;
  letter-spacing: 3px;
  margin-top: 8px;
  text-transform: uppercase;
  color: var(--gold);
}
.word-box.hidden-word .word { color: var(--muted); font-size: 28px; letter-spacing: 1px; }
.role-pill {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 14px;
}
.role-pill.guesser { background: var(--gold); color: #1a1a1a; }
.role-pill.cluegiver { background: var(--ok); color: #08351c; }
.role-pill.spectator { background: var(--panel-2); color: var(--muted); }

.guess-dots { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.dot {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.dot.points { color: var(--gold); }
.dot.wrong { background: var(--red-dark); color: #fff; border-color: var(--red); }
.dot.correct { background: var(--ok); color: #08351c; border-color: var(--ok); }

/* Teams roster */
.rosters { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.roster { border-radius: 12px; padding: 14px; }
.roster.red { background: rgba(215,38,61,.12); border: 1px solid rgba(215,38,61,.4); }
.roster.blue { background: rgba(27,108,168,.12); border: 1px solid rgba(27,108,168,.4); }
.roster h4 { margin: 0 0 10px; }
.roster ul { list-style: none; padding: 0; margin: 0; }
.roster li { padding: 7px 10px; border-radius: 8px; margin-bottom: 5px; background: rgba(255,255,255,.04); display: flex; justify-content: space-between; align-items: center; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--gold); color: #1a1a1a; font-weight: 700; }

/* Admin */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.admin-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.admin-controls button { width: auto; }
select, .inline-input {
  padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 14px;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions button, .row-actions select { padding: 5px 9px; font-size: 12px; width: auto; }
.mini-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mini-form input { width: auto; flex: 1; min-width: 120px; margin-bottom: 0; }
.mini-form button { width: auto; }

.big-guess-btns { display: flex; gap: 14px; margin-top: 16px; }
.big-guess-btns button { font-size: 17px; padding: 18px; }

.log-section { max-width: 1000px; margin: 0 auto; padding: 0 22px 40px; }
.log-section h3 { color: var(--muted); font-size: 14px; }
#log { list-style: none; padding: 0; margin: 0; font-size: 13px; }
#log li { padding: 6px 0; border-bottom: 1px solid var(--line); color: var(--muted); }

.winner-banner {
  text-align: center; padding: 30px; border-radius: 16px; margin-bottom: 18px;
  font-size: 28px; font-weight: 800;
}
.winner-banner.red { background: linear-gradient(160deg, var(--red), var(--red-dark)); }
.winner-banner.blue { background: linear-gradient(160deg, var(--blue), var(--blue-dark)); }
.winner-banner.tie { background: var(--panel-2); }

.hint { color: var(--muted); font-size: 13px; margin-top: 8px; }

@media (max-width: 720px) {
  .admin-grid, .rosters { grid-template-columns: 1fr; }
  .score-num { font-size: 40px; }
}
