/* =============================================================================
   Spielstatistik (bundesliga/spiel/<slug>.html)
   Teamvergleich und Spielertabellen im Off-White-Material der Seite:
   linear-gradient(160deg,#FFFFFF 0%,#F4F6FA 34%,#E6EBF3 68%,#D5DCE8 100%), 12px-Trikotnaht links,
   Navy-Schrift, Lichtkante oben. Erzeugt von bl_stats_page() in api/lib-bl.php,
   Umschalten der Teams in js/spielstat.js.
   ============================================================================= */
.stv, .stp {
  --navy: #0F1636; --rot: #f82818;
  position: relative; color: #0616a8;
  background: linear-gradient(160deg,#FFFFFF 0%,#F4F6FA 34%,#E6EBF3 68%,#D5DCE8 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), inset 0 -1px 0 rgba(4,8,40,.10), 0 18px 40px rgba(4,8,40,.42);
  padding: clamp(1.2rem, 3vw, 2rem) clamp(1rem, 3vw, 2rem) clamp(1.2rem, 3vw, 2rem) calc(12px + clamp(1rem, 3vw, 2rem));
}
.stv::before, .stp::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 12px;
  background: repeating-linear-gradient(90deg, #0016a8 0 2px, #0818d8 2px 4px, #0016a8 4px 6px, #cc1d0a 6px 8px, #f82818 8px 10px, #cc1d0a 10px 12px);
}
.stv .kicker, .stp .kicker {
  display: block; font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  letter-spacing: .22em; font-size: .72rem; color: #cc1d0a;
}

/* --- Teamvergleich ---------------------------------------------------------- */
.stv { margin-top: clamp(1.8rem, 4vw, 2.6rem); }
.stv-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  padding-bottom: 1.1rem; border-bottom: 3px solid var(--rot); }
.stv-team { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; min-width: 0; }
.stv-team img, .stv-team .st-mark { height: clamp(48px, 7vw, 72px); width: auto; max-width: 100%; object-fit: contain; }
.stv-team b { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: clamp(.9rem, 2vw, 1.15rem); line-height: 1.05; }
.stv-team small, .stv-mid small { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: .14em; font-size: .68rem; color: rgba(15,22,54,.6); }
.stv-mid { display: flex; flex-direction: column; align-items: center; gap: .15rem; }
.stv-mid strong { font-family: var(--font-display); font-weight: 900; font-size: clamp(2rem, 6vw, 3.2rem); line-height: 1; letter-spacing: -.01em; }
.stv-rows { list-style: none; margin: 0; padding: 0; }
.stv-rows li { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 1rem; row-gap: .35rem;
  padding: .7rem 0; border-bottom: 1px solid rgba(15,22,54,.12); }
