/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1117;
  --bg-card:   #1a1d27;
  --bg-input:  #242736;
  --border:    #2e3245;
  --text:      #e8eaf0;
  --muted:     #6b7094;
  --accent:    #f5a623;
  --accent-dk: #c8861a;
  --green:     #3ecf8e;
  --red:       #e05252;
  --gold:      #ffd700;
  --silver:    #c0c0c0;
  --bronze:    #cd7f32;
  --radius:    12px;
  --radius-sm: 8px;
  --header-bg: var(--bg-card);
}

/* ── Corona theme ────────────────────────────────────────────────────────── */
[data-theme="corona"] {
  --bg:        #b8d8e8;
  --bg-card:   #cce4f0;
  --bg-input:  #a8ccdc;
  --border:    #88b0c8;
  --text:      #07204a;
  --muted:     #3a5e78;
  --accent:    #c8920a;
  --accent-dk: #a07408;
  --green:     #1a7a48;
  --red:       #c02828;
  --gold:      #c8920a;
}

/* Force dark text everywhere on the light corona background */
[data-theme="corona"] body  { color: #07204a; }

/* Navy header with gold accents */
[data-theme="corona"] header               { background: #07204a; border-bottom-color: #07204a; }
[data-theme="corona"] header .site-title   { color: #c8920a; }

/* Live header: navy bar — timer and event name must be readable */
[data-theme="corona"] .live-header         { background: #07204a; border-color: #07204a; }
[data-theme="corona"] .live-event-name     { color: #f0e8d0; }
[data-theme="corona"] .live-timer          { color: #c8920a; }

/* Buttons */
[data-theme="corona"] .btn--primary        { background: #07204a; color: #c8920a; }
[data-theme="corona"] .btn--ghost          { background: var(--bg-input); color: #07204a; border-color: var(--border); }
[data-theme="corona"] .drink-btn           { background: #07204a; color: #c8920a; }
[data-theme="corona"] .drink-btn:disabled  { background: var(--bg-input); color: var(--muted); }

/* Scoreboard pips */
[data-theme="corona"] .sb-pip--done                          { background: #07204a; border-color: #07204a; }
[data-theme="corona"] .scoreboard__row--done .sb-pip--done   { background: #c8920a; border-color: #c8920a; }
[data-theme="corona"] .sb-time                               { color: #1a7a48; }

/* Misc */
[data-theme="corona"] .banner--active      { border-left-color: #c8920a; }
[data-theme="corona"] .section-label       { color: #3a5e78; }
[data-theme="corona"] .spectator-note      { color: #3a5e78; }

/* ── Christmas theme ─────────────────────────────────────────────────────── */
[data-theme="christmas"] {
  --bg:        #0a1a0a;
  --bg-card:   #112211;
  --bg-input:  #1a2e1a;
  --border:    #2a442a;
  --text:      #f0ece0;
  --muted:     #7a9878;
  --accent:    #e03030;
  --accent-dk: #b82020;
  --green:     #30c850;
  --red:       #ff5050;
  --gold:      #f0c040;
  --header-bg: #0a1a0a;
}
[data-theme="christmas"] header { border-bottom-color: #e03030; }
[data-theme="christmas"] .site-title { color: #e03030; }
[data-theme="christmas"] .live-timer { color: #30c850; }
[data-theme="christmas"] .drink-btn { background: #e03030; color: #f0ece0; }
[data-theme="christmas"] .drink-btn:disabled { background: var(--bg-input); color: var(--muted); }
[data-theme="christmas"] .sb-pip--done { background: #e03030; border-color: #e03030; }
[data-theme="christmas"] .scoreboard__row--done .sb-pip--done { background: #30c850; border-color: #30c850; }
[data-theme="christmas"] .scoreboard__row--done { border-color: #30c850; }
[data-theme="christmas"] .sb-time { color: #30c850; }

/* ── Easter theme ────────────────────────────────────────────────────────── */
[data-theme="easter"] {
  --bg:        #120d1e;
  --bg-card:   #1c1430;
  --bg-input:  #261a3e;
  --border:    #3d2a60;
  --text:      #e8e0f8;
  --muted:     #8870b8;
  --accent:    #b060f0;
  --accent-dk: #9040d0;
  --green:     #40c878;
  --red:       #e04070;
  --gold:      #e8a010;
  --header-bg: var(--bg-card);
}
[data-theme="easter"] header { background: var(--bg-card); border-bottom-color: var(--border); }
[data-theme="easter"] .site-title { color: var(--accent); }
[data-theme="easter"] .live-timer { color: var(--accent); }
[data-theme="easter"] .drink-btn { background: var(--accent); color: #fff; }
[data-theme="easter"] .drink-btn:disabled { background: var(--bg-input); color: var(--muted); }
[data-theme="easter"] .btn--primary { background: var(--accent); color: #fff; }
[data-theme="easter"] .sb-pip--done { background: var(--accent); border-color: var(--accent); }
[data-theme="easter"] .scoreboard__row--done .sb-pip--done { background: var(--green); border-color: var(--green); }
[data-theme="easter"] .live-header { background: var(--bg-card); border-color: var(--border); }
[data-theme="easter"] .live-event-name { color: var(--accent); }

/* ── ØL theme ────────────────────────────────────────────────────────────── */
[data-theme="oel"] {
  --bg:        #1a0f00;
  --bg-card:   #2a1800;
  --bg-input:  #3a2400;
  --border:    #5a3c00;
  --text:      #f5e8c8;
  --muted:     #9a7040;
  --accent:    #e8a020;
  --accent-dk: #c07810;
  --green:     #50c040;
  --red:       #ff4848;
  --gold:      #f0c030;
  --header-bg: #1a0f00;
}
[data-theme="oel"] .site-title                                  { color: #e8a020; }
[data-theme="oel"] .live-timer                                  { color: #e8a020; }
[data-theme="oel"] .drink-btn                                   { background: #e8a020; color: #1a0f00; }
[data-theme="oel"] .drink-btn:disabled                          { background: var(--bg-input); color: var(--muted); }
[data-theme="oel"] .btn--primary                                { background: #e8a020; color: #1a0f00; }
[data-theme="oel"] .sb-pip--done                                { background: #e8a020; border-color: #e8a020; }
[data-theme="oel"] .scoreboard__row--done .sb-pip--done         { background: #50c040; border-color: #50c040; }
[data-theme="oel"] .scoreboard__row--done                       { border-color: #50c040; }
[data-theme="oel"] .sb-time                                     { color: #e8a020; }

/* ── Puke penalty ────────────────────────────────────────────────────────── */
.puke-badge {
  display: inline-block;
  font-size: 0.75rem;
  background: var(--bg-input);
  color: var(--muted);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.4rem;
}
.puke-badge--active { color: var(--text); }

.puke-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.2rem 0.3rem;
  border-radius: 4px;
  line-height: 1;
  filter: grayscale(1);
  opacity: 0.45;
  transition: opacity 0.15s, filter 0.15s;
}
.puke-btn:hover         { opacity: 0.7; }
.puke-btn--active       { filter: none; opacity: 1; }
.puke-btn--active:hover { opacity: 0.8; }

/* ── Theme picker (new event form) ───────────────────────────────────────── */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.theme-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.theme-card input { display: none; }
.theme-card:has(input:checked) { border-color: var(--accent); }

.theme-card__preview {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  flex-shrink: 0;
}

.theme-card--default   .theme-card__preview { background: linear-gradient(135deg, #0f1117 50%, #f5a623 50%); }
.theme-card--corona    .theme-card__preview { background: linear-gradient(135deg, #b8d8e8 50%, #07204a 50%); }
.theme-card--christmas .theme-card__preview { background: linear-gradient(135deg, #0a1a0a 50%, #e03030 50%); }
.theme-card--easter    .theme-card__preview { background: linear-gradient(135deg, #fdf8ff 50%, #9030e0 50%); }
.theme-card--oel       .theme-card__preview { background: linear-gradient(135deg, #1a0f00 50%, #e8a020 50%); }

.theme-card__logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.event-card__logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.theme-card__name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}
.theme-card:has(input:checked) .theme-card__name { color: var(--text); }

/* ── Theme accent strip on index event cards ─────────────────────────────── */
.event-card[data-event-theme="corona"]    { border-left-color: #c8920a; }
.event-card[data-event-theme="christmas"] { border-left-color: #e03030; }
.event-card[data-event-theme="easter"]    { border-left-color: #9030e0; }

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.header-logo {
  height: 44px;
  width: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Main layout ─────────────────────────────────────────────────────────── */
main {
  max-width: 540px;
  margin: 0 auto;
  padding: 1.25rem 1rem 5rem;
}

/* ── Typography ──────────────────────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; }

.section-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { opacity: 0.8; }
.btn--primary  { background: var(--accent);  color: #000; }
.btn--ghost    { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn--danger   { background: var(--red); color: #fff; }
.btn--full     { width: 100%; margin-top: 0.75rem; }
.btn--sm       { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge--live    { background: #3ecf8e22; color: var(--green); border: 1px solid var(--green); }
.badge--pending { background: #f5a62322; color: var(--accent); border: 1px solid var(--accent); }
.badge--done    { background: #6b709444; color: var(--muted);  border: 1px solid var(--border); }

/* ── Alert ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.alert--error { background: #e0525222; color: var(--red); border: 1px solid var(--red); }

/* ── Active event banner ─────────────────────────────────────────────────── */
.banner--active {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.5rem;
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

/* ── Sort bar ────────────────────────────────────────────────────────────── */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.sort-bar__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-right: 0.15rem;
}
.sort-btn {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.sort-btn--active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* ── Event list (index) ──────────────────────────────────────────────────── */
.event-list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }

.event-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  gap: 0.75rem;
}
.event-card--active { border-left: 3px solid var(--green); }
.event-card--pending { border-left: 3px solid var(--accent); }

.event-card__left { display: flex; align-items: center; gap: 0.65rem; min-width: 0; overflow: hidden; }
.event-card__info { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.event-card__name { font-weight: 600; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-card__date { font-size: 0.8rem; color: var(--muted); }
.event-card__right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* ── Form ────────────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 1.1rem; }

.form__label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}
.form__hint { font-weight: 400; }

.form__input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  padding: 0.7rem 0.9rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
.form__input:focus { border-color: var(--accent); }
.form__input--error { border-color: var(--red) !important; }
.form__textarea { resize: vertical; min-height: 140px; font-family: inherit; }

/* ── Player input list (new event form) ──────────────────────────────────── */
.player-input-list { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.5rem; }

.player-input-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.player-input-wrap { position: relative; flex: 1; }

.player-suggestions {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  z-index: 20;
  box-shadow: 0 4px 16px #0006;
  max-height: 220px;
  overflow-y: auto;
}

.player-suggestion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  font-size: 0.95rem;
}
.player-suggestion:hover { background: var(--bg-input); }
.player-suggestion__count { font-size: 0.78rem; color: var(--muted); }

.player-warning {
  font-size: 0.78rem;
  color: var(--red);
  margin: 0.2rem 0 0;
  line-height: 1.4;
}

.player-remove-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.55rem 0.4rem;
  line-height: 1;
  flex-shrink: 0;
}
.player-remove-btn:hover { color: var(--text); }

/* ── Player pick list (join page) ────────────────────────────────────────── */
.player-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }

.player-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.player-pick:active:not(.player-pick--taken) { background: var(--bg-input); }
.player-pick--taken     { opacity: 0.45; cursor: default; }
.player-pick--mine      { border-color: var(--green); background: #3ecf8e11; }
.player-pick--unclaimed { opacity: 0.5; cursor: default; }

.player-pick__body    { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.player-pick__top     { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.player-pick__name    { font-size: 1.05rem; font-weight: 600; }
.player-pick__tag     { font-size: 0.8rem; color: var(--muted); font-weight: 500; flex-shrink: 0; }
.player-pick--mine .player-pick__tag { color: var(--green); }

.player-pick__chance {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.player-pick__chance-label {
  font-size: 0.68rem;
  color: var(--muted);
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.player-pick__bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}
.player-pick__bar {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.3s ease;
}
.player-pick--mine .player-pick__bar { background: var(--green); }
.player-pick__pct {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 2.2rem;
  text-align: right;
}
.player-pick--mine .player-pick__pct { color: var(--green); }

/* ── Admin section ───────────────────────────────────────────────────────── */
.admin-section { margin-top: 1.5rem; }

.admin-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 0.5rem;
}

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

.pin-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.pin-row .form__input { flex: 1; }

/* ── Live page ───────────────────────────────────────────────────────────── */
.live-page main { padding-top: 0; }

.live-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
  max-width: 100%;
}
.live-event-name {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.live-timer {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* ── Scoreboard ──────────────────────────────────────────────────────────── */
.scoreboard {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
}
.scoreboard__loading { color: var(--muted); padding: 1rem; text-align: center; }

.scoreboard__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  transition: border-color 0.2s;
}
.scoreboard__row--me   { border-color: var(--accent); }
.scoreboard__row--done { border-color: var(--green); }

.sb-rank {
  font-size: 1rem;
  font-weight: 800;
  color: var(--muted);
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}
.sb-player { flex: 1; min-width: 0; }
.sb-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.sb-name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-name em { font-style: normal; color: var(--muted); font-size: 0.8rem; }
.sb-seed { font-size: 0.7rem; font-weight: 600; color: var(--muted); margin-left: 0.35rem; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.sb-time { font-size: 0.8rem; color: var(--green); font-weight: 700; flex-shrink: 0; }

.sb-pips {
  display: flex;
  gap: 5px;
  margin-top: 2px;
}
.sb-pip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.sb-pip--done {
  background: var(--accent);
  border-color: var(--accent);
}
.scoreboard__row--done .sb-pip--done {
  background: var(--green);
  border-color: var(--green);
}

.sb-count {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.sb-total { font-size: 0.75rem; color: var(--muted); font-weight: 500; }

/* ── Drink button ────────────────────────────────────────────────────────── */
.drink-zone {
  padding: 0.75rem 1rem 0;
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--bg) 80%, transparent);
  padding-top: 1.5rem;
}

.drink-btn {
  width: 100%;
  padding: 1.2rem;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #000;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: transform 0.1s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.drink-btn:active:not(:disabled) { transform: scale(0.97); }
.drink-btn:disabled { background: var(--bg-input); color: var(--muted); cursor: default; }

.drink-btn__icon { font-size: 1.6rem; }

.drink-progress {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 0 0.4rem;
}
.beer-pip { font-size: 1.2rem; opacity: 0.25; transition: opacity 0.2s; }
.beer-pip--done { opacity: 1; }

.spectator-note { text-align: center; color: var(--muted); padding: 1rem; font-size: 0.9rem; }

/* ── Countdown overlay ───────────────────────────────────────────────────── */
.countdown-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.countdown-number {
  font-size: 40vw;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-align: center;
}
.countdown-number--text {
  font-size: 22vw;
  line-height: 1.15;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.modal__title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal__question {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  text-align: center;
  padding: 0.5rem 0;
}

.modal__actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.25rem;
}
.modal__actions .btn { flex: 1; }

/* ── Stats page ──────────────────────────────────────────────────────────── */
.records-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.record-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.record-card__icon  { font-size: 1.4rem; }
.record-card__value { font-size: 1.15rem; font-weight: 800; }
.record-card__label { font-size: 0.75rem; color: var(--muted); }

.stats-table-wrap { overflow-x: auto; }

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.stats-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.stats-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.stats-table tbody tr:last-child td { border-bottom: none; }
.stats-table tbody tr { background: var(--bg-card); }
.stats-table tbody tr:hover { background: var(--bg-input); }

.row--gold   td:first-child { color: var(--gold); }
.row--silver td:first-child { color: var(--silver); }
.row--bronze td:first-child { color: var(--bronze); }

.td-rank { font-size: 1.1rem; width: 2.5rem; }
.td-name { font-weight: 700; }
#leaderboardTable .td-name,
#top25Table .td-name { cursor: pointer; }
#leaderboardTable .td-name:hover,
#top25Table .td-name:hover { color: var(--accent); }
.td-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.td-event { font-size: 0.82rem; }
.td-muted { color: var(--muted); }
.td-num  { text-align: center; color: var(--muted); }

.theme-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
a.theme-pill:hover { filter: brightness(1.15); }
.theme-pill--default  { background: #2e3245; color: #e8eaf0; }
.theme-pill--corona   { background: #c8920a22; color: #c8920a; border: 1px solid #c8920a55; }
.theme-pill--christmas { background: #c8281822; color: #e05252; border: 1px solid #c8281855; }
.theme-pill--easter   { background: #9b59b622; color: #c39bd3; border: 1px solid #9b59b655; }
.theme-pill--oel      { background: #e8a02022; color: #e8a020; border: 1px solid #e8a02055; }

.player-search-wrap { position: relative; }

.player-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 0.75rem;
}
.player-stat-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}
.player-stat-card__name {
  font-size: 1.2rem;
  font-weight: 800;
}
.player-stat-card__close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}
.player-stat-card__close:hover { color: var(--text); }
.player-stat-card__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.player-stat-card__stat {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.player-stat-card__val {
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.player-stat-card__lbl {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.th-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.th-sortable:hover { color: var(--text); }
.th-sort--active   { color: var(--accent) !important; }
.sort-arrow        { font-style: normal; opacity: 0.8; }

.stats-show-more {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.stats-show-more:hover { color: var(--text); border-color: var(--muted); }

.stats-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  margin-top: -0.25rem;
}

.pacing-cards { display: flex; flex-direction: column; gap: 0.75rem; }

.pacing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.pacing-card__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.pacing-card__name { font-weight: 700; font-size: 1rem; }
.pacing-card__meta { font-size: 0.78rem; color: var(--muted); }

.pacing-beers {
  display: flex;
  gap: 0.4rem;
}
.pacing-beer {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.pacing-beer__num  { font-size: 0.7rem; color: var(--muted); }
.pacing-beer__bar  {
  width: 100%;
  height: 28px;
  border-radius: 4px;
  background: var(--clr, var(--accent));
  opacity: 0.85;
}
.pacing-beer__time { font-size: 0.65rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.pacing-history {
  margin-top: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
}
.pacing-history summary {
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  padding: 0.1rem 0;
}
.pacing-history summary::-webkit-details-marker { display: none; }

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-top: 0.5rem;
}
.history-table th {
  color: var(--muted);
  text-align: left;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.history-table td {
  padding: 0.3rem 0.4rem;
}
.event-link,
.event-link:visited,
.event-link:hover,
.event-link:active {
  color: inherit;
  text-decoration: none;
}

/* ── Results ─────────────────────────────────────────────────────────────── */
.results-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }

.result-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.result-row--gold   { border-color: var(--gold);   background: #ffd70011; }
.result-row--silver { border-color: var(--silver); background: #c0c0c011; }
.result-row--bronze { border-color: var(--bronze); background: #cd7f3211; }

.result-rank  { font-size: 1.4rem; width: 2rem; text-align: center; flex-shrink: 0; line-height: 1.3; }
.result-player { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.result-name  { font-size: 1.05rem; font-weight: 700; }
.result-meta  { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; }
.result-time  { font-size: 1rem; font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }
.result-beers { font-size: 0.85rem; color: var(--muted); }

.result-splits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.result-split {
  display: inline-flex;
  align-items: stretch;
  font-variant-numeric: tabular-nums;
  background: var(--bg-input);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
.result-split__num {
  font-size: 0.72rem;
  color: #000;
  background: var(--accent);
  font-weight: 800;
  padding: 0.25rem 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  min-width: 1.4rem;
}
.result-split__time {
  padding: 0.25rem 0.45rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.08rem;
  line-height: 1;
}
.result-split__split {
  color: var(--text);
  font-weight: 700;
  font-size: 0.8rem;
}
.result-split__cumul {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 400;
}
