/* =============================================================
   Bepordy — styles.css
   Classic Jeopardy palette: deep royal blue board, gold values,
   white clue text. Mobile-first (this is a phones-around-a-room
   party game) but scales up to a shared big screen.
   ============================================================= */

:root {
  --blue-950: #05073a;
  --blue-900: #070a52;
  --blue-800: #0b0e6b;
  --blue-700: #12179a;
  --blue-600: #1b22c4;
  --blue-500: #2b34e0;
  --gold: #ffcc00;
  --gold-soft: #ffd94d;
  --cream: #f4f1e4;
  --ink: #0a0c30;
  --white: #ffffff;
  --good: #37d67a;
  --bad: #ff5964;
  --muted: #9aa0d4;
  --panel: #10143f;
  --panel-2: #171c56;
  --line: #2a3080;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --clue-font: "Georgia", "Times New Roman", serif;
  --ui-font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* ---- Glass design system (deep-blue + gold) ---- */
  --glass-1: linear-gradient(160deg, rgba(43, 52, 224, 0.16), rgba(9, 12, 74, 0.52));
  --glass-2: linear-gradient(160deg, rgba(43, 52, 224, 0.30), rgba(9, 12, 74, 0.66));
  --glass-3: linear-gradient(160deg, rgba(9, 12, 74, 0.55), rgba(4, 6, 40, 0.72));
  --glass-brd: rgba(255, 255, 255, 0.10);
  --glass-brd-soft: rgba(255, 255, 255, 0.06);
  --hi: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --hi-strong: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --elev-1: 0 4px 14px rgba(0, 0, 0, 0.28);
  --elev-2: 0 12px 32px rgba(0, 0, 0, 0.42);
  --elev-3: 0 22px 60px rgba(0, 0, 0, 0.55);
  --gold-glow: 0 0 22px rgba(255, 204, 0, 0.28);
  --blur: blur(14px);
  --blur-sm: blur(6px);
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;
  --field-bg: rgba(4, 6, 40, 0.6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--ui-font);
  color: var(--white);
  background:
    radial-gradient(900px 520px at 50% 118%, rgba(255, 204, 0, 0.10), transparent 60%),
    radial-gradient(1000px 620px at 12% -8%, rgba(43, 52, 224, 0.45), transparent 55%),
    radial-gradient(1100px 700px at 92% 0%, rgba(120, 60, 220, 0.28), transparent 55%),
    radial-gradient(1200px 700px at 50% -10%, var(--blue-700), transparent 60%),
    linear-gradient(180deg, var(--blue-900), var(--blue-950));
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------------- Top bar ---------------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 18px;
  background: linear-gradient(180deg, rgba(7, 10, 58, 0.86), rgba(5, 7, 40, 0.68));
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-brd);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}
.brand {
  font-family: var(--clue-font);
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--gold);
  font-size: 20px;
  cursor: pointer;
  user-select: none;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4), 0 0 18px rgba(255, 204, 0, 0.25);
  transition: filter 0.2s;
}
.brand:hover { filter: brightness(1.12); }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.room-badge {
  font-size: 13px;
  color: var(--cream);
  background: var(--glass-2);
  backdrop-filter: var(--blur-sm);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--hi);
}
.room-badge b { color: var(--gold); letter-spacing: 2px; }
.icon-btn {
  background: var(--glass-1);
  border: 1px solid var(--glass-brd-soft);
  font-size: 18px;
  cursor: pointer;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
  box-shadow: var(--hi);
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.icon-btn:hover { background: var(--glass-2); border-color: var(--glass-brd); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0); }
.conn-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 8px var(--bad);
  transition: background 0.3s, box-shadow 0.3s;
}
.conn-dot.on { background: var(--good); box-shadow: 0 0 8px var(--good); }

