/* Ligen, Tabellen, Turnierbaum und Team-Seite (views/league.js, views/team.js).
   Präfixe: league-, team-. Farben, Abstände, Radien und Dauern nur über Variablen aus app.css (DESIGN.md 4.4).
   Gemeinsame Bausteine (page-hero, section-head, day-head, mrows, input-search, table) kommen aus app.css. */

/* ---------- Gemeinsam ---------- */

.league-logo {
  display: inline-block;
  flex: none;
  object-fit: contain;
  border-radius: var(--r-xs);
  background: var(--surface-2);
}
img.league-logo { padding: 3px; }
:root[data-theme="light"] .league-logo { background: var(--logo-bg); }
.league-logo-fallback {
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  background: var(--surface-3);
  color: var(--text-2);
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1;
  text-transform: uppercase;
}
:root[data-theme="light"] .league-logo-fallback { background: var(--surface-3); }

/* Stern: Icon-Knopf ghost, aus --muted, an Gold gefüllt */
.league-star { flex: none; color: var(--muted); }
.league-star:hover { color: var(--accent); }
.league-star.is-on { color: var(--accent); }
.league-star.is-on .icon { animation: league-pop var(--dur-2) var(--ease); }
@keyframes league-pop {
  50% { transform: scale(1.15); }
}

/* Brotkrumen (Eyebrow über h1) */
.league-crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 0 6px; min-width: 0; color: var(--muted); }
/* Link optisch unverändert, Touch-Ziel per Pseudo-Element vergrößert (ca. 48 × 33 statt 36 × 11) */
.league-crumb a { position: relative; color: var(--text-2); text-decoration: none; transition: color var(--dur-1); }
.league-crumb a::after { content: ""; position: absolute; inset: -11px -6px; } /* waagrecht nur 6 px: sonst überlappen sich benachbarte Krumen */
.league-crumb a:hover { color: var(--text); text-decoration: none; }
.league-crumb-sep { color: var(--muted); }

/* ---------- Ligen-Übersicht ---------- */

.league-search-slot { flex: 0 1 320px; }
.league-search { width: 100%; }

/* Festes Spaltenraster (4 / 3 / 2). Gruppen mit wenigen Ligen spannen nur so viele Spalten, wie sie Kacheln haben,
   und teilen sich dadurch eine Zeile (Nordamerika + Brasilien …) – auf dem Handy spart das gut 300 px. */
.league-groups {
  --cols: 4;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--s-8) var(--grid-gap);
  min-width: 0;
}
.league-groups > :not(.league-group) { grid-column: 1 / -1; }
.league-group {
  --span: var(--cols);
  grid-column: span var(--span);
  display: grid;
  grid-template-rows: 1fr auto;
  gap: var(--s-3);
  min-width: 0;
}
.league-group[data-span="1"] { --span: 1; }
.league-group[data-span="2"] { --span: 2; }
.league-group[data-span="3"] { --span: 3; }
.league-group-head { align-self: end; display: flex; align-items: center; gap: var(--s-2); min-width: 0; color: var(--text-2); line-height: 1.35; }
.league-group-head > span:not(.league-group-count) { min-width: 0; }
.league-group-head::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.league-group-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--text-2);
  line-height: 1;
  letter-spacing: 0;
}
.league-group-fav .league-group-head { color: var(--accent); }
.league-group-fav .league-group-count { background: var(--accent-soft); color: var(--text); }

