/*
 * Liveticker — für Zuschauer am Spielfeldrand (Handy) und für den großen
 * Bildschirm im Zelt (Desktop). Das Wichtigste ist der Score: groß, fett,
 * mit festen Ziffernbreiten, damit nichts springt, wenn er sich ändert.
 */

main.live-main {
  max-width: 1200px;
  padding: 16px;
}

.lv-userlink { margin: 0 0 8px; text-align: right; }

.lv-head { margin-bottom: 8px; }
.lv-head h1 { margin: 0; font-size: clamp(24px, 4vw, 36px); line-height: 1.15; }
.lv-head p { margin: 2px 0 0; }

.lv-empty { padding: 48px 0; text-align: center; }

.lv-section { margin-top: 28px; }
.lv-section h2 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ── Kacheln pro Feld ────────────────────────────────────────────────── */

.lv-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.lv-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.lv-tile.is-live {
  border-color: rgba(239, 68, 68, .55);
  box-shadow: inset 0 3px 0 var(--accent);
}

.lv-tile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}
.lv-field {
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}
.lv-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}
.lv-status.is-next { color: var(--text-dim); font-weight: 600; }

.lv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: lv-pulse 1.6s ease-in-out infinite;
}
@keyframes lv-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .25; }
}

.lv-free { margin: 8px 0 0; }

