/* Boule-Boy Webview — dunkles Anzeigetafel-Theme, für das Handy gebaut,
   auf dem Desktop großzügiger. */

:root {
  --bg: #0a1422;
  --bg-2: #0e1c2f;
  --surface: #142338;
  --surface-2: #192c45;
  --border: #21374f;
  --border-soft: rgba(33, 55, 79, .55);

  --text: #eaf1fa;
  --muted: #8fa4bd;
  --dim: #6b7f97;

  --gold: #f5b739;
  --silver: #c9d3e0;
  --bronze: #cd7f32;
  --accent: #3b8ef0;
  --win: #34d399;
  --err: #f87171;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px -12px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }

/* Sanftes Einblenden beim Ansichtswechsel (Klasse wird per JS neu gesetzt).
   Wer „reduzierte Bewegung" eingestellt hat, bekommt keins — Vorschrift und
   Ruecksicht zugleich. */
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.fadein { animation: fadein .18s ease-out; }
@media (prefers-reduced-motion: reduce) { .fadein { animation: none; } }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 50% -10%, #12243c 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

a { color: inherit; text-decoration: none; }

.wrap { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 20px 16px 56px; }

/* ── Kopfleiste ───────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(14, 28, 47, .88);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { border-radius: 7px; }
.brand-text { font-weight: 800; letter-spacing: .06em; font-size: 1rem; }
.gold { color: var(--gold); }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.iconbtn {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border); color: var(--muted);
  font-weight: 800; font-size: .92rem;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.iconbtn:hover { border-color: var(--gold); color: var(--gold); background: rgba(245,183,57,.08); }

/* Sprachwahl: bewusst ein schlichtes <select> — es ist auf jedem Gerät
   bedienbar und braucht kein eigenes Menü. */
.langsel {
  font: inherit; font-size: .82rem; font-weight: 600;
  color: var(--muted); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 8px; cursor: pointer;
}
.langsel:hover { border-color: #35577c; color: var(--text); }

.live-dot[hidden] { display: none; }
.live-dot {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .74rem; font-weight: 700; letter-spacing: .08em;
  color: var(--win); text-transform: uppercase;
}
.live-dot::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--win); box-shadow: 0 0 0 0 rgba(52,211,153,.6);
  animation: pulse 2.2s ease-out infinite;
}
/* Veralteter Stand: kein Gruen, kein Pulsieren — die Anzeige soll nicht
   weiter Aktualitaet vortaeuschen, wenn gerade nichts ankommt. */
.live-dot.stale { color: var(--dim); text-transform: none; letter-spacing: 0; }
.live-dot.stale::before { background: var(--dim); box-shadow: none; animation: none; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(52,211,153,.55); }
  70%  { box-shadow: 0 0 0 7px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}

/* ── Typografie ───────────────────────────────────────────────────────── */
h1 { font-size: clamp(1.5rem, 5vw, 2rem); line-height: 1.15; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: .95rem; margin: 0; }
h3 { font-size: 1.06rem; margin: 0 0 6px; line-height: 1.3; }
.sub { color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }

.hero { margin-bottom: 26px; }

/* Vereinsansicht: Logo neben dem Vereinsnamen. Feste Kantenlänge mit
   object-fit, damit ein hoch- oder querformatiges Logo die Zeile nicht
   verzieht. */
.org-hero { display: flex; align-items: center; gap: 14px; }
.org-logo {
  flex: none; width: 56px; height: 56px;
  object-fit: contain;
  transform-origin: center bottom;
  /* Kurzes Wackeln beim Erscheinen — laeuft einmal und bleibt dann still.
     „prefers-reduced-motion" schaltet es ab (Ruecksicht und Vorschrift). */
  animation: logowackel .7s ease-in-out .15s both;
}
@keyframes logowackel {
  0%   { transform: rotate(0deg); }
  15%  { transform: rotate(-9deg); }
  30%  { transform: rotate(7deg); }
  45%  { transform: rotate(-5deg); }
  60%  { transform: rotate(3deg); }
  75%  { transform: rotate(-1.5deg); }
  100% { transform: rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) { .org-logo { animation: none; } }

.sec {
  display: flex; align-items: center; gap: 10px;
  margin: 30px 0 12px;
  font-size: .78rem; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--dim);
}
.sec::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }

