:root {
  /* Marke (bleibt dynamisch je Usergroup überschreibbar, siehe header.ejs) */
  --primary: #126b5e;
  --secondary: #f0b429;

  /* Semantische Basisfarben */
  --color-bg: #f7f8fa;
  --color-surface: #ffffff;
  --color-surface-muted: #f1f4f8;
  --color-text: #17202a;
  --color-text-muted: #667085;
  --color-border: #7f8d9c; /* WCAG 1.4.11: >=3:1 gegen weiß/--color-bg/--color-surface-muted (vorher #d9dee7 lag bei ~1.3:1) */
  --color-success: #067647;
  --color-success-bg: #ecfdf3;
  --color-warning: #93590a;
  --color-warning-bg: #fef6e7;
  --color-danger: #b42318;
  --color-danger-bg: #fef3f2;
  --color-info: #175cd3;
  --color-info-bg: #eff6ff;
  --color-focus-ring: #126b5e;

  /* Rückwärtskompatible Aliasnamen (im gesamten CSS/EJS bereits verwendet) */
  --bg: var(--color-bg);
  --ink: var(--color-text);
  --muted: var(--color-text-muted);
  --line: var(--color-border);
  --panel: var(--color-surface);

  /* Abstandsraster */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Radien */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-pill: 999px;

  color-scheme: light;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}
h1, h2, h3 { line-height: 1.25; font-weight: 700; }
p { line-height: 1.55; }
a { color: var(--primary); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }

/* Sichtbarer Fokusring für Tastaturbedienung (Buttons, Links, Formularfelder, Chips) */
a:focus-visible,
button:focus-visible,
.button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Buttons: .btn ist die primäre Klasse, bestehende Klassen (button/ghost/danger/
   linklike/btn-small) bleiben als Aliase erhalten, damit keine View geändert werden muss. */
button, .button, .btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  padding: 0 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
button:disabled, .button:disabled, .btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
button.ghost, .button.ghost, .btn-secondary {
  background: var(--color-surface);
  color: var(--primary);
  border-color: var(--color-border);
}
.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
button.danger, .btn-danger { background: var(--color-danger); color: #fff; }
button.linklike {
  min-height: 30px;
  padding: 0 8px;
  background: var(--color-surface-muted);
  color: #344054;
  font-size: .85rem;
  font-weight: 600;
}
button.btn-small, .button.btn-small, .btn-sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: .85rem;
  font-weight: 600;
  background: var(--color-surface-muted);
  color: #344054;
}
button.btn-small.danger, .button.btn-small.danger { background: #f6e4e1; color: var(--color-danger); }
.btn-icon { min-width: 40px; padding: 0; }
.btn-icon.btn-sm { min-width: 32px; }

input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font: inherit;
  background: #fff;
  color: var(--color-text);
}
textarea { min-height: 88px; resize: vertical; }
label { display: grid; gap: 6px; font-weight: 600; color: #344054; }
.field-hint { margin: 2px 0 0; font-size: .85rem; color: var(--color-text-muted); font-weight: 400; }
.required-mark { color: var(--color-danger); }
fieldset { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-4); margin: 0; }
fieldset legend { padding: 0 var(--space-2); font-weight: 700; }
.checkbox-group { display: grid; gap: var(--space-2); }

