* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #12122b;
  --bg2: #1c1c3f;
  --fg: #f4f4ff;
  --accent: #ffd447;
  --muted: #9a9ac0;
}

html, body { height: 100%; }
body {
  background: radial-gradient(ellipse at top, var(--bg2), var(--bg));
  color: var(--fg);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  overflow: hidden;
}

#app { height: 100vh; display: flex; flex-direction: column; }

body.screen-offline::after {
  content: '⚠ reconnecting to server…';
  position: fixed; top: 12px; right: 16px;
  background: #c0392b; color: white; padding: 8px 16px;
  border-radius: 8px; font-weight: 700;
}

/* ---- Lobby ---- */
.lobby { height: 100%; display: flex; flex-direction: column; padding: 3vh 4vw; }
.lobby-head h1 { font-size: 5vh; letter-spacing: 1px; }
.lobby-sub { color: var(--muted); font-size: 2.4vh; margin-top: 4px; }

.lobby-main { flex: 0 0 auto; display: flex; gap: 4vw; margin-top: 3vh; min-height: 0; }

.join-panel {
  display: flex; flex-direction: column; align-items: center; gap: 1.6vh;
  background: rgba(255,255,255,0.05); border-radius: 24px; padding: 3vh 3vw;
}
.qr { width: 34vh; height: 34vh; border-radius: 16px; background: white; padding: 8px; }
.join-url { font-size: 2.6vh; color: var(--accent); font-weight: 600; font-family: ui-monospace, monospace; }
.join-alt { font-size: 1.8vh; color: var(--muted); font-family: ui-monospace, monospace; }
.room-code { display: flex; gap: 1vh; }
.code-ch {
  font-size: 6vh; font-weight: 800; font-family: ui-monospace, monospace;
  background: var(--accent); color: #222; border-radius: 12px; padding: 0.6vh 1.6vh;
}

.roster-panel { flex: 1; min-width: 0; }
.roster-panel h2 { font-size: 3vh; color: var(--muted); text-transform: uppercase; letter-spacing: 2px; }
.roster { display: flex; flex-wrap: wrap; gap: 1.4vh; margin-top: 1.4vh; }
.roster-empty { color: var(--muted); font-size: 2.4vh; padding: 1vh 0; }
.player-chip {
  display: flex; align-items: center; gap: 10px;
  font-size: 2.8vh; font-weight: 700;
  border: 3px solid; border-radius: 999px; padding: 1vh 2vh;
  background: rgba(0,0,0,0.25);
}
.player-off { opacity: 0.35; }
.player-off::after { content: ' zzz'; font-size: 2vh; color: var(--muted); }
.player-dot { width: 2.2vh; height: 2.2vh; border-radius: 50%; display: inline-block; flex: none; }
.crown { font-size: 2.4vh; }

.standings { margin-top: 1.4vh; display: flex; flex-direction: column; gap: 0.8vh; }
.standing-row { display: flex; align-items: center; gap: 12px; font-size: 2.6vh; }
.standing-rank { color: var(--muted); width: 3vh; }
.standing-name { font-weight: 700; }
.standing-pts { color: var(--accent); margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
/* Secondary line: total points + games played, the evidence behind the rating. */
.standing-sub { color: var(--muted); font-size: 1.8vh; margin-left: auto; }
.standing-sub + .standing-pts { margin-left: 12px; }
/* On the roster but hasn't played a game yet — listed, deliberately unranked. */
.standing-row-idle { opacity: 0.55; }
.standings-note { color: var(--muted); font-size: 1.5vh; margin-top: 0.9vh; line-height: 1.35; }

.game-strip {
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 1vw; margin-top: 2vh;
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
}
.game-card {
  flex: 1 1 10.5vw; min-width: 10.5vw; background: rgba(255,255,255,0.06);
  border-radius: 14px; padding: 1.2vh 0.8vw; text-align: center;
}
.game-emoji { font-size: 3.6vh; }
.game-title { font-weight: 800; font-size: 1.8vh; margin-top: 0.5vh; }
.game-tag { color: var(--muted); font-size: 1.4vh; margin-top: 0.3vh;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.lobby-foot { text-align: center; color: var(--muted); font-size: 2.2vh; margin-top: 2vh; }

/* ---- Hall of Fame ---- */
.hof-list { margin-top: 1.4vh; display: flex; flex-direction: column; gap: 0.7vh; }
.hof-row { display: flex; align-items: baseline; gap: 10px; font-size: 2vh; }
.hof-label { color: var(--muted); flex: 0 0 auto; }
.hof-name { font-weight: 700; }
.hof-value { color: var(--accent); margin-left: auto; font-weight: 700; text-align: right; }
.hof-nights { color: var(--muted); font-size: 1.5vh; margin-top: 0.6vh; }

/* ---- Lobby admin row (End Night / Reset Hall of Fame) ---- */
.lobby-foot-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 2vh; gap: 2vw;
}
.lobby-foot-row .lobby-foot { margin-top: 0; flex: 1; }
.lobby-admin-row { display: flex; gap: 1vh; flex: 0 0 auto; }
.admin-btn {
  font: inherit; font-size: 1.6vh; font-weight: 700; color: var(--muted);
  background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.12);
  border-radius: 999px; padding: 0.8vh 1.6vh; cursor: pointer;
}
.admin-btn:hover { color: var(--fg); border-color: rgba(255,255,255,0.3); }
.admin-btn-subtle { color: var(--muted); background: transparent; border-color: transparent; }
.admin-btn-armed { color: #fff; background: #c0392b; border-color: #c0392b; }

/* ---- Rules screen ---- */
.rules-screen {
  height: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2vh; padding: 4vh 6vw; text-align: center;
}
.rules-emoji { font-size: 9vh; }
.rules-title { font-size: 5vh; letter-spacing: 1px; }
.rules-goal { font-size: 2.8vh; color: var(--accent); font-weight: 600; max-width: 70vw; }
.rules-bullets {
  list-style: none; display: flex; flex-direction: column; gap: 1vh;
  font-size: 2.4vh; max-width: 60vw;
}
.rules-bullets li::before { content: '• '; color: var(--accent); }
.rules-ready-row {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 1.2vh; margin-top: 1vh;
  max-width: 80vw;
}
.ready-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 2.2vh; font-weight: 700;
  border: 3px solid; border-radius: 999px; padding: 0.8vh 1.6vh;
  background: rgba(0,0,0,0.25); opacity: 0.6;
}
.ready-chip-on { opacity: 1; background: rgba(60,187,60,0.18); }
.ready-mark { font-size: 2vh; }
.rules-foot { color: var(--muted); font-size: 2vh; margin-top: 1vh; }