/* ── Turnierkarten ────────────────────────────────────────────────────── */
.tcard {
  position: relative; display: block;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 44px 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.tcard { border-left-width: 3px; }
.tcard.live { border-left-color: var(--win); }
.tcard.open { border-left-color: var(--gold); }
.tcard.soon { border-left-color: var(--accent); }
.tcard.done { border-left-color: var(--border); }
.tcard:hover { border-color: #35577c; }
@media (hover: hover) {
  .tcard { will-change: transform; }
  .tcard:hover { transform: translateY(-2px); box-shadow: 0 10px 26px -14px rgba(0,0,0,.7); }
}
.tcard:active { transform: scale(.995); }
.tcard .chev {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  color: var(--dim); font-size: 1.5rem; line-height: 1;
}

/* Turnierkarte mit Anmeldeknopf: der Knopf sitzt unten an der Karte und
   bildet mit ihr optisch einen Block. Die Karte verliert dafür ihren unteren
   Abstand und ihre unteren Ecken. */
.tcard-wrap { margin-bottom: 12px; }
.tcard-wrap.has-reg .tcard {
  margin-bottom: 0;
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}
.reg-link {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px;
  font-weight: 700; font-size: .92rem; letter-spacing: .02em;
  color: #10233c; background: linear-gradient(180deg, #ffc95a, var(--gold));
  border: 1px solid var(--border); border-top: 0;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.reg-link::after { content: "›"; font-size: 1.2rem; line-height: 1; }
.reg-link:hover { filter: brightness(1.06); }

.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .87rem; }
/* Belegungszeile auf der Turnierkarte — etwas kleiner als die Turnierdaten
   darueber, damit sie die Karte nicht dominiert. */
.meta.cap { margin-top: 6px; font-size: .82rem; }
.cap-free { color: var(--win); font-weight: 600; }
.cap-wait { color: var(--gold); font-weight: 600; }
.cap-full { color: var(--err); font-weight: 600; }
.mi { display: inline-flex; align-items: center; gap: 6px; }
.mi svg { flex: none; opacity: .75; }
/* „Nur fuer Vereinsmitglieder" — als abgesetzter Hinweis, damit klar ist, dass
   hier keine oeffentliche Anmeldung moeglich ist. */
.mi.members { color: var(--gold); font-weight: 600; }
.mi.members svg { opacity: 1; }
.mi.license { color: var(--accent); font-weight: 600; }
.mi.license svg { opacity: 1; }

/* Auf breiten Bildschirmen die Liste zweispaltig — auf dem Handy waere das
   unlesbar, dort bleibt es einspaltig. Die Ueberschriften spannen beide
   Spalten, align-items:start haelt kurze Karten oben. */
@media (min-width: 900px) {
  #results { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; align-items: start; }
  #results .sec { grid-column: 1 / -1; }
}

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; margin-bottom: 10px;
  border-radius: 999px;
  font-size: .72rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  border: 1px solid transparent;
}
.badge.live { background: rgba(52,211,153,.13); color: var(--win); border-color: rgba(52,211,153,.42); }
.badge.open { background: rgba(245,183,57,.13); color: var(--gold); border-color: rgba(245,183,57,.42); }
.badge.soon { background: rgba(59,142,240,.13); color: #7fb2ff; border-color: rgba(59,142,240,.42); }
.badge.done { background: rgba(143,164,189,.10); color: var(--muted); border-color: rgba(143,164,189,.3); }
.badge.live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; animation: pulse 2.2s ease-out infinite;
}

/* ── Panels ───────────────────────────────────────────────────────────── */
.phead { margin-bottom: 22px; }
/* Live-Spielstand: Boule-Boy-Logo links im Kopf. Kurzer Wackler nur beim
   ersten Aufbau (Klasse .wobble), nicht bei jedem Poll. */
.live-phead { display: flex; align-items: flex-start; gap: 14px; }
.live-phead .phead-body { flex: 1; min-width: 0; }
.live-logo {
  flex: none; width: 42px; height: 42px; border-radius: 8px;
  object-fit: contain; transform-origin: center bottom;
}
/* Vereinslogo darf doppelt so gross sein wie das Boule-Boy-Logo. */
.live-logo.big { width: 84px; height: 84px; border-radius: 12px; }
.live-logo.wobble { animation: logowackel .7s ease-in-out .1s both; }
@media (prefers-reduced-motion: reduce) { .live-logo.wobble { animation: none; } }

/* Gruppen der Vereinsmeisterschaft: zwei nebeneinander, sobald genug Platz
   ist. Auf dem Handy blieben zwei Spalten unlesbar — dort untereinander.
   align-items:start, damit eine kurze Gruppe nicht auf die Hoehe der langen
   danebenstehenden gezogen wird. */
.grid-2 { display: grid; grid-template-columns: 1fr; column-gap: 16px; align-items: start; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.panel-head {
  display: flex; align-items: baseline; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent);
}
.panel-head h2 { font-size: .8rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.upd { margin-left: auto; font-size: .74rem; color: var(--dim); font-variant-numeric: tabular-nums; }
.panel-body { padding: 14px 16px; }

/* ── Rangliste ────────────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; text-align: right; white-space: nowrap; }
th:nth-child(2), td:nth-child(2) { text-align: left; white-space: normal; width: 99%; }
thead th {
  position: sticky; top: 0;
  font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--dim); background: var(--surface-2);
}
tbody tr { border-top: 1px solid var(--border-soft); }
tbody tr:nth-child(even) { background: rgba(255,255,255,.015); }
td.team { font-weight: 600; }
td.pts { font-weight: 800; font-size: 1.05rem; }
td.pos { color: var(--win); }
td.neg { color: var(--err); }

/* Podest */
.rank {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: .78rem; font-weight: 800; color: var(--dim);
}
tr.p1 .rank { background: var(--gold); color: #14213a; }
tr.p2 .rank { background: var(--silver); color: #14213a; }
tr.p3 .rank { background: var(--bronze); color: #fff; }
tr.p1 td.team { color: var(--gold); }

/* ── Paarungen ────────────────────────────────────────────────────────── */
.matches { list-style: none; margin: 0; padding: 0; }
.match { padding: 12px 16px; border-top: 1px solid var(--border-soft); }
.match:first-child { border-top: 0; }
.side { display: flex; align-items: center; gap: 12px; padding: 3px 0; color: var(--muted); }
.side .nm { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.side .sc {
  min-width: 34px; text-align: center; font-weight: 800;
  padding: 2px 8px; border-radius: 8px;
  background: rgba(255,255,255,.05); color: var(--muted);
}
/* K.-o.-Paarung: Hin- und Rückspiel nebeneinander. Auf schmalen Displays
   untereinander — zwei Spalten mit Name und Punktestand wären dort unlesbar. */
.tie { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) {
  .tie { grid-template-columns: 1fr 1fr; column-gap: 36px; }
  /* Trennlinie mittig im Zwischenraum: als Rand der zweiten Spalte, um den
     halben Spaltenabstand nach links gerückt. */
  .tie > .leg + .leg {
    border-left: 1px solid var(--border);
    padding-left: 18px;
    margin-left: -18px;
  }
}
.leg-label {
  display: block; margin-bottom: 4px;
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--dim);
}
.leg-open { padding: 3px 0; color: var(--dim); font-size: .9rem; }

.side.win { color: var(--text); }
.side.win .nm { font-weight: 700; }
.side.win .sc { background: rgba(52,211,153,.16); color: var(--win); }

/* ── Pyramide ─────────────────────────────────────────────────────────── */
/* Reihe 1 oben mit einem Platz, jede weitere eine breiter. Die Reihen sind
   zentriert, damit die Dreiecksform auch dann erkennbar bleibt, wenn eine
   Reihe wegen langer Namen umbricht. */
.pyr { display: flex; flex-direction: column; gap: 8px; }
.pyr-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pyr-cell {
  flex: 0 1 auto; min-width: 84px; max-width: 200px;
  padding: 8px 12px;
  text-align: center; font-size: .88rem; font-weight: 600;
  color: var(--text); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  overflow-wrap: anywhere;
}
/* Die Spitze ist der Sinn der ganzen Pyramide — die darf man sehen. */
.pyr-row.top .pyr-cell {
  color: var(--gold); border-color: rgba(245,183,57,.55);
  background: rgba(245,183,57,.10);
}
/* Freie Plätze bleiben sichtbar: eine Lücke ist eine Aussage (dort kann
   jemand aufsteigen), kein fehlender Eintrag. */
.pyr-cell.empty {
  color: var(--dim); font-weight: 400; font-style: italic;
  background: none; border-style: dashed;
}

/* Infoknopf hinter einem Wert (z. B. Spielmodus) und der Absatz, den er
   aufklappt. Der Knopf ist bewusst klein und rund — er soll den Wert
   begleiten, nicht mit ihm konkurrieren. */
.infobtn {
  display: inline-grid; place-items: center;
  width: 21px; height: 21px; margin-left: 8px; padding: 0;
  font: inherit; font-size: .76rem; font-weight: 800; line-height: 1;
  color: var(--gold); background: rgba(245,183,57,.14);
  border: 1px solid rgba(245,183,57,.55); border-radius: 50%;
  cursor: pointer; vertical-align: middle;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.infobtn:hover { border-color: var(--gold); background: rgba(245,183,57,.26); }
.infobtn.on {
  color: #10233c; background: var(--gold); border-color: var(--gold);
}
.rowhelp {
  margin-top: 8px; padding: 10px 12px;
  font-size: .86rem; line-height: 1.45; color: var(--muted);
  background: var(--bg-2);
  border-left: 3px solid var(--gold); border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

/* ── Beschreibungsliste ───────────────────────────────────────────────── */
.rows { margin: 0; }
.row { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-top: 1px solid var(--border-soft); }
.row:first-child { border-top: 0; }
.row dt { color: var(--muted); flex: none; }
.row dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* ── Aktionen ─────────────────────────────────────────────────────────── */
.cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 18px; padding: 15px;
  font: inherit; font-weight: 800; letter-spacing: .03em;
  color: #10233c; background: linear-gradient(180deg, #ffc95a, var(--gold));
  border: 0; border-radius: var(--r-md); cursor: pointer;
  box-shadow: 0 6px 18px -8px rgba(245,183,57,.7);
  transition: filter .16s ease, transform .16s ease;
}
.cta:hover { filter: brightness(1.06); }
.cta:active { transform: scale(.99); }
.cta:disabled { opacity: .5; box-shadow: none; cursor: default; }

.ghost {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 10px; padding: 13px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--muted); font-weight: 600;
  transition: border-color .16s ease, color .16s ease;
}
.ghost:hover { border-color: #35577c; color: var(--text); }

.back {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 16px; color: var(--muted); font-size: .9rem; font-weight: 600;
}
.back:hover { color: var(--text); }

/* ── Formular ─────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .88rem; color: var(--muted); }
input, textarea {
  width: 100%; padding: 13px 14px;
  font: inherit; color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--r-md);
  transition: border-color .16s ease, box-shadow .16s ease;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
/* Read-only-Felder (Anmelder im Team-Abschnitt): sichtbar, aber klar als
   nicht editierbar erkennbar. */
input[readonly] { color: var(--muted); background: rgba(255,255,255,.03); cursor: default; }
input[readonly]:focus { border-color: var(--border); box-shadow: none; }
input:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,142,240,.22);
}
textarea { resize: vertical; }
/* Vor-/Nachname nebeneinander; unter 380px untereinander, sonst wird jedes
   Feld zu schmal fuer einen Namen. */
.name2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* Geschlechts-Auswahl als zwei Chips (nur zur Zielgruppen-Warnung). */
.gender { display: flex; gap: 8px; }
.gchip { position: relative; flex: 1; cursor: pointer; }
.gchip input { position: absolute; opacity: 0; pointer-events: none; }
.gchip span {
  display: block; text-align: center; padding: 9px 8px;
  font-weight: 600; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-md); transition: border-color .16s ease, color .16s ease;
}
.gchip input:checked + span {
  color: var(--text); border-color: var(--gold);
  background: rgba(245,183,57,.12);
}
.gchip input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (max-width: 380px) { .name2 { grid-template-columns: 1fr; } }
.req { color: var(--gold); }

/* „Anmeldung stornieren" — als Knopf, aber bewusst zurückhaltend: der
   Hauptweg auf dieser Seite ist Ändern, nicht Abbrechen. */
button.ghost {
  width: 100%; font: inherit; font-weight: 600;
  background: none; cursor: pointer;
}
button.ghost.danger { color: var(--err); }
button.ghost.danger:hover { border-color: var(--err); color: var(--err); }

/* Anmeldenummer — wird am Turniertag vorgelesen und abgetippt, also gross,
   mit Ziffernabstand und ohne Verwechslungsgefahr. */
.regcode {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 18px 16px; margin: 16px 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.regcode strong {
  font-size: 1.9rem; font-weight: 800; letter-spacing: .14em;
  font-variant-numeric: tabular-nums; color: var(--gold);
}

/* Honeypot: für Menschen unsichtbar, Bots füllen ihn aus. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ── Hinweise ─────────────────────────────────────────────────────────── */
.note {
  display: flex; gap: 12px;
  padding: 14px 16px; margin: 16px 0;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--gold); border-radius: 0 var(--r-md) var(--r-md) 0;
}
.note.error { border-left-color: var(--err); }
.note.ok { border-left-color: var(--win); }
.note strong { display: block; margin-bottom: 2px; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty svg { opacity: .35; margin-bottom: 12px; }

/* ── Ladeskelett ──────────────────────────────────────────────────────── */
.sk { border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); margin-bottom: 12px; height: 92px; position: relative; overflow: hidden; }
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk::after { transform: translateX(-100%); }

/* ── Fuß ──────────────────────────────────────────────────────────────── */
.foot {
  padding: 28px 16px calc(32px + env(safe-area-inset-bottom, 0px));
  text-align: center; color: var(--dim); font-size: .84rem;
  border-top: 1px solid var(--border-soft);
}
.foot a { color: var(--muted); font-weight: 600; }
/* Rechtslinks: eine Zeile darunter, durch einen Mittelpunkt getrennt. */
.foot-legal { margin-top: 8px; display: flex; gap: 16px; justify-content: center; }
.foot-legal a { position: relative; }
.foot-legal a + a::before {
  content: "·"; position: absolute; left: -10px; color: var(--dim);
}
.foot-legal a:hover { color: var(--gold); }

@media (min-width: 640px) {
  body { font-size: 17px; }
  .wrap { padding: 32px 24px 64px; }
}

/* ── Hilfe ────────────────────────────────────────────────────────────── */
.help { list-style: none; margin: 0; padding: 0; }
.help li { padding: 12px 0; border-top: 1px solid var(--border-soft); }
.help li:first-child { border-top: 0; padding-top: 0; }
.help b { display: block; margin-bottom: 2px; }
.help span { color: var(--muted); font-size: .92rem; }

/* ── Werbung ──────────────────────────────────────────────────────────── */
/* Werbung: deutlich zurueckhaltender als der Inhalt darueber. Kein Gold,
   kein Farbverlauf — die Seite gehoert dem Zuschauer. Der grosse Abstand
   nach oben setzt sie sichtbar vom Turnierinhalt ab. */
.promo {
  position: relative; overflow: hidden;
  margin-top: 56px; padding: 20px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-2);
}
/* Der Absender darf Farbe tragen: das Panel bleibt zurueckhaltend, aber woher
   die Werbung kommt, soll man auf einen Blick sehen. */
.promo-tag {
  display: inline-block; margin-bottom: 10px;
  padding: 3px 10px; border-radius: 999px;
  color: #10233c; background: linear-gradient(180deg, #ffc95a, var(--gold));
  border: 1px solid var(--gold);
  font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.promo h3 { font-size: 1.15rem; margin-bottom: 8px; }
.promo p { margin: 0; color: var(--muted); font-size: .93rem; }
.promo ul { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: .9rem; }
.promo ul li { margin: 4px 0; }
/* Der Knopf in der Werbung ist bewusst kein goldener Hauptknopf — der ist
   fuer „Jetzt anmelden" reserviert. */
.promo .cta {
  margin-top: 16px;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); box-shadow: none;
}
.promo .cta:hover { border-color: #35577c; filter: none; background: var(--surface); }

/* Externe Links (Karte, Vereinswebseite) */
.maplink { color: var(--muted); text-decoration: none; border-bottom: 1px dotted rgba(143,164,189,.5); }
.maplink:hover { color: var(--gold); border-bottom-color: var(--gold); }
dd .maplink { color: var(--gold); border-bottom-color: rgba(245,183,57,.5); font-weight: 600; }

/* Runden-Reiter */
.tabs {
  display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 12px 16px; border-bottom: 1px solid var(--border-soft);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; padding: 7px 14px;
  font: inherit; font-size: .84rem; font-weight: 700; white-space: nowrap;
  color: var(--muted); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.tab:hover { color: var(--text); border-color: #35577c; }
.tab.on {
  color: #14213a; background: var(--gold); border-color: var(--gold);
}

/* ── Suche in der Übersicht ───────────────────────────────────────────── */
.search { margin-bottom: 18px; }
.search input {
  width: 100%; padding: 13px 14px;
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.search input::placeholder { color: var(--dim); }
.search input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,142,240,.22);
}
.search input::-webkit-search-cancel-button { filter: invert(.6); cursor: pointer; }

/* Knopf „ältere Turniere anzeigen" */
button.more {
  width: 100%; margin-top: 6px;
  font: inherit; font-weight: 600;
  background: transparent; cursor: pointer;
}


/* ── Anzeigetafel (#/tafel/<id>) ───────────────────────────────────────── */
/* Vollbild für Beamer und Fernseher: Kopfleiste und Fußzeile verschwinden,
   die Schrift skaliert mit der Fensterbreite (vw), damit dieselbe Seite auf
   einem 24-Zoll-Monitor und auf einer Leinwand lesbar bleibt. */
body.board .top,
body.board .foot,
body.board .promo { display: none; }
body.board { overflow: hidden; }
body.board .wrap {
  max-width: none; height: 100dvh; padding: 2vh 3vw;
  display: flex; flex-direction: column;
}

.bhead {
  display: flex; align-items: baseline; gap: 2vw;
  padding-bottom: 1.4vh; margin-bottom: 1.8vh;
  border-bottom: 2px solid var(--border);
}
.bhead h1 { font-size: clamp(1.4rem, 3.4vw, 3.4rem); margin: 0; }
.bmeta { color: var(--muted); font-size: clamp(.8rem, 1.3vw, 1.4rem); }
.bclock {
  margin-left: auto; color: var(--gold); font-weight: 800;
  font-size: clamp(1rem, 2vw, 2.2rem); font-variant-numeric: tabular-nums;
}

.bbody { flex: 1; min-height: 0; overflow: hidden; }
.btitle {
  font-size: clamp(.9rem, 1.6vw, 1.7rem); font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase; color: var(--gold);
  margin: 0 0 1.2vh;
}

.btable { width: 100%; border-collapse: collapse; font-size: clamp(.9rem, 2.1vw, 2.1rem); }
.btable th {
  text-align: left; padding: .5vh 1vw;
  font-size: .5em; letter-spacing: .1em; text-transform: uppercase;
  color: var(--dim); border-bottom: 1px solid var(--border);
}
.btable td { padding: .8vh 1vw; border-bottom: 1px solid var(--border-soft); }
.btable .bname { font-weight: 700; }
.btable tr.p1 td { color: var(--gold); }
.btable tr.p2 td { color: var(--silver); }
.btable tr.p3 td { color: var(--bronze); }

.bmatches { display: grid; gap: 1vh; }
.bmatch {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 1.5vw; padding: 1vh 1.5vw;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: clamp(.85rem, 1.9vw, 1.9rem);
}
.bside { color: var(--muted); overflow-wrap: anywhere; }
.bside.right { text-align: right; }
.bside.win { color: var(--text); font-weight: 800; }
.bscore {
  font-weight: 800; color: var(--gold);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* Seitenanzeige beim Umblättern — klein, aber sie erklärt, warum sich das
   Bild gleich ändert. */
.bdots { display: flex; justify-content: center; gap: 8px; padding-top: 1.4vh; }
.bdot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border);
}
.bdot.on { background: var(--gold); }

body.board .pyr-cell { font-size: clamp(.75rem, 1.5vw, 1.5rem); min-width: 6vw; }

/* Ausstieg aus der Tafel: dezent, aber auffindbar. Auf der Leinwand faellt er
   nicht auf, am Tablet findet ihn der Finger. */
.bexit {
  position: fixed; top: 1vh; right: 1vw; z-index: 30;
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  font-size: 1.6rem; line-height: 1; color: var(--dim);
  background: rgba(10,20,34,.5); border: 1px solid var(--border);
  opacity: .25; transition: opacity .16s ease, color .16s ease;
}
.bexit:hover, .bexit:focus { opacity: 1; color: var(--text); }

/* Vorlauf-Ansicht der Tafel (vor dem Start): grosse, ruhige Mitte mit dem
   Beginn, Belegung und Anmeldeknopf. */
.bpre {
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2vh; text-align: center;
}
.bpre .badge { margin: 0; font-size: clamp(.8rem, 1.4vw, 1.4rem); }
.bpre-label {
  font-size: clamp(.9rem, 1.6vw, 1.6rem); letter-spacing: .1em;
  text-transform: uppercase; color: var(--dim);
}
.bpre-when {
  font-size: clamp(1.8rem, 5vw, 5rem); font-weight: 800; line-height: 1.1;
  color: var(--gold);
}
.bpre-cap { font-size: clamp(1rem, 2.2vw, 2.2rem); color: var(--muted); }
.bpre-cta {
  width: auto; margin-top: 1vh; padding: 1.4vh 4vw;
  font-size: clamp(1rem, 2vw, 2rem);
}


/* Tastaturfokus sichtbar machen (nur bei Tab-Navigation, nicht beim Klick). */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, .tcard:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px; border-radius: var(--r-sm);
}
.tcard:focus-visible { outline-offset: 0; border-radius: var(--r-lg); }


/* ── Auflockernde Effekte ─────────────────────────────────────────────── */
/* 1) Belegung als duenner Fuellbalken unter der Turnierkarte. Faehrt sich beim
      Erscheinen auf den Fuellstand auf. */
.capbar {
  height: 5px; margin-top: 6px; border-radius: 3px;
  background: var(--bg-2); overflow: hidden;
}
.capbar > span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--win), #7ee0b4);
  border-radius: 3px;
  animation: capfill .6s ease-out .1s both;
}
.capbar.full > span { background: linear-gradient(90deg, var(--err), #ff9d9d); }
@keyframes capfill { from { transform: scaleX(0); transform-origin: left; } }

/* 4) Karten laufen beim ersten Aufbau gestaffelt ein. */
.tcard-wrap.stagger { animation: cardin .28s ease-out both; }
@keyframes cardin { from { opacity: 0; transform: translateY(8px); } }

/* 2) Frisch aktualisierte Rangzeile leuchtet einmal gold auf. */
tr.flash { animation: rowflash 1.4s ease-out; }
@keyframes rowflash {
  0%   { background: rgba(245,183,57,.32); }
  100% { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .capbar > span, .tcard-wrap.stagger, tr.flash { animation: none; }
  .capbar > span { width: auto; }
}
