/* Buzzkill: styles for the host's game page. Builds on ../theme.css tokens. */

:root {
  --team-0: #4f8fe8;
  --team-0-soft: rgba(79, 143, 232, 0.18);
  --team-1: #e0566c;
  --team-1-soft: rgba(224, 86, 108, 0.18);
  --good: #68d36e;
  --bad: #e0566c;
}
:root[data-theme="light"] {
  --team-0: #2f5f9e;
  --team-0-soft: rgba(47, 95, 158, 0.16);
  --team-1: #a8364a;
  --team-1-soft: rgba(168, 54, 74, 0.16);
  --good: #3f8a46;
  --bad: #a8364a;
}

/* Buzzkill uses Figtree throughout (loaded from Google Fonts in each page). */
body.admin,
body.admin h1, body.admin h2, body.admin h3 {
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* The "u" in Buzzkill gets two buzzers: a red dome over each arm, one per team.
   Positions are in em, measured from Figtree's "u": arms centred at 0.114em and
   0.445em from the left, tops at x-height (0.5em above the baseline), and the
   inline box bottom sits 0.25em below the baseline. */
.buzzer-u { position: relative; }
.buzzer-u::before,
.buzzer-u::after {
  content: '';
  position: absolute;
  bottom: calc(0.25em + 0.5em + 0.045em);
  width: 0.2em; height: 0.1em;
  border-radius: 0.1em 0.1em 0 0;
  background: radial-gradient(circle at 38% 70%, #ff8a7a 0, #e8352b 45%, #b81d16 100%);
}
/* On a solid team-colour block (e.g. Team Huw's red banner) the red domes
   would disappear, so give them a thin white rim there. */
.status.buzzed .buzzer-u::before, .status.buzzed .buzzer-u::after {
  box-shadow: 0 0 0 0.025em #fff;
}
.buzzer-u::before { left: calc(0.114em - 0.1em); }
.buzzer-u::after { left: calc(0.445em - 0.1em); }

.team-0 { --team: var(--team-0); --team-soft: var(--team-0-soft); }
.team-1 { --team: var(--team-1); --team-soft: var(--team-1-soft); }
.team-text { color: var(--team); }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
[hidden] { display: none !important; }

/* ---------- buzzer test lights ---------- */

.test-lights { display: flex; gap: 10px; margin: 10px 0 6px; }
.light {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 48px; height: 48px; padding: 0 12px;
  border-radius: 24px;
  border: 2px solid var(--team);
  color: var(--team);
  font-weight: 700;
}
.light.on { animation: light-on 1.2s ease-out; }
@keyframes light-on {
  0% { background: var(--team); color: var(--bg); box-shadow: 0 0 30px var(--team); }
  100% { background: transparent; color: var(--team); box-shadow: none; }
}

/* ======================================================================
   Game page
   ====================================================================== */

.admin .site-bar a.site-logo { text-decoration: none; }
.bar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-btn { min-height: 26px; padding: 2px 12px; font-size: 13px; border-radius: 13px; }
.listen-pill {
  font-size: 12px; padding: 3px 10px; border-radius: 12px;
  border: 1px solid var(--border-2); color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.listen-pill.ok { border-color: var(--good); color: var(--good); }
.listen-pill.warn { border-color: var(--bad); color: var(--bad); background: var(--team-1-soft); }

.admin-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 14px;
}

.setup summary { cursor: pointer; list-style: none; }
.setup summary::-webkit-details-marker { display: none; }
.setup summary h3 { display: inline; margin: 0; }
.setup summary h3::before { content: '▸ '; }
.setup[open] summary h3::before { content: '▾ '; }
.setup[open] summary { margin-bottom: 12px; }
.setup-grid {
  display: grid; gap: 18px;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 12px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }
.field input[type="text"] + .field-label { margin-top: 6px; }
.check { display: flex; gap: 8px; align-items: center; margin: 4px 0 12px; cursor: pointer; }
#questions-status { margin: 4px 0 0; }
#questions-status.error { color: var(--bad); }

.admin-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.control { padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.control-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.control-head h3 { margin: 0; color: var(--gold); }

.question-card { min-height: 80px; overflow-wrap: anywhere; }
.question-card .q { font-size: clamp(22px, 2.4vw, 32px); line-height: 1.35; margin: 0 0 14px; }
.question-card .big { font-size: 26px; margin: 0 0 6px; }
.question-card .kicker { margin: 0 0 8px; color: var(--text-dim); font-size: 13px; }
.answer {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  background: var(--bg-2); border: 1px dashed var(--border-2);
  border-radius: 8px; padding: 12px 14px; font-size: clamp(18px, 1.8vw, 24px); font-weight: 600;
}
.answer .label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); font-weight: 600; }
.answer .note { flex-basis: 100%; font-size: 13px; font-weight: 400; color: var(--text-dim); }

.status {
  padding: 12px 14px; border-radius: 8px; font-weight: 700; font-size: 18px;
  border: 1px solid var(--border-2);
}
.status.live { color: var(--good); border-color: var(--good); }
.status.dead { color: var(--text-dim); }
.status.buzzed { background: var(--team); color: #fff; border-color: var(--team); animation: pulse 1s ease-in-out infinite; }
.status.won { color: var(--team); border-color: var(--team); background: var(--team-soft); }
@keyframes pulse { 50% { filter: brightness(1.2); } }

.bonus-num {
  flex: 0 0 auto; width: 1.8em; height: 1.8em; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gold); color: var(--primary-fg); font-weight: 800;
  font-size: clamp(16px, 2.2vw, 44px);
}
.bonus-admin { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.bonus-admin > div { flex: 1; min-width: 0; }
.bonus-admin .bonus-num {
  width: 26px; height: 26px; font-size: 14px; margin-top: 2px;
}
.marks { display: flex; flex-direction: column; gap: 10px; }
.mark-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.mark-name { font-weight: 700; color: var(--team); min-width: 120px; overflow-wrap: anywhere; }
.mark-opts { display: flex; gap: 6px; }
button.mark { min-width: 52px; font-size: 18px; font-weight: 700; }
button.mark.on { background: var(--team); border-color: var(--team); color: #fff; }

.actions:empty { display: none; }
.actions button { font-size: 16px; }
button.good { background: var(--good); border-color: var(--good); color: #10200f; }
button.good:hover:not(:disabled) { background: var(--good); filter: brightness(1.1); border-color: var(--good); }
button.bad { border-color: var(--bad); color: var(--bad); }
button.bad:hover:not(:disabled) { border-color: var(--bad); }

.nav { border-top: 1px solid var(--border); padding-top: 12px; }
.nav button { font-size: 13px; min-height: 36px; padding: 6px 12px; }

.score-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.score-row:last-child { border-bottom: 0; }
.score-name { font-weight: 600; color: var(--team); overflow-wrap: anywhere; }
.score-num { font-size: 28px; font-weight: 700; }
.score-adj { grid-column: 1 / -1; display: flex; gap: 6px; }
.score-adj button { min-height: 32px; padding: 4px 10px; font-size: 13px; }

.timer-readout { font-variant-numeric: tabular-nums; font-weight: 700; margin-left: 4px; }
.panel .row button[data-timer], #timer-stop { min-height: 36px; padding: 6px 12px; }

.soundboard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.sound { display: flex; min-width: 0; }
.sound button { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound.custom button:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.sound .remove { flex: 0 0 auto; padding: 0 10px; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; color: var(--text-dim); }
.volume { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--text-dim); font-size: 13px; }
.volume input { flex: 1; }

@media (min-width: 720px) {
  .setup-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .admin-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition: none !important; }
}