/* ---------------- Layout ---------------- */
#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}
.screen { animation: fade 0.35s ease; }
.hidden { display: none !important; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------- Home ---------------- */
.hero { text-align: center; margin: 24px 0 28px; }
.logo {
  font-family: var(--clue-font);
  font-weight: 800;
  font-size: clamp(52px, 13vw, 104px);
  letter-spacing: 5px;
  margin: 0;
  transform: skewX(-6deg);
  background: linear-gradient(180deg, #fff3c4 0%, var(--gold-soft) 42%, var(--gold) 70%, #d9a400 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.35)) drop-shadow(0 0 34px rgba(255, 204, 0, 0.32));
}
.tagline { color: var(--cream); opacity: 0.82; margin-top: 12px; font-size: 16px; letter-spacing: 0.2px; }

.card {
  background: var(--glass-1);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-lg);
  padding: 26px;
  box-shadow: var(--elev-2), var(--hi);
  max-width: 460px;
  margin: 0 auto;
}
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field small { font-weight: 400; }
input[type="text"], select {
  width: 100%;
  padding: 13px 15px;
  font-size: 16px;
  color: var(--white);
  background: var(--field-bg);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-sm);
  outline: none;
  font-family: inherit;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input[type="text"]::placeholder { color: rgba(154, 160, 212, 0.7); }
input[type="text"]:focus, select:focus {
  border-color: var(--gold);
  background: rgba(4, 6, 40, 0.78);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(255, 204, 0, 0.18);
}
select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23ffcc00' d='M0 0h12L6 8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
}

.btn {
  display: inline-block;
  border: none;
  border-radius: var(--r-sm);
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s, box-shadow 0.15s;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-lg { width: 100%; padding: 15px; font-size: 17px; }
.btn-primary {
  background: linear-gradient(180deg, #ffe27a, var(--gold-soft) 45%, var(--gold));
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(255, 204, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 10px 24px rgba(255, 204, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn-secondary {
  background: linear-gradient(180deg, var(--blue-500), var(--blue-700));
  color: var(--white);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--elev-1), var(--hi);
}
.btn-secondary:hover { filter: brightness(1.1); }
.btn-ghost {
  background: var(--glass-1);
  border: 1px solid var(--glass-brd);
  color: var(--cream);
  backdrop-filter: var(--blur-sm);
  box-shadow: var(--hi);
}
.btn-ghost:hover { background: var(--glass-2); }
.btn-ghost.danger { color: var(--bad); border-color: rgba(255, 89, 100, 0.4); }
.btn-ghost.danger:hover { background: rgba(255, 89, 100, 0.12); }

.or {
  text-align: center;
  margin: 18px 0;
  position: relative;
  color: var(--muted);
  font-size: 13px;
}
.or::before, .or::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background: var(--line);
}
.or::before { left: 0; }
.or::after { right: 0; }

.join-row { display: flex; gap: 10px; }
.code-input {
  text-transform: uppercase;
  letter-spacing: 8px;
  font-weight: 800;
  text-align: center;
  font-size: 22px !important;
  font-family: var(--clue-font);
}
.join-row .btn { flex: 0 0 auto; }

.hint {
  max-width: 460px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  line-height: 1.5;
}
.hint b { color: var(--cream); }

/* ---------------- Lobby ---------------- */
.lobby-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}
.lobby-code-card { max-width: none; text-align: center; }
.lobby-code-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.lobby-code {
  font-family: var(--clue-font);
  font-size: clamp(44px, 12vw, 58px);
  font-weight: 800;
  letter-spacing: 10px;
  margin: 6px 0 14px;
  padding: 6px 0 6px 10px;
  background: linear-gradient(180deg, #fff3c4, var(--gold) 70%, #d9a400);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.35)) drop-shadow(0 0 20px rgba(255, 204, 0, 0.3));
}
.lobby-players { margin: 18px 0; text-align: left; }
.lobby-players h3 { margin: 0 0 8px; font-size: 15px; }
.player-list { list-style: none; padding: 0; margin: 0; }
.player-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  background: var(--glass-1);
  border: 1px solid var(--glass-brd-soft);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
  font-size: 15px;
  box-shadow: var(--hi);
}
.player-list li .pi-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); flex: 0 0 auto; }
.player-list li .pi-dot.off { background: var(--muted); box-shadow: none; }
.player-list li .pi-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-list li .pi-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pi-tag.host { background: var(--gold); color: var(--ink); }
.pi-tag.you { background: var(--blue-600); color: var(--white); }
.pi-tag.score { background: transparent; color: var(--gold); font-family: var(--clue-font); font-size: 13px; }

.lobby-settings-card { max-width: none; }
.lobby-settings-card h3 { margin: 0 0 14px; }
.settings-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.field.small > span { font-size: 12px; }
.field.small { margin-bottom: 10px; }
.settings-toggles { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 18px; }
.toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  cursor: pointer;
  color: var(--cream);
  background: var(--glass-1);
  border: 1px solid var(--glass-brd-soft);
  padding: 9px 14px;
  border-radius: var(--r-pill);
  box-shadow: var(--hi);
  transition: border-color 0.15s, background 0.15s;
}
.toggle:hover { background: var(--glass-2); border-color: var(--glass-brd); }
.toggle input { width: 18px; height: 18px; accent-color: var(--gold); cursor: pointer; }
.settings.locked { opacity: 0.55; pointer-events: none; }