/* Teamzeile wie auf einer Anzeigetafel: Name links, Score rechts. */
.lv-team {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}
.lv-name {
  min-width: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
}
.lv-score {
  font-size: 40px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.lv-team.is-trail .lv-name,
.lv-team.is-trail .lv-score { color: var(--text-dim); }
.lv-ball { font-size: 15px; }

/* Geänderter Spielstand: einmal kurz aufleuchten. */
.lv-tile.is-flash { animation: lv-flash 2.4s ease-out; }
@keyframes lv-flash {
  0%   { background: rgba(239, 68, 68, .45); }
  100% { background: var(--surface); }
}
@media (prefers-reduced-motion: reduce) {
  .lv-dot, .lv-tile.is-flash { animation: none; }
}

/* ── Letzte Aktionen ─────────────────────────────────────────────────── */

.lv-feed {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.lv-feed li {
  display: grid;
  grid-template-columns: 48px 64px 1fr;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.lv-feed li:last-child { border-bottom: none; }
.lv-feed-time { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.lv-feed-field { color: var(--accent); font-weight: 700; }

/* ── Als Nächstes / Ergebnisse ───────────────────────────────────────── */

.lv-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 24px;
}
@media (min-width: 900px) {
  .lv-columns { grid-template-columns: 1fr 1fr; }
}

.lv-slot + .lv-slot { margin-top: 16px; }
.lv-slot-time {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.lv-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.lv-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.lv-row:last-child { border-bottom: none; }
.lv-row-field {
  flex: 0 0 56px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}
.lv-row-match { flex: 1 1 200px; font-weight: 600; }
.lv-row-round { flex-basis: 100%; padding-left: 68px; font-size: 14px; }

.lv-results { display: grid; gap: 10px; }
.lv-result {
  padding: 10px 14px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.lv-result-head { font-size: 13px; margin-bottom: 2px; }
.lv-result .lv-team { min-height: 34px; }
.lv-result .lv-name { font-size: 16px; }
.lv-result .lv-score { font-size: 24px; }

.lv-updated { margin: 24px 0 0; font-size: 13px; text-align: center; }
.lv-updated.is-stale { color: var(--danger); }

/* ── TV-Modus (index.php?tv=1) ───────────────────────────────────────── */
/*
 * Ein 16:9-Bildschirm, gesehen aus drei bis fünf Metern. Keine Seite zum
 * Scrollen: alles ist in vh bemessen und passt in genau eine Bildschirmhöhe.
 * Was nicht passt, wird in lib_live.php gekürzt (TV_RESULTS usw.), nicht
 * hier abgeschnitten.
 */

body.tv {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  cursor: none;
  font-size: 2.2vh;
}

.tv-head {
  display: flex;
  align-items: center;
  gap: 1.6vh;
  padding: 1.6vh 2.4vw;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.tv-head .brand-mark { width: 5vh; height: 5vh; font-size: 2.2vh; border-radius: 1vh; }
.tv-head img { height: 5vh; width: auto; border-radius: 1vh; }
.tv-head h1 {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 3.6vh;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tv-state { color: var(--danger); font-weight: 700; }
.tv-clock {
  font-size: 4.4vh;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.tv-main {
  /* app.css begrenzt <main> auf Lesebreite — am Fernseher zählt jeder Pixel. */
  width: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2vh;
  min-height: 0;
  padding: 2vh 2.4vw 2.4vh;
}

.tv-empty { margin: auto; text-align: center; font-size: 3vh; }

/* Obere Hälfte: die Felder. */
.tv-fields {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(var(--fields, 4), minmax(0, 1fr));
  gap: 1.6vh;
}
body.tv .lv-tile { gap: 1vh; padding: 1.8vh 1.6vw 2.2vh; border-radius: 1.6vh; }
body.tv .lv-tile.is-live { box-shadow: inset 0 0.6vh 0 var(--accent); }
body.tv .lv-tile-head { font-size: 2vh; margin-bottom: 0.6vh; }
body.tv .lv-dot { width: 1.2vh; height: 1.2vh; }
body.tv .lv-team { min-height: 8vh; gap: 1vw; }
body.tv .lv-name { font-size: 3vh; line-height: 1.15; }
body.tv .lv-score { font-size: 8vh; }
body.tv .lv-ball { font-size: 2.4vh; }
body.tv .lv-free { margin: 2vh 0 0; font-size: 3vh; color: var(--text-dim); }

/* Untere Hälfte: drei Spalten. */
.tv-columns {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.6vh;
  min-height: 0;
}
.tv-col {
  min-height: 0;
  overflow: hidden;
  padding: 1.8vh 1.4vw;
  border: 1px solid var(--border);
  border-radius: 1.6vh;
  background: var(--surface);
}
.tv-col h2 {
  margin: 0 0 1.2vh;
  font-size: 2.1vh;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.tv-slot { margin: 1.2vh 0 0.4vh; font-size: 2.9vh; font-weight: 800; }
.tv-slot:first-of-type { margin-top: 0; }
.tv-none { margin: 0; color: var(--text-dim); }

.tv-list { margin: 0; padding: 0; list-style: none; }
.tv-list li {
  display: flex;
  align-items: baseline;
  gap: 1vw;
  padding: 0.8vh 0;
  border-bottom: 1px solid var(--border);
  font-size: 2.7vh;
  line-height: 1.25;
}
.tv-list li:last-child { border-bottom: none; }
.tv-tag { flex: 0 0 auto; color: var(--accent); font-weight: 800; }
/* Umbrechen statt abschneiden: "Schwäbisch Hall Unicorns vs Kiel Baltic
   Hurricanes" passt nicht in ein Drittel der Breite, und ein halber
   Teamname hilft am Fernseher niemandem. */
.tv-match { flex: 1; min-width: 0; }
.tv-vs { color: var(--text-dim); }
.tv-trail { color: var(--text-dim); }
.tv-final {
  flex: 0 0 auto;
  font-size: 3.2vh;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

/* ── Top 10 (stats.php) ──────────────────────────────────────────────── */

.st-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.st-card {
  padding: 14px 16px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.st-card h2 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.st-list { margin: 0; padding: 0; list-style: none; }
.st-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.st-list li:last-child { border-bottom: none; }
.st-rank {
  flex: 0 0 24px;
  font-weight: 800;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.st-player { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.3; }
.st-name { font-weight: 700; }
.st-team { font-size: 14px; }
.st-value {
  font-size: 22px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.st-list li.is-first .st-rank,
.st-list li.is-first .st-value { color: var(--accent); }

/* Alle Spieler nach Team, unter den Top 10. Überschreibt die globale
   Tabellen-CSS (nowrap, breites Padding, Großbuchstaben), damit lange
   Namen umbrechen statt aus der Karte zu laufen. */
.st-heading { margin: 32px 0 0; font-size: 20px; }
.st-grid-teams { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.st-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.st-table th, .st-table td {
  padding: 7px 0 7px 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  vertical-align: top;
  white-space: nowrap;
  width: 1%;
}
.st-table thead th { font-size: 11px; letter-spacing: .06em; }
.st-table th:first-child { width: 100%; }
.st-table tbody th {
  padding-left: 0;
  text-align: left;
  white-space: normal;
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  color: var(--text);
  line-height: 1.3;
}
.st-table thead th:first-child { padding-left: 0; text-align: left; }
.st-num { font-weight: 800; margin-right: 4px; }
.st-pname { color: var(--text-dim); font-weight: 600; overflow-wrap: break-word; }
.st-table tbody tr:last-child > * { border-bottom: none; }
.st-table td:nth-child(2) { font-weight: 900; }

/* Liga-Umschalter über den Top 10 */
.st-leagues { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.st-leagues a {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.st-leagues a.is-active { border-color: var(--accent); background: var(--accent); color: #000; }