.stv-rows li:last-child { border-bottom: 0; }
.stv-v { font-family: var(--font-display); font-weight: 800; font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.stv-v:first-child { text-align: left; }
.stv-v:nth-child(3) { text-align: right; }
.stv-l { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .74rem;
  color: rgba(15,22,54,.7); text-align: center; }
.stv-bar { grid-column: 1 / -1; display: flex; gap: 3px; height: 6px; }
.stv-bar i { display: block; height: 100%; }
.stv-bar i:first-child { width: var(--a); background: var(--ca, #0616a8); }
.stv-bar i:last-child { flex: 1; background: var(--cb, var(--rot)); }

/* --- Spielerstatistik ------------------------------------------------------- */
.stp-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap;
  padding-bottom: 1rem; border-bottom: 3px solid var(--rot); }
.stp-club { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.stp-crest { height: clamp(52px, 7vw, 76px); width: auto; max-width: 110px; object-fit: contain; transition: opacity .2s ease, transform .2s ease; }
.stp-name { margin: .1rem 0 0; font-family: var(--font-display); font-weight: 900; text-transform: uppercase; color: #0616a8;
  font-size: clamp(1.3rem, 3.4vw, 2rem); line-height: 1; transition: opacity .2s ease; }
.stp.st-swap .stp-crest, .stp.st-swap .stp-name { opacity: 0; transform: translateY(4px); }

.stp-switch { display: inline-flex; gap: 6px; padding: 4px; background: rgba(15,22,54,.08); box-shadow: inset 0 1px 2px rgba(4,8,40,.15); }
.stp-switch button { display: inline-flex; align-items: center; gap: .5rem; border: 0; cursor: pointer; padding: .5rem .9rem;
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .82rem;
  color: #0616a8; background: transparent; transition: background .2s ease, color .2s ease, transform .15s ease, box-shadow .2s ease; }
.stp-switch button img, .stp-switch button .st-mark { height: 24px; width: auto; max-width: 34px; object-fit: contain; }
.stp-switch button:hover { background: rgba(255,255,255,.7); }
.stp-switch button[aria-selected="true"] { color: #fff; background: linear-gradient(165deg, #0a1cd6 0%, #0616a8 55%, #04127e 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 6px 14px rgba(4,8,40,.35); }
.stp-switch button:focus-visible { outline: 3px solid var(--rot); outline-offset: 2px; }

.st-panel h4 { margin: 1.4rem 0 .6rem; font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  letter-spacing: .18em; font-size: .78rem; color: #0616a8; display: flex; align-items: center; gap: .8rem; }
.st-panel h4::after { content: ""; flex: 1 1 auto; height: 2px; background: rgba(15,22,54,.15); }
.st-panel h4.st-nojs { font-size: 1.1rem; letter-spacing: .06em; color: #0616a8; }

/* Ohne JavaScript: beide Teams untereinander, kein Umschalter, kein Kartenkopf-Wappen */
.stp:not(.st-ready) .stp-switch, .stp:not(.st-ready) .stp-club { display: none; }
.stp:not(.st-ready) .stp-head { display: none; }
.stp.st-ready .st-nojs { display: none; }
.stp.st-ready .st-panel[hidden] { display: none; }

/* --- Tabelle ---------------------------------------------------------------- */
.st-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.st-scroll:focus-visible { outline: 3px solid var(--rot); outline-offset: 2px; }
.st-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; color: #0616a8; }
.st-table th, .st-table td { padding: .55rem .6rem; text-align: center; white-space: nowrap; font-size: .9rem; }
.st-table thead th { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem;
  color: rgba(6,22,168,.72); border-bottom: 2px solid var(--navy); }
.st-table thead th[title] { cursor: help; text-decoration: underline dotted rgba(15,22,54,.35); text-underline-offset: 3px; }
.st-table tbody tr { border-bottom: 1px solid rgba(15,22,54,.1); }
.st-table tbody tr:nth-child(even) { background: rgba(255,255,255,.45); }
.st-table tbody tr:hover { background: rgba(10,28,214,.07); }
.st-table tbody th[scope="row"] { text-align: left; font-family: var(--font-display); font-weight: 800; text-transform: uppercase; letter-spacing: .02em; font-size: .95rem; }
.st-table td:first-child { font-family: var(--font-display); font-weight: 800; color: #cc1d0a; width: 2.4rem; }
.st-table td:nth-child(3) { font-weight: 700; }
.st-table .st-empty { text-align: left; color: rgba(15,22,54,.6); font-style: italic; }
.st-mark { display: inline-flex; align-items: center; justify-content: center; aspect-ratio: 1; min-width: 2em; padding: .2em;
  font-family: var(--font-display); font-weight: 900; color: #fff; background: var(--navy); }

/* Name-Spalte bleibt beim seitlichen Scrollen stehen */
@media (max-width: 900px) {
  .st-table tbody th[scope="row"], .st-table thead th:nth-child(2) { position: sticky; left: 0; z-index: 1; background: #F2F0EC; box-shadow: 6px 0 8px -6px rgba(4,8,40,.25); }
  .st-table td:first-child, .st-table thead th:first-child { display: none; }
}
@media (max-width: 560px) {
  .stp-switch { width: 100%; }
  .stp-switch button { flex: 1; justify-content: center; }
  .stv-v { font-size: .98rem; }
  .stv-l { font-size: .66rem; letter-spacing: .06em; }
}
@media (prefers-reduced-motion: reduce) {
  .stp-crest, .stp-name, .stp-switch button { transition: none; }
}
@media print {
  .stp .st-panel[hidden] { display: block !important; }
  .stp-switch { display: none; }
}

/* --- Farben gegen die Sektionsregel .dsn-card :is(h3,h4,th){color:#fff} absichern --- */
.dsn-card .stp :is(h3, h4, th, td), .dsn-card .stv :is(h3, h4, th, td, b, strong) { color: #0616a8; }
.dsn-card .stp .st-panel h4 { color: #0616a8; }
.dsn-card .stp .st-panel h4.st-nojs { color: #0616a8; }
.dsn-card .stp .st-table thead th { color: rgba(6,22,168,.72); }
.dsn-card .stp .st-table td:first-child { color: #cc1d0a; }
.dsn-card .stp .stp-switch button[aria-selected="true"] span { color: #fff; }
.dsn-card .stp :is(h3, h4)::before, .dsn-card .stp h3::after { content: none; }

/* Abschnittskopf wechselt mit: Wappen und Vereinsname */
.st-section .st-ph-logo { object-fit: contain; max-width: 110px; transition: opacity .2s ease; }
.st-section .st-ph-name { transition: opacity .2s ease; }
.st-section.st-swap .st-ph-logo, .st-section.st-swap .st-ph-name { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .st-section .st-ph-logo, .st-section .st-ph-name { transition: none; } }

/* --- Tabellenform im SG-Design (wie Liga-Tabelle): blauer Kopf, rote Linie, kompakte Zeilen --- */
.stp .st-scroll { box-shadow: 0 10px 24px rgba(4,8,40,.14); background: #fff; }
.stp .st-table thead th { background: linear-gradient(165deg, #0a1cd6 0%, #0616a8 55%, #04127e 100%); color: rgba(255,255,255,.82) !important;
  border-bottom: 3px solid #f82818; padding: .75rem .5rem .65rem; font-size: .66rem; letter-spacing: .12em; }
.stp .st-table thead th[title] { text-decoration-color: rgba(255,255,255,.45); }
.stp .st-table thead th:nth-child(2) { text-align: left; }
.stp .st-table th, .stp .st-table td { padding: .5rem .5rem; font-size: .88rem; }
.stp .st-table tbody tr { border-bottom: 1px solid rgba(15,22,54,.08); background: #fff; transition: background .15s ease; }
.stp .st-table tbody tr:nth-child(even) { background: #F6F5F2; }
.stp .st-table tbody tr:hover { background: #E9ECFB; }
.stp .st-table tbody th[scope="row"] { font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-weight: 700; font-size: .9rem; }
.stp .st-table td:first-child { font-family: var(--font-hero); font-weight: 400; font-size: 1rem; }
/* Hauptwert-Spalte (Tore bzw. Paraden) hervorgehoben */
.stp .st-table td:nth-child(3) { font-weight: 800; background: rgba(10,28,214,.06); }
.stp .st-table thead th:nth-child(3) { color: #fff !important; }
/* Nullwerte treten zurueck, damit die echten Werte auffallen */
.stp .st-table td.st-z { color: rgba(15,22,54,.32) !important; font-weight: 400; }
/* Top-Werfer bzw. Torhueter mit den meisten Paraden */
.stp .st-table tbody tr.st-top { background: #FFF1EF; box-shadow: inset 3px 0 0 #f82818; }
.stp .st-table tbody tr.st-top th[scope="row"]::after { content: "Top"; margin-left: .5rem; padding: .12rem .35rem; vertical-align: .1em;
  font: 800 .58rem/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: #fff; background: #f82818; }
.stp .st-table tbody tr.st-top td:nth-child(3) { color: #cc1d0a !important; }
.dsn-card .stp .st-table thead th { color: rgba(255,255,255,.82); }

@media (max-width: 900px) {
  .stp .st-table thead th:nth-child(2) { background: #0616a8; box-shadow: 6px 0 8px -6px rgba(4,8,40,.35); }
  .stp .st-table tbody th[scope="row"] { background: inherit; }
  .stp .st-table tbody tr th[scope="row"] { background: #fff; }
  .stp .st-table tbody tr:nth-child(even) th[scope="row"] { background: #F6F5F2; }
  .stp .st-table tbody tr.st-top th[scope="row"] { background: #FFF1EF; box-shadow: inset 3px 0 0 #f82818, 6px 0 8px -6px rgba(4,8,40,.25); }
}
@media (max-width: 560px) {
  .stp .st-table th, .stp .st-table td { padding: .5rem .4rem; font-size: .8rem; }
  .stp .st-table tbody th[scope="row"] { font-size: .8rem; max-width: 8.5rem; white-space: normal; line-height: 1.15; }
  .stp .st-table thead th { font-size: .6rem; letter-spacing: .08em; }
  .stp .st-table tbody tr.st-top th[scope="row"]::after { display: inline-block; margin: .2rem 0 0; }
}
.stp .st-table .st-fi { display: none; }
@media (max-width: 560px) {
  .stp .st-table tbody th[scope="row"] { white-space: nowrap; max-width: none; }
  .stp .st-table .st-fn { display: none; }
  .stp .st-table .st-fi { display: inline; }
  .stp .st-table tbody tr.st-top th[scope="row"]::after { content: ""; display: inline-block; width: .45rem; height: .45rem; padding: 0; margin: 0 0 .1em .4rem; border-radius: 50%; vertical-align: middle; }
}

/* Knoepfe unter dem Ergebnis: nebeneinander, gleich gross */
.st-actions, main p:has(> a.button-primary + a.text-link-btn) { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: .7rem !important; max-width: 640px; }
.st-actions > a, main p:has(> a.button-primary + a.text-link-btn) > a { display: flex !important; align-items: center; justify-content: center; gap: .55rem; width: 100%; min-width: 0 !important; text-decoration: none !important; min-height: 3.2rem; margin: 0 !important;
  padding: .7rem .8rem !important; text-align: center; white-space: nowrap; box-sizing: border-box; }
.st-actions > a img, main p:has(> a.button-primary + a.text-link-btn) > a img { height: 22px; width: auto; flex: none; }
@media (max-width: 560px) {
  .st-actions > a, main p:has(> a.button-primary + a.text-link-btn) > a { font-size: .74rem !important; letter-spacing: .04em; padding: .65rem .5rem !important; gap: .4rem; }
  .st-actions > a img, main p:has(> a.button-primary + a.text-link-btn) > a img { height: 18px; }
}