.msg { min-height: 20px; font-size: 14px; margin: 10px 0 0; text-align: center; }
.msg.err { color: var(--bad); }
.msg.ok { color: var(--good); }
.center { text-align: center; }
.muted { color: var(--muted); }

/* ---------------- Game board ---------------- */
.round-banner {
  text-align: center;
  font-family: var(--clue-font);
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--gold);
  font-size: clamp(18px, 3.4vw, 26px);
  margin: 2px 0 20px;
  min-height: 24px;
  text-transform: uppercase;
  text-shadow: 0 0 26px rgba(255, 204, 0, 0.35);
}

/* Modern tile grid: airy gaps, glassy category headers, glossy clue tiles. */
.board {
  display: grid;
  gap: 10px;
  max-width: 980px;
  margin: 0 auto 22px;
}
.cat-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 66px;
  padding: 10px 8px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(43, 52, 224, 0.34), rgba(9, 12, 74, 0.62));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: var(--white);
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(10px, 1.5vw, 13.5px);
  letter-spacing: 0.6px;
  line-height: 1.2;
  overflow: hidden;
  word-break: break-word;
  hyphens: auto;
  backdrop-filter: blur(4px);
}
.clue-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  border-radius: 14px;
  background: linear-gradient(165deg, var(--blue-600), var(--blue-800));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  font-family: var(--clue-font);
  font-weight: 800;
  font-size: clamp(22px, 3.2vw, 34px);
  color: var(--gold);
  cursor: default;
  transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.15s, filter 0.15s;
}
.clue-cell .cv-cur { font-size: 0.6em; vertical-align: 0.16em; opacity: 0.8; margin-right: 1px; }
.clue-cell.pickable {
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 0 0 1px rgba(255, 204, 0, 0.28);
}
.clue-cell.pickable:hover {
  transform: translateY(-3px) scale(1.025);
  filter: brightness(1.12);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), inset 0 0 0 2px var(--gold-soft), 0 0 22px rgba(255, 204, 0, 0.28);
  z-index: 2;
}
.clue-cell.pickable:active { transform: translateY(-1px) scale(1); }
.clue-cell.done {
  background: rgba(255, 255, 255, 0.022);
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  color: transparent;
}

/* ---------------- Scores ---------------- */
.scores {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.score-chip {
  min-width: 128px;
  background: linear-gradient(160deg, rgba(43, 52, 224, 0.16), rgba(9, 12, 74, 0.5));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 12px 16px;
  text-align: center;
  position: relative;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.score-chip.control {
  border-color: var(--gold);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 0 1px rgba(255, 204, 0, 0.35);
  transform: translateY(-2px);
}
.score-chip.buzzed {
  border-color: var(--good);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 0 1px rgba(55, 214, 122, 0.4);
}
.score-chip.off { opacity: 0.5; }
.score-chip .sc-name {
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--cream);
}
.score-chip .sc-val { font-family: var(--clue-font); font-size: 24px; font-weight: 800; margin-top: 3px; }
.sc-val.pos { color: var(--gold); }
.sc-val.neg { color: var(--bad); }
.score-chip .sc-badge {
  position: absolute;
  top: -8px;
  right: -6px;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  text-transform: uppercase;
}
.sc-badge.host { background: var(--gold); color: var(--ink); }
.sc-badge.control { background: var(--blue-500); color: var(--white); }

.turn-hint {
  text-align: center;
  color: var(--gold-soft);
  font-size: 15px;
  margin-top: 16px;
  min-height: 20px;
  font-weight: 600;
}

/* ---------------- Overlays ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 38%, rgba(11, 14, 107, 0.5), transparent 55%),
    rgba(3, 4, 26, 0.82);
  backdrop-filter: var(--blur-sm);
  animation: fade 0.25s ease;
}
.loading-box { text-align: center; }
.spinner {
  width: 58px;
  height: 58px;
  border: 5px solid rgba(255, 204, 0, 0.18);
  border-top-color: var(--gold);
  border-right-color: var(--gold-soft);
  border-radius: 50%;
  margin: 0 auto 18px;
  animation: spin 0.9s linear infinite;
  filter: drop-shadow(0 0 12px rgba(255, 204, 0, 0.35));
}
@keyframes spin { to { transform: rotate(360deg); } }
#loadingMsg { font-size: 18px; color: var(--cream); }

/* Clue card */
.clue-card {
  width: min(760px, 96vw);
  background:
    radial-gradient(120% 90% at 50% -20%, rgba(43, 52, 224, 0.42), transparent 60%),
    var(--glass-3);
  backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 204, 0, 0.45);
  border-radius: var(--r-xl);
  padding: 30px;
  box-shadow: var(--elev-3), 0 0 64px -12px rgba(255, 204, 0, 0.3), var(--hi-strong);
  text-align: center;
  animation: pop 0.3s cubic-bezier(0.2, 1.2, 0.4, 1);
}
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.clue-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--glass-brd);
}
.clue-cat { font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--gold); font-size: 15px; }
.clue-cat.big { font-size: 22px; display: block; margin: 6px 0 16px; }
.clue-val { font-family: var(--clue-font); font-weight: 800; color: var(--gold); font-size: 26px; text-shadow: var(--gold-glow); }
.clue-text {
  font-family: var(--clue-font);
  font-size: clamp(22px, 4.5vw, 40px);
  line-height: 1.3;
  color: var(--white);
  text-transform: uppercase;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
  margin: 12px 0 22px;
  min-height: 60px;
}
.clue-footer { min-height: 40px; }

