.page-content--tabelle {
  max-width: 780px;
}

.tabelle-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  border: 1px solid #ddd;
}

.table-wrap {
  overflow: auto;
  max-height: min(460px, 60vh);
}

.tabelle {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}

.tabelle thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eaeaea;
  font-weight: 700;
  padding: 10px 6px;
  border: 1px solid #d0d0d0;
  text-align: center;
}

.tabelle tbody td {
  padding: 10px 6px;
  border: 1px solid #e0e0e0;
  text-align: center;
  height: 38px;
  vertical-align: middle;
}

.tabelle tbody td.col-mannschaft {
  text-align: left;
  padding-left: 14px;
  font-weight: 700;
}

.tabelle tbody td.col-platz,
.tabelle tbody td.col-punkte {
  font-weight: 700;
}

.col-platz { width: 60px; }
.col-mannschaft { width: 180px; }
.col-punkte { width: 80px; }

/* Kurzbezeichner sind nur auf schmalen Schirmen sichtbar */
.th-kurz { display: none; }

/* "Torverhaeltnis" braucht 92px, die Spalte ist aber immer nur 71px breit
   (die Tabelle ist auf 780px gedeckelt) - deshalb dort dauerhaft die Kurzform
   mit Tooltip, wie im Aushang. */
.tabelle abbr {
  text-decoration: none;
  border: none;
  cursor: help;
}

.tabelle tbody tr.rank-1 { background: #d3fad3; }
.tabelle tbody tr.rank-2 { background: #ffffdf; }
.tabelle tbody tr.rank-3,
.tabelle tbody tr.rank-4 { background: #fff; }
.tabelle tbody tr.rank-zebra-even { background: #f9f9f9; }
.tabelle tbody tr.rank-zebra-odd { background: #fff; }

.tabelle tbody tr.selected {
  background: #358ae6;
  color: #fff;
}

.tabelle tbody tr.selected td {
  border-color: #2a6fc4;
  color: #fff;
}

.tabelle tbody tr { cursor: pointer; }
.tabelle tbody tr:hover:not(.selected) { filter: brightness(0.97); }

.tabelle-leer {
  padding: 24px 16px !important;
  text-align: center;
  color: var(--color-muted);
  font-weight: 600;
}


/* ---------- Grosse Schirme ----------
   Ab 1100px Fensterbreite ist Platz vorhanden: breitere Tabelle, groessere
   Schrift, hoehere Zeilen. Gilt nur fuer diese Seite, weil tabelle.css allein
   von tabelle.html geladen wird. Handy und Tablet bleiben unberuehrt. */

@media (min-width: 1100px) {
  .page-content--tabelle { max-width: 1040px; }

  .tabelle { font-size: 17px; }

  .tabelle thead th,
  .tabelle tbody td { padding: 14px 10px; }

  .tabelle tbody td { height: 48px; }

  .tabelle tbody td.col-mannschaft { padding-left: 20px; }

  .col-platz { width: 80px; }
  .col-mannschaft { width: 260px; }
  .col-punkte { width: 100px; }

  /* Mehr Zeilen ohne Rollen: neun Mannschaften passen so vollstaendig hinein. */
  .table-wrap { max-height: min(680px, 74vh); }
}


/* ---------- Handy ----------
   Mit table-layout:fixed und festen Breiten von zusammen 320px blieben fuer
   die sechs Statistikspalten je 3px uebrig. Darum hier eigene, knappe Breiten
   und die Kurzbezeichner aus dem Aushang. */

/* Unterhalb von ~780px Fensterbreite bleiben je Statistikspalte weniger als
   die noetigen 71px uebrig ("Unentsch."), deshalb hier schon auf Kurzform. */
@media (max-width: 820px) {
  .th-lang { display: none; }
  .th-kurz { display: inline; }
}

@media (max-width: 560px) {
  .tabelle { font-size: 13px; }

  .tabelle thead th,
  .tabelle tbody td {
    padding: 9px 2px;
  }

  .tabelle tbody td.col-mannschaft {
    padding-left: 7px;
    overflow-wrap: anywhere;
    hyphens: auto;
  }

  .col-platz { width: 30px; }
  .col-mannschaft { width: auto; }
  .col-sp,
  .col-s,
  .col-u,
  .col-n { width: 24px; }
  .col-tore { width: 46px; }
  .col-diff { width: 32px; }
  .col-punkte { width: 32px; }

  .table-wrap { max-height: none; }
}

/* ---------- Zwei Gruppentabellen ---------- */

.tabelle-gruppe {
  margin-bottom: 28px;
}

.tabelle-gruppe__titel {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 1.05rem;
}

/* Platz 1 und 2: Halbfinale */
.tabelle tbody tr.rank-quali {
  background: var(--color-quali);
}

.tabellen-status {
  margin: 0 0 20px;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 0.9rem;
  background: #fff8e6;
  border: 1px solid #f0d878;
  color: #7a5c00;
}

.tabellen-status:empty {
  display: none;
}

.tabellen-status.is-fertig {
  background: #f0fff4;
  border-color: #c6f6d5;
  color: #276749;
}

.tabellen-legende {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.legende-marke {
  display: inline-block;
  width: 18px;
  height: 12px;
  border: 1px solid #c0c0c0;
  border-radius: 2px;
}

.legende-marke--quali {
  background: var(--color-quali);
}

/* Auf grossen Schirmen stehen die Tabellen in zwei Spalten nebeneinander
   nicht - beide bleiben untereinander, dafuer ohne eigenes Rollen. */
.tabelle-gruppe .table-wrap {
  max-height: none;
}
