/* ==========================================================================
   Das Live-Widget für die Vereinsseite — UEBERGABE.md, Abschnitt 93.

   Steht in einem <iframe> auf fremden Seiten und muss dort auf jedem
   Hintergrund bestehen: Die Karte bringt ihren eigenen Grund mit, der Rahmen
   drumherum bleibt durchsichtig. Keine fremde Schrift (die Kopfzeile verbietet
   das Nachladen ohnehin) — die Systemschrift sieht auf jedem Gerät ordentlich
   aus und kostet nichts.

   Die Vereinsfarbe kommt als `--akzent` aus dem Skript; ohne sie ein
   neutrales Blau.
   ========================================================================== */

:root {
  --akzent: #1f5fbf;
  --auf-akzent: #ffffff;

  --grund: #ffffff;
  --grund-2: #f4f6f9;
  --tinte: #0f172a;
  --tinte-2: #475569;
  --tinte-3: #94a3b8;
  --linie: #e2e8f0;
  --live: #e11d48;
  --sieg: #0f172a;
  --schatten: 0 1px 2px rgb(15 23 42 / 0.06), 0 8px 24px rgb(15 23 42 / 0.08);

  color-scheme: light;
}

:root[data-theme="dunkel"] {
  --grund: #0f172a;
  --grund-2: #172036;
  --tinte: #f1f5f9;
  --tinte-2: #cbd5e1;
  --tinte-3: #64748b;
  --linie: #243049;
  --live: #fb7185;
  --sieg: #ffffff;
  --schatten: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --grund: #0f172a;
    --grund-2: #172036;
    --tinte: #f1f5f9;
    --tinte-2: #cbd5e1;
    --tinte-3: #64748b;
    --linie: #243049;
    --live: #fb7185;
    --sieg: #ffffff;
    --schatten: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: transparent;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.35;
  color: var(--tinte);
  -webkit-font-smoothing: antialiased;
}

.wg { padding: 6px; }

.wg-karte {
  overflow: hidden;
  border: 1px solid var(--linie);
  border-radius: 16px;
  background: var(--grund);
  box-shadow: var(--schatten);
}

/* --- Kopf und Anzeigetafel ------------------------------------------------ */