/* Buzz button */
.buzz-btn {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  display: block;
  padding: 22px;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 2px;
  border: none;
  border-radius: var(--r-lg);
  background: radial-gradient(circle at 50% 28%, #ff8088, var(--bad) 62%, #d93b45);
  color: var(--white);
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 8px 0 #b3323b, 0 16px 30px rgba(255, 60, 70, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.05s, box-shadow 0.05s;
  animation: buzzpulse 1s ease-in-out infinite;
}
.buzz-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 #b3323b, 0 4px 10px rgba(0, 0, 0, 0.5); }
.buzz-btn:disabled { animation: none; background: linear-gradient(180deg, #4a4f80, #3a3f68); box-shadow: 0 6px 0 #2a2e55; cursor: not-allowed; color: var(--muted); }
@keyframes buzzpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }

.answer-box { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.answer-input-row { display: flex; gap: 8px; width: 100%; max-width: 460px; }
.answer-input-row input { flex: 1; }
.stt-status {
  font-size: 14px;
  color: var(--gold-soft);
  min-height: 20px;
  font-style: italic;
}
.stt-transcript { color: var(--white); font-style: normal; font-weight: 700; }
.mic-live { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); margin-right: 6px; animation: buzzpulse 0.8s infinite; }

.status-line { font-size: 18px; font-weight: 700; color: var(--cream); }
.status-line.good { color: var(--good); }
.status-line.bad { color: var(--bad); }
.reveal-answer { margin-top: 10px; font-size: 16px; color: var(--cream); }
.reveal-answer b { color: var(--gold); font-family: var(--clue-font); font-size: 20px; }
.wrong-note { color: var(--bad); font-size: 14px; margin-top: 6px; }

/* Circular "fill up" timer — the ring fills from empty to full as the
   window elapses (a visible sense of time running out), with the seconds
   remaining shown in the middle. */
.ring-timer {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
}
.ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);   /* start the fill at 12 o'clock */
}
.ring-track {
  fill: none;
  stroke: rgba(0, 0, 0, 0.35);
  stroke-width: 5;
}
.ring-fill {
  fill: none;
  stroke: var(--gold);
  stroke-width: 5;
  stroke-linecap: round;
  /* dasharray/offset are driven from JS (RingTimer) */
  transition: stroke 0.3s ease;
  filter: drop-shadow(0 0 5px rgba(255, 204, 0, 0.5));
}
.ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--clue-font);
  font-weight: 800;
  font-size: 20px;
  color: var(--cream);
}

/* Final Jeopardy */
.final-card { border-color: var(--gold); }
.final-title {
  font-family: var(--clue-font);
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--gold);
  font-size: 18px;
  margin-bottom: 4px;
}
.final-body { margin-top: 10px; }
.final-wager-row { display: flex; gap: 8px; max-width: 360px; margin: 12px auto 0; }
.final-note { font-size: 13px; color: var(--muted); margin-top: 8px; }
.final-progress { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; text-align: left; max-width: 360px; margin-left: auto; margin-right: auto; }
.final-progress .fp-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.final-progress .fp-check { color: var(--good); }
.final-progress .fp-wait { color: var(--muted); }