/* ---- Game stage ---- */
.game-stage { position: fixed; inset: 0; }

/* ---- Results ---- */
.standings-screen {
  height: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4vh; padding: 4vh;
}
.standings-screen h1 { font-size: 7vh; color: var(--accent); }
.result-rows { display: flex; flex-direction: column; gap: 1.6vh; width: min(80vw, 900px); }
.result-row {
  display: flex; align-items: center; gap: 2vw; font-size: 3.4vh;
  border: 3px solid; border-radius: 16px; padding: 1.6vh 2.4vw;
  background: rgba(0,0,0,0.3);
}
.result-medal { font-size: 4vh; width: 5vh; }
.result-name { font-weight: 800; }
.result-score { margin-left: auto; font-family: ui-monospace, monospace; font-weight: 700; }
/* The game's own units sit next to the session points, so each is named. */
.result-score-label { color: var(--muted); font-family: inherit; font-weight: 400; font-size: 1.8vh; }
.result-pts { color: var(--accent); font-size: 2.4vh; min-width: 15ch; text-align: right; }
.standings-screen .standings-note { max-width: min(80vw, 900px); text-align: center; font-size: 1.9vh; margin-top: 1.6vh; }

/* ---- Awards ceremony ---- */
.ceremony-stage { position: fixed; inset: 0; }
.ceremony {
  height: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 5vh; padding: 4vh;
  background: radial-gradient(ellipse at top, var(--bg2), var(--bg));
}
.ceremony-head {
  font-size: 3.2vh; letter-spacing: 3px; color: var(--muted);
  text-transform: uppercase; font-weight: 700;
}
.ceremony-slide { display: flex; align-items: center; justify-content: center; min-height: 40vh; width: 100%; }
.award-card {
  display: flex; flex-direction: column; align-items: center; gap: 1.6vh;
  text-align: center; max-width: 70vw;
  animation: award-in 0.5s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes award-in {
  from { opacity: 0; transform: scale(0.7) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.award-emoji { font-size: 11vh; line-height: 1; }
.award-title {
  font-size: 4.4vh; font-weight: 800; letter-spacing: 1px; color: var(--accent);
}
.award-names { font-size: 5.4vh; font-weight: 900; }
.award-subtitle { font-size: 2.4vh; color: var(--muted); max-width: 56vw; }

.ceremony-finale {
  height: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4vh;
  background: radial-gradient(ellipse at top, var(--bg2), var(--bg));
}
.ceremony-finale-text { font-size: 4vh; color: var(--muted); }
.ceremony-finale-actions { display: flex; gap: 2vw; }
.ceremony-btn {
  font: inherit; font-size: 2.4vh; font-weight: 700; color: var(--fg);
  background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.2);
  border-radius: 999px; padding: 1.6vh 3.2vh; cursor: pointer;
}
.ceremony-btn-primary { background: var(--accent); color: #222; border-color: var(--accent); }
