:root {
  --color-bg: #0f172a;
  --color-bg-light: #f4f6f9;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --color-warning: #d97706;
  --color-text: #1e293b;
  --color-muted: #64748b;
  --color-border: #e2e8f0;
  --color-card: #ffffff;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg-light);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
}

a { color: var(--color-primary); }

.container {
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  box-sizing: border-box;
}

.container-narrow {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px;
}

header.app-header {
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

header.app-header h1 {
  font-size: 1.25rem;
  margin: 0;
}

.site-logo {
  height: 1.3em;
  width: auto;
  vertical-align: -0.22em;
}

nav.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 16px 0;
}

nav.tabs a {
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 0.95rem;
  white-space: nowrap;
}

nav.tabs a.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* Menü/Kopfzeile nie mitdrucken - egal auf welcher Admin-Seite (z.B. Spielzettel, Endergebnis) */
@media print {
  nav.tabs { display: none !important; }
}

.card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-groups { grid-template-columns: repeat(2, 1fr); } /* bewusst fest auf max. 2 begrenzt - Gruppentabellen sind inhaltlich breit (viele Spalten), mehr als 2 nebeneinander wird schnell unübersichtlich */
@media (max-width: 900px) { .grid-groups { grid-template-columns: 1fr; } }
.grid-table-wrap { overflow-x: auto; } /* verhindert, dass eine zu breite Tabelle in Nachbar-Spalten hineinragt */
.grid-table-wrap table { min-width: 100%; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--color-border);
}

th { color: var(--color-muted); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; }

.rank-1 { font-weight: 700; color: var(--color-success); }

label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 0.9rem; }

input[type=text], input[type=number], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  font-size: 1rem;
  background: #fff;
}

.field-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.field-row input, .field-row select { flex: 1; }

/* Positionen-Zuordnung: Textfeld mit Kader-Vorschlagsliste (list=datalist), optisch wie
   ein Dropdown (Chevron rechts), aber frei überschreibbar - siehe admin/match.php */
.position-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
}
.qr-box { text-align: center; padding: 10px; margin-bottom: 14px; background: #f8fafc; border-radius: 10px; }

/* Kommentar-Spalte in Tabellen: standardmäßig ausgeblendet, nur bei Bedarf einblenden */
.col-comment { display: none; }
.show-comments .col-comment { display: table-cell; }

/* Zusammenfassungs-Seite */
.summary-lower { display: grid; grid-template-columns: 1fr 3fr; gap: 20px; align-items: start; margin-top: 20px; }

/* Inline geoeffnete Ergebniseingabe innerhalb der "Aktuelle Stage"-Karte - deutlich
   abgesetzt von der Tabelle/den Runden darueber, statt direkt daran zu kleben. */
#matchDetailCard:not(:empty) {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 2px solid var(--color-border);
}
@media (max-width: 900px) {
  .summary-lower { grid-template-columns: 1fr; }
  /* .summary-links-card ist nur im 2-Spalten-Layout sinnvoll "sticky" (bleibt sichtbar,
     während man die danebenliegende breite Spalte durchscrollt). Sobald die Spalten
     bei schmalen Screens untereinander stehen, gibt es keine "daneben" mehr - sticky
     würde die Karte dann einfach dauerhaft oben festkleben und alles darunter beim
     Scrollen überdecken. */
  .summary-links-card { position: static; }
}
.summary-links-card { /* position: sticky; */ top: 20px; }
.summary-links-list { display: flex; flex-direction: column; gap: 8px; }
.summary-links-list .btn { text-align: center; }

.adm-tabs { width: 100%; }
.adm-tab-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; border-bottom: 1px solid var(--color-border); padding-bottom: 8px; }
.adm-tab-btn {
  background: #fff; border: 1px solid var(--color-border); color: var(--color-muted);
  border-radius: 20px; padding: 6px 14px; font-size: 0.85rem; cursor: pointer;
  text-decoration: none; display: inline-block;
}
.adm-tab-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; font-weight: 700; }
.adm-tab-panel { display: none; }
.adm-tab-panel.active { display: block; }
.adm-tab-panel .adm-tabs { margin-top: 4px; }