.final-results { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; text-align: left; }
.fr-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 11px 13px;
  background: var(--glass-1);
  border: 1px solid var(--glass-brd-soft);
  border-radius: var(--r-sm);
  box-shadow: var(--hi);
}
.fr-row.correct { border-color: var(--good); }
.fr-row.wrong { border-color: var(--bad); }
.fr-name { font-weight: 700; }
.fr-delta { font-family: var(--clue-font); font-weight: 800; }
.fr-delta.pos { color: var(--good); }
.fr-delta.neg { color: var(--bad); }
.fr-resp { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.fr-resp .fr-said { color: var(--cream); }

/* ---------------- Category vote ---------------- */
.vote-card {
  width: min(860px, 96vw);
  background:
    radial-gradient(120% 90% at 50% -20%, rgba(43, 52, 224, 0.4), transparent 60%),
    var(--glass-3);
  backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 204, 0, 0.4);
  border-radius: var(--r-xl);
  padding: 26px;
  box-shadow: var(--elev-3), 0 0 64px -14px rgba(255, 204, 0, 0.26), var(--hi-strong);
  text-align: center;
  animation: pop 0.3s cubic-bezier(0.2, 1.2, 0.4, 1);
  max-height: 92vh;
  overflow-y: auto;
}
.vote-title {
  font-family: var(--clue-font);
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--gold);
  font-size: clamp(20px, 4vw, 30px);
}
.vote-sub { color: var(--cream); opacity: 0.9; font-size: 14px; margin: 6px 0 14px; }
.vote-sub b { color: var(--gold); }
.vote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.vote-cand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 84px;
  padding: 14px 12px;
  background: var(--glass-2);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-md);
  color: var(--white);
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--elev-1), var(--hi);
  transition: transform 0.08s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.vote-cand:hover { transform: translateY(-3px); border-color: var(--gold-soft); box-shadow: var(--elev-2), var(--hi); }
.vote-cand:disabled { cursor: not-allowed; opacity: 0.75; }
.vote-cand.sel {
  border-color: var(--gold);
  background: linear-gradient(160deg, rgba(43, 52, 224, 0.45), rgba(9, 12, 74, 0.72));
  box-shadow: 0 0 0 2px rgba(255, 204, 0, 0.35), 0 10px 24px rgba(0, 0, 0, 0.45), var(--gold-glow);
}
.vote-cand .vc-title {
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(12px, 2vw, 15px);
  line-height: 1.15;
  letter-spacing: 0.4px;
}
.vote-cand .vc-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 34px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--gold);
  font-family: var(--clue-font);
  font-weight: 800;
  font-size: 14px;
}
.vote-cand .vc-check {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--ink);
  font-weight: 900;
  font-size: 14px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.vote-cand.sel .vc-check { display: flex; }
.vote-footer { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.vote-status { font-size: 14px; color: var(--gold-soft); font-weight: 600; }
.vote-progress { font-size: 13px; color: var(--muted); }
.vote-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---------------- Game over ---------------- */
.go-title {
  text-align: center;
  font-family: var(--clue-font);
  font-size: clamp(32px, 7vw, 54px);
  letter-spacing: 2px;
  margin: 20px 0 24px;
  background: linear-gradient(180deg, #fff3c4, var(--gold) 70%, #d9a400);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(255, 204, 0, 0.3));
}
.standings { max-width: 520px; margin: 0 auto 24px; padding: 0; list-style: none; counter-reset: rank; }
.standings li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  background: var(--glass-1);
  backdrop-filter: var(--blur-sm);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-md);
  margin-bottom: 10px;
  font-size: 18px;
  box-shadow: var(--elev-1), var(--hi);
}
.standings li::before {
  counter-increment: rank;
  content: counter(rank);
  font-family: var(--clue-font);
  font-weight: 800;
  font-size: 22px;
  color: var(--muted);
  width: 30px;
  text-align: center;
}
.standings li.win {
  border-color: var(--gold);
  background: linear-gradient(160deg, rgba(255, 204, 0, 0.14), rgba(9, 12, 74, 0.5));
  box-shadow: 0 0 0 2px rgba(255, 204, 0, 0.3), var(--gold-glow), var(--elev-1);
}
.standings li.win::before { color: var(--gold); }
.standings .st-name { flex: 1; font-weight: 700; }
.standings .st-score { font-family: var(--clue-font); font-weight: 800; color: var(--gold); font-size: 22px; }
.standings .crown { font-size: 22px; }