.wg-buehne {
  color: var(--auf-akzent);
  /* Erst die schlichte Farbe: Ein Browser ohne `color-mix` verwirft die
     ganze Zeile darunter und behält diese. */
  background: var(--akzent);
  background:
    radial-gradient(120% 140% at 0% 0%, rgb(255 255 255 / 0.18), transparent 55%),
    linear-gradient(135deg, var(--akzent), color-mix(in srgb, var(--akzent) 70%, #000));
}

.wg-kopf {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 0;
  font-size: 12px;
}

.wg-marke {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.18);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.wg-marke.live { background: var(--live); color: #fff; }

.wg-liga {
  overflow: hidden;
  opacity: 0.88;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wg-puls {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.wg-puls::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: currentColor;
  animation: wg-puls 1.6s ease-out infinite;
}

@keyframes wg-puls {
  from { transform: scale(1); opacity: 0.7; }
  to   { transform: scale(2.6); opacity: 0; }
}

.wg-tafel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 14px 16px 18px;
}

.wg-team {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
  text-align: center;
}

.wg-teamname {
  max-width: 100%;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
  /* Getrennt wird nach Silben (`lang="de"`) und nur, wenn ein Wort gar nicht
     passt — „Nachbaro-rt“ mitten im Wort sieht nach Fehler aus. */
  hyphens: auto;
  overflow-wrap: break-word;
}

.wg-wappen {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 14px;
  background: rgb(255 255 255 / 0.16);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.25);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* Ein Logo bekommt eine weiße Kachel: Vereinswappen sind für hellen Grund
   gemacht, und auf der Vereinsfarbe verschwände die Hälfte davon. */
.wg-wappen.mit-logo { background: #fff; }
.wg-wappen img { width: 100%; height: 100%; padding: 5px; object-fit: contain; }

.wg-stand { display: grid; justify-items: center; gap: 2px; }

.wg-zahlen {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 44px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
}

.wg-zahlen span { opacity: 0.72; }
.wg-zahlen span.vorn { opacity: 1; }
.wg-zahlen .wg-doppelpunkt { opacity: 0.5; font-weight: 600; }

.wg-fortschritt,
.wg-datum {
  font-size: 12px;
  opacity: 0.85;
  white-space: nowrap;
}

.wg-zeit {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.wg-uhr {
  font-size: 15px;
  font-weight: 600;
  opacity: 0.85;
}

/* --- Einzelspiele ---------------------------------------------------------- */

.wg-spiele {
  margin: 0;
  padding: 4px 0;
  list-style: none;
}

.wg-spiel {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--linie);
}

.wg-spiel:first-child { border-top: 0; }
.wg-spiel.live { background: color-mix(in srgb, var(--live) 7%, transparent); }

.wg-rolle {
  padding: 3px 0;
  border-radius: 7px;
  background: var(--grund-2);
  color: var(--tinte-2);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.wg-seiten { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; min-width: 0; }

.wg-seite {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--tinte-2);
  font-size: 13.5px;
}

.wg-seite.sieger { color: var(--sieg); font-weight: 700; }
.wg-seite.leer .wg-name { color: var(--tinte-3); font-style: italic; }

.wg-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wg-saetze { display: flex; gap: 4px; flex-shrink: 0; }

.wg-satz {
  min-width: 24px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.wg-satz.gewonnen { color: var(--sieg); font-weight: 700; }
.wg-satz.laufend {
  padding: 0 5px;
  border-radius: 5px;
  background: var(--live);
  color: #fff;
  font-weight: 700;
}

.wg-zustand { display: grid; place-items: center; color: var(--live); }
.wg-spiel.fertig .wg-zustand::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tinte-3);
}

.wg-ort {
  margin: 0;
  padding: 12px 16px;
  color: var(--tinte-2);
  font-size: 13px;
  text-align: center;
}

/* --- Fuß ------------------------------------------------------------------- */

.wg-fuss {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--linie);
  background: var(--grund-2);
  color: var(--tinte-3);
  font-size: 11.5px;
}

.wg-verein { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-stoerung { color: var(--live); }

/* --- Leer, Laden, Hinweis -------------------------------------------------- */

.wg-leer { padding: 22px 18px; text-align: center; }
.wg-leer-kopf { display: grid; justify-items: center; gap: 8px; margin-bottom: 12px; }
.wg-leer .wg-wappen { background: var(--akzent); color: var(--auf-akzent); box-shadow: none; }
.wg-leer .wg-wappen.mit-logo { background: var(--grund-2); }
.wg-leer-titel { margin: 0; font-weight: 700; }
.wg-leer-text { margin: 4px 0 0; color: var(--tinte-2); font-size: 13px; }

.wg-laden { display: grid; gap: 10px; padding: 22px; }
.wg-balken {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--grund-2), var(--linie), var(--grund-2));
  background-size: 200% 100%;
  animation: wg-schimmer 1.4s linear infinite;
}
.wg-balken.kurz { width: 60%; }
@keyframes wg-schimmer { to { background-position: -200% 0; } }

.wg-hinweis { margin: 12px; color: var(--tinte-2); font-size: 13px; }

/* --- Kompakt und schmal ------------------------------------------------------ */

.wg-karte.kompakt .wg-tafel { padding-bottom: 14px; }
.wg-karte.kompakt .wg-zahlen { font-size: 36px; }
.wg-karte.kompakt .wg-wappen { width: 38px; height: 38px; border-radius: 11px; font-size: 14px; }
.wg-karte.kompakt .wg-teamname { font-size: 12.5px; }
.wg-karte.kompakt .wg-zeit { font-size: 28px; }
.wg-karte.kompakt .wg-uhr { font-size: 13px; }
.wg-karte.kompakt .wg-tafel { gap: 6px; padding-inline: 12px; }

@media (max-width: 360px) {
  .wg-zahlen { font-size: 36px; }
  .wg-wappen { width: 40px; height: 40px; font-size: 14px; }
  .wg-teamname { font-size: 13px; }
  .wg-spiel { grid-template-columns: 40px minmax(0, 1fr) 10px; gap: 8px; padding: 8px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .wg-puls::after, .wg-balken { animation: none; }
}

/* „Termin offen“ steht an der Stelle der Uhrzeit und muss dort bestehen —
   ohne die Karte zu sprengen (Abschnitt 102). */
.wg-datum.gross {
  font-size: 15px;
  font-weight: 700;
  opacity: 1;
  white-space: normal;
  text-align: center;
}
