/* Badminton-Rangliste – mobil-zuerst, leichtgewichtig, ohne Build-Schritt.
 * Vereinsfarben (Blau/Weiß). Zwei Themes: dunkel (Standard) + hell. */

:root {
  --bg: #0f172a;
  --bg-karte: #1e293b;
  --bg-karte-2: #273449;
  --rand: #334155;
  --text: #e2e8f0;
  --text-leise: #94a3b8;
  --kopf-bg: rgba(15, 23, 42, 0.92);

  --marke: #3b82c4;        /* Vereinsblau (Primärfarbe) */
  --marke-hell: #5a9bd6;
  --marke-dunkel: #2c6498;

  --sieg: #22c55e;
  --sieg-bg: rgba(34, 197, 94, 0.18);
  --gefahr: #ef4444;
  --neg: #fca5a5;
  --neg-bg: rgba(239, 68, 68, 0.18);
  --warn: #f59e0b;
  --blau: #38bdf8;

  --radius: 14px;
  --schatten: 0 6px 20px rgba(0, 0, 0, 0.35);
}

:root[data-theme="hell"] {
  --bg: #eef2f7;
  --bg-karte: #ffffff;
  --bg-karte-2: #e7edf5;
  --rand: #cdd7e5;
  --text: #10233b;
  --text-leise: #5a6b82;
  --kopf-bg: rgba(247, 250, 253, 0.92);

  --marke: #2f6fb0;
  --marke-hell: #3f82c8;
  --marke-dunkel: #245a91;

  --neg: #dc2626;
  --schatten: 0 6px 18px rgba(30, 58, 95, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

[x-cloak] { display: none !important; }

.huelle {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 14px 96px;
}

/* ------------------------------- Kopf -------------------------------------- */
.kopf {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--kopf-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rand);
  margin: 0 -14px 16px;
  padding: 12px 14px 0;
}
.kopf-oben { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kopf-marke { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kopf-logo {
  width: 42px; height: 42px; object-fit: contain; flex: 0 0 auto;
  border-radius: 9px; background: #fff; padding: 2px;
}
.kopf-logo.fehlt { display: none; }
.kopf-name { font-weight: 800; font-size: 1.0rem; line-height: 1.12; min-width: 0; }
.kopf-name small { display: block; font-weight: 600; font-size: 0.68rem; color: var(--text-leise); letter-spacing: 0.2px; }
.thema-knopf {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 999px;
  background: var(--bg-karte-2); border: 1px solid var(--rand); color: var(--text);
  font-size: 1.15rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.tabs {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  overflow-x: auto;
}
.tab {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--text-leise);
  font: inherit;
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}
.tab.aktiv { color: var(--text); border-bottom-color: var(--marke); }
.tab.rechts { margin-left: auto; }

/* ------------------------------ Bausteine ---------------------------------- */
.karte {
  background: var(--bg-karte);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--schatten);
}
h1, h2, h3 { margin: 0 0 10px; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; color: var(--text-leise); font-weight: 600; }
.leise { color: var(--text-leise); }
.klein { font-size: 0.85rem; }
.mittig { text-align: center; }

.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-karte-2);
  color: var(--text);
  border: 1px solid var(--rand);
  border-radius: 10px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease;
}
.knopf:active { transform: translateY(1px); }
.knopf:disabled { opacity: 0.5; cursor: not-allowed; }
.knopf.primaer { background: var(--marke); color: #fff; border-color: var(--marke-dunkel); }
.knopf.gefahr { background: transparent; color: var(--gefahr); border-color: var(--gefahr); }
.knopf.voll { width: 100%; }
.knopf.gross { padding: 16px; font-size: 1.05rem; }

.feld { margin-bottom: 12px; }
.feld label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.92rem; }
input, select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--rand);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--marke); border-color: var(--marke); }

.reihe { display: flex; gap: 10px; align-items: center; }
.reihe > * { flex: 1; }

