* { box-sizing: border-box; }
body {
    font-family: Arial, sans-serif;
    background: #111;
    color: #fff;
    margin: 0;
    padding: 16px;
}
.container {
    max-width: 960px;
    margin: 0 auto;
}
h1 { font-size: 28px; margin-bottom: 4px; }
h2 { font-size: 20px; color: #ccc; font-weight: normal; margin-top: 0; }
.card {
    background: #1c1c1c;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.meta { color: #999; font-size: 14px; margin-bottom: 16px; }
label { display: block; margin: 10px 0 4px; color: #ccc; }
input, select {
    width: 100%;
    font-size: 18px;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #222;
    color: #fff;
}
input[readonly] { background: #1a1a1a; color: #aaa; }
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    padding: 0;
    vertical-align: middle;
    margin: 0 6px 0 0;
}
label:has(input[type="checkbox"]) { display: flex; align-items: center; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 200px; }
.btn {
    display: inline-block;
    margin-top: 16px;
    padding: 16px 32px;
    font-size: 20px;
    font-weight: bold;
    background: #0979f9;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #0a5fcf; }
.btn-danger { background: #cc0000; }
.btn-danger:hover { background: #a00; }
.btn-confirm { background: #1a8a3d; }
.btn-confirm:hover { background: #146b2e; }
.btn-small { padding: 6px 14px; font-size: 14px; margin: 0; }
.btn-timeout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-top: 10px;
    font-size: 18px;
    font-weight: bold;
    background: #ffcc00;
    color: #111;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}
.btn-timeout:hover { background: #e0b400; }
.btn-timeout-used,
.btn-timeout:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}
/* Spieler-Anzeige (player.js): rein informative Anzeige, KEIN Button - spiegelt
   bewusst Farbe/Form von .action-timeout (Referee-Schirm), aber ohne
   cursor:pointer und ohne jede Reaktion auf Antippen, damit auf diesem
   Schirm nichts wie ein Funktionsbutton wirkt. */
.timeout-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    font-size: 24px;
    font-weight: bold;
    background: #1a8a3d;
    color: #fff;
    border-radius: 12px;
    pointer-events: none;
}
.timeout-badge.timeout-badge-used { background: #333; color: #666; }
.errors { background: #401010; border: 1px solid #cc0000; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.wins { font-size: 22px; text-align: center; margin-bottom: 8px; }
.wins b { font-size: 32px; }
.server-badge { display: inline-block; margin-top: 10px; padding: 6px 12px; background: #333; border-radius: 6px; font-size: 14px; }
.serve-indicator {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 50%;
    font-size: 30px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.5);
    z-index: 2;
}

/*
 * Schiedsrichter-/Spieler-Live-Ansicht (referee-live.js, player.js):
 * Querformat-Tablet, sprengt bewusst .container (max-width:960px) fuer
 * riesige, aus einigen Metern Entfernung lesbare Zahlen - abgestimmt anhand
 * von Mockups, s. https://claude.ai/artifact/2BStxNFTnxaGyVWRf7GdAm.
 * .scoreboard-fullbleed ist der einzige Ort, der bewusst aus .container
 * ausbricht (klassischer CSS-"Breakout" per 100vw + negativem Margin) - alle
 * anderen Kartenansichten in referee.php/player.php bleiben bei der
 * normalen, schmalen Breite.
 */
.scoreboard-fullbleed {
    position: relative;
    left: 50%;
    right: 50%;
    width: 100vw;
    margin-left: -50vw;
    margin-right: -50vw;
    box-sizing: border-box;
    padding: 0 20px;
    height: calc(100vh - 170px);
    min-height: 480px;
    display: flex;
    flex-direction: column;
}
.scoreboard-top-bar { flex-shrink: 0; padding: 4px 0 10px; text-align: center; color: #999; font-size: 20px; }
.scoreboard-row { flex: 1; display: flex; gap: 20px; min-height: 0; padding-bottom: 16px; }
.score-panel {
    flex: 1;
    position: relative;
    background: #000;
    border-radius: 20px;
    padding: 22px;
    display: flex;
    gap: 16px;
    min-height: 0;
}
.score-panel.score-panel-compact { padding: 24px 26px; flex-direction: column; }
.score-panel .sets-badge { position: absolute; top: 14px; font-size: 120px; font-weight: bold; line-height: 1; color: #cc0000; }
.score-panel.score-panel-compact .sets-badge { font-size: 128px; }
.score-panel .sets-badge.sets-badge-right { right: 20px; }
.score-panel .sets-badge.sets-badge-left { left: 20px; }
.side-actions { width: 96px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
/* Gleiche Groesse/Form wie .action-minus darunter - nur Farbe (Gruen statt
   Rot) und Beschriftung unterscheiden die beiden Buttons. */
.action-timeout {
    width: 96px;
    height: 96px;
    background: #1a8a3d;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: bold;
    color: #fff;
    border: none;
    cursor: pointer;
}
.action-timeout:hover { background: #146b2e; }
.action-timeout:disabled, .action-timeout.action-timeout-used { background: #333; color: #666; cursor: not-allowed; }
.action-minus {
    width: 96px;
    height: 96px;
    background: #cc0000;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: bold;
    color: #fff;
    border: none;
    cursor: pointer;
}
.action-minus:hover { background: #a00; }
.score-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.score-names-and-points { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-between; min-height: 0; }
/* padding links/rechts haelt den Namen von der Sätze-Eck-Zahl fern (s.
   .sets-badge) - unabhaengig davon, auf welcher Seite sie bei diesem Panel
   gerade sitzt, damit lange Vereinsnamen nie unter die Zahl laufen. */
.score-names { flex-shrink: 0; text-align: center; padding: 6px 100px 0; }
.score-names .team-name { font-size: 18px; color: #888; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px; }
.score-names .player-name { font-size: 24px; color: #ddd; }
/* overflow:hidden als Sicherheitsnetz: min() unten haelt die Punktzahl schon
   normalerweise innerhalb der verfuegbaren Hoehe, falls ein Browserfenster
   aber noch kleiner/kuerzer ist als angenommen (z.B. nicht-Vollbild-Browser
   mit sichtbarer Tab-/Adressleiste), wird lieber die Zahl selbst beschnitten
   als dass sie in den Namen darueber hineinragt. */
.score-points { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; }
/* min(...vh...): die Punktzahl bleibt bei ausreichender Fensterhoehe exakt
   bei der vollen, mit den Mockups abgestimmten Groesse (320px/360px) - erst
   wenn fuer die tatsaechliche Fensterhoehe (z.B. kleines/nicht-maximiertes
   Browserfenster) weniger Platz da ist, schrumpft sie automatisch mit,
   statt in den Namen darueber hineinzuragen. */
.score-points .points-value { font-size: min(320px, 32vh); font-weight: bold; line-height: 0.9; color: #fff; }
.score-panel-compact .score-points .points-value { font-size: min(360px, 38vh); }
.action-plus {
    flex-shrink: 0;
    height: 110px;
    background: #0979f9;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    color: #fff;
    margin-top: 14px;
    border: none;
    cursor: pointer;
}
.action-plus:hover { background: #0a5fcf; }
.timeout-static-wrap { flex-shrink: 0; display: flex; justify-content: center; margin-top: 14px; }

/*
 * Hochformat-Handy (schmal genug, dass zwei nebeneinanderliegende Panels
 * keinen Sinn mehr ergeben): Panels stapeln sich untereinander statt
 * nebeneinander, mit eigenen, fuer diese Breite/Hoehe handgetunten (nicht
 * fliessenden) Groessen - bewusst eine EIGENE, kleinere Groessenstufe statt
 * einer Fortsetzung der obigen vw-Skalierung, weil beim Stapeln die Hoehe
 * (nicht mehr die Breite) zum knappen Faktor wird.
 */
@media (max-width: 700px) {
    .scoreboard-fullbleed { height: calc(100vh - 130px); padding: 0 12px; }
    .scoreboard-row { flex-direction: column; gap: 10px; padding-bottom: 10px; }
    .scoreboard-top-bar { font-size: 15px; padding: 2px 0 6px; }
    .score-panel, .score-panel.score-panel-compact { padding: 12px 14px; gap: 10px; border-radius: 14px; }
    .score-panel .sets-badge, .score-panel.score-panel-compact .sets-badge { font-size: 48px; top: 8px; }
    .score-panel .sets-badge.sets-badge-right { right: 12px; }
    .score-panel .sets-badge.sets-badge-left { left: 12px; }
    .side-actions { width: 52px; gap: 8px; }
    .action-timeout { width: 52px; height: 52px; font-size: 20px; border-radius: 10px; }
    .action-minus { width: 52px; height: 52px; font-size: 20px; border-radius: 10px; }
    .score-names { padding: 4px 56px 0; }
    .score-names .team-name { font-size: 12px; }
    .score-names .player-name { font-size: 15px; }
    .score-points .points-value, .score-panel-compact .score-points .points-value { font-size: 110px; }
    .action-plus { height: 44px; font-size: 22px; margin-top: 8px; border-radius: 10px; }
    .timeout-badge { width: 40px; height: 40px; font-size: 17px; border-radius: 9px; }
    .timeout-static-wrap { margin-top: 8px; }
    .serve-indicator { width: 36px; height: 36px; font-size: 18px; }
}
table.games { width: 100%; border-collapse: collapse; margin-top: 8px; }
table.games th, table.games td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #333; font-size: 14px; }
table.games .code { font-weight: bold; width: 60px; }
.history { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.history li { background: #222; border-radius: 6px; padding: 4px 8px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.history li.voided { opacity: 0.35; text-decoration: line-through; }
.history form { margin: 0; }
.void-btn { background: none; border: none; color: #ff6666; cursor: pointer; font-size: 13px; padding: 0; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; background: #333; }
.badge-finished { background: #1a5c1a; }
.badge-pending { background: #444; }
.badge-progress { background: #5c4a1a; }
.badge-skipped { background: #333; color: #777; }
/* Liveticker: "Live" gruen vs. "Endstand" grau - bewusst eigene Klassen statt
   .badge-finished (dort schon anders belegt: gruen = Spielstatus "beendet"),
   sonst waere die Bedeutung je nach Kontext widerspruechlich. */
.ticker-status-live { background: #1a5c1a; }
.ticker-status-final { background: #444; color: #ccc; }
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.table-card {
    background: #1c1c1c;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    color: #fff;
    display: block;
}
.table-card:hover { border-color: #0979f9; }
.table-number {
    display: inline-block;
    background: #0979f9;
    border-radius: 6px;
    padding: 2px 10px;
    font-size: 13px;
    margin-bottom: 8px;
}
.table-card h3 { margin: 0 0 8px; font-size: 18px; }
.table-card .live-points { font-size: 40px; font-weight: bold; text-align: center; }
.table-card .live-names { display: flex; justify-content: space-between; font-size: 14px; color: #ccc; }
.table-sides { display: flex; gap: 8px; margin-top: 10px; }
.table-side { position: relative; flex: 1; background: #000; border-radius: 8px; padding: 10px 6px; text-align: center; }
.table-side .team-name { font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.table-side .name { font-size: 15px; font-weight: bold; }
.table-side .pts { font-size: 48px; font-weight: bold; line-height: 1.1; }
.table-side .sets { font-size: 13px; color: #aaa; margin-top: 2px; }
.table-side .serve-indicator { width: 20px; height: 20px; font-size: 11px; }
.ticker-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; user-select: none; }
.ticker-header .teams { font-size: 18px; }
.ticker-header .wins { margin: 0; font-size: 18px; }
.ticker-header .toggle-icon { color: #666; font-size: 14px; margin-left: 12px; }
/* Kopfzeile einer Meisterschaftspartie: Spielort links, Punktestand-Box
   mittig, Auf-/Zuklappen rechts - 3-Spalten-Grid statt space-between, damit
   die Box in der Mitte immer wirklich mittig bleibt, egal wie lang/kurz der
   Spielort-Text links ist (eigene Klasse statt .ticker-header, das bleibt
   fuer Trainingsspiele/andere 2-Elemente-Kopfzeilen unveraendert). */
.ticker-header-match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 12px; cursor: pointer; user-select: none; }
.ticker-header-left { font-size: 14px; }
.ticker-header-match .toggle-icon { color: #666; font-size: 14px; text-align: right; }
.match-scorebox { border-collapse: collapse; margin: 0 auto; }
.match-scorebox th { font-size: 13px; font-weight: normal; color: #999; text-transform: uppercase; letter-spacing: 0.5px; padding: 0 16px 2px; text-align: center; white-space: nowrap; }
.match-scorebox td { font-size: 30px; font-weight: bold; text-align: center; padding: 0 16px; line-height: 1.15; }
.match-scorebox .scorebox-provisional td { font-size: 13px; font-weight: normal; color: #999; padding-top: 2px; }
.ticker-body { margin-top: 14px; }
.live-list { display: flex; flex-direction: column; gap: 6px; }
.live-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1c1c1c;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
}
.live-row .live-row-points { font-weight: bold; font-size: 18px; }
.training-players { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.training-player-row { display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.training-player-row .live-row-points { font-weight: bold; font-size: 18px; }
.training-player-row .sets-won { font-weight: normal; font-size: 13px; color: #999; margin-left: 6px; }
/* Timeout-Mini-Symbol links vom Namen (gruen = noch vorhanden, grau = schon
   verbraucht - dieselbe Bedeutung wie .action-timeout auf referee.php, nur
   klein und rein informativ) und Aufschlag-Symbol rechts vom Namen. */
.player-name-group { display: flex; align-items: center; gap: 6px; }
.mini-timeout-badge {
    width: 14px; height: 14px; border-radius: 50%; background: #1a8a3d; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 8px; font-weight: bold; color: #fff; line-height: 1;
}
.mini-timeout-badge.used { background: #444; color: #999; }
.mini-serve-icon { font-size: 13px; }
/* Leuchtet auf, waehrend genau diese Seite gerade ihr Timeout laufen hat.
   margin gleicht das padding horizontal wieder aus, sonst rutschen Name und
   Punktestand dieser einen Zeile gegenueber den anderen (padding-losen)
   Zeilen sichtbar nach innen ein. */
.training-player-row.timeout-active-row { background: rgba(26, 138, 61, 0.22); border-radius: 6px; padding: 4px 8px; margin: 0 -8px; }
.side-dnd { display: flex; gap: 16px; margin: 16px 0; touch-action: none; }
.side-zone {
    flex: 1;
    background: #111;
    border: 2px dashed #444;
    border-radius: 10px;
    padding: 12px;
    min-height: 100px;
}
.side-zone-label { color: #888; font-size: 13px; text-transform: uppercase; text-align: center; margin-bottom: 8px; }
.side-slot { min-height: 60px; display: flex; align-items: center; justify-content: center; }
.chip {
    background: #0979f9;
    color: #fff;
    font-weight: bold;
    padding: 16px 20px;
    border-radius: 10px;
    text-align: center;
    cursor: grab;
    user-select: none;
    touch-action: none;
    width: 100%;
}
.swap-overlay {
    background: #2a1c00;
    border: 2px solid #ffcc00;
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
}
.swap-overlay-compact { padding: 10px; margin: 10px 0 0; }
.swap-overlay-compact .swap-anim { height: 44px; gap: 10px; }
.swap-overlay-compact .swap-chip { width: 32px; height: 32px; font-size: 13px; }
.swap-overlay-compact .swap-chip-a { animation-name: swap-move-a-compact; }
.swap-overlay-compact .swap-chip-b { animation-name: swap-move-b-compact; }
.swap-overlay-compact .swap-arrows { font-size: 20px; }
.swap-overlay-compact .swap-title { font-size: 16px; margin: 4px 0 2px; }
@keyframes swap-move-a-compact {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(40px); }
}
@keyframes swap-move-b-compact {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-40px); }
}
.swap-title { text-align: center; font-size: 22px; font-weight: bold; color: #ffcc00; margin: 8px 0 4px; }
/* Countdown-Zahl (Einspielzeit/Satzpause/Timeout) - soll aus Tisch-Entfernung
   ablesbar sein, deshalb bewusst riesig. min() deckelt sie nach Breite UND
   Hoehe (analog .score-points .points-value), damit auf jedem Tablet im
   Querformat alles ohne Scrollen auf eine Seite passt statt am Rand
   abgeschnitten zu werden. Selektor braucht dieselbe Spezifitaet (zwei
   Klassen) wie .swap-overlay-compact .swap-title weiter oben, sonst würde
   player.js' kompakte Variante die Zahl auf 16px zurückstufen. */
.swap-title.timer-countdown { font-size: min(220px, 30vw, 34vh); margin: 4px 0; }
.swap-anim { display: flex; align-items: center; justify-content: center; gap: 16px; height: 70px; }
.swap-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 18px;
    color: #111;
    animation: swap-move 1.4s ease-in-out infinite;
}
.swap-chip-a { background: #0979f9; color: #fff; animation-name: swap-move-a; }
.swap-chip-b { background: #ffcc00; animation-name: swap-move-b; }
.swap-arrows { font-size: 30px; color: #ffcc00; animation: swap-pulse 1.4s ease-in-out infinite; }
@keyframes swap-move-a {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(64px); }
}
@keyframes swap-move-b {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-64px); }
}
@keyframes swap-pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}