.adm-match-rows { display: flex; flex-direction: column; gap: 6px; }
.adm-match-row {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  border: 1px solid var(--color-border); border-radius: 8px; text-decoration: none; color: inherit;
  background: #fff;
}
a.adm-match-row:hover { border-color: var(--color-primary); }
.adm-row-field { color: var(--color-primary); font-weight: 700; min-width: 70px; font-size: 0.85rem; }
.adm-row-vs { flex: 1; }
.adm-row-score { font-weight: 700; min-width: 60px; text-align: right; }
.adm-row-pending { background: #dcfce7; border-color: #86efac; }
.adm-row-live { background: #eff6ff; border-color: #bfdbfe; }

.field-card { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 16px; }
.field-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.field-card-header strong { font-size: 1.05rem; }
.field-card-vs { font-weight: 600; margin-bottom: 10px; }
.field-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.field-card-more { margin-top: 12px; border-top: 1px solid var(--color-border); padding-top: 8px; }
.field-card-more summary { cursor: pointer; color: var(--color-primary); font-size: 0.9rem; font-weight: 600; list-style: none; }
.field-card-more summary::-webkit-details-marker { display: none; }
.field-card-more summary::before { content: "▸ "; }
.field-card-more[open] summary::before { content: "▾ "; }
.field-card-more-body { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.waiting-match-row { align-items: flex-start; }
.waiting-match-pos { font-weight: 700; color: var(--color-muted); min-width: 28px; padding-top: 2px; }
.waiting-match-item { border: 1px solid transparent; border-radius: 10px; margin-bottom: 4px; }
.waiting-match-item.dragging { opacity: 0.4; }
.waiting-match-item:hover { border-color: var(--color-border); }
.waiting-match-conflict { color: var(--color-warning); font-size: 0.8rem; margin-top: 2px; }
.drag-handle { cursor: grab; color: var(--color-muted); font-size: 1.1rem; padding-top: 2px; user-select: none; }
.drag-handle:active { cursor: grabbing; }

/* Gruppen einteilen per Drag & Drop */
.group-assign-card {
  background: #fff; border: 2px solid var(--color-border); border-radius: 12px;
  padding: 14px; min-height: 120px; transition: border-color 0.15s, background 0.15s;
}
.group-assign-card h3 { margin: 0 0 10px; font-size: 1rem; }
.group-assign-card.drag-over { border-color: var(--color-primary); background: #eff6ff; }
.group-assign-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 40px; }
.group-assign-pool { margin-top: 16px; padding: 14px; border: 2px dashed var(--color-border); border-radius: 12px; }
.participant-chip {
  background: #f1f5f9; border: 1px solid var(--color-border); border-radius: 20px;
  padding: 8px 14px; font-size: 0.9rem; cursor: grab; user-select: none;
}
.participant-chip:active { cursor: grabbing; }
.participant-chip.dragging { opacity: 0.4; }
.participant-chip.selected { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.participant-chip.drag-over-insert { box-shadow: -3px 0 0 var(--color-primary); }
.group-assign-list .participant-chip { display: inline-flex; align-items: center; gap: 6px; }
.chip-pos {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border-radius: 50%; background: #64748b; color: #fff; font-size: 0.7rem; font-weight: 700; flex: none;
}
.participant-chip:nth-child(1) .chip-pos, .participant-chip:nth-child(2) .chip-pos { background: #d97706; }

/* Turnierbaum: manuelle Slot-Zuordnung per Drag & Drop */
.bracket-slot-drop {
  border: 2px dashed var(--color-border); border-radius: 8px; padding: 8px;
  min-height: 40px; display: flex; align-items: center; transition: border-color 0.15s, background 0.15s;
}
.bracket-slot-drop.drag-over { border-color: var(--color-primary); background: #eff6ff; }
.bracket-slot-drop .participant-chip { cursor: grab; width: 100%; }

.btn {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover { background: var(--color-primary-dark); }
.btn.secondary { background: #fff; color: var(--color-text); border: 1px solid var(--color-border); }
.btn.danger { background: var(--color-danger); }
.btn.success { background: var(--color-success); }
.btn.small { padding: 8px 14px; font-size: 0.85rem; }
.btn.block { display: block; width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--color-border);
  color: var(--color-muted);
}
.badge.running { background: #dcfce7; color: var(--color-success); }
.badge.finished { background: #e2e8f0; color: var(--color-muted); }
.badge.waiting { background: #fef3c7; color: var(--color-warning); }
.badge.confirm-pending { background: #bbf7d0; color: #15803d; font-weight: 700; }
.confirm-banner {
  background: #dcfce7; border: 1px solid #86efac; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 14px; color: #14532d;
}
.confirm-banner .btn { color: #fff; }

.muted { color: var(--color-muted); font-size: 0.9rem; }
.mt-0 { margin-top: 0; }
.flash {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 600;
}
.flash.ok { background: #dcfce7; color: #166534; }
.flash.error { background: #fee2e2; color: #991b1b; }

.copy-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: monospace;
  font-size: 0.9rem;
  word-break: break-all;
}
.link-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 4px; flex-wrap: wrap; }
.link-row .copy-box { flex: 1; min-width: 0; }
.link-row .btn { flex-shrink: 0; white-space: nowrap; }
@media (max-width: 640px) {
  /* Auf schmalen Screens quetscht sich sonst die URL-Box neben mehreren Buttons zu
     einer unlesbaren Spalte zusammen - lieber die URL-Box in eine eigene Zeile. */
  .link-row .copy-box { flex-basis: 100%; }
}

/* ============ Ergebniseingabe (Smartphone) ============ */
.score-pad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
  align-items: stretch;
}
.score-side {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
}
.score-side h3 { margin: 0 0 8px; font-size: 1rem; min-height: 2.4em; display: flex; align-items: center; justify-content: center; }
.score-value {
  font-size: 4rem;
  font-weight: 800;
  margin: 10px 0;
  line-height: 1;
}
.big-tap-btn {
  width: 100%;
  padding: 26px 0;
  font-size: 1.6rem;
  font-weight: 800;
  border-radius: 16px;
  border: none;
  color: #fff;
  background: var(--color-primary);
  cursor: pointer;
}
.big-tap-btn:active { transform: scale(0.97); }
/* Punkt/-1 werden bewusst UNTEREINANDER gestapelt (nicht nebeneinander) -
   das bleibt so auch auf schmalen Hochkant-Bildschirmen sauber lesbar. */
.tap-btn-col { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.tap-btn-col .big-tap-btn { order: 1; }
.tap-btn-col .minus-tap-btn { order: 2; width: 100%; }
.minus-tap-btn {
  padding: 14px 0;
  font-size: 1.1rem;
  font-weight: 800;
  border-radius: 16px;
  border: none;
  color: #fff;
  background: var(--color-danger);
  cursor: pointer;
}
.minus-tap-btn:active { transform: scale(0.97); }
.sets-history { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.set-chip {
  background: #f1f5f9; border: 1px solid var(--color-border); border-radius: 8px;
  padding: 6px 12px; font-size: 0.85rem; cursor: pointer;
}
.set-chip:active { background: #e2e8f0; }
.correct-form {
  margin-top: 12px; padding: 12px; background: #f8fafc; border-radius: 10px;
  border: 1px solid var(--color-border);
}
.correct-form-actions { display: flex; gap: 8px; margin-top: 10px; }
.correct-form-actions .btn { flex: 1; }

/* ============ Team-Stand hervorgehoben (Mannschaftsturnier) ============ */
.team-score-banner {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  margin-bottom: 16px;
}
.team-score-banner .names { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.team-score-banner .score { font-size: 3.2rem; font-weight: 800; line-height: 1; }
.team-score-banner .score.draw { font-size: 1.6rem; }
.team-score-banner .label { font-size: 0.75rem; opacity: 0.85; text-transform: uppercase; letter-spacing: 1px; margin-top: 8px; }

/* .match-tile wird u.a. im Admin-Dashboard für "Laufende Spiele" genutzt (siehe render_match_tile()) */
.match-tile {
  background: #1e293b;
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  color: #e2e8f0;
}
.match-tile .field-label { color: #93c5fd; font-weight: 700; margin-bottom: 8px; }
.match-tile .tile-context { color: #94a3b8; font-size: 0.75rem; margin: -6px 0 8px; }
.match-tile .tile-timer { color: #fbbf24; font-size: 0.8rem; font-weight: 700; margin-bottom: 6px; }
.match-tile .vs { font-size: 1.4rem; font-weight: 800; margin: 6px 0; color: #fff; }
.team-logo { height: 1.3em; width: auto; vertical-align: -0.22em; margin: 0 3px; border-radius: 3px; }

/* Schnelleingabe: kompakte, tabbare Satz-Tabelle */
.quick-entry-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 10px; }
.quick-entry-table th, .quick-entry-table td { border: 1px solid var(--color-border); padding: 6px 8px; text-align: center; }
.quick-entry-table th { background: #f1f5f9; font-weight: 700; white-space: nowrap; }
.quick-entry-table td.qe-names { text-align: left; min-width: 160px; font-size: 1.05rem; font-weight: 600; }
.quick-entry-table .qe-input {
  width: 48px; text-align: center; padding: 5px 2px; border: 1.5px solid var(--color-primary);
  border-radius: 5px; font-size: 0.95rem;
}
.quick-entry-table .qe-input:disabled { border-color: var(--color-border); background: #f8fafc; opacity: 0.4; }
.quick-entry-table .qe-input:focus { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.quick-entry-table .qe-done { background: #f0fdf4; color: #166534; font-weight: 700; cursor: pointer; }
.quick-entry-table .qe-done:hover { background: #dcfce7; outline: 1.5px dashed #166534; outline-offset: -2px; }
.quick-entry-table .qe-sets-total { font-weight: 800; background: #f8fafc; }
.quick-entry-table tr[data-decided="1"] .qe-sets-total { color: #15803d; }
.match-tile .score-line { font-size: 1.6rem; font-weight: 800; color: #fff; }
.match-tile .sub-score { color: #cbd5e1; font-size: 0.9rem; }
.match-tile .tile-done { color: #4ade80; font-weight: 700; font-size: 0.85rem; margin-top: 8px; }
.match-tile-done { background: #123321; border: 1px solid #1e5c3a; }
.match-tile-done .field-label { color: #6ee7a5; }

/* ============ Bracket-Darstellung (Admin) ============ */
.bracket { display: flex; gap: 30px; overflow-x: auto; padding: 10px 0; }
.bracket-round-outer { display: flex; flex-direction: column; min-width: 200px; }
.bracket-round-label { text-align: center; font-weight: 600; color: var(--color-muted); padding-bottom: 10px; flex-shrink: 0; }
.bracket-round { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.bracket-slot { display: flex; align-items: center; justify-content: center; padding: 4px 0; flex-basis: 0; min-height: 0; }
.bracket-match { background: var(--color-card); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; font-size: 0.9rem; width: 100%; }
.presentation .bracket-match { background: #1e293b; }
.bracket-match .p { padding: 3px 0; display: flex; justify-content: space-between; }
.bracket-match .p.winner { font-weight: 700; color: var(--color-success); }

/* Platzierungsspiel (z.B. "Spiel um Platz 3") - bewusst getrennt vom Baum, siehe
   render_placement_match_box() */
.placement-match-box { max-width: 260px; margin-top: 26px; padding-top: 20px; border-top: 2px dashed var(--color-border); }
.placement-match-label { font-weight: 700; color: var(--color-muted); margin-bottom: 8px; font-size: 0.9rem; }

@media (max-width: 640px) {
  .score-value { font-size: 3rem; }
  .big-tap-btn { padding: 20px 0; font-size: 1.3rem; }
  .minus-tap-btn { padding: 12px 0; font-size: 0.95rem; }
}
@media (max-width: 400px) {
  /* Auf sehr schmalen Screens auch die beiden Seiten (Spieler 1/2) untereinander statt
     nebeneinander - sonst wird jede Seite zu schmal, um noch sauber lesbar zu sein. */
  .score-pad { grid-template-columns: 1fr; }
}

/* ============ Öffentliche Startseite (index.php) ============ */
.landing-tournament-card { background: #f8fafc; margin-bottom: 14px; }
.landing-tournament-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
}
.landing-tournament-name { flex: 1; min-width: 160px; }
.landing-tournament-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.landing-field-links { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 480px) {
  /* Auf schmalen Handys reicht neben dem Namen kein Platz mehr für die beiden Buttons -
     lieber sauber untereinander als gequetscht/abgeschnitten nebeneinander. */
  .landing-tournament-header { flex-direction: column; align-items: stretch; }
  .landing-tournament-actions .btn { flex: 1; text-align: center; }
}

/* ============================================================================
   ADMINBEREICH: MOBILE (<=768px)
   ============================================================================
   Der Adminbereich war bisher nicht für schmale Bildschirme gedacht (mehrspaltige
   Grids, Tabellen ohne Scroll-Wrapper, nicht umbrechende Formular-Zeilen). Dieser
   Block macht die grundlegende Bedienung vom Handy aus möglich, ohne die einzelnen
   Admin-Seiten inhaltlich umzubauen.
   ============================================================================ */
@media (max-width: 768px) {
  .container, .container-narrow { padding: 12px; }
  header.app-header { padding: 12px; }
  header.app-header h1 { font-size: 1.05rem; }

  nav.tabs { gap: 4px; margin: 12px 0; }
  nav.tabs a { padding: 8px 12px; font-size: 0.85rem; }

  .card { padding: 14px; }

  /* Mehrspaltige Grids: unter dieser Breite lohnt sich "nebeneinander" nicht mehr -
     eine Spalte ist lesbarer als mehrere arg gequetschte. */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  /* Tabellen haben in vielen Admin-Seiten mehr Spalten, als auf ein schmales Display
     passen - horizontal scrollbar statt die ganze Seite seitlich verschieben zu
     lassen. Pragmatischer Ansatz direkt am table-Element, ohne dass jede einzelne
     Admin-Seite einen eigenen Wrapper-div bräuchte. */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Formular-Zeilen mit mehreren Feldern nebeneinander (Positionen-Zuordnung,
     Stage-Regeln, Feld-Zuweisung, ...) - stapeln statt seitlich abzuschneiden. */
  .field-row { flex-wrap: wrap; }
  .field-row > label { flex: 1 1 100%; }

  .quick-entry-table { font-size: 0.8rem; }
  .quick-entry-table th, .quick-entry-table td { padding: 4px 6px; }
  .quick-entry-table td.qe-names { font-size: 0.95rem; }

  /* Admin-Turnierbaum (Turnierverlauf) ist schon horizontal scrollbar
     (.bracket { overflow-x:auto }), Spalten auf dem Handy nur etwas kompakter. */
  .bracket-round-outer { min-width: 160px; }
  .bracket-match { padding: 8px 10px; font-size: 0.85rem; }

  /* Gruppen-/Turnierbaum-Zuordnung: Chips etwas kompakter, damit mehr davon in eine
     Zeile passen. Die Zuordnung selbst funktioniert auf Touch-Geräten schon ohne
     Drag&Drop über Tippen-zum-Auswählen/Einfügen (siehe admin/stages.php JS). */
  .participant-chip { font-size: 0.85rem; padding: 6px 10px; }
}

@media (max-width: 480px) {
  /* "Turnier-Links zum Teilen" (URL + mehrere Buttons wie "📜 Komplettübersicht") und
     Spielfeld-Zeilen: auf schmalen Handys reicht der Platz für "nebeneinander mit
     Umbruch" oft nicht - stattdessen komplett untereinander, jedes Element auf
     voller Breite. Bulletproof gegen jede Button-Textlänge, statt auf genau
     passenden Zeilenumbruch zu hoffen. */
  .link-row, .field-row { flex-direction: column; align-items: stretch; }
  .link-row .btn, .field-row .btn { width: 100%; }
  .qr-box canvas { max-width: 100%; height: auto; }
}

/* ============ Match-Karte (Turnierleitung) ============
   Klappt direkt unter "Laufende Spiele" auf (fester Platz im Seiten-Fluss, nahe an dem,
   wo man normalerweise hinklickt) statt als Overlay über der Seite - auf dem Handy sorgte
   das Overlay für eine Lücke am oberen Rand (100vh-Problem durch ein-/ausblendende
   Adressleiste) und wirkte "springend", da die Seite dahinter nicht am Mitscrollen
   gehindert wurde. Beim Öffnen wird stattdessen mittig ins Bild gescrollt (siehe JS). */
#matchDetailCard > .card { border: 2px solid var(--color-primary); }

/* Fehlte bisher komplett - dadurch waren ALLE per classList.toggle('hidden-block')
   auf-/zuklappbaren Bereiche (Stage umbenennen/Einstellungen, Teilnehmer umbenennen)
   die ganze Zeit dauerhaft sichtbar statt wie vorgesehen standardmäßig eingeklappt. */
.hidden-block { display: none; }

/* ---------- Offline-Sync (Pi als Kopie), siehe includes/sync.php ---------- */
.sync-banner { padding: 10px 14px; border-radius: 10px; margin: 0 0 14px; font-size: 0.95rem; }
.sync-banner a { font-weight: 600; margin-left: 6px; }
.sync-banner.mirror { background: #e0f2fe; color: #075985; }
.sync-banner.stale { background: #fef3c7; color: #92400e; }
.sync-banner.primary { background: #fee2e2; color: #991b1b; }
.sync-status { width: 100%; border-collapse: collapse; }
.sync-status th { text-align: left; padding: 6px 10px 6px 0; white-space: nowrap; vertical-align: top; color: var(--color-muted); font-weight: 600; }
.sync-status td { padding: 6px 0; }
.mt-1 { margin-top: 10px; }
.text-danger { color: var(--color-danger); }


/* ---------- Laufende Spiele (Admin, render_match_tile): Ergebnistafel + Einzelbegegnungen ---------- */
.match-tile .tile-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; margin: 2px 0; }
.match-tile .tile-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.15rem; font-weight: 800; }
.match-tile .tile-name.name-long { font-size: 1rem; }
.match-tile .tile-name.name-xlong { font-size: 0.85rem; }
.match-tile .tile-score { flex: 0 0 auto; font-size: 1.5rem; font-weight: 800; color: #fff; font-family: ui-monospace, Consolas, monospace; }
.match-tile .team-a .tile-name { color: #fdba74; }
.match-tile .team-b .tile-name { color: #5eead4; }
.match-tile .tile-row.team-a { margin-top: 8px; }
.match-tile .rubber-grid { display: grid; gap: 6px; margin-top: 12px; }
.match-tile .rubber-cell { display: flex; flex-direction: column; align-items: center; padding: 5px 2px; border-radius: 7px; border: 2px solid transparent; background: rgba(255,255,255,0.06); line-height: 1.15; min-width: 0; }
.match-tile .rc-type { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: #94a3b8; white-space: nowrap; }
.match-tile .rc-score { font-size: 0.95rem; font-weight: 800; color: #fff; font-family: ui-monospace, Consolas, monospace; white-space: nowrap; }
.match-tile .rubber-cell.win-a { background: rgba(253, 186, 116, 0.22); }
.match-tile .rubber-cell.win-a .rc-type, .match-tile .rubber-cell.win-a .rc-score { color: #fdba74; }
.match-tile .rubber-cell.win-b { background: rgba(94, 234, 212, 0.18); }
.match-tile .rubber-cell.win-b .rc-type, .match-tile .rubber-cell.win-b .rc-score { color: #5eead4; }
.match-tile .rubber-cell.live { border-color: #ef4444; }
.match-tile .rubber-cell.open { background: transparent; opacity: 0.45; }

/* Schnelleingabe direkt in der Kachel (admin/summary.php, render_quick_set_entry) */
.match-tile-click { cursor: pointer; }
.match-tile .quick-set { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.12); text-align: left; cursor: default; }
.match-tile .qs-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.match-tile .qs-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: #93c5fd; margin-right: 4px; }
.match-tile .qs-chip { font-size: 0.8rem; font-family: ui-monospace, Consolas, monospace; background: rgba(255,255,255,0.1); color: #e2e8f0; border-radius: 10px; padding: 1px 8px; }
.match-tile .qs-undo { margin-left: auto; background: transparent; border: 1px solid rgba(255,255,255,0.25); color: #cbd5e1; border-radius: 6px; padding: 0 8px; cursor: pointer; font-size: 0.9rem; }
.match-tile .qs-undo:hover { border-color: #f87171; color: #f87171; }
.match-tile .qs-players { font-size: 0.8rem; color: #cbd5e1; margin: -2px 0 6px; }
.match-tile .qs-row { display: flex; align-items: center; gap: 8px; }
.match-tile .qs-input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 6px; border: 1.5px solid #3b82f6; background: #0f172a; color: #fff; font-size: 1rem; font-family: ui-monospace, Consolas, monospace; }
.match-tile .qs-input:focus { outline: 2px solid #60a5fa; outline-offset: 1px; }
.match-tile .qs-preview { min-width: 4.5em; font-family: ui-monospace, Consolas, monospace; font-weight: 700; color: #fbbf24; white-space: nowrap; }
.match-tile .qs-btn { background: #2563eb; color: #fff; border: none; border-radius: 6px; padding: 8px 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.match-tile .qs-btn:hover { background: #1d4ed8; }

/* ==========================================================================
   Formular-Bausteine (Neues Turnier, Turnierverlauf) - einheitlich:
   jedes Bedienelement ist eine 44px hohe Box, Beschriftung immer darüber,
   Erklärungen nur über das ⓘ, Raster mit gleich breiten Spalten.
   ========================================================================== */
.ui-wrap { max-width: 780px; }
.ui-title { font-size: 1.3rem; margin: 4px 0 14px; }
.ui-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 14px; }
.ui-grid + .ui-grid { margin-top: 16px; }
.ui-span-2 { grid-column: span 2; }
.ui-span-3 { grid-column: 1 / -1; }
.ui-field { min-width: 0; }
.ui-field > .ui-lbl, .ui-lbl {
  display: flex; align-items: center; gap: 6px; height: 20px;
  margin: 0 0 6px; font-size: .82rem; font-weight: 700; color: #334155;
}
.ui-field input[type=text], .ui-field input[type=number], .ui-field select {
  height: 44px; padding: 0 12px; border: 1.5px solid #cbd5e1; border-radius: 10px; font-size: 1rem;
}
.ui-field input:focus, .ui-field select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

/* ⓘ-Hinweis */
.ui-i {
  display: inline-flex; width: 17px; height: 17px; border-radius: 50%; background: #e2e8f0; color: #475569;
  font-size: .7rem; font-style: normal; font-weight: 700; align-items: center; justify-content: center; cursor: help; position: relative; flex-shrink: 0;
}
.ui-i:hover::after, .ui-i:focus::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: 140%; transform: translateX(-50%);
  background: #0f172a; color: #fff; font-weight: 400; font-size: .78rem; line-height: 1.4; text-transform: none;
  padding: 8px 10px; border-radius: 8px; width: 250px; z-index: 20; white-space: normal; text-align: left;
}

/* Segment-Schalter (Radio-Buttons) - Knöpfe gleich breit */
.ui-seg { display: flex; background: #f1f5f9; border-radius: 10px; padding: 3px; gap: 3px; height: 44px; }
.ui-seg label { flex: 1 1 0; margin: 0; display: flex; }
.ui-seg input { position: absolute; opacity: 0; pointer-events: none; }
.ui-seg span {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px;
  font-weight: 600; font-size: .93rem; color: #475569; cursor: pointer; white-space: nowrap; padding: 0 8px;
}
.ui-seg input:checked + span { background: #fff; color: var(--color-primary); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.ui-seg input:focus-visible + span { outline: 2px solid var(--color-primary); }

/* Zahlen mit −/＋ (füllt die Spalte komplett) */
.ui-step { display: flex; height: 44px; border: 1.5px solid #cbd5e1; border-radius: 10px; overflow: hidden; background: #fff; }
.ui-step button { width: 44px; flex-shrink: 0; border: 0; background: #f8fafc; font-size: 1.2rem; cursor: pointer; color: #334155; }
.ui-step button:hover { background: #eef2f7; }
.ui-field .ui-step input[type=number] {
  flex: 1; min-width: 0; height: 100%; border: 0; border-radius: 0; box-shadow: none; padding: 0;
  text-align: center; font-weight: 700; font-size: 1.05rem; -moz-appearance: textfield;
}
.ui-step input::-webkit-outer-spin-button, .ui-step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ui-step:focus-within { border-color: var(--color-primary); }

/* Schalter als Box (gleiche Höhe/Rahmen wie Eingabefelder) */
.ui-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 44px; margin: 0;
  padding: 0 12px; border: 1.5px solid #cbd5e1; border-radius: 10px; background: #fff;
  font-weight: 600; font-size: .95rem; cursor: pointer; user-select: none;
}
.ui-switch input { position: absolute; opacity: 0; pointer-events: none; }
.ui-switch i { width: 42px; height: 24px; border-radius: 999px; background: #cbd5e1; position: relative; transition: .15s; flex-shrink: 0; }
.ui-switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: .15s; }
.ui-switch input:checked ~ i { background: var(--color-primary); }
.ui-switch input:checked ~ i::after { left: 21px; }
.ui-switch input:focus-visible ~ i { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Begegnungen als Chips */
.ui-chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 44px; padding: 5px 6px;
  border: 1.5px solid #cbd5e1; border-radius: 10px; background: #fff;
}
.ui-chips .ui-chip { display: inline-flex; align-items: center; gap: 6px; background: #f1f5f9; border-radius: 999px; padding: 5px 10px; font-size: .85rem; font-weight: 600; }
.ui-chips .ui-chip button { border: 0; background: none; padding: 0; cursor: pointer; color: #64748b; font-size: .9rem; line-height: 1; }
.ui-field .ui-chips input[type=text] { flex: 1; min-width: 110px; height: 30px; border: 0; padding: 0 6px; box-shadow: none; font-size: .9rem; }

/* Weitere Einstellungen */
.ui-more { border-top: 1px solid var(--color-border); margin-top: 20px; padding-top: 14px; }
.ui-more > summary { cursor: pointer; font-weight: 700; color: var(--color-primary); list-style: none; }
.ui-more > summary::-webkit-details-marker { display: none; }
.ui-more > summary::before { content: '▸ '; }
.ui-more[open] > summary::before { content: '▾ '; }
.ui-more > .ui-grid { margin-top: 16px; }
.ui-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.ui-actions .btn { min-width: 140px; }
.ui-actions .ui-right { margin-left: auto; }
.ui-hidden { display: none !important; }

/* Stage-Art als Kacheln */
.ui-types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ui-types label { margin: 0; display: flex; }
.ui-types input { position: absolute; opacity: 0; pointer-events: none; }
.ui-types span {
  flex: 1; border: 2px solid var(--color-border); border-radius: 12px; padding: 12px 8px; text-align: center; cursor: pointer; background: #fff;
}
.ui-types span em { display: block; font-style: normal; font-size: 1.5rem; }
.ui-types span b { display: block; margin-top: 4px; }
.ui-types span small { color: var(--color-muted); font-weight: 400; }
.ui-types input:checked + span { border-color: var(--color-primary); background: #eff6ff; }
.ui-types input:focus-visible + span { outline: 2px solid var(--color-primary); }
.ui-defaults { font-size: .85rem; color: var(--color-muted); margin: 6px 0 0; }

/* Turnierverlauf */
.stage-card { border-left: 5px solid #cbd5e1; padding: 16px 18px; }
.stage-card.st-running { border-left-color: var(--color-success); }
.stage-card.st-pending { border-left-color: var(--color-warning); }
.stage-head { display: flex; gap: 14px; align-items: center; }
.stage-num { width: 36px; height: 36px; border-radius: 50%; background: #f1f5f9; display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.stage-body { flex: 1; min-width: 0; }
.stage-title { font-weight: 800; font-size: 1.08rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stage-title .badge { font-size: .72rem; }
.stage-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.stage-chip { background: #f1f5f9; border-radius: 999px; padding: 4px 10px; font-size: .8rem; font-weight: 600; color: #334155; }
.stage-chip.diff { background: #fef3c7; color: #92400e; }
.stage-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stage-acts form { margin: 0; }
.stage-edit { background: #f8fafc; border-radius: 12px; padding: 18px; margin-top: 14px; }
.stage-content { margin-top: 16px; }
.stage-link { margin: -8px 0 8px 34px; padding-left: 18px; border-left: 3px dashed #cbd5e1; color: var(--color-muted); font-size: .85rem; min-height: 34px; display: flex; align-items: center; }
.stage-add {
  display: block; width: 100%; border: 2px dashed #cbd5e1; border-radius: var(--radius); padding: 16px; text-align: center;
  color: var(--color-primary); font-weight: 700; font-size: 1rem; cursor: pointer; background: transparent; margin-bottom: 16px;
}
.stage-add:hover { background: #fff; }

@media (max-width: 640px) {
  .ui-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-span-2 { grid-column: 1 / -1; }
  .ui-types { grid-template-columns: 1fr; }
  .ui-seg { height: auto; flex-wrap: wrap; }
  .ui-seg span { min-height: 38px; }
  .stage-head { flex-wrap: wrap; }
  .stage-acts { width: 100%; justify-content: flex-start; }
}
@media (max-width: 420px) { .ui-grid { grid-template-columns: 1fr; } }

/* Pause (Admin-Navigation) */
nav.tabs .pause-form { margin: 0; display: inline-flex; }
.pause-btn {
  padding: 10px 16px; border-radius: 999px; border: 1px solid #fcd34d; background: #fffbeb; color: #92400e;
  font-size: 0.95rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.pause-btn:hover { background: #fef3c7; }
.pause-btn.pause-btn-resume { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.pause-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -6px 0 16px; padding: 12px 16px;
  background: #fef3c7; border: 1px solid #fcd34d; border-radius: 12px; color: #78350f;
}
.pause-banner .pause-form { margin: 0 0 0 auto; }
.pause-banner .btn { background: var(--color-success); }

/* K.-o.: nächste Runde wartet auf Start */
.release-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; padding: 14px 18px;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius); color: #1e3a8a;
}
.release-banner form { margin: 0 0 0 auto; }

/* Schnelleingabe: Satz löschen (Rückfrage direkt am Feld) */
.quick-entry-table td { position: relative; }
.quick-entry-table .qe-input.qe-armed { border-color: var(--color-danger); background: #fef2f2; outline-color: var(--color-danger); }
.qe-delete-hint {
  position: absolute; left: 50%; top: calc(100% - 2px); transform: translateX(-50%); z-index: 10;
  background: var(--color-danger); color: #fff; font-size: 0.8rem; line-height: 1.35; padding: 6px 10px;
  border-radius: 8px; white-space: nowrap; box-shadow: var(--shadow);
}

/* Satz-Tafel wie im TV: Zeile je Spieler, Spalte je Satz, rechts gewonnene Sätze */
.set-board-wrap { overflow-x: auto; margin: 12px 0 4px; }
.set-board { border-collapse: separate; border-spacing: 0; width: auto; min-width: 280px; font-variant-numeric: tabular-nums; }
.set-board th, .set-board td { border: none; padding: 8px 14px; text-align: center; white-space: nowrap; }
.set-board thead th { font-size: 0.75rem; font-weight: 700; color: var(--color-muted); text-transform: uppercase; padding-bottom: 4px; }
.set-board tbody td { font-size: 1.35rem; font-weight: 600; color: #475569; background: #f8fafc; border-bottom: 1px solid var(--color-border); }
.set-board tbody tr:first-child td:first-child { border-top-left-radius: 10px; }
.set-board tbody tr:last-child td:first-child { border-bottom-left-radius: 10px; }
.set-board tbody tr:first-child td:last-child { border-top-right-radius: 10px; }
.set-board tbody tr:last-child td:last-child { border-bottom-right-radius: 10px; }
.set-board tbody tr:last-child td { border-bottom: none; }
.set-board td.sb-name { text-align: left; font-size: 1rem; font-weight: 700; color: var(--color-text); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.set-board td.sb-won { color: #15803d; font-weight: 800; }
.set-board td.sb-total { background: #1e293b; color: #fff; font-weight: 800; min-width: 54px; }
.set-board td.sb-total.sb-won { background: #15803d; color: #fff; }
.set-board th.sb-live, .set-board td.sb-live { color: #dc2626; }
.set-board td.sb-live { background: #fef2f2; font-weight: 800; }
.set-board-click [data-col] { cursor: pointer; }
.set-board-click td[data-col]:hover, .set-board-click .sb-selected { background: #dbeafe; color: var(--color-primary); }
.set-board-hint { font-size: 0.8rem; color: var(--color-muted); margin: 2px 0 10px; }
.correct-form { margin-top: 8px; }
.correct-form .field-row { flex-wrap: wrap; }
.correct-form .field-row input { min-width: 90px; }

/* Schnelleingabe-Tabelle: größere Felder */
.quick-entry-table { font-size: 1rem; }
.quick-entry-table .qe-input { width: 72px; height: 44px; font-size: 1.2rem; font-weight: 700; }
.quick-entry-table .qe-done { font-size: 1.1rem; }
@media (max-width: 560px) {
  .set-board { width: 100%; min-width: 0; }
  .set-board th, .set-board td { padding: 6px 6px; }
  .set-board tbody td { font-size: 1.15rem; }
  .set-board td.sb-name { font-size: 0.9rem; max-width: 110px; }
  .set-board td.sb-total { min-width: 40px; }
}
/* noch offene Sätze: leere Spalten */
.set-board th.sb-empty { color: #cbd5e1; }
.set-board td.sb-empty { background: #fff; border: 1px dashed #e2e8f0; }
/* ruhiger: Tafel nutzt die volle Kartenbreite, Sätze-Spalte dezenter */
.set-board { width: 100%; }
.set-board td.sb-total { background: #e2e8f0; color: var(--color-text); }
.set-board td.sb-total.sb-won { background: #dcfce7; color: #15803d; }
.set-board td.sb-name, .set-board th.sb-name { width: 100%; max-width: 0; }
.set-board td:not(.sb-name), .set-board th:not(.sb-name) { min-width: 44px; }

/* Schiedsrichter: Satz eintragen - klar beschriftet, zwei Felder nebeneinander (auch am Handy) */
.set-entry { margin-top: 14px; padding: 14px; border: 2px solid var(--color-primary); border-radius: 14px; background: #eff6ff; }
.set-entry-title { font-weight: 800; font-size: 1.05rem; margin-bottom: 10px; color: #1e3a8a; }
.set-entry-title span { font-weight: 400; font-size: 0.85rem; color: var(--color-muted); margin-left: 6px; }
.set-entry-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: end; margin-bottom: 12px; }
.set-entry-row label { margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.set-entry-row label > span { font-size: 0.85rem; font-weight: 700; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-entry-row input[type=number] { width: 100%; background: #fff; border: 1.5px solid #93c5fd; }
.set-entry-row b { font-size: 1.6rem; padding-bottom: 14px; color: var(--color-muted); }
/* nächster Satz in der Tafel: antippbar */
.set-board .sb-next { cursor: pointer; color: var(--color-primary); font-weight: 800; }
.set-board td.sb-next { background: #eff6ff; border: 1.5px dashed var(--color-primary); }
/* Rahmen der letzten Zeile nicht vom Scroll-Container abschneiden lassen */
.set-board-wrap { padding: 2px 2px 4px; }
/* letzte Zeile: gestrichelte Rahmen der offenen/nächsten Sätze unten nicht entfernen */
.set-board tbody tr:last-child td.sb-empty { border-bottom: 1px dashed #e2e8f0; }
.set-board tbody tr:last-child td.sb-next { border-bottom: 1.5px dashed var(--color-primary); }

/* ===== Aufstellung vor jedem Spiel melden (includes/lineup.php) ===== */
.lineup-chip { border: 1px solid transparent; border-radius: 999px; padding: 4px 10px; font-size: 0.85rem; font-weight: 700; cursor: pointer; line-height: 1.2; font-family: inherit; }
.lineup-chip.open { background: #fef3c7; color: #92400e; border-color: #f59e0b; }
.lineup-chip.ok { background: #dcfce7; color: #166534; border-color: #86efac; }
.lineup-chip:hover { filter: brightness(0.96); }
.lineup-list { display: flex; flex-direction: column; gap: 6px; }
.lineup-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: 10px; background: #fff; }
.lineup-row.done { opacity: 0.6; }
.lineup-where { min-width: 92px; font-size: 0.8rem; font-weight: 700; color: var(--color-muted); }
.lineup-where.on { color: var(--color-primary); }
.lineup-teams { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.lineup-vs { font-size: 0.8rem; }
.lineup-ctx { font-size: 0.8rem; }
.lineup-summary { margin: 0 0 10px; color: var(--color-warning); }
.lineup-summary.ok { color: var(--color-success); }
.match-tile .tile-lineup { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.match-tile .tile-lineup-lbl { font-size: 0.75rem; color: #94a3b8; }
.match-tile .tile-lineup .lineup-chip { font-size: 0.75rem; padding: 3px 8px; }
.lineup-dialog { border: none; border-radius: var(--radius); padding: 20px; width: min(520px, 94vw); box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35); }
.lineup-dialog::backdrop { background: rgba(15, 23, 42, 0.5); }
.lineup-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.lineup-fields { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.lineup-field { display: flex; align-items: center; gap: 8px; margin: 0; }
.lineup-field > span { width: 72px; flex: none; font-weight: 700; }
.lineup-field input { flex: 1; min-width: 0; font-size: 1rem; }
.lineup-hint { background: #eff6ff; border-radius: 8px; padding: 6px 10px; font-size: 0.85rem; }
.lineup-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.lineup-pending-note { background: #fef3c7; color: #92400e; border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; text-align: center; }
.lineup-pending-note .muted { color: #a16207; font-size: 0.85rem; }

/* ===== Doppel-Stage: Paare bilden (admin/stages.php, includes/doubles.php) ===== */
.pairs-layout { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(280px, 1.4fr); gap: 18px; align-items: start; }
@media (max-width: 760px) { .pairs-layout { grid-template-columns: 1fr; } }
.pair-pool { display: flex; flex-wrap: wrap; gap: 6px; min-height: 56px; padding: 10px; border: 1px dashed var(--color-border); border-radius: 10px; background: #f8fafc; }
.pair-rows { display: flex; flex-direction: column; gap: 6px; }
.pair-row { display: flex; align-items: center; gap: 6px; }
.pair-num { width: 22px; text-align: right; font-weight: 700; color: var(--color-muted); font-size: 0.85rem; }
.pair-slot { flex: 1; min-width: 0; min-height: 40px; display: flex; align-items: center; padding: 4px 8px; border: 1px dashed var(--color-border); border-radius: 8px; background: #fff; cursor: pointer; }
.pair-slot.filled { border-style: solid; }
.pair-slot .participant-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pair-and { color: var(--color-muted); font-weight: 700; }
.pair-del { border: none; background: none; color: var(--color-muted); cursor: pointer; font-size: 1rem; padding: 4px 6px; }
.pair-del:hover { color: var(--color-danger, #dc2626); }

/* Turnierleitung: Spiel wartet auf Bestätigung - bleibt an seinem Platz, grün markiert */
.summary-tile.is-awaiting .match-tile { outline: 3px solid #16a34a; outline-offset: -1px; }
.summary-tile .confirm-tile-btn { display: block; width: 100%; margin-top: 6px; background: #16a34a; }
.awaiting-hint { margin: 0 0 10px; color: #15803d; font-weight: 600; }
/* Turnierleitung: feste Plätze je Tisch (auto-fill: ein einzelnes Spiel wird nicht seitenbreit) */
.table-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } /* volle Breite; jeder Tisch hat immer seinen Platz */
.table-slot { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.slot-done-label { font-size: 0.8rem; font-weight: 700; color: #15803d; margin-top: 4px; }
.table-slot .table-slot-free { min-height: 90px; }
.table-slot-free { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 120px;
  border: 2px dashed var(--color-border); border-radius: var(--radius); color: var(--color-muted); }
.summary-tile.is-finished .match-tile { opacity: 0.7; }

/* Emoji-Symbole: jedes Design kann sie ausblenden (.pv-ico) und stattdessen Text zeigen (.pv-ico-alt) */
.pv-ico-alt { display: none; }

/* Design-Umschalter oben rechts im Kopf (klar / klassisch) */
header.app-header h1 { margin-right: auto; }
.design-switch { font-size: 0.8rem; color: var(--color-muted); }
.design-switch a { color: var(--color-muted); }
.design-switch strong { color: var(--color-text); font-weight: 600; }
