/* 3 Noten Buzzer — one stylesheet for all three screens.
   Dark by default: these screens are used in a dark room on a stage. */

:root {
  color-scheme: dark;
  --bg: #0a0b10;
  --surface: #14161f;
  --surface-2: #1d2030;
  --line: #2b2f42;
  --text: #f2f4fb;
  --muted: #9aa1bd;
  --accent: #ff2e63;
  --accent-dark: #c3143f;
  --ok: #2fd67a;
  --warn: #ffc14d;
  --gold: #ffd166;
  --bad: #ff5c5c;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
}

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.01em; }

button {
  font: inherit;
  color: inherit;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.85rem 1.1rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:hover:not(:disabled) { background: #262a3d; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--accent-dark); }
button.gold { background: var(--gold); color: #2a1c00; }
button.gold:hover:not(:disabled) { background: #ffdb8a; }
button.gold.is-on { background: transparent; color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
button.gold.is-on:hover:not(:disabled) { background: rgba(255, 209, 102, 0.14); }
button.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
button.danger:hover:not(:disabled) { background: rgba(255, 92, 92, 0.12); }
button.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
button.ghost:hover:not(:disabled) { background: var(--surface-2); }

input[type="text"] {
  font: inherit;
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}
input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.card {
  min-width: 0;              /* let the card shrink inside its grid track */
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}

.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1.4em; font-size: 0.95rem; }
.hidden { display: none !important; }

/* connection pill (PRD §26) */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
}
.status .dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--muted);
}
.status[data-state="connected"] { color: var(--ok); }
.status[data-state="connected"] .dot { background: var(--ok); }
.status[data-state="reconnecting"] { color: var(--warn); }
.status[data-state="reconnecting"] .dot { background: var(--warn); animation: pulse 1s ease-in-out infinite; }
.status[data-state="offline"] { color: var(--bad); }
.status[data-state="offline"] .dot { background: var(--bad); }

@keyframes pulse { 50% { opacity: 0.25; } }

/* ---------------------------------------------------------------- landing */

.centered {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.panel { width: min(26rem, 100%); display: grid; gap: 1rem; }
.panel h1 { font-size: 1.7rem; }
.code-input { text-align: center; font-size: 2rem; letter-spacing: 0.4em; text-transform: uppercase; font-weight: 800; }

/* ------------------------------------------------------------ team buzzer */

.buzzer-page {
  position: fixed;      /* PRD §25: no scrolling, no rubber-banding */
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.75rem;
  padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(0.75rem, env(safe-area-inset-bottom));
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.buzzer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.95rem;
}
.buzzer-head .team-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.buzzer-stage {
  display: grid;
  /* Room for the button's side wall and drop shadow, which sit outside its box. */
  padding: 6px 6px 22px;
}

/*
 * The buzzer is a keycap: an outer body that forms the bevelled side wall, an inset
 * face with its own gloss, and a coloured wall underneath that the cap drops onto when
 * pressed. Purely cosmetic — the message is already on the wire before any of this
 * animates (PRD §25).
 */
.buzz-button {
  --lift: 18px;
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: 44px;
  overflow: hidden;   /* a drifting note can never escape onto the page background */
  background: linear-gradient(180deg, #8a1435 0%, #530819 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.10),
    inset 0 -3px 6px rgba(0, 0, 0, 0.5),
    0 var(--lift) 0 #4a0719,
    0 calc(var(--lift) + 2px) 0 #2c040f,
    0 calc(var(--lift) + 12px) 34px rgba(0, 0, 0, 0.65),
    0 0 70px rgba(255, 46, 99, 0.28);
  touch-action: manipulation;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}

/*
 * While a round is open the music is actually playing in the room, so the button says so:
 * an equaliser along the bottom and a few notes drifting up. Transform and opacity only,
 * no script and no canvas — a hundred phones run this without breaking a sweat, and it
 * cannot get between a thumb and the buzz.
 */
.buzz-eq,
.buzz-notes {
  position: absolute;
  z-index: 1;
  pointer-events: none;   /* the tap always belongs to the button */
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.buzz-eq {
  left: 12%;
  right: 12%;
  bottom: clamp(1.8rem, 8%, 4rem);
  height: clamp(2.4rem, 10vh, 4.5rem);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(0.4rem, 2.2vw, 0.85rem);
}
.buzz-eq i {
  width: clamp(0.45rem, 2.6vw, 0.95rem);
  height: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  transform-origin: bottom center;
  transform: scaleY(0.22);
}

.buzz-notes { inset: 0; }
.buzz-notes b {
  position: absolute;
  bottom: 22%;
  font-size: clamp(1.4rem, 6.5vw, 2.6rem);
  color: rgba(255, 255, 255, 0.72);
  opacity: 0;
}
.buzz-notes b:nth-child(1) { left: 14%; }
.buzz-notes b:nth-child(2) { left: 31%; }
.buzz-notes b:nth-child(3) { left: 50%; }
.buzz-notes b:nth-child(4) { left: 68%; }
.buzz-notes b:nth-child(5) { left: 84%; }

/* Only while the buzzer is live: a pressed or idle button stays quiet. */
.buzz-button.armed .buzz-eq,
.buzz-button.armed .buzz-notes { opacity: 1; }

.buzz-button.armed .buzz-eq i { animation: eq 900ms ease-in-out infinite alternate; }
.buzz-button.armed .buzz-eq i:nth-child(1) { animation-duration: 620ms; animation-delay: -420ms; }
.buzz-button.armed .buzz-eq i:nth-child(2) { animation-duration: 880ms; animation-delay: -160ms; }
.buzz-button.armed .buzz-eq i:nth-child(3) { animation-duration: 540ms; animation-delay: -700ms; }
.buzz-button.armed .buzz-eq i:nth-child(4) { animation-duration: 1010ms; animation-delay: -300ms; }
.buzz-button.armed .buzz-eq i:nth-child(5) { animation-duration: 700ms; animation-delay: -540ms; }
.buzz-button.armed .buzz-eq i:nth-child(6) { animation-duration: 830ms; animation-delay: -80ms; }
.buzz-button.armed .buzz-eq i:nth-child(7) { animation-duration: 600ms; animation-delay: -620ms; }

.buzz-button.armed .buzz-notes b { animation: float-note 3.6s ease-in-out infinite; }
.buzz-button.armed .buzz-notes b:nth-child(1) { animation-delay: 0s; }
.buzz-button.armed .buzz-notes b:nth-child(2) { animation-delay: 0.7s; }
.buzz-button.armed .buzz-notes b:nth-child(3) { animation-delay: 1.4s; }
.buzz-button.armed .buzz-notes b:nth-child(4) { animation-delay: 2.1s; }
.buzz-button.armed .buzz-notes b:nth-child(5) { animation-delay: 2.8s; }

@keyframes eq {
  from { transform: scaleY(0.18); }
  to   { transform: scaleY(1); }
}

@keyframes float-note {
  0%   { transform: translateY(0) rotate(-8deg); opacity: 0; }
  15%  { opacity: 0.8; }
  70%  { opacity: 0.5; }
  100% { transform: translateY(-11rem) rotate(10deg); opacity: 0; }
}

/* The cap face. */
.buzz-button::before {
  content: "";
  position: absolute;
  inset: 12px 12px 17px;
  border-radius: 36px;
  background:
    radial-gradient(115% 52% at 50% -6%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 62%),
    radial-gradient(80% 45% at 50% 108%, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0) 60%),
    linear-gradient(180deg, #ff5f87 0%, var(--accent) 44%, #d81b4c 100%);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.55),
    inset 0 -14px 26px rgba(0, 0, 0, 0.22),
    0 3px 7px rgba(0, 0, 0, 0.4);
  transition: filter 80ms ease-out, box-shadow 80ms ease-out;
}

.buzz-label {
  position: relative;
  z-index: 1;
  font-size: clamp(3rem, 21vw, 9rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 0 rgba(120, 6, 34, 0.55), 0 6px 22px rgba(0, 0, 0, 0.35);
}

.buzz-button.armed { animation: ready 2.4s ease-in-out infinite; }

.buzz-button:active,
.buzz-button.pressed {
  --lift: 4px;
  transform: translateY(14px);
  animation: none;
}
.buzz-button:active::before,
.buzz-button.pressed::before {
  filter: brightness(0.85) saturate(1.12);
  box-shadow:
    inset 0 22px 34px rgba(0, 0, 0, 0.45),
    inset 0 -8px 18px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.buzz-button:focus-visible { outline: 4px solid #fff; outline-offset: 8px; }
.buzz-button:disabled { opacity: 1; }

@keyframes ready {
  0%, 100% { box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.10),
      inset 0 -3px 6px rgba(0, 0, 0, 0.5),
      0 var(--lift) 0 #4a0719,
      0 calc(var(--lift) + 2px) 0 #2c040f,
      0 calc(var(--lift) + 12px) 34px rgba(0, 0, 0, 0.65),
      0 0 55px rgba(255, 46, 99, 0.22); }
  50% { box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.10),
      inset 0 -3px 6px rgba(0, 0, 0, 0.5),
      0 var(--lift) 0 #4a0719,
      0 calc(var(--lift) + 2px) 0 #2c040f,
      0 calc(var(--lift) + 12px) 34px rgba(0, 0, 0, 0.65),
      0 0 120px rgba(255, 46, 99, 0.6); }
}

@media (prefers-reduced-motion: reduce) {
  .buzz-button, .buzz-button.armed { animation: none; transition: none; }
  /* The bars stay, frozen at a readable height: still says "audio", without the motion. */
  .buzz-button.armed .buzz-eq i { animation: none; transform: scaleY(0.6); }
  .buzz-notes { display: none; }
}

/* Every non-armed state uses the same slab so the layout never shifts. */
.slab {
  display: grid;
  place-content: center;
  text-align: center;
  gap: 0.6rem;
  border-radius: 40px;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 60%),
    var(--surface);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 14px 34px rgba(0, 0, 0, 0.45);
  padding: 1.5rem;
}
.slab .headline { font-size: clamp(1.5rem, 7vw, 2.6rem); font-weight: 900; line-height: 1.1; }
.slab .time { font-size: clamp(2.4rem, 15vw, 5rem); font-weight: 900; color: var(--ok); font-variant-numeric: tabular-nums; }
.slab.buzzed { box-shadow: inset 0 0 0 2px var(--ok), inset 0 14px 34px rgba(0, 0, 0, 0.45), 0 0 60px rgba(47, 214, 122, 0.16); }
/* ---------------------------------------------------------------- avatars */

/* A real photo, cropped to a circle. The background shows through as a fallback
   glyph when a team never took one. */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2) center/cover no-repeat;
  box-shadow: inset 0 0 0 2px var(--line);
  overflow: hidden;
  font-size: 0.9em;
  line-height: 1;
  user-select: none;
}
.avatar[data-empty="false"] { color: transparent; box-shadow: inset 0 0 0 2px var(--line); }

.avatar-xs { width: 1.6rem; height: 1.6rem; font-size: 0.7rem; }
.avatar-sm { width: 2.1rem; height: 2.1rem; padding: 0; border: 0; }
.avatar-lg { width: 4.5rem; height: 4.5rem; font-size: 1.6rem; }
.avatar-xl { width: clamp(6.5rem, 34vw, 11rem); height: clamp(6.5rem, 34vw, 11rem); }

.avatar.gold { box-shadow: inset 0 0 0 3px var(--gold), 0 0 44px rgba(255, 209, 102, 0.45); }

/*
 * The winning photo, shown whole. `contain` rather than `cover` on purpose: a group shot
 * cropped to a circle loses whoever stood on the ends, and this is the one place the
 * picture is the point.
 */
.photo-hero {
  display: block;
  width: min(88%, 26rem);
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  background: #05060a center/contain no-repeat;
  box-shadow: inset 0 0 0 3px var(--gold), 0 0 50px rgba(255, 209, 102, 0.4);
}
.photo-hero-sm { width: min(64%, 15rem); }

/* The winner's face lands with a little weight rather than just appearing. */
.avatar.pop,
.photo-hero.pop { animation: pop-in 620ms cubic-bezier(0.16, 1.2, 0.3, 1) both; }
@keyframes pop-in {
  0%   { transform: scale(0.2) rotate(-14deg); opacity: 0; }
  60%  { transform: scale(1.08) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Photo control on the join form. */
.photo-picker {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  text-align: left;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 0.7rem 0.9rem;
}
.photo-picker:hover { background: var(--surface-2); }
.photo-picker-text { display: grid; gap: 0.1rem; min-width: 0; }
.photo-picker-text small { font-weight: 500; }

#my-avatar { cursor: pointer; box-shadow: inset 0 0 0 2px var(--line); }

/* End-of-quiz scoreboard, on every phone at once. */
.slab.finale {
  grid-template-rows: auto minmax(0, 1fr);
  place-content: stretch;
  gap: 1rem;
  padding: 1.25rem 1rem;
  box-shadow: inset 0 0 0 2px var(--gold), inset 0 14px 34px rgba(0, 0, 0, 0.45), 0 0 90px rgba(255, 209, 102, 0.18);
}
.slab.finale .finale-head { display: grid; gap: 0.5rem; justify-items: center; }
.slab.finale .headline { font-size: clamp(1.3rem, 6vw, 2.2rem); color: var(--gold); }
.slab.finale .trophy { font-size: clamp(2.5rem, 12vw, 4rem); line-height: 1; }

/* The one place the buzzer screen scrolls: a long list of teams has to be reachable. */
.standings-list {
  list-style: none;
  margin: 0;
  padding: 0 0.25rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  gap: 0.15rem;
  align-content: start;
  text-align: left;
}
.standings-list li {
  display: grid;
  grid-template-columns: 1.5rem 1.7rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.standings-list li .place { font-weight: 900; color: var(--muted); }
.standings-list li .who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standings-list li .points { font-weight: 900; font-size: 1.1rem; }
.standings-list li.is-winner { background: rgba(255, 209, 102, 0.14); }
.standings-list li.is-winner .place,
.standings-list li.is-winner .points { color: var(--gold); }
.standings-list li.is-me { box-shadow: inset 0 0 0 1px var(--line); }
.standings-list li.is-me .who::after { content: " — jullie"; color: var(--muted); font-weight: 600; }

/* Round result, shown between closing a round and opening the next one. */
.slab.celebrate {
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px var(--gold), inset 0 14px 34px rgba(0, 0, 0, 0.45), 0 0 90px rgba(255, 209, 102, 0.22);
}
.slab.celebrate .headline { color: var(--gold); }
.slab.celebrate .trophy { font-size: clamp(3.5rem, 20vw, 7rem); line-height: 1; animation: trophy 1.6s ease-in-out infinite; }
.slab.celebrate .trophy.small { font-size: clamp(2rem, 9vw, 3rem); animation: none; }

.slab.result .winner-name {
  font-size: clamp(1.8rem, 9vw, 3.4rem);
  font-weight: 900;
  line-height: 1.1;
  color: var(--gold);
  word-break: break-word;
}

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.confetti i {
  position: absolute;
  top: -12%;
  width: 0.6rem;
  height: 0.95rem;
  border-radius: 2px;
  opacity: 0;
  animation: fall linear infinite;
}

@keyframes trophy {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-10px) rotate(4deg); }
}
@keyframes fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  8% { opacity: 1; }
  100% { transform: translateY(115vh) rotate(720deg); opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
  .slab.celebrate .trophy { animation: none; }
}

.slab.offline { box-shadow: inset 0 0 0 2px var(--bad), inset 0 14px 34px rgba(0, 0, 0, 0.45); }

.buzzer-foot { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }

/* ----------------------------------------------------------------- admin */

.admin {
  max-width: 88rem;
  margin: 0 auto;
  padding: 1.25rem;
  display: grid;
  gap: 1.25rem;
}

.admin-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.round-title { font-size: clamp(1.5rem, 3.5vw, 2.4rem); }
.round-title .state { color: var(--accent); }
.round-title[data-state="active"] .state { color: var(--ok); }
.round-title[data-state="closed"] .state { color: var(--warn); }
.round-sub { color: var(--muted); font-weight: 700; margin-top: 0.15rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.actions .primary { font-size: 1.05rem; padding: 0.95rem 1.6rem; }

.admin-grid {
  display: grid;
  grid-template-columns: minmax(15rem, 18rem) minmax(0, 1.7fr) minmax(15rem, 1.1fr);
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 1100px) { .admin-grid { grid-template-columns: 1fr; } }

.card h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 0.85rem; }

.join-card { text-align: center; display: grid; gap: 0.75rem; }
.join-card img { width: 100%; max-width: 15rem; margin: 0 auto; border-radius: 10px; background: #fff; padding: 8px; image-rendering: pixelated; }
.join-code { font-size: clamp(2.5rem, 6vw, 3.6rem); font-weight: 900; letter-spacing: 0.22em; text-indent: 0.22em; }
.join-url { font-size: 1.05rem; font-weight: 700; color: var(--accent); word-break: break-all; }

table { width: 100%; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); padding-bottom: 0.5rem; font-weight: 700; }
td { padding: 0.5rem 0.35rem; border-top: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; }
td.name { white-space: nowrap; }
td.name .with-avatar { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
td.name .with-avatar span:last-child { overflow: hidden; text-overflow: ellipsis; }
td.num, th.num { text-align: right; }
tr.fresh td { animation: flash 700ms ease-out; }
@keyframes flash { from { background: rgba(255, 46, 99, 0.28); } }

.rank { font-weight: 900; color: var(--muted); }
.rank.first { color: var(--accent); }
.time-cell { font-weight: 800; font-size: 1.05rem; }
.badge {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 193, 77, 0.16);
  color: var(--warn);
}

/* Judging the answer — the action the quizmaster reaches for after every song. */
.verdict-cell { display: flex; align-items: center; justify-content: flex-end; gap: 0.3rem; }

.verdict-btn {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.verdict-btn.go-good { color: #06301a; background: var(--ok); padding: 0.35rem 0.75rem; }
.verdict-btn.go-good:hover:not(:disabled) { background: #58e39a; }
.verdict-btn.go-bad { color: var(--bad); background: transparent; box-shadow: inset 0 0 0 1px var(--bad); padding: 0.35rem 0.75rem; }
.verdict-btn.go-bad:hover:not(:disabled) { background: rgba(255, 92, 92, 0.14); }
.verdict-btn.is-correct { color: #2a1c00; background: var(--gold); }
.verdict-btn.is-correct:hover { background: #ffdb8a; }
.verdict-btn.is-wrong { color: var(--bad); background: rgba(255, 92, 92, 0.12); font-weight: 700; }
.verdict-btn.is-waiting { background: transparent; color: var(--muted); font-weight: 600; opacity: 0.55; }
.verdict-btn.is-waiting:disabled { cursor: default; }

tr.is-turn td { background: rgba(255, 255, 255, 0.045); }
tr.is-turn td:first-child { box-shadow: inset 3px 0 0 var(--text); }
tr.is-turn td.name { font-weight: 800; }
tr.is-wrong td { opacity: 0.45; }
tr.is-wrong td.name { text-decoration: line-through; }

.winner-line.is-turn { color: var(--text); }

/* Legacy star control, kept for the standings row. */
.winner-btn {
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
  color: var(--gold);
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.4);
  white-space: nowrap;
}
.winner-btn:hover:not(:disabled) { background: rgba(255, 209, 102, 0.14); }
.winner-btn.is-winner {
  color: #2a1c00;
  background: var(--gold);
  box-shadow: none;
  padding: 0.35rem 0.7rem;
}
.winner-btn.is-winner:hover { background: #ffdb8a; }

tr.is-winner td { background: rgba(255, 209, 102, 0.09); }
tr.is-winner td:first-child { box-shadow: inset 3px 0 0 var(--gold); }

.winner-line {
  margin-top: 0.35rem;
  font-weight: 800;
  color: var(--gold);
}

.finale-line {
  margin-top: 0.2rem;
  font-weight: 800;
  color: var(--gold);
}

.score-cell { display: flex; align-items: center; justify-content: flex-end; gap: 0.3rem; }
.score-value { min-width: 1.4rem; text-align: right; font-weight: 900; font-size: 1.05rem; }
.score-btn { padding: 0.3rem 0.5rem; border-radius: 9px; font-size: 0.85rem; line-height: 1; background: var(--surface-2); }

.team-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0; border-top: 1px solid var(--line); }
.team-row:first-child { border-top: 0; }
.team-row .name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-row .avatar { margin-right: -0.15rem; }
.team-row .dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--bad); flex: none; }
.team-row[data-connected="true"] .dot { background: var(--ok); }
.team-row .buzzed { font-size: 0.7rem; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }

.empty { color: var(--muted); padding: 0.75rem 0; font-size: 0.95rem; }
.footnote { color: var(--muted); font-size: 0.8rem; text-align: center; padding-bottom: 1rem; }


/* ---------------------------------------------------------------- dialogs */

dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 1.5rem;
  width: min(24rem, calc(100vw - 2rem));
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), inset 0 0 0 1px var(--line);
}
dialog::backdrop { background: rgba(4, 5, 10, 0.72); }
.dialog-title { font-size: 1.3rem; margin-bottom: 0.5rem; }
.dialog-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.dialog-actions .ghost:first-child { margin-right: auto; }

.join-actions { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.button-link {
  display: inline-block;
  text-decoration: none;
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--line);
}
.button-link:hover { background: var(--surface-2); }

/* ------------------------------------------------------------ print sheet */

/* Printed on white regardless of the console's dark theme — it has to survive a
   cheap inkjet and be readable across a noisy room. */
.print-body { background: #f4f5f8; color: #101018; }

.print-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.25rem;
  background: var(--bg);
  color: var(--text);
}
.print-choice { display: flex; gap: 0.5rem; }
.print-choice .ghost.is-active { background: var(--accent); box-shadow: none; color: #fff; }

.sheet { margin: 1.5rem auto; display: grid; gap: 8mm; }
.sheet.poster { width: 210mm; grid-template-columns: 1fr; }
.sheet.cards { width: 210mm; grid-template-columns: 1fr 1fr; }

.qr-card {
  background: #fff;
  color: #101018;
  border: 1px dashed #b9bdcc;
  border-radius: 6px;
  padding: 10mm 6mm;
  text-align: center;
  display: grid;
  gap: 3mm;
  justify-items: center;
  break-inside: avoid;
}
.sheet.poster .qr-card { min-height: 265mm; align-content: center; gap: 8mm; border-style: none; }

.qr-kicker { margin: 0; font-weight: 800; letter-spacing: 0.28em; font-size: 0.7rem; color: #6a7086; }
.qr-lead { margin: 0; font-weight: 800; font-size: 1.1rem; }
.qr-image { width: 46mm; height: auto; image-rendering: pixelated; }
.qr-code { margin: 0; font-weight: 900; font-size: 2rem; letter-spacing: 0.2em; text-indent: 0.2em; }
.qr-url { margin: 0; font-weight: 700; font-size: 0.95rem; color: #3c4256; word-break: break-all; }
.qr-foot { margin: 0; font-size: 0.75rem; color: #6a7086; }

.sheet.poster .qr-kicker { font-size: 1.2rem; }
.sheet.poster .qr-lead { font-size: 3rem; }
.sheet.poster .qr-image { width: 120mm; }
.sheet.poster .qr-code { font-size: 6rem; }
.sheet.poster .qr-url { font-size: 1.6rem; }
.sheet.poster .qr-foot { font-size: 1.05rem; }

@page { size: A4 portrait; margin: 10mm; }

@media print {
  .print-bar { display: none; }
  .print-body { background: #fff; }
  .sheet { margin: 0; width: auto; gap: 6mm; }
  .sheet.poster .qr-card { min-height: 250mm; }
  .qr-card { border-color: #ccc; }
}