.final-recap { max-width: 520px; margin: 0 auto 24px; text-align: center; color: var(--muted); font-size: 14px; }
.go-actions { max-width: 460px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; gap: 12px; }

/* ---------------- Toasts ---------------- */
.toasts {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--glass-2);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-brd);
  color: var(--white);
  padding: 11px 20px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--elev-2), var(--hi);
  animation: toastIn 0.25s ease, toastOut 0.3s ease forwards 3.2s;
  max-width: 90vw;
}
.toast.good { border-color: var(--good); box-shadow: var(--elev-2), 0 0 18px -4px var(--good); }
.toast.bad { border-color: var(--bad); box-shadow: var(--elev-2), 0 0 18px -4px var(--bad); }
.toast.info { border-color: var(--blue-500); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(12px); } }

/* ---------------- Responsive ---------------- */
@media (max-width: 760px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .settings-row { grid-template-columns: repeat(2, 1fr); }
  .lobby-code { font-size: 46px; }
  #app { padding: 14px 10px 50px; }
  .clue-text { text-transform: none; }
  .board { gap: 6px; }
  .cat-cell { min-height: 52px; border-radius: 11px; }
  .clue-cell { min-height: 54px; border-radius: 11px; }
  .clue-card, .vote-card { padding: 20px; border-radius: var(--r-lg); }
  .clue-head { margin-bottom: 12px; padding-bottom: 10px; }
}
@media (max-width: 420px) {
  .settings-row { grid-template-columns: 1fr 1fr; }
  .score-chip { min-width: 92px; padding: 8px 10px; }
}

/* ---------------- Difficulty slider ---------------- */
.diff-label { color: var(--gold); font-weight: 800; }
.diff-slider {
  width: 100%;
  margin: 6px 0 2px;
  accent-color: var(--gold);
  cursor: pointer;
}
.diff-slider:disabled { cursor: not-allowed; opacity: 0.7; }
.diff-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ---------------- Host "End Game" button ---------------- */
.end-game-btn {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 150;             /* above overlays (100), below toasts (200) */
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--white);
  background: rgba(179, 50, 59, 0.92);
  border: 1px solid var(--bad);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
  transition: transform 0.06s, background 0.2s;
}
.end-game-btn:hover { background: var(--bad); }
.end-game-btn:active { transform: translateY(2px); }

/* ---------------- Music toggle (top bar) ---------------- */
.icon-btn.off { opacity: 0.38; filter: grayscale(1); }

/* ---------------- Per-player colour accents ---------------- */
/* --pc is set inline per player (js/main.js -> playerColor). */
.player-list li { border-left: 3px solid var(--pc, var(--line)); }
.score-chip .sc-name::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pc, var(--muted));
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 6px var(--pc, transparent);
}

/* ---------------- "Who buzzed" banner (clue overlay) ---------------- */
.clue-buzz {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: max-content;
  max-width: 92%;
  margin: 0 auto 14px;
  padding: 9px 20px;
  background: rgba(3, 4, 26, 0.55);
  border: 2px solid var(--pc, var(--gold));
  border-radius: 999px;
  font-size: clamp(16px, 3vw, 22px);
  font-weight: 800;
  color: var(--white);
  box-shadow: 0 0 18px -2px var(--pc, transparent), 0 6px 18px rgba(0, 0, 0, 0.4);
  animation: buzzbanner 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.clue-buzz .cb-name { color: var(--pc, var(--gold)); }
.clue-buzz .cb-bell { display: inline-block; transform-origin: 50% 10%; animation: bellring 0.5s ease-in-out infinite alternate; }
@keyframes bellring { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
@keyframes buzzbanner { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------------- Timer urgency (final seconds) ---------------- */
.ring-timer.urgent { animation: ringpulse 0.7s ease-in-out infinite; }
.ring-timer.urgent .ring-fill { stroke: var(--bad); filter: drop-shadow(0 0 6px rgba(255, 89, 100, 0.6)); }
.ring-timer.urgent .ring-num { color: var(--bad); }
@keyframes ringpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.09); } }

/* ---------------- Speech "keep talking" grace bar ---------------- */
.stt-countdown { width: 100%; max-width: 460px; margin: 2px auto 0; }
.stt-cd-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.stt-cd-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  transition: width 0.08s linear;
}
.stt-cd-label { font-size: 11.5px; color: var(--muted); margin-top: 4px; text-align: center; }