.league-tiles {
  display: grid;
  gap: var(--grid-gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
}
.league-group > .league-tiles { grid-template-columns: repeat(var(--span), minmax(0, 1fr)); }
@media (max-width: 999.98px) {
  .league-groups { --cols: 3; }
}

.league-tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
  height: 56px;
  padding: 0 var(--s-1) 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  transition: border-color var(--dur-1), background-color var(--dur-1);
}
.league-tile:hover { border-color: var(--border-strong); background: var(--surface-2); }
:root[data-theme="light"] .league-tile:hover { background: var(--surface); }
.league-tile-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.league-tile-link:focus-visible { outline-offset: -2px; }
.league-tile .league-logo { width: 36px; height: 36px; }
.league-tile .league-star { position: relative; z-index: 2; margin-left: auto; }
.league-tile-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.league-tile-name {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.league-tile-sub {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 500;
  line-height: var(--lh-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.league-tile-skel { height: 56px; border-radius: var(--r-md); }

/* Handy: zwei Spalten (Seite ca. halb so lang). Bewusst zweizeilig – Abweichung von DESIGN 4.4 Punkt 4 (Kachel 48,
   Logo 28, Name einzeilig 14/600 mit Ellipsis): bei ~165 px Kachelbreite blieben nur ~95 px für den Namen, 14 von 33
   Namen wurden zu „Liga Port…“ / „Esports Bal…“ gekürzt und damit unkenntlich (title hilft auf Touch nicht).
   Deshalb Kachel einheitlich 60 hoch (zwei Zeilen 13/1,2 bzw. Name + Region in „Deine Ligen“ haben Luft, ein- und
   zweizeilige Kacheln sind gleich hoch und mittig ausgerichtet), Logo 24, Stern 28 breit (Touch-Ziel über die ganze
   Kachelhöhe), Name höchstens zwei Zeilen 13/600. */
@media (max-width: 759.98px) {
  .league-search-slot { flex: 1 1 100%; margin-left: 0; }
  .league-groups { --cols: 2; gap: var(--s-6) 8px; }
  .league-group[data-span="3"] { --span: 2; }
  .league-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .league-tile { height: 60px; gap: var(--s-2); padding: 0 0 0 var(--s-2); border-radius: var(--r-sm); }
  .league-tile .league-logo { width: 24px; height: 24px; }
  .league-tile img.league-logo { padding: 2px; }
  .league-tile-text { flex: 1 1 auto; }
  .league-tile-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    font-size: 13px;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .league-tile-sub { font-size: 12px; line-height: 1.2; }
  /* Stern: Touch-Ziel 28 × volle Höhe; −4 px links, weil das 18-px-Icon im Knopf schon 5 px Luft hat (Name bekommt ~94 px) */
  .league-tile .league-star { align-self: stretch; width: 28px; height: auto; margin: 0 0 0 -4px; padding: 0; border-radius: var(--r-xs); }
  .league-tile .league-star .icon { width: 18px; height: 18px; }
  .league-tile-skel { height: 60px; border-radius: var(--r-sm); }
}

/* ---------- Liga-Kopf (.page-hero) ---------- */

.league-hero { display: flex; align-items: center; gap: var(--s-4); }
.league-hero-logo { display: inline-flex; flex: none; }
.league-hero-logo .league-logo { width: 56px; height: 56px; border-radius: var(--r-md); }
.league-hero-logo img.league-logo { padding: 7px; }
.league-hero-text { display: flex; flex: 1; flex-direction: column; gap: 6px; min-width: 0; }
.league-hero h1 { overflow-wrap: anywhere; }
.league-hero > .league-star { align-self: flex-start; margin: -6px -8px 0 0; }

.league-controls { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-3); min-width: 0; margin-top: calc(-1 * var(--s-3)); }
.league-tselect { flex: 0 1 320px; min-width: 0; }
.league-tselect > .select { width: 100%; }
.league-tinfo { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px var(--s-3); min-width: 0; }
.league-tstatus {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  padding: 0 var(--s-2);
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1;
  text-transform: uppercase;
}
.league-tstatus::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.league-tstatus.is-done::before { display: none; }
.league-tstatus.is-running { background: color-mix(in srgb, var(--accent-2) 16%, transparent); color: var(--accent-2); }
.league-tstatus.is-upcoming { background: var(--blue-soft); color: var(--blue); }
/* Hell: farbiger Text auf Soft-Fläche zu schwach (DESIGN 2.1) → Text dunkel, Farbe nur im Punkt */
:root[data-theme="light"] .league-tstatus.is-running,
:root[data-theme="light"] .league-tstatus.is-upcoming { color: var(--text); }
:root[data-theme="light"] .league-tstatus.is-running::before { background: var(--accent-2); }
:root[data-theme="light"] .league-tstatus.is-upcoming::before { background: var(--blue); }
.league-dates { color: var(--muted); }

/* Hülle ohne eigene Box: der Reiter (.tabs--sticky aus app.css) klebt so am Seitenfluss statt an einer gleich hohen Hülle.
   inert wirkt trotzdem auf den Inhalt; die Deckkraft beim Laden sitzt deshalb am Reiter selbst. */
.league-tabs { display: contents; }
.league-tabs > .tabs { margin-bottom: calc(-1 * var(--s-2)); transition: opacity var(--dur-2); }
.league-tabs.is-busy > .tabs { opacity: .55; }
.league-panel { min-width: 0; }

@media (max-width: 759.98px) {
  .league-hero { gap: var(--s-3); padding: var(--s-4); }
  .league-hero-logo .league-logo { width: 48px; height: 48px; border-radius: var(--r-sm); }
  .league-hero-logo img.league-logo { padding: 5px; }
  .league-controls { margin-top: calc(-1 * var(--s-2)); }
  .league-tselect { flex: 1 1 100%; }
  /* Reiter klebrig (tabs--sticky: top = Kopfzeile + Safe-Area, Hintergrund --bg), Fläche bis an den Rand wie auf der Statistik-Seite */
  .league-tabs > .tabs { margin-inline: -16px; padding-inline: 6px; }
}

/* ---------- Spielplan (Tagesgruppen mit Zeilen) ---------- */

.league-sched { display: flex; flex-direction: column; gap: var(--s-10); min-width: 0; }
.league-part { gap: var(--s-4); }
/* Gruppen einspaltig untereinander, volle Inhaltsbreite wie die Tagesgruppen der Übersicht (.home-day).
   Vorher zwei Spalten: Phasen sind ungleich lang („Finale · 1 Match“ neben „Entscheidungsspiele · 9 Matches“),
   das gab große Lücken und der Lesefluss sprang zwischen den Spalten statt der Zeit nach von oben nach unten. */
.league-days { display: flex; flex-direction: column; gap: var(--s-8); min-width: 0; }
.league-day { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.league-day.is-live .day-head { border-bottom-color: color-mix(in srgb, var(--live) 40%, var(--border)); }
.league-day.is-live .day-head .live-dot { color: var(--live); }
.league-more { align-self: center; min-width: 200px; }

@media (max-width: 759.98px) {
  .league-sched { gap: var(--s-8); }
  .league-part { gap: var(--s-3); }
  .league-days { gap: var(--s-5); }
  .league-day { gap: 10px; }
}

/* ---------- Spoiler-Abdeckung (Tabelle, Baum) ---------- */

.league-cover {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.league-cover-fake {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  padding: var(--s-6);
  -webkit-mask-image: linear-gradient(to bottom, var(--bg), transparent 95%);
  mask-image: linear-gradient(to bottom, var(--bg), transparent 95%);
}
.league-cover-fake span { height: 14px; border-radius: var(--r-xs); background: var(--surface-2); }
.league-cover-body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  max-width: 380px;
  margin: var(--s-6) var(--s-4);
  padding: var(--s-6) var(--s-5);
  border-radius: var(--r-md);
  background: var(--bg-elev);
  box-shadow: var(--shadow-2);
  text-align: center;
}
:root[data-theme="light"] .league-cover-body { background: var(--surface); }
.league-cover-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: var(--s-1);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.league-cover-title { color: var(--text); font-size: var(--fs-h3); font-weight: 700; }
.league-cover-text { max-width: 44ch; color: var(--text-2); font-size: var(--fs-small); line-height: var(--lh-small); }
.league-cover-body .btn { margin-top: var(--s-2); }

/* ---------- Tabelle ---------- */

.league-tables { display: flex; flex-direction: column; gap: var(--s-8); min-width: 0; }
.league-table-block { gap: var(--s-3); }
.league-table th.league-col-place, .league-table td.league-col-place { width: 64px; text-align: center; }
.league-table th.league-col-place .th-btn { justify-content: center; }
.league-table td.league-col-team { width: 100%; max-width: 0; }
.league-table th.league-col-rate, .league-table td.league-col-rate { min-width: 112px; }

.league-place {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 26px;
  padding: 0 6px;
  border-radius: var(--r-xs);
  color: var(--text-2);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.league-place-1 { background: var(--accent-soft); color: var(--text); }
:root:not([data-theme="light"]) .league-place-1 { color: var(--accent); }
.league-place-2, .league-place-3 { background: var(--surface-3); color: var(--text); }
.league-place-shared {
  position: absolute;
  top: -3px;
  right: -7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.league-team-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
  color: var(--text);
  font-weight: 600;
  vertical-align: middle;
  transition: color var(--dur-1);
}
a.league-team-link:hover { color: var(--accent); text-decoration: none; }
.league-tname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.league-tname-short { display: none; }
.league-fav-mark { display: inline-flex; flex: none; color: var(--accent); }
.league-table tbody tr:has(.league-fav-mark) td { background: var(--accent-soft); }
.league-table tbody tr:has(.league-fav-mark) td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.league-record { display: inline-flex; align-items: baseline; gap: 2px; font-weight: 700; }
.league-record .league-w { color: var(--text); }
.league-record .league-sep, .league-record .league-l { color: var(--muted); font-weight: 500; }

/* Quote-Balken Gold (ein Akzent für „Leistung“; Türkis bleibt für Links/Status) */
.league-rate { display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--s-3); }
.league-rate > .num { min-width: 5ch; text-align: right; } /* Balken bleiben bündig, auch bei „0 %“ */
.league-rate-bar { display: block; width: 56px; height: 6px; overflow: hidden; border-radius: var(--r-pill); background: var(--surface-3); }
.league-rate-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width var(--dur-3) var(--ease); }
.league-legend { color: var(--muted); }

@media (max-width: 519.98px) {
  .league-table .table th, .league-table .table td { padding-left: 8px; padding-right: 8px; }
  .league-table .th-btn { padding-left: 8px; padding-right: 8px; }
  .league-table th.league-col-place, .league-table td.league-col-place { width: 48px; }
  .league-table th.league-col-rate, .league-table td.league-col-rate { min-width: 0; }
  .league-table .league-tname-long { display: none; }
  .league-table .league-tname-short { display: inline; }
  .league-rate-bar { display: none; }
}

/* ---------- Turnierbaum ---------- */

.league-bracket-wrap { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.league-phases { min-width: 0; }
.league-bracket-host { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }

.league-bnav { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-width: 0; }
.league-bnav-hint { color: var(--muted); }
.league-bnav-btns { display: inline-flex; gap: var(--s-2); }
.league-bnav .btn:disabled { opacity: .35; }

.league-bracket-frame { min-width: 0; }
.league-bracket-scroll {
  --bm-w: 200px;
  --b-gap: 44px;
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  padding: var(--s-4) var(--s-5) var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background-color: var(--bg-elev);
  background-image: radial-gradient(var(--border) 1px, transparent 1.2px);
  background-size: 18px 18px;
  scroll-snap-type: x proximity;
  scroll-padding-left: var(--s-5);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
:root[data-theme="light"] .league-bracket-scroll { background-color: var(--surface-2); }
.league-bracket-scroll:focus-visible { outline-offset: -2px; }
.league-bracket-scroll.can-right:not(.can-left) {
  -webkit-mask-image: linear-gradient(to right, var(--bg) calc(100% - 36px), transparent);
  mask-image: linear-gradient(to right, var(--bg) calc(100% - 36px), transparent);
}
.league-bracket-scroll.can-left:not(.can-right) {
  -webkit-mask-image: linear-gradient(to left, var(--bg) calc(100% - 36px), transparent);
  mask-image: linear-gradient(to left, var(--bg) calc(100% - 36px), transparent);
}
.league-bracket-scroll.can-left.can-right {
  -webkit-mask-image: linear-gradient(to right, transparent, var(--bg) 36px, var(--bg) calc(100% - 36px), transparent);
  mask-image: linear-gradient(to right, transparent, var(--bg) 36px, var(--bg) calc(100% - 36px), transparent);
}

.league-bracket {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), var(--bm-w));
  column-gap: var(--b-gap);
  row-gap: var(--s-3);
  width: max-content;
}
.league-blines { position: absolute; left: 0; top: 0; z-index: 0; overflow: visible; pointer-events: none; }
.league-bline { fill: none; stroke: var(--surface-3); stroke-width: 2; stroke-linecap: round; }
:root[data-theme="light"] .league-bline { stroke: color-mix(in srgb, var(--muted) 45%, transparent); }
.league-bline.is-strong { stroke: color-mix(in srgb, var(--accent) 60%, var(--surface-3)); }
:root[data-theme="light"] .league-bline.is-strong { stroke: color-mix(in srgb, var(--accent) 70%, transparent); }
.league-bline.is-guess { stroke-dasharray: 3 5; }

.league-bcol-head {
  position: relative;
  z-index: 1;
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  scroll-snap-align: start;
}
.league-blane-head {
  position: sticky;
  left: 0;
  z-index: 2;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: 6px;
  height: 24px;
  padding: 0 10px 0 8px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: var(--fs-caption);
  font-weight: 600;
}
.league-blane-head::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.league-blane-head.is-lower::before { background: var(--muted); }

.league-bcell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: var(--s-4);
  min-width: 0;
}
.is-rounds .league-bcell { justify-content: flex-start; gap: var(--s-3); }
.league-bpool { display: flex; flex-direction: column; gap: var(--s-2); }
.league-bpool-head { color: var(--text-2); font-size: var(--fs-caption); font-weight: 700; }

.league-bm {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  color: var(--text);
  transition: border-color var(--dur-1);
}
.league-bm:hover { border-color: var(--border-strong); text-decoration: none; }
.league-bm:focus-visible { outline-offset: 2px; }
.league-bm-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
/* LIVE-Abzeichen im Standardmaß (20 px, 11/700, DESIGN 3.5) – passt in die 24-px-Leiste */
.league-bm-meta .badge { flex: none; }
.league-bm-bo { font-weight: 700; }

.league-bm-team { position: relative; display: flex; align-items: center; gap: var(--s-2); height: 32px; padding: 0 10px; min-width: 0; }
.league-bm-team + .league-bm-team { border-top: 1px solid var(--border); }
.league-bm-name { flex: 1 1 auto; min-width: 0; overflow: hidden; font-size: 13.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.league-bm-score { flex: none; min-width: 1.4ch; color: var(--text-2); font-size: 14px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.league-bm-trophy { display: inline-flex; flex: none; color: var(--accent); }
/* Sieger: flache Gold-Fläche + Kante (kein Verlauf) */
.league-bm-team.is-win { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.league-bm-team.is-win .league-bm-name { font-weight: 700; }
.league-bm-team.is-win .league-bm-score { color: var(--accent); }
:root[data-theme="light"] .league-bm-team.is-win .league-bm-score { color: var(--text); }
.league-bm-team.is-loss { color: var(--muted); }
.league-bm-team.is-loss .tlogo { opacity: .55; }
.league-bm-team.is-tbd .league-bm-name { color: var(--muted); font-weight: 500; }
.league-bm.is-live { border-color: color-mix(in srgb, var(--live) 45%, var(--border)); box-shadow: inset 3px 0 0 var(--live), var(--shadow-1); }
.league-bm.is-live .league-bm-meta { background: var(--live-soft); }
.league-bm.is-final { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.league-bm.is-final.is-live { border-color: color-mix(in srgb, var(--live) 45%, var(--border)); }

.league-bm-list { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

@media (max-width: 759.98px) {
  .league-bracket-frame { margin: 0 -16px; }
  .league-bracket-scroll {
    --bm-w: 168px;
    --b-gap: 30px;
    padding: 14px 16px 16px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    scroll-padding-left: 16px;
  }
  .league-bm-name .league-tname-long { display: none; }
  .league-bm-name .league-tname-short { display: inline; }
  .league-bnav-hint { display: none; }
  .league-bnav { justify-content: flex-end; }
}

/* ---------- Team-Seite ---------- */

/* Hero: Hintergrund-Logo (10 %) ist die erlaubte Ausnahme für Tiefe – deshalb kein Verlauf zusätzlich (DESIGN 4.4 Punkt 12) */
.team-hero {
  isolation: isolate;
  overflow: hidden;
  padding: var(--s-6);
  background: var(--surface);
}
.team-hero-bg {
  position: absolute;
  top: 50%;
  right: -6%;
  z-index: -1;
  width: min(62%, 520px);
  max-width: none;
  height: auto;
  opacity: .1;
  transform: translateY(-50%);
  pointer-events: none;
  /* Maske: eine Ellipse ab der Mitte der rechten Kante, die nach links und oben/unten ganz ausläuft. Das Bild ist ein
     Rechteck mit eigener (dunkler) Fläche – zwei sich schneidende lineare Verläufe ließen am Ende der Rampe (45 %) eine
     senkrechte Kante stehen. Der Farbhinweis (55 %) macht den Verlauf weich, ohne Knick im sichtbaren Bereich. */
  -webkit-mask-image: radial-gradient(ellipse 100% 50% at 100% 50%, var(--bg), 55%, transparent);
  mask-image: radial-gradient(ellipse 100% 50% at 100% 50%, var(--bg), 55%, transparent);
}
/* Hell: Das Bild (helles Logo auf dunkler Fläche) erschien als grauer Schleier. Umgekehrt und grau multipliziert
   wird die dunkle Fläche fast weiß und verschwindet auf --surface, nur das Logo bleibt als leichte Tönung (Tiefe wie dunkel). */
:root[data-theme="light"] .team-hero-bg {
  padding: 0;
  background: transparent;
  opacity: .1;
  filter: invert(1) grayscale(1);
  mix-blend-mode: multiply;
}
.team-hero-main { display: flex; align-items: center; gap: var(--s-5); min-width: 0; }
.team-hero-logo {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 112px;
  height: 112px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface-2);
}
:root[data-theme="light"] .team-hero-logo { background: var(--logo-bg); border-color: transparent; }
.team-hero-logo .tlogo { background: transparent; border-radius: var(--r-sm); }
:root[data-theme="light"] .team-hero-logo img.tlogo { padding: 0; }
.team-hero-text { display: flex; flex: 1; flex-direction: column; gap: 6px; min-width: 0; }
.team-hero h1 { overflow-wrap: anywhere; }
.team-hero-main > .league-star { align-self: flex-start; margin: -8px -8px 0 0; }
/* Meta-Zeile als eine umbrechende Inline-Zeile mit „·“-Trennern (keine Flex-Items mit festem Abstand),
   damit beim Umbruch kein einzelnes Wort verwaist unter der Kürzel-Pille steht */
.team-hero-meta {
  min-width: 0;
  margin-top: 2px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 26px;
}
.team-hero-meta > * { vertical-align: middle; }
.team-meta-sep { margin: 0 var(--s-2); color: var(--muted); }
.team-code {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--s-2);
  border-radius: var(--r-xs);
  background: var(--surface-3);
  color: var(--text);
  font-size: var(--fs-caption);
  font-weight: 800;
  letter-spacing: .06em;
}
.team-league { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; transition: color var(--dur-1); }
a.team-league:hover { color: var(--accent); text-decoration: none; }
.team-league .league-logo { width: 18px; height: 18px; border-radius: 4px; }
.team-league img.league-logo { padding: 1px; }
.team-region { color: var(--muted); white-space: nowrap; }
/* Schmal: Region ausblenden – sie ergibt sich aus der Liga (Link daneben und in der Brotkrume) */
@media (max-width: 479.98px) {
  .team-region, .team-meta-sep.is-region { display: none; }
}

.team-block { min-width: 0; }
.team-count { color: var(--muted); }

.team-roster { display: grid; gap: var(--grid-gap); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
/* Desktop: bis zu 6 Spieler je Zeile; ein Kader mit 5 Spielern füllt die Zeile */
@media (min-width: 1000px) { .team-roster { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } }
.team-player {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.team-player-photo {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.team-player-img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; }
.team-player-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: .02em;
}
.team-player-role {
  position: absolute;
  left: var(--s-2);
  top: var(--s-2);
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 var(--s-2);
  border-radius: var(--r-pill);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.team-player-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px var(--s-3) var(--s-3); }
.team-player-name { overflow: hidden; color: var(--text); font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.team-player-real { overflow: hidden; color: var(--muted); font-size: var(--fs-caption); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }

/* Nächste Spiele und Ergebnisse: zwei Abschnitte mit Abschnittsabstand 40 (Handy 32) */
.team-matches { display: flex; flex-direction: column; gap: var(--s-10); min-width: 0; margin-top: var(--s-4); }
.team-matches > .skel-rows { margin-top: calc(-1 * var(--s-8)); }
.team-cards { min-width: 0; }
.team-cards + .mrows { margin-top: calc(var(--grid-gap) - var(--s-4)); }
.team-more { align-self: center; min-width: 200px; }
.team-source { color: var(--muted); }

@media (max-width: 759.98px) {
  .team-hero { padding: var(--s-4); }
  .team-hero-main { gap: 14px; }
  .team-hero-logo { width: 76px; height: 76px; border-radius: var(--r-lg); }
  .team-hero-logo .tlogo { width: 56px; height: 56px; }
  .team-hero-bg { width: 90%; right: -20%; }
  .team-matches { gap: var(--s-8); }
}

/* Handy: drei Spieler je Zeile, damit große Kader nicht endlos lang werden */
@media (max-width: 519.98px) {
  .team-roster { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
  .team-player { border-radius: var(--r-sm); }
  .team-player-role { left: 5px; top: 5px; height: 18px; padding: 0 6px; letter-spacing: .03em; }
  .team-player-fallback { font-size: 24px; }
  .team-player-text { padding: 7px var(--s-2) 9px; }
  .team-player-name { font-size: 13px; }
  .team-player-real { font-size: 12px; }
}

/* Handy: In Zeilen mit Aufdecken-Knopf bleibt für Teamnamen zu wenig Platz (Kürzel wurden zu „T.“).
   Der Favorit ist an der goldenen Kante der Zeile weiter erkennbar – der Stern entfällt nur hier. */
@media (max-width: 519.98px) {
  .league-page .mcard-row.has-reveal .mcard-fav,
  .team-page .mcard-row.has-reveal .mcard-fav { display: none; }
}