.schalter { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.schalter input { width: auto; }

/* Segment-Umschalter (z. B. Gesamt / Einzel / Doppel) */
.segment { display: inline-flex; background: var(--bg-karte-2); border: 1px solid var(--rand); border-radius: 999px; padding: 3px; gap: 2px; }
.segment button { background: none; border: none; color: var(--text-leise); font: inherit; font-weight: 700; font-size: 0.85rem; padding: 7px 13px; border-radius: 999px; cursor: pointer; }
.segment button.an { background: var(--marke); color: #fff; }

/* ------------------------------ Tabelle ------------------------------------ */
.rang-zeile {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 6px;
  border-bottom: 1px solid var(--rand);
  cursor: pointer;
}
.rang-zeile:last-child { border-bottom: none; }
.rang-zeile:active { background: var(--bg-karte-2); }
.rang-platz { font-weight: 800; color: var(--text-leise); text-align: center; }
.rang-platz.gold { color: #fbbf24; }
.rang-platz.silber { color: #94a3b8; }
.rang-platz.bronze { color: #d97706; }
.rang-name { font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rang-meta { font-size: 0.82rem; color: var(--text-leise); }
.rang-peak { font-size: 0.72rem; color: var(--text-leise); }
.rang-elo { font-weight: 800; font-size: 1.05rem; text-align: right; }
.rang-elo small { display: block; font-weight: 600; font-size: 0.72rem; color: var(--text-leise); }

.merker {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.merker.inaktiv { background: rgba(148, 163, 184, 0.18); color: var(--text-leise); }
.merker.ausgetreten { background: rgba(245, 158, 11, 0.16); color: var(--warn); }
.merker.sieg { background: var(--sieg-bg); color: var(--sieg); }
.merker.niederlage { background: var(--neg-bg); color: var(--neg); }

/* ------------------------------ Begegnung ---------------------------------- */
.beg {
  border: 1px solid var(--rand);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg-karte);
}
.beg-kopf { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.beg-typ {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: 999px; background: rgba(56, 189, 248, 0.15); color: var(--blau);
}
.beg-teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.beg-team { font-weight: 600; }
.beg-team.rechts { text-align: right; }
.beg-team.sieger { color: var(--sieg); }
.beg-saetze { text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.beg-saetze .satz { display: inline-block; padding: 0 3px; }
.beg-aktionen { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.beg-aktionen .knopf { padding: 7px 12px; font-size: 0.85rem; }

/* ------------------------------ Profil ------------------------------------- */
.profil-kopf { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.profil-elo { font-size: 2.1rem; font-weight: 800; color: var(--marke); }
.statreihe { display: flex; gap: 18px; flex-wrap: wrap; margin: 10px 0 4px; }
.stat b { display: block; font-size: 1.2rem; }
.stat span { font-size: 0.8rem; color: var(--text-leise); }
svg.verlauf { width: 100%; height: 160px; display: block; }

/* Head-to-Head / Vorschläge / Form */
.h2h-zeile, .vorschlag-zeile { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--rand); }
.h2h-zeile:last-child, .vorschlag-zeile:last-child { border-bottom: none; }
.bilanz-zahl { font-weight: 800; font-variant-numeric: tabular-nums; }
.bilanz-zahl .s { color: var(--sieg); }
.bilanz-zahl .n { color: var(--neg); }
.form-kuerzel { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.fk { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.74rem; font-weight: 800; }
.fk.s { background: var(--sieg-bg); color: var(--sieg); }
.fk.n { background: var(--neg-bg); color: var(--neg); }
.serie-gross { font-size: 1.5rem; font-weight: 800; }
.serie-gross.s { color: var(--sieg); }
.serie-gross.n { color: var(--neg); }
.vorschlag-prob { font-weight: 800; color: var(--marke); font-variant-numeric: tabular-nums; }

/* Hall of Fame */
.hof-zeile { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--rand); }
.hof-zeile:last-child { border-bottom: none; }
.hof-pokal { font-size: 1.5rem; flex: 0 0 auto; }
.hof-text { flex: 1; min-width: 0; }
.hof-champ { font-weight: 800; }
.hof-saison { font-size: 0.8rem; color: var(--text-leise); }

/* Spielerkarte (Share) */
.share-bild { width: 100%; border-radius: 14px; display: block; border: 1px solid var(--rand); }

/* ------------------------------ Assistent ---------------------------------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(2, 6, 23, 0.7);
  display: flex; align-items: flex-end; justify-content: center;
}
.blatt {
  background: var(--bg);
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--rand);
  padding: 16px 16px 24px;
}
.blatt-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.x-knopf { background: none; border: none; color: var(--text-leise); font-size: 1.6rem; cursor: pointer; line-height: 1; }
.schritte { display: flex; gap: 6px; margin-bottom: 16px; }
.schritte .punkt { flex: 1; height: 5px; border-radius: 3px; background: var(--rand); }
.schritte .punkt.an { background: var(--marke); }

.wahl-gitter { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wahl {
  border: 2px solid var(--rand); border-radius: 12px; padding: 16px; text-align: center;
  cursor: pointer; font-weight: 700; background: var(--bg-karte);
}
.wahl.an { border-color: var(--marke); background: rgba(59, 130, 196, 0.12); }

.erwartung { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; }
.erwartung .balken { flex: 1; height: 12px; border-radius: 6px; background: var(--gefahr); overflow: hidden; }
.erwartung .balken > div { height: 100%; background: var(--sieg); }
.erwartung .zahl { font-weight: 800; font-variant-numeric: tabular-nums; }

.satz-zeile { display: grid; grid-template-columns: 28px 1fr 14px 1fr; gap: 8px; align-items: center; margin-bottom: 10px; }
.satz-zeile .nr { color: var(--text-leise); font-weight: 700; text-align: center; }
.satz-zeile .vs { text-align: center; color: var(--text-leise); }

.vorschau-zeile { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--rand); }
.delta-plus { color: var(--sieg); font-weight: 700; }
.delta-minus { color: var(--neg); font-weight: 700; }

.hinweis { background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.4); color: #d99413; padding: 10px 12px; border-radius: 10px; font-size: 0.9rem; }
.fehlerbox { background: var(--neg-bg); border: 1px solid var(--gefahr); color: var(--neg); padding: 10px 12px; border-radius: 10px; font-size: 0.9rem; margin-bottom: 12px; }
.erfolgbox { background: var(--sieg-bg); border: 1px solid var(--sieg); color: var(--sieg); padding: 10px 12px; border-radius: 10px; font-size: 0.9rem; margin-bottom: 12px; }

.fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 30;
  border-radius: 999px; padding: 14px 20px; font-size: 1rem; font-weight: 800;
  box-shadow: var(--schatten);
}

.laden { text-align: center; color: var(--text-leise); padding: 40px 0; }
.leer { text-align: center; color: var(--text-leise); padding: 30px 10px; }

@media (min-width: 560px) {
  .blatt { border-radius: 18px; margin-bottom: 4vh; }
  .overlay { align-items: center; }
}

/* --------------------- Verwaltung / Filter / Seiten ------------------------ */
.verwalt-zeile {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 4px; border-bottom: 1px solid var(--rand);
}
.verwalt-zeile:last-child { border-bottom: none; }
.verwalt-zeile.archiviert { color: var(--text-leise); }
.verwalt-zeile .knopf { padding: 6px 11px; font-size: 0.82rem; }
.verwalt-aktionen { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }

.filter-gitter { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.einst-gitter { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }

.seiten { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px 0 4px; }
.seiten .knopf { flex: 0 0 auto; }

/* ------------------------------ Turniere ----------------------------------- */
.turnier-zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
.turnier-name { font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.merker.offen { background: rgba(59, 130, 196, 0.18); color: var(--marke); }
.sieger-banner { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--sieg-bg); color: var(--sieg); font-size: 1.05rem; font-weight: 600; }

.mitglied-zeile { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.mitglied-zeile .schalter { flex: 0 0 auto; }
.mitglied-zeile select, .mitglied-zeile input { flex: 1; min-width: 0; }

table.tturnier { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.tturnier th { text-align: left; font-weight: 600; color: var(--text-leise); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.3px; padding: 4px 6px; border-bottom: 1px solid var(--rand); }
table.tturnier td { padding: 7px 6px; border-bottom: 1px solid var(--rand); font-variant-numeric: tabular-nums; }
table.tturnier td:nth-child(2) { font-weight: 600; }
table.tturnier th:first-child, table.tturnier td:first-child { width: 22px; text-align: center; color: var(--text-leise); }
table.tturnier tr:last-child td { border-bottom: none; }

.tspiel { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--rand); }
.tspiel:last-child { border-bottom: none; }
.tspiel-seite { font-weight: 600; font-size: 0.9rem; }
.tspiel-seite.rechts { text-align: right; }
.tspiel-seite.sieger { color: var(--sieg); }
.tspiel-mitte { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tspiel-ergebnis { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.82rem; white-space: nowrap; }
.tspiel-mitte .knopf { padding: 5px 10px; font-size: 0.78rem; }

.bracket { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; align-items: stretch; }
.bracket-runde { flex: 0 0 auto; min-width: 172px; display: flex; flex-direction: column; }
.bracket-titel { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-leise); text-align: center; margin-bottom: 8px; }
.bracket-spiele { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 12px; }
.bracket-spiel { border: 1px solid var(--rand); border-radius: 10px; background: var(--bg-karte-2); padding: 6px; }
.bracket-spiel.erledigt { border-color: var(--marke-dunkel); }
.b-seite { display: flex; justify-content: space-between; gap: 8px; padding: 3px 5px; font-size: 0.84rem; border-radius: 6px; }
.b-seite.sieger { background: var(--sieg-bg); color: var(--sieg); font-weight: 800; }
.b-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-pkt { font-variant-numeric: tabular-nums; font-weight: 800; flex: 0 0 auto; }
.b-btn { width: 100%; margin-top: 6px; padding: 5px 8px; font-size: 0.76rem; }