table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--color-border); text-align: left; vertical-align: top; }
th { color: #475467; background: var(--color-surface-muted); font-size: .9rem; font-weight: 600; }
tr:nth-child(even) td { background: #fbfcfd; }

/* Leerzustände (für Tabellen/Listen ohne Einträge) */
.empty-state {
  display: grid;
  gap: var(--space-2);
  justify-items: start;
  padding: var(--space-6) var(--space-4);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  background: var(--color-surface-muted);
}
.empty-state strong { color: var(--color-text); font-size: 1.05rem; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 10px clamp(14px, 4vw, 34px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  font-size: 1.1rem;
  font-weight: 700;
}
.brand img { width: 38px; height: 38px; object-fit: contain; }

.nav-toggle {
  display: none;
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  background: var(--color-surface-muted);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav-group-label {
  color: var(--color-text-muted);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: 2px;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: #344054;
  font-size: .95rem;
  font-weight: 600;
}
.site-nav a:hover { background: var(--color-surface-muted); text-decoration: none; }
.site-nav a.is-active, .site-nav a[aria-current="page"] {
  background: var(--color-surface-muted);
  color: var(--primary);
}
.site-nav form { margin: 0; }

.account-menu { position: relative; }
.account-menu > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-size: .9rem;
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu[open] > summary { background: var(--color-surface-muted); }
.account-menu-panel {
  display: grid;
  gap: 4px;
  padding: 8px;
  margin-top: 6px;
}
.account-menu-panel a, .account-menu-panel form { width: 100%; }
.account-menu-panel button { width: 100%; }

@media (min-width: 901px) {
  .account-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 20px rgba(23, 32, 42, .1);
    z-index: 20;
  }
}
.page { width: min(1480px, 100%); margin: 0 auto; padding: 22px clamp(12px, 3vw, 30px) 60px; }
.headline {
  display: grid;
  gap: 8px;
  margin: 8px 0 22px;
}
.headline h1, .panel h1 { margin: 0; font-size: clamp(1.7rem, 2.8vw, 3rem); }
.headline p, .panel p { margin: 0; color: var(--muted); }
.panel, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
}
.panel h2, .card h2 { margin: 0 0 14px; font-size: 1.25rem; }
.narrow { max-width: 480px; margin: 40px auto; }
.grid { display: grid; gap: 14px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { display: grid; gap: 10px; align-content: start; }
.card-logo { width: 64px; height: 64px; object-fit: contain; }
.hero-logo { width: 96px; max-height: 96px; object-fit: contain; }
.mini-logo { width: 42px; height: 42px; object-fit: contain; }
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, .8fr);
  gap: 16px;
  align-items: start;
}
.form { display: grid; gap: 12px; }
.compact-form {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 10px 0;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.compact-form label:has(textarea), .compact-form button { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 18px; min-height: 18px; }
.row-form, .inline-form, .score-form, .actions, .quick {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.row-form { margin-bottom: 14px; }
.row-form > * { flex: 1 1 160px; }
.score-form input { width: 58px; min-height: 34px; padding: 6px; }
.score-form button { min-height: 34px; }
.score-form.is-correction { justify-content: flex-start; }
.score-form button.btn-change { margin-left: auto; min-height: 28px; }
.hint { color: var(--color-danger); font-size: .85rem; margin: 4px 0 0; }
.hint.hint-neutral { color: var(--color-text-muted); }
.group-standings { display: grid; gap: 10px; margin-top: 14px; }
.group-standings details { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.compact-check {
  display: inline-flex;
  min-height: 34px;
  gap: 6px;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-size: .88rem;
  white-space: nowrap;
}
.compact-check input {
  width: 16px;
  min-height: 16px;
}
.membership-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 10px;
}
.membership-list .compact-check { gap: 8px; }
.membership-list .inline-form { margin: 0; }
.membership-list button.btn-small { min-height: 32px; min-width: 32px; padding: 0 8px; line-height: 1; }
.player-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
.player-chip-grid .chip-form { margin: 0; }
.player-chip {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--ink);
  font-weight: 700;
  border: 1px solid var(--line);
}
.player-chip:hover { background: #e2e8f0; }
.player-chip.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.table-wrap table { border: 0; }

/* Responsives Listenmuster: Desktop bleibt tabellarisch, auf schmalen
   Screens wird jede Zeile zu einer gestapelten Karte (Label/Wert-Paare
   über data-label). Kein Inhalt geht verloren, nur horizontales Scrollen
   entfällt für die damit markierten Tabellen. */
@media (max-width: 640px) {
  .table-wrap.responsive-cards { border: 0; overflow: visible; }
  .responsive-cards table { min-width: 0; }
  .responsive-cards thead { display: none; }
  .responsive-cards tr {
    display: block;
    margin-bottom: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    background: var(--color-surface);
  }
  .responsive-cards tr:nth-child(even) td { background: transparent; }
  .responsive-cards td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 6px 2px;
    border-bottom: 1px solid var(--color-surface-muted);
    text-align: right;
  }
  .responsive-cards td:last-child { border-bottom: 0; flex-wrap: wrap; justify-content: flex-end; }
  .responsive-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-text-muted);
    text-align: left;
    padding-right: var(--space-2);
  }
  .responsive-cards td:empty::before { content: none; }
  /* Kritische (destruktive/bestätigungspflichtige) Aktionen brauchen auf
     Touchgeräten mindestens 44x44px, auch wenn sie sonst als kleinerer
     Button dargestellt sind. */
  .responsive-cards .actions button,
  .responsive-cards .actions .button {
    min-height: 44px;
  }
}
@media (max-width: 640px) {
  .membership-list button.btn-small,
  .btn-critical {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Rein clientseitige Such-/Filterleiste über bereits gerenderten Tabellen. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.filter-bar input, .filter-bar select {
  width: auto;
  min-width: 160px;
  flex: 1 1 180px;
}
.filter-bar .field-hint { flex-basis: 100%; margin: 0; }
[data-filter-row].is-filtered-out { display: none; }
.ranking-table td, .ranking-table th { white-space: nowrap; }
.ranking-table td:nth-child(2), .ranking-table th:nth-child(2) { white-space: normal; min-width: 180px; }
.rank-out td { color: #98a2b3; }
/* Einheitliches Badge-System für Turnier-, Teilnehmer-, Zahlungs-, Check-in-,
   Match- und Benutzerstatus. .status-active/.status-out bleiben als bestehende
   Klassen erhalten; .badge-* sind die neuen, breiter nutzbaren Varianten. */
.status-pill, .badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-active, .badge-success { background: var(--color-success-bg); color: var(--color-success); }
.status-out, .badge-neutral { background: var(--color-surface-muted); color: var(--color-text-muted); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-info { background: var(--color-info-bg); color: var(--color-info); }
details {
  margin: 8px 0;
}
summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--primary);
  margin: 4px 0 8px;
}
.machine-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.machine-checks p { width: 100%; margin: 0; color: var(--muted); }
.section-head, .bracket-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h2, .bracket-section-head h3 { margin: 0; }
.section-head p, .bracket-section-head span {
  margin: 3px 0 0;
  color: var(--muted);
  font-weight: 600;
}
.draw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.draw-actions form { margin: 0; }

/* Lokale Tabs (Turnier-Detailseite u. ä.). Ohne JavaScript sind es einfache
   Anker-Links und alle .tab-panel-Abschnitte bleiben sichtbar/erreichbar. */
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0 0 var(--space-5);
  padding-bottom: 2px;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
}
.tab-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-4);
  border-bottom: 3px solid transparent;
  color: var(--color-text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.tab-link:hover { color: var(--color-text); text-decoration: none; }
.tab-link.is-active, .tab-link[aria-selected="true"] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-panel { scroll-margin-top: 84px; margin-bottom: var(--space-5); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

dialog.confirm-dialog {
  border: 0;
  border-radius: var(--radius-md);
  padding: 0;
  max-width: 440px;
  width: calc(100% - 32px);
}
dialog.confirm-dialog::backdrop { background: rgba(23, 32, 42, .5); }
.confirm-dialog-body { display: grid; gap: var(--space-4); padding: var(--space-5); }
.confirm-dialog-body h2 { margin: 0; font-size: 1.15rem; }
.confirm-dialog-body p { margin: 0; color: var(--color-text); }
.confirm-dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; }
.bracket-board-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.bracket-jump {
  display: flex;
  justify-content: flex-end;
  padding: 10px 14px;
  background: #f7f8fa;
  border-bottom: 1px solid var(--line);
}
.bracket-jump .button { min-height: 44px; }
.bracket-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) 18px;
  background: #f7f8fa;
  border-bottom: 1px solid var(--line);
  font-size: .85rem;
  font-weight: 600;
  color: #475467;
}
.bracket-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.bracket-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 2px solid #555;
  background: #fff;
  display: inline-block;
}
.bracket-scroll-hint {
  padding: 6px 18px;
  font-size: .8rem;
  color: var(--muted);
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
}
.bracket-scroll-hint::before { content: "\2194︎ "; }
.bracket-board.stacked {
  display: flex;
  flex-direction: column;
  background: #fbfcfd;
}
.bracket-lane {
  display: grid;
  grid-template-rows: auto 1fr;
  border-bottom: 1px solid var(--line);
}
.bracket-lane:last-child { border-bottom: 0; }
.bracket-rounds-graph { overflow-x: auto; }
.bracket-lane-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 18px 8px;
  background: #f7f8fa;
}
.bracket-lane-head h3 {
  margin: 0;
  color: #667085;
  font-size: clamp(1.35rem, 2.4vw, 2.15rem);
  font-weight: 400;
}
.bracket-lane-head span {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.bracket-rounds {
  display: flex;
  gap: 0;
  overflow: visible;
  padding: 0;
}
.bracket-round {
  min-width: 238px;
  display: grid;
  align-content: start;
  gap: 0;
  padding: 0 18px 18px;
  border-right: 1px solid #eef1f5;
}
.bracket-round:last-child { border-right: 0; }
.graph-round > strong {
  display: block;
  margin: 0 -18px 18px;
  padding: 9px 18px 12px;
  color: #7a7f87;
  background: #f7f8fa;
  border-bottom: 1px solid #eef1f5;
  font-size: clamp(1.1rem, 2vw, 1.65rem);
  font-weight: 400;
  white-space: nowrap;
}
.graph-round-stack {
  position: relative;
  display: grid;
  gap: 22px;
  align-content: space-around;
  min-height: 100%;
}
.graph-round:not(:last-child) .graph-match::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -19px;
  width: 18px;
  border-top: 2px solid #555;
}
.graph-round:not(:first-child) .graph-match::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -19px;
  width: 18px;
  border-top: 2px solid #555;
}
.match-card {
  position: relative;
  display: grid;
  gap: 0;
  padding: 0;
  border: 2px solid #555;
  border-left: 2px solid #555;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}
.match-card.assigned, .match-card.running { border-color: #c48a00; }
.match-card.completed, .match-card.corrected { border-color: #555; }
.match-card.blocked_player_busy { border-color: #b42318; }
.match-card.waiting_for_machine { border-color: #c96f00; }
.match-card span {
  padding: 4px 7px;
  color: #475467;
  font-size: .76rem;
  font-weight: 700;
  border-bottom: 1px solid #cfd4dc;
  background: #f8fafc;
}
.match-card b {
  overflow-wrap: anywhere;
}
.match-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-height: 32px;
  padding: 4px 7px;
  border-radius: 0;
}
.match-side + .match-side {
  border-top: 1px solid #cfd4dc;
}
.match-side.winner-side {
  background: #e8ecef;
  color: #111827;
  font-weight: 700;
}
.match-side em {
  min-width: 30px;
  padding: 0 0 0 8px;
  border-radius: 0;
  background: transparent;
  color: #111827;
  font-style: normal;
  font-weight: 700;
  text-align: center;
}
.draw-stage {
  display: grid;
  gap: 18px;
}
.draw-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.draw-stage-head h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.5rem);
}
.draw-stage-head p { margin: 4px 0 0; color: var(--muted); font-weight: 700; }
.draw-screen {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(320px, 1.4fr);
  gap: 18px;
  align-items: stretch;
  min-height: 480px;
  padding: clamp(16px, 3vw, 34px);
  border-radius: 8px;
  background: #111827;
  color: #fff;
  overflow: hidden;
}
.draw-drum {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  border-radius: 8px;
  background: radial-gradient(circle, #28403b 0%, #182230 48%, #0b1220 100%);
  border: 1px solid #344054;
}
.draw-drum strong {
  position: relative;
  z-index: 1;
  font-size: clamp(2rem, 5vw, 4rem);
  letter-spacing: 0;
  color: var(--secondary);
}
.draw-drum span {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--secondary);
  transform: rotate(calc(var(--i) * 22.5deg)) translateX(118px);
}
.draw-drum.spin { animation: draw-spin 1.1s linear infinite; }
.draw-current {
  display: grid;
  align-content: center;
  gap: 22px;
  padding: clamp(16px, 3vw, 34px);
  background: #182230;
  border: 1px solid #344054;
  border-radius: 8px;
}
.draw-countdown {
  min-height: 54px;
  color: var(--secondary);
  font-size: clamp(1.6rem, 4vw, 3.4rem);
  font-weight: 700;
}
.draw-countdown.pulse { animation: draw-pulse .42s ease; }
.draw-current h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3.8rem);
}
.draw-versus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.draw-versus div {
  display: grid;
  gap: 8px;
  min-height: 140px;
  align-content: center;
  padding: 18px;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
}
.draw-versus small { color: var(--muted); font-weight: 700; }
.draw-versus b {
  font-size: clamp(1.25rem, 3vw, 2.4rem);
  overflow-wrap: anywhere;
}
.draw-versus em {
  color: var(--secondary);
  font-style: normal;
  font-weight: 700;
}
.draw-progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #344054;
}
.draw-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--secondary);
  transition: width .35s ease;
}
.draw-stage-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.draw-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.draw-results li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.draw-results span { overflow-wrap: anywhere; }
.draw-results em { color: var(--muted); font-style: normal; font-weight: 700; }
@keyframes draw-spin {
  to { transform: rotate(360deg); }
}
@keyframes draw-pulse {
  50% { transform: scale(1.08); }
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stats div {
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}
.stats strong { font-size: 2rem; color: var(--primary); }
.stats span { color: var(--muted); font-weight: 600; }
.flash {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  border: 1px solid transparent;
}
.flash.ok { background: var(--color-success-bg); color: var(--color-success); }
.flash.error { background: var(--color-danger-bg); color: var(--color-danger); }
.flash.warning { background: var(--color-warning-bg); color: var(--color-warning); }
.flash.info { background: var(--color-info-bg); color: var(--color-info); }
.flash-close {
  min-height: 28px;
  min-width: 28px;
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.action-stack { display: grid; gap: var(--space-2); align-items: start; }
.section-gap-top { margin-top: var(--space-5); }
.qr-preview {
  display: block;
  width: 220px;
  height: 220px;
  max-width: 100%;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #fff;
}
.danger-zone {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px dashed var(--color-border);
}
.danger-zone-label {
  display: block;
  margin-bottom: 4px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-danger);
}
.color-preview {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.color-preview span { display: block; width: 18px; height: 24px; }
.swatch {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--line);
  margin-right: 6px;
  vertical-align: middle;
}

.tv-body {
  --bg: #101828;
  --panel: #182230;
  --ink: #f8fafc;
  --muted: #cbd5e1;
  --line: #344054;
  background: #101828;
  color: #f8fafc;
}
.tv-body .topbar { display: none; }
.tv-body .page { width: 100%; max-width: none; padding: clamp(14px, 3vw, 34px); }
.tv-head {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 22px;
}
.tv-head img { width: 92px; height: 92px; object-fit: contain; background: #fff; border-radius: 8px; padding: 6px; }
.tv-head h1 { margin: 0; font-size: clamp(2rem, 5vw, 4.6rem); }
.tv-head p { margin: 4px 0 0; color: var(--secondary); font-size: clamp(1.1rem, 2.5vw, 2rem); font-weight: 700; }
.tv-standings-btn { margin-left: auto; font-size: clamp(1rem, 2vw, 1.4rem); padding: 12px 22px; white-space: nowrap; }
.tv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.tv-grid.single { grid-template-columns: 1fr; }
.tv-grid > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  overflow-x: auto;
}
.tv-grid h2 { margin: 0 0 12px; color: var(--secondary); font-size: clamp(1.3rem, 3vw, 2.2rem); }
.tv-grid table { min-width: 680px; font-size: clamp(1.05rem, 2vw, 1.6rem); }
.tv-grid th, .tv-grid td { border-bottom-color: #344054; }
.tv-grid tr:nth-child(even) td, .tv-grid th { background: rgba(255,255,255,.04); }

@media (max-width: 900px) {
  html.js .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  html.js .site-nav { display: none; width: 100%; }
  html.js .site-nav.is-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding-top: 10px;
  }
  html:not(.js) .topbar-inner { flex-wrap: wrap; }
  html:not(.js) .site-nav { flex-direction: column; align-items: stretch; width: 100%; }
  .nav-group { flex-direction: column; align-items: stretch; }
  .account-menu-panel { padding-left: 4px; }
  .split { grid-template-columns: 1fr; }
  .tv-grid { grid-template-columns: 1fr; }
  .draw-stage-head { align-items: flex-start; flex-direction: column; }
  .draw-screen { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .page { padding-inline: 10px; }
  .panel, .card { padding: 14px; }
  .site-nav a, .site-nav button { font-size: .9rem; }
  .row-form, .inline-form, .score-form { align-items: stretch; }
  .row-form > *, .inline-form > * { flex-basis: 100%; }
  .score-form input { width: 64px; }
  .tv-head { align-items: flex-start; flex-direction: column; }
  .tv-grid table { min-width: 560px; }
  .draw-versus { grid-template-columns: 1fr; }
  .draw-versus em { text-align: center; }
  .draw-results li { grid-template-columns: 1fr; }
}
