/* =====================================================================
   DartScorer Turniere - Farben wie die App (app.css), Hell/Dunkel nach System
   ===================================================================== */

:root {
   --accent: #66B032;
   --accent-strong: #3f7d1c;
   --accent-soft: color-mix(in srgb, var(--accent) 16%, var(--surface));
   /* neutrale Grundfarben: Kopfzeile und Hauptknöpfe in Grau, in einem Turnier mit Branding die Knöpfe in dessen Farbe */
   --primary: #3a414b;
   --on-primary: #ffffff;
   --topbar: #1f2328;
   --topbar-2: #2b3038;
   --topbar-text: #e6e9ee;
   /* Branding der verknüpften App (app.js applyTournamentBranding): Zweitfarbe und Schriften, ohne = wie bisher */
   --accent2: var(--accent);
   --accent2-strong: var(--accent-strong);
   --font-display: "Varela Round", system-ui, sans-serif;
   --font-body: "Varela Round", system-ui, sans-serif;
   --on-accent: #ffffff;
   --bg: #eef1f4;
   --surface: #ffffff;
   --surface-2: #f4f6f8;
   --text: #111827;
   --muted: #5b6472;
   --border: #d7dce2;
   --line: #b9c1cb;
   --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px rgba(16, 24, 40, 0.08);
   --danger: #c93a3a;
   --gold: #f5b700;
   --radius: 14px;
   --radius-small: 10px;
   color-scheme: light;
}
@media (prefers-color-scheme: dark) {
   :root {
      --accent-strong: #4f9a26;
      --bg: #0e1013;
      --surface: #171a1f;
      --surface-2: #1f232a;
      --text: #f2f4f7;
      --muted: #a2abb8;
      --border: #2b3039;
      --line: #46505d;
      --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 16px rgba(0, 0, 0, 0.35);
      --danger: #e06060;
      color-scheme: dark;
   }
}

/* Farben aus dem Branding; im Dunkeln die kräftige Variante etwas heller (wie das Standardgrün) */
html.branded { --accent: var(--b-accent); --accent-strong: var(--b-accent-strong); --primary: var(--accent-strong); }
html.branded2 { --accent2: var(--b-accent2); --accent2-strong: var(--b-accent2-strong); }
@media (prefers-color-scheme: dark) {
   html.branded { --accent-strong: color-mix(in srgb, var(--b-accent) 50%, var(--b-accent-strong)); }
   html.branded2 { --accent2-strong: color-mix(in srgb, var(--b-accent2) 50%, var(--b-accent2-strong)); }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
h1, h2, h3, .match-row .legs, .live-score, .tv-row-score { font-family: var(--font-display); }
.topbar, .topbar h1 { font-family: "Varela Round", system-ui, sans-serif; }   /* Kopfzeile bleibt neutral */
body {
   font-family: var(--font-body);
   background: var(--bg);
   color: var(--text);
   min-height: 100vh;
   display: flex;
   flex-direction: column;
   line-height: 1.4;
}
a { color: var(--accent-strong); }
@media (prefers-color-scheme: dark) { a { color: var(--accent); } }
h1, h2, h3 { line-height: 1.2; }
h1 { font-size: 1.6em; margin: 0 0 4px; }
h2 { font-size: 1.2em; margin: 24px 0 10px; }
h3 { font-size: 1em; margin: 0 0 8px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
[hidden] { display: none !important; }   /* hidden gilt auch für Elemente mit eigenem display (flex, inline …) */

/* ---------- Kopf und Fuß ---------- */
/* Kopfzeile immer neutral (auch bei Turnieren mit Branding): Marke, Menü, Sprache; darunter die Reiter */
.topbar { background: var(--topbar); color: var(--topbar-text); }
.topbar-row { display: flex; align-items: center; gap: 12px; padding: 8px 16px; max-width: 1100px; margin: 0 auto; }
.brand { color: #fff; text-decoration: none; font-size: 1.1em; display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.topnav { display: flex; gap: 4px; margin-left: 12px; flex: 1; }
.topnav-link { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 8px; color: var(--topbar-text); text-decoration: none; }
.topnav-link i { opacity: 0.75; }
.topnav-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.topnav-link.active { background: rgba(255, 255, 255, 0.14); color: #fff; }
.menu-toggle { display: none; background: transparent; color: inherit; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 8px; padding: 5px 10px; font: inherit; cursor: pointer; }
.toptabs { display: flex; gap: 6px; padding: 6px max(16px, calc((100% - 1100px) / 2 + 16px)); background: var(--topbar-2); overflow-x: auto; scrollbar-width: thin; }
.toptabs[hidden] { display: none; }
.toptab { display: inline-flex; align-items: center; flex: 0 0 auto; max-width: 240px; border-radius: 8px; background: rgba(255, 255, 255, 0.06); border: 1px solid transparent; }
.toptab a { display: inline-flex; align-items: center; gap: 7px; min-width: 0; padding: 5px 4px 5px 8px; color: var(--topbar-text); text-decoration: none; font-size: 0.9em; }
.toptab a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toptab:hover { background: rgba(255, 255, 255, 0.1); }
.toptab.active { background: var(--bg); border-color: rgba(255, 255, 255, 0.2); }
.toptab.active a { color: var(--text); }
.toptab-logo { width: 20px; height: 20px; object-fit: contain; border-radius: 4px; flex: 0 0 20px; }
.toptab-close { background: transparent; border: 0; color: inherit; opacity: 0.6; cursor: pointer; padding: 5px 8px; font: inherit; font-size: 0.85em; }
.toptab.active .toptab-close { color: var(--text); }
.toptab-close:hover { opacity: 1; }
@media (max-width: 720px) {
   .topbar-row { flex-wrap: wrap; }
   .menu-toggle { display: inline-flex; }
   .topnav { display: none; order: 3; flex-basis: 100%; flex-direction: column; margin: 4px 0 0; }
   .topbar.menu-open .topnav { display: flex; }
   .lang { margin-left: auto; }
}
.tm-head { display: flex; align-items: center; gap: 12px; }
.head-logo { height: 44px; width: auto; max-width: 140px; object-fit: contain; border-radius: 6px; flex: 0 0 auto; }
.brand i { color: var(--gold); }
.brand-logo { height: 28px; width: auto; max-width: 120px; object-fit: contain; border-radius: 4px; }
.footer-sep { color: var(--muted); }
.tv-logo { height: 2.6em; width: auto; max-width: 8em; object-fit: contain; flex: 0 0 auto; align-self: center; }
.print-logo { display: block; max-height: 16mm; max-width: 50mm; margin: 0 0 2mm; }
.lang {
   background: transparent;
   color: inherit;
   border: 1px solid rgba(255, 255, 255, 0.35);
   border-radius: 8px;
   padding: 4px 10px;
   font: inherit;
   cursor: pointer;
}
.page { width: 100%; max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; flex: 1; }
.footer { text-align: center; padding: 16px; font-size: 0.9em; color: var(--muted); }

/* ---------- Bausteine ---------- */
.card {
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--radius);
   box-shadow: var(--shadow);
   padding: 16px;
}
.card + .card { margin-top: 12px; }
.btn {
   display: inline-flex;
   align-items: center;
   justify-content: center;
   gap: 8px;
   border: 1px solid var(--border);
   background: var(--surface);
   color: var(--text);
   border-radius: var(--radius-small);
   padding: 9px 14px;
   font: inherit;
   cursor: pointer;
   text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 0.9em; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn[hidden] { display: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip {
   display: inline-flex;
   align-items: center;
   gap: 5px;
   padding: 3px 10px;
   border-radius: 999px;
   background: var(--surface-2);
   border: 1px solid var(--border);
   font-size: 0.85em;
}
.chip.accent { background: var(--accent-soft); border-color: var(--accent); }
.note {
   background: var(--accent-soft);
   border-left: 4px solid var(--accent);
   border-radius: var(--radius-small);
   padding: 10px 12px;
   margin: 10px 0;
}
.note.error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-left-color: var(--danger); }
.empty { color: var(--muted); padding: 12px 0; }

/* ---------- Formulare ---------- */
label.field { display: block; margin: 10px 0; }
label.field > span { display: block; font-size: 0.9em; color: var(--muted); margin-bottom: 4px; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], input[type="search"], select, textarea {
   width: 100%;
   font: inherit;
   color: var(--text);
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--radius-small);
   padding: 8px 10px;
}
textarea { min-height: 160px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .match.clickable:focus-visible {
   outline: 2px solid var(--accent);
   outline-offset: 1px;
}
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; cursor: pointer; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row > * { flex: 1 1 160px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; min-width: 0; }
.inline input[type="number"] { flex: 0 0 90px; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Auswahl des Modus als Kacheln */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.choice {
   display: block;
   border: 2px solid var(--border);
   border-radius: var(--radius);
   padding: 12px;
   cursor: pointer;
   background: var(--surface);
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice strong { display: flex; gap: 8px; align-items: center; }
.choice small { display: block; color: var(--muted); margin-top: 4px; }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Neues Turnier: Schritte über die volle Breite, schmale Zusammenfassung rechts (mitlaufend) */
.wizard { display: grid; gap: 16px; }
@media (min-width: 980px) {
   .wizard { grid-template-columns: minmax(0, 1fr) 290px; align-items: start; }
   .wizard-summary { position: sticky; top: 12px; }
}
.wizard-form h1 { margin-bottom: 12px; }
.wz-step { display: none; }
.wz-step.active { display: block; }
.wz-step > h2:first-child, .wz-step > .field:first-child { margin-top: 4px; }
.wizard-form .choices { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stepper { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 18px; counter-reset: none; }
.stepper li { flex: 1; min-width: 0; }
.stepper button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-small);
   background: var(--surface); color: var(--muted); font: inherit; font-size: 0.9em; cursor: pointer; text-align: left; }
.stepper button:hover { background: var(--surface-2); }
.stepper-no { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
   background: var(--surface-2); border: 1px solid var(--border); font-weight: bold; font-size: 0.85em; }
.stepper-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper button.active { border-color: var(--primary); color: var(--text); font-weight: bold; }
.stepper button.active .stepper-no { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.stepper button.done .stepper-no { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
@media (max-width: 640px) { .stepper-label { display: none; } .stepper button { justify-content: center; } }
.wz-nav { display: flex; align-items: center; gap: 10px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border); }
.wz-count { margin-right: auto; font-size: 0.9em; }
.wz-nav > .btn:first-child[hidden] + .wz-count { margin-left: 0; }
.wizard-summary h2 { margin-top: 0; }
.wizard-summary p { margin: 0 0 6px; }
.wz-sum-name { font-weight: bold; font-size: 1.1em; overflow-wrap: anywhere; }
.wz-review { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; margin: 4px 0 8px;
   border-radius: var(--radius-small); background: var(--surface-2); border: 1px solid var(--border); }
.wz-review p { margin: 0; flex: 1 1 260px; }
.small-note { font-size: 0.9em; display: flex; align-items: center; gap: 8px; margin: 6px 0 0; }
.tlist-logo.small { width: 24px; height: 24px; flex-basis: 24px; border-radius: 5px; }
.preview { overflow: hidden; }

/* ---------- Listen ---------- */
.list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
/* Kacheln im Raster: gleich hoch, ohne den Abstand von .card + .card; Datum unten bündig */
.list > .card + .card, .groups > .card + .card { margin-top: 0; }
.list-item { display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.list-item > small { margin-top: auto; padding-top: 4px; }
.list-item:hover { border-color: var(--accent); }
.list-item h3 { margin-bottom: 4px; }
/* Startseite: Einleitung ohne Kasten, Turniere als Liste */
.home-hero { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 56px; align-items: center; margin: 32px 0 56px; }
.home-lead h1 { font-size: 2.4em; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 14px; }
.home-lead > p { margin: 0 0 24px; color: var(--muted); font-size: 1.08em; line-height: 1.6; }
.home-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn.big { padding: 12px 20px; font-size: 1.05em; }
.home-icon { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
   border: 1px solid var(--border); color: var(--accent-strong); background: var(--surface); font-size: 0.95em; }
.home-facts, .home-features ul { list-style: none; margin: 0; padding: 0; }
.home-facts { border-left: 1px solid var(--border); padding-left: 32px; display: grid; gap: 22px; }
.home-facts li, .home-features li { display: flex; gap: 14px; align-items: flex-start; }
.home-facts strong, .home-features strong { display: block; margin: 6px 0 4px; }
.home-facts p, .home-features li p { margin: 0; color: var(--muted); font-size: 0.93em; line-height: 1.55; }
.home-features h2 { font-size: 0.8em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 18px; }
.home-features ul { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px 40px; border-top: 1px solid var(--border); padding-top: 28px; }
@media (max-width: 900px) {
   .home-hero { grid-template-columns: 1fr; gap: 32px; margin: 16px 0 40px; }
   .home-facts { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 24px; }
   .home-features ul { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
   .home-lead h1 { font-size: 1.9em; }
   .home-features ul { grid-template-columns: 1fr; gap: 22px; }
}
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.list-head h1 { margin: 0; }
.list-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.list-search { flex: 1 1 220px; max-width: 360px; }
.list-filter { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-small); overflow: hidden; background: var(--surface); }
.list-filter button { border: 0; background: transparent; color: var(--text); padding: 8px 14px; font: inherit; cursor: pointer; }
.list-filter button + button { border-left: 1px solid var(--border); }
.list-filter button.active { background: var(--primary); color: var(--on-primary); }
.tlist { list-style: none; margin: 0 0 8px; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tlist li + li { border-top: 1px solid var(--border); }
.tlist a { display: flex; align-items: center; gap: 12px; padding: 10px 14px; color: inherit; text-decoration: none; }
.tlist a:hover, .tlist a:focus-visible { background: var(--surface-2); }
.tlist a > .fa-chevron-right { color: var(--muted); flex: 0 0 auto; }
.tlist-logo { width: 40px; height: 40px; flex: 0 0 40px; object-fit: contain; border-radius: 8px; }
.tlist-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tlist-name { font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tlist-meta { font-size: 0.82em; color: var(--muted); }
.tlist-side { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: 0 1 auto; }
@media (max-width: 560px) {
   .tlist a { flex-wrap: wrap; }
   .tlist-side { order: 3; width: 100%; justify-content: flex-start; padding-right: 1.5em; }
}

/* ---------- Turnier ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 16px 0 12px; overflow-x: auto; }
.tab {
   border: 0;
   background: transparent;
   color: var(--muted);
   font: inherit;
   padding: 8px 14px;
   border-bottom: 3px solid transparent;
   cursor: pointer;
   white-space: nowrap;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
/* Endstand: Treppchen (2 | 1 | 3) und die weiteren Plätze */
.final h2 { margin-bottom: 4px; }
.podium-stage { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 10px; max-width: 560px; margin: 6px auto 0; text-align: center; }
.step { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.step .medal { font-size: 1.8em; line-height: 1; }
.step.first .medal { font-size: 2.4em; }
.step-names strong { display: block; overflow-wrap: anywhere; line-height: 1.25; }
.step.first .step-names strong { font-size: 1.2em; }
.step-names strong.mine { color: var(--accent2-strong); }
.step-info { font-size: 0.8em; color: var(--muted); }
.step-block { width: 100%; margin-top: 4px; border: 1px solid var(--border); border-bottom-width: 4px; border-radius: 10px 10px 0 0;
   display: flex; align-items: center; justify-content: center; font-size: 1.35em; font-weight: bold; background: var(--surface-2); }
.step.first .step-block { height: 76px; border-bottom-color: var(--gold); background: color-mix(in srgb, var(--gold) 18%, var(--surface)); }
.step.second .step-block { height: 54px; border-bottom-color: #9aa4b1; background: color-mix(in srgb, #9aa4b1 18%, var(--surface)); }
.step.third .step-block { height: 40px; border-bottom-color: #c07a3c; background: color-mix(in srgb, #c07a3c 16%, var(--surface)); }
.final-rest { list-style: none; margin: 14px 0 0; padding: 10px 0 0; border-top: 1px solid var(--border); columns: 2 240px; column-gap: 28px; }
.final-rest li { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; break-inside: avoid; }
.final-place { flex: 0 0 2.4em; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.final-names { flex: 0 1 auto; min-width: 0; }
.final-info { font-size: 0.8em; color: var(--muted); white-space: nowrap; }
.final-names .mine { font-weight: bold; color: var(--accent2-strong); }
.medal.gold { color: var(--gold); }
.medal.silver { color: #9aa4b1; }
.medal.bronze { color: #c07a3c; }

/* Begegnung */
.match {
   position: relative;
   width: 100%;
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--radius-small);
   font-size: 0.92em;
}
.match.clickable { cursor: pointer; }
.match.clickable:hover { border-color: var(--accent); }
.match.ready { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.match.bye { opacity: 0.55; }
.match-label {
   display: flex;
   justify-content: space-between;
   gap: 8px;
   padding: 3px 10px;
   font-size: 0.78em;
   color: var(--muted);
   border-bottom: 1px solid var(--border);
}
.match-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent-strong); font-weight: 600; }
.match-status { flex: 0 0 auto; align-self: center; padding: 0 0.6em; border-radius: 999px; font-size: 0.9em; line-height: 1.5; white-space: nowrap;
   background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.match-status.ready { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); font-weight: 600; }
.match-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; }
.match-row + .match-row { border-top: 1px solid var(--border); }
.match-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Live-Stand eines laufenden Spiels (aus dem Live Display) */
.match-row .live-score { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: bold; color: var(--danger); }
.match-row.live .legs { min-width: 1.8em; padding-left: 0.4em; border-left: 1px solid var(--border); }
.match-row.active { box-shadow: inset 4px 0 0 var(--danger); }
.match-row .legs { min-width: 1.4em; text-align: right; font-variant-numeric: tabular-nums; font-weight: bold; }
.match-row.winner .name { font-weight: bold; }
.match-row.loser { color: var(--muted); }
.match-row .open { color: var(--muted); font-style: italic; }

/* Läuft gerade (aus der App gemeldet) */
.match.running { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.match-live {
   display: flex;
   align-items: center;
   gap: 6px;
   padding: 3px 10px;
   font-size: 0.78em;
   color: var(--danger);
   border-bottom: 1px solid var(--border);
}
.live-link { margin-left: auto; color: var(--danger); font-weight: bold; text-decoration: none; white-space: nowrap; }
.live-link:hover { text-decoration: underline; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex: 0 0 8px; animation: live-pulse 1.6s ease-in-out infinite; }
.chip.live { color: var(--danger); border-color: var(--danger); }
@keyframes live-pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* Kampflos */
.match-note { display: flex; align-items: center; gap: 6px; padding: 3px 10px; font-size: 0.78em; color: var(--muted); border-bottom: 1px solid var(--border); }
.walkover { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.walkover summary { cursor: pointer; color: var(--muted); }

/* Spieler verwalten */
.player-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; max-height: 45vh; overflow-y: auto; }
.player-row { display: flex; align-items: center; gap: 6px; }
.player-row input { flex: 1; min-width: 0; }
.player-row .chip { color: var(--accent-strong); }
.icon-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--radius-small); width: 36px; height: 36px; cursor: pointer; flex: 0 0 36px; }
.icon-btn.danger { color: var(--danger); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }

/* Turnierbaum: Spalten je Runde, Linien per Rahmen */
.bracket-wrap { overflow-x: auto; padding-bottom: 8px; }
.bracket { display: flex; min-width: min-content; }
.bracket-round { display: flex; flex-direction: column; width: 230px; flex: 0 0 230px; }
.bracket-round > h3 { text-align: center; font-size: 0.9em; color: var(--muted); margin: 0 0 6px; }
.bracket-matches { flex: 1; display: flex; flex-direction: column; }
.bracket-slot { flex: 1; display: flex; align-items: center; position: relative; padding: 6px 18px; min-height: 84px; }
.bracket-round:first-child .bracket-slot { padding-left: 0; }
.bracket-round:last-child .bracket-slot { padding-right: 0; }
.bracket-round:not(:last-child) .bracket-slot::after {
   content: "";
   position: absolute;
   right: 0;
   top: 50%;
   width: 18px;
   border-top: 2px solid var(--line);
}
.bracket-round:not(:last-child) .bracket-slot:nth-child(odd)::before,
.bracket-round:not(:last-child) .bracket-slot:nth-child(even)::before {
   content: "";
   position: absolute;
   right: 0;
   height: 50%;
   border-right: 2px solid var(--line);
}
.bracket-round:not(:last-child) .bracket-slot:nth-child(odd)::before { top: 50%; }
.bracket-round:not(:last-child) .bracket-slot:nth-child(even)::before { top: 0; }
.bracket-round:not(:first-child) .bracket-slot > .match::before {
   content: "";
   position: absolute;
   left: -19px;
   top: 50%;
   width: 18px;
   border-top: 2px solid var(--line);
}
.bracket-extra { margin-top: 12px; max-width: 230px; }
/* Im Baum: „läuft gerade“/„kampflos“ als Abzeichen über der Karte - die Karte bleibt gleich hoch und nichts wird verdeckt;
   .badges gibt allen Plätzen oben und unten gleich viel Luft dafür (Linien bleiben gerade) */
.bracket.badges .bracket-slot { padding-top: calc(6px + 1.5em); padding-bottom: calc(6px + 1.5em); }
.bracket .match-live, .bracket .match-note {
   position: absolute; bottom: 100%; top: auto; left: 0; right: auto; max-width: 100%; z-index: 1;
   margin-bottom: 3px; padding: 0 0.6em; line-height: 1.6; font-size: 0.72em; white-space: nowrap;
   background: var(--surface); border: 1px solid currentColor; border-radius: 999px;
}
.bracket .match-live .live-link { margin-left: 0.5em; }
.bracket-finals { display: flex; flex-wrap: wrap; gap: 0 16px; }
.bracket.plain .bracket-slot::before, .bracket.plain .bracket-slot::after, .bracket.plain .bracket-slot > .match::before { display: none; }
.bracket.plain .bracket-slot { padding-left: 6px; padding-right: 6px; }
.match.skipped { opacity: 0.45; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table.standings { width: 100%; border-collapse: collapse; font-size: 0.92em; }
.standings th, .standings td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.standings th { color: var(--muted); font-weight: normal; font-size: 0.85em; }
.standings th.name, .standings td.name { text-align: left; width: 100%; }
.standings tr.qualified td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.groups { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.section-title { margin: 20px 0 8px; }

/* Statistik */
.boards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
.board.card + .board.card { margin-top: 0; }
.board h3 { display: flex; gap: 8px; align-items: center; }
.board h3 i { color: var(--accent-strong); }
.board-list { list-style: none; margin: 0; padding: 0; }
.board-list li { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--border); }
.board-list li:last-child { border-bottom: 0; }
.board-list li.first strong { color: var(--accent2-strong); }
.board-list .rank { width: 1.8em; color: var(--muted); font-variant-numeric: tabular-nums; }
.board-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.match-stats { margin: 4px 0 10px; }
.match-stats th:not(.name) { color: var(--text); font-weight: bold; }

.totals { margin-bottom: 12px; }
.totals-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); }
.total { display: flex; flex-direction: column; gap: 2px; }
.total .muted { font-size: 0.82em; }
.total strong { font-size: 1.25em; font-variant-numeric: tabular-nums; }
.running-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* Mein Spieler */
.me-box { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 16px; }
.me-select { display: flex; align-items: center; gap: 8px; }
.me-select select { width: auto; min-width: 180px; }
.me-box p { margin: 0; }
.me-info { font-weight: bold; color: var(--accent-strong); }
.match.mine { background: color-mix(in srgb, var(--accent2) 16%, var(--surface)); }
.match.mine .match-row .name { font-weight: bold; }

/* Boards */
.boards-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.boards-grid > .card + .card { margin-top: 0; }
.board-card.busy { border-color: var(--danger); }
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.board-head h3 { margin: 0; }
.board-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.board-tools select { flex: 1; min-width: 0; }

/* Fernsehansicht */
body.tv {
   --bg: #0b0d10;
   --surface: #15181d;
   --surface-2: #1d2128;
   --text: #f2f4f7;
   --muted: #a2abb8;
   --border: #2b3039;
   --line: #46505d;
   --accent-soft: color-mix(in srgb, var(--accent) 22%, #15181d);
   color-scheme: dark;
   font-size: clamp(16px, 1.3vw, 30px);
   overflow: hidden;
   height: 100vh;
   height: 100dvh;
   min-height: 0;
}
body.tv .topbar, body.tv .footer { display: none; }
body.tv .page { max-width: none; padding: 0.9em 1.4em 1.2em; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
/* Kopfbereich (Titel + Ansichten) als abgesetztes Band */
.tv-top {
   display: flex;
   flex-wrap: wrap;
   align-items: center;
   gap: 0.5em 1.2em;
   margin: -0.9em -1.4em 0.9em;
   padding: 0.5em 1.4em;
   background: var(--surface);
   border-bottom: 1px solid var(--border);
   box-shadow: 0 0.3em 1.2em rgba(0, 0, 0, 0.45);
}
.tv-title { flex: 1 1 auto; min-width: 0; }
.tv-top h1 { font-size: 1.25em; margin: 0; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-meta { font-size: 0.72em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-meta strong { color: var(--accent); }
.tv-tools { order: 2; display: flex; align-items: center; gap: 0.5em; margin-left: auto; }
.tv-clock { font-size: 1.25em; font-variant-numeric: tabular-nums; color: var(--muted); margin-right: 0.2em; }
.tv-exit { color: var(--muted); opacity: 0.35; padding: 0.2em 0.4em; }
.tv-theme { border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 999px; width: 2.2em; height: 2.2em; font: inherit; cursor: pointer; }
.tv-theme:hover { color: var(--text); border-color: var(--accent); }

/* Tagansicht (Umschalter in der Kopfzeile): helle Farben wie die normale Turnierseite */
body.tv.tv-light {
   --bg: #eef1f4;
   --surface: #ffffff;
   --surface-2: #f4f6f8;
   --text: #111827;
   --muted: #5b6472;
   --border: #d7dce2;
   --line: #b9c1cb;
   --accent-soft: color-mix(in srgb, var(--accent) 16%, #ffffff);
   color-scheme: light;
}
body.tv.tv-light .tv-top { box-shadow: 0 0.3em 1.2em rgba(16, 24, 40, 0.12); }

/* Statistik-Tafel: Bestenlisten breit genug, dass Namen nicht mitten im Wort brechen */
body.tv .tv-boards { grid-template-columns: repeat(auto-fit, minmax(18em, 1fr)); }
body.tv .tv-boards .board-list .name { overflow-wrap: normal; word-break: normal; }
body.tv .totals-grid { grid-template-columns: repeat(auto-fit, minmax(8.5em, 1fr)); }
.tv-exit:hover { opacity: 1; }

/* Leiste mit allen Ansichten; der Balken in der aktiven Ansicht zeigt die Zeit bis zum Wechsel */
/* zweite Zeile: Ansichten inkl. Play/Pause; die Ansichten bleiben in einer Zeile und gleiten seitlich */
.tv-tabs { flex: 0 1 auto; min-width: 0; position: relative; display: flex; gap: 0.4em; overflow-x: auto; scrollbar-width: none; padding: 1px; }
.tv-tabs::-webkit-scrollbar { display: none; }
.tv-tabs .tv-tab { flex: 0 0 auto; white-space: nowrap; }
.tv-tabs.more-left { -webkit-mask-image: linear-gradient(to right, transparent, #000 2.5em); mask-image: linear-gradient(to right, transparent, #000 2.5em); }
.tv-tabs.more-right { -webkit-mask-image: linear-gradient(to left, transparent, #000 2.5em); mask-image: linear-gradient(to left, transparent, #000 2.5em); }
.tv-tabs.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 2.5em, #000 calc(100% - 2.5em), transparent); mask-image: linear-gradient(to right, transparent, #000 2.5em, #000 calc(100% - 2.5em), transparent); }
.tv-nav { order: 3; flex: 1 1 100%; min-width: 0; display: flex; flex-wrap: nowrap; align-items: center; gap: 0.4em; margin: 0; font-size: 0.85em; }
.tv-tab {
   position: relative;
   overflow: hidden;
   isolation: isolate;
   display: inline-flex;
   align-items: center;
   gap: 0.5em;
   padding: 0.45em 1.1em;
   border: 1px solid var(--border);
   border-radius: 999px;
   background: var(--surface);
   color: var(--muted);
   font: inherit;
   cursor: pointer;
}
.tv-tab.active { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); font-weight: bold; }
/* Fortschritt bis zum Wechsel: füllt die ganze Schaltfläche von links nach rechts (hinter dem Text) */
.tv-progress {
   position: absolute;
   inset: 0 auto 0 0;
   width: 0;
   z-index: -1;
   background: color-mix(in srgb, var(--accent) 38%, var(--surface));
   animation: tv-progress var(--tv-seconds, 15s) linear forwards;
}
@keyframes tv-progress { from { width: 0; } to { width: 100%; } }
.tv-arrow, .tv-pause {
   border: 1px solid var(--border);
   background: transparent;
   color: var(--muted);
   border-radius: 999px;
   width: 2.2em;
   height: 2.2em;
   font: inherit;
   cursor: pointer;
}
.tv-pause { margin-left: auto; }
.tv-nav > .tv-arrow, .tv-nav > .tv-pause { flex: 0 0 auto; }
.tv-nav.paused .tv-pause { color: var(--accent); border-color: var(--accent); }
.tv-arrow:hover, .tv-pause:hover, .tv-tab:hover { border-color: var(--accent); color: var(--text); }

/* Ansicht: füllt den Rest des Bildschirms; Inhalt wird per fitTvPanel() eingepasst, nie abgeschnitten */
/* Innenrand für Rahmen/Schatten der Karten (sonst am Rand abgeschnitten); der negative Außenrand hält die Kante bündig
   mit dem Kopf, rechts und unten bleibt etwas mehr Luft */
.tv-panel { flex: 1; min-height: 0; overflow: hidden; position: relative; padding: 0.4em 0.9em 0.9em 0.4em; margin: -0.4em -0.4em 0 -0.4em; }
/* bewusst ohne Einblend-Animation: bleibt sie hängen (manche Fernseh-Browser), wäre der Inhalt verschoben/unsichtbar */
.tv-fit { transform-origin: top left; }
body.tv .bracket-wrap { overflow: visible; }
body.tv .bracket { min-width: 100%; }
body.tv .bracket { justify-content: center; }
body.tv .bracket-round { flex: 1 1 0; width: auto; min-width: 11em; max-width: 32em; }
body.tv .bracket-finals { gap: 0 1.2em; }
body.tv .bracket-extra { max-width: none; flex: 0 1 16em; min-width: 12em; }
body.tv .boards-grid { grid-template-columns: repeat(auto-fit, minmax(16em, 1fr)); }
body.tv .board-head h3, body.tv .board-head .chip, .match-label > span:last-child { white-space: nowrap; }
body.tv .match { font-size: 1em; }
/* TV: nichts umbrechen - fitTvPanel verkleinert stattdessen (sehr lange Namen notfalls mit „…“) */
body.tv .match-row .name, body.tv .board-list .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
body.tv .tv-boards .board-list .name { overflow-wrap: normal; }
body.tv .match-label { align-items: center; padding: 0.35em 0.7em; font-size: 0.85em; }
body.tv .match-title { color: var(--accent); }
body.tv .match-row { font-weight: 600; }
body.tv .schedule-list { grid-template-columns: repeat(auto-fit, minmax(15em, 1fr)); }
body.tv .card { box-shadow: none; }
body.tv .standings td, body.tv .standings th { white-space: nowrap; }
body.tv .groups { grid-template-columns: repeat(auto-fit, minmax(20em, 1fr)); }
body.tv .table-wrap, body.tv .bracket-wrap { scrollbar-width: none; }
@media (prefers-reduced-motion: reduce) {
   .tv-progress { animation: none; }
}
/* Schmale Bildschirme (Handy): Leiste einzeilig und seitlich wischbar, kleinere Kopfzeile */
@media (max-width: 700px) {
   body.tv { font-size: 14px; }
   body.tv .page { padding: 0.8em; }
   .tv-top { margin: -0.8em -0.8em 0.8em; padding: 0.6em 0.8em; }
}

/* Fernseher verbinden (/tv) */
.tv-connect { margin: auto; text-align: center; max-width: 40em; }
.tv-connect h1 { font-size: 2em; }
.tv-connect-code { font-size: 6em; font-weight: bold; letter-spacing: 0.2em; color: var(--accent); margin: 0.2em 0; font-variant-numeric: tabular-nums; }
.tv-code-input { width: 7em !important; font-size: 1.4em; letter-spacing: 0.2em; text-align: center; }
.tv-pair-url { font-weight: bold; font-size: 1.1em; margin: 0.3em 0 0.8em; }

/* TV-Tafel Spielplan: Spieltage als kompakte Karten */
.tv-schedule { display: grid; gap: 1em; grid-template-columns: repeat(auto-fit, minmax(22em, 1fr)); align-items: start; }
.tv-schedule > .card { margin: 0; }
.tv-round h3 { margin: 0 0 0.3em; color: var(--accent); }
.tv-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 0.8em; align-items: center; padding: 0.4em 0; border-top: 1px solid var(--border); font-weight: 600; }
.tv-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-row-name:first-child { text-align: right; }
.tv-row-name.loser, .tv-row-name.open { color: var(--muted); font-weight: normal; }
.tv-row-name.open { font-style: italic; }
.tv-row-name.winner { font-weight: bold; }
.tv-row-score { min-width: 4em; text-align: center; font-variant-numeric: tabular-nums; font-weight: bold; display: inline-flex; align-items: center; justify-content: center; gap: 0.4em; }
.tv-row.ready:not(.running) .tv-row-score { color: var(--muted); font-weight: normal; }
.tv-row.running .tv-row-score { color: var(--danger); }
.tv-round-idle { margin: 0.4em 0 0; font-size: 0.85em; }

/* Fernsteuerung: Tafel-Auswahl */
.tv-panel-check { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 0.9em; }
.tv-panel-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* Board-Karte: danach geplantes Spiel */
.board-after { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.board-after-label { font-size: 0.8em; font-weight: bold; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent-strong); }
.board-after-match { font-weight: 600; }
.board-after .muted { font-size: 0.85em; }
body.tv .board-after-match { white-space: nowrap; }
body.tv .board-after-label { color: var(--accent); }

/* Board-Tafeln: Live Displays in fester Ebene über dem Platzhalter (.tv-frame-slot), Karte ohne Live Display groß */
.tv-panel.live { display: flex; flex-direction: column; gap: 0.6em; }
.tv-frame-slot { flex: 1; min-height: 0; border-radius: var(--radius-small); background: #000; }
.tv-frames { position: fixed; z-index: 5; }
.tv-frames[hidden] { display: none; }
.tv-frames iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: var(--radius-small); background: #000; display: none; }
.tv-frames iframe.shown { display: block; }
.tv-board-single { max-width: 60em; margin: 0 auto; }
.tv-board-single .board-card { font-size: 1.3em; }

/* Spotlight: Live Display groß in der Fernsehansicht */
.tv-spotlight { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0.6em; }
.tv-spotlight-bar { display: flex; align-items: center; gap: 0.8em; font-size: 1.3em; flex-wrap: wrap; }
.tv-spotlight-bar .live-dot { width: 0.6em; height: 0.6em; flex-basis: 0.6em; }
.tv-spotlight-name { margin-left: auto; color: var(--muted); }
.tv-spotlight iframe { flex: 1; width: 100%; min-height: 0; border: 0; border-radius: var(--radius-small); background: #000; }

/* Links per E-Mail */
.mail-row input { flex: 1 1 14em; min-width: 0; }
/* Teilen-Dialog: Abschnitte Link / App / QR-Code / E-Mail */
.share-section { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); }
.share-section > h3:first-child { margin-top: 0; }
.share-section .qr { margin: 6px auto 0; }
.share-section .actions { margin-top: 6px; }
.mail-guard { margin: 10px 0 4px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: var(--radius-small); }
.mail-guard .field { margin: 0 0 6px; }
.guard-question { font-weight: 600; }
.mail-guard .guard-answer { width: 5em; text-align: center; }
.btn.whatsapp { background: #25d366; border-color: #1ebe5a; color: #fff; }
.btn.whatsapp:hover { background: #1ebe5a; }
.note.mail-warning { border-left-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--surface)); }
.note.mail-warning .fa-exclamation-triangle { color: #b8860b; }

/* Fernbedienung im Dialog „Fernsehansicht“ */
.tv-remote h3 { margin: 18px 0 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.tv-remote h3:first-child { margin-top: 4px; padding-top: 0; border-top: 0; }
.tv-remote-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.tv-remote-row .inline select { width: auto; }


/* Spielplan */
.schedule h3 { margin: 18px 0 8px; }
.schedule-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }

/* Handy: weniger Rand, Tabellen enger */
@media (max-width: 520px) {
   .page { padding: 12px 10px 32px; }
   .card { padding: 12px; }
   .card .card { padding: 10px; box-shadow: none; }
   .standings th, .standings td { padding: 6px 4px; }
}

/* ---------- Dialog ---------- */
.dialog {
   border: 1px solid var(--border);
   border-radius: var(--radius);
   background: var(--surface);
   color: var(--text);
   padding: 0;
   width: min(480px, calc(100vw - 32px));
   box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 16px 0; }
.dialog-head h2 { margin: 0; font-size: 1.15em; display: flex; gap: 8px; align-items: center; }
.dialog-close { border: 0; background: transparent; color: var(--muted); font-size: 1.2em; cursor: pointer; padding: 4px 8px; }
.dialog-body { padding: 8px 16px 16px; }
.dialog-body h3 { margin: 16px 0 8px; }
.result-input { display: grid; grid-template-columns: 1fr 90px; gap: 8px; align-items: center; margin: 8px 0; }
.result-input .name { font-weight: bold; overflow: hidden; text-overflow: ellipsis; }
.app-start { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius-small); padding: 10px 12px; margin: 4px 0 14px; }
.app-start h3 { margin: 0 0 4px; }
.app-start p { margin: 0 0 6px; }
.app-start .actions { margin-top: 6px; }
.inline > span { white-space: nowrap; color: var(--muted); }
.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; font-size: 0.85em; }
.qr { display: block; margin: 12px auto; width: 180px; height: 180px; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: 8px; }

/* ---------- Druckansicht (/<id>/druck): am Bildschirm als A4-Blatt, beim Drucken ohne Bedienung ---------- */
.print-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 6px; }
.print-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.print-go { margin-left: auto; }
.print-hint { margin: 0 0 10px; font-size: 0.9em; }
.print-doc {
   --text: #111; --muted: #555; --surface: #fff; --surface-2: #f3f4f6; --border: #c8ccd2; --line: #9aa1aa; --accent-soft: #eef4ea;
   background: #fff; color: #111; color-scheme: light;
   width: 100%; max-width: 210mm; margin: 0 auto 24px; padding: 14mm 13mm; box-sizing: border-box;
   border-radius: 6px; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18); font-size: 10.5pt; line-height: 1.35;
}
.print-head h1 { font-size: 19pt; margin: 0 0 2px; }
/* QR-Code zum Turnier (nur Spielplan) rechts oben */
.print-head.with-qr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr auto; column-gap: 12px; align-items: start; }
.print-head.with-qr > h1, .print-head.with-qr > .print-meta { grid-column: 1; }
.print-head.with-qr > h2 { grid-column: 1 / -1; }
.print-qr { grid-column: 2; grid-row: 1 / 3; margin: 0; text-align: center; }
.print-qr .qr { width: 24mm; height: 24mm; margin: 0 auto; padding: 0; border-radius: 0; }
.print-qr figcaption { font-size: 7pt; color: #555; line-height: 1.25; margin-top: 2px; }
.print-meta { margin: 0; color: #555; font-size: 9.5pt; }
.print-head h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13pt; margin: 10px 0 4px;
   padding-bottom: 4px; border-bottom: 2px solid #111; }
.print-head h2 small { font-size: 8.5pt; font-weight: normal; color: #555; }
.print-section { margin-top: 12px; }
.print-section h3, .print-stats > h3, .print-break-title { font-size: 11.5pt; margin: 14px 0 4px; }
.print-section h4 { font-size: 10.5pt; margin: 8px 0 2px; }
.print-idle { margin: 0 0 4px; color: #555; font-size: 9pt; }
/* feste Spaltenbreiten: alle Tabellen stehen exakt untereinander */
.print-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.print-table th.small, .print-table td.small { width: 20mm; white-space: nowrap; }
.print-table th.res, .print-table td.res { width: 28mm; }
.print-table th.fill, .print-table td.fill { width: 16mm; }
.print-table th.fill.wide, .print-table td.fill.wide { width: 26mm; }
.print-table td { overflow: hidden; text-overflow: ellipsis; }
.print-table th { text-align: left; font-size: 8.5pt; font-weight: 600; color: #555; border-bottom: 1px solid #111; padding: 3px 6px; }
.print-table td { border-bottom: 1px solid #c8ccd2; padding: 6px; vertical-align: middle; }
.print-table td.home { text-align: right; }
.print-table th.home { text-align: right; }
.print-table th.res { text-align: center; }
.print-table td.res { text-align: center; white-space: nowrap; }
.print-table td.res.done { font-weight: bold; }
.print-table td.res small { font-weight: normal; color: #555; }
.print-table td.small { font-size: 9pt; color: #555; }
.print-table td.fill { border-left: 1px solid #e3e5e8; }
.print-table .open { color: #666; font-style: italic; }
.print-box { display: inline-block; width: 2em; height: 1.45em; border: 1px solid #333; border-radius: 2px; vertical-align: middle; }
.print-ranking { margin: 4px 0 0; padding-left: 2em; }
.print-ranking li { padding: 2px 0; }
.print-ranking li.top { font-weight: bold; }
.print-note { padding: 6px 10px; border: 1px solid #c8ccd2; border-radius: 4px; background: #f3f4f6; }
.print-foot { margin-top: 18px; padding-top: 6px; border-top: 1px solid #c8ccd2; color: #777; font-size: 8.5pt; text-align: right; }
/* wiederverwendete Bausteine (Tabelle, Statistik) schlicht */
.print-doc .card { box-shadow: none; border: 1px solid #c8ccd2; background: #fff; }
.print-doc .table-wrap { overflow: visible; }
.print-doc .standings { font-size: 9.5pt; }
.print-doc .note { background: #f3f4f6; }

@media print {
   @page { size: A4; margin: 12mm; }
   html, body.print-view { background: #fff !important; }
   body.print-view .topbar, body.print-view .footer, .print-toolbar, .print-hint { display: none !important; }
   body.print-view .page { padding: 0; max-width: none; margin: 0; }
   .print-doc { box-shadow: none; border-radius: 0; padding: 0; margin: 0; max-width: none; }
   .print-section, .print-doc .card, .print-table tr, .print-ranking { break-inside: avoid; }
   .print-doc h3, .print-doc h4 { break-after: avoid; }
}

/* ---------- Spielberichtsbögen: ein Blatt je Spiel ---------- */
.print-options { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 10px; }
.print-options select { width: auto; }
.print-sheet { padding: 11mm 11mm 9mm; font-size: 9.5pt; }
.sheet-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 6px 16px;
   border-bottom: 2px solid #111; padding-bottom: 4px; }
.sheet-title { font-size: 10pt; }
.sheet-title small { color: #555; }
.sheet-fields { display: flex; gap: 12px; }
.sheet-field { display: inline-flex; align-items: flex-end; gap: 4px; }
.sheet-field small { color: #555; font-size: 8pt; }
.sheet-line { display: inline-block; min-width: 22mm; border-bottom: 1px solid #333; padding: 0 2px; min-height: 1.2em; font-weight: 600; }
.sheet-players { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; margin: 8px 0 2px; font-size: 15pt; font-weight: bold; }
.sheet-players .sheet-name:first-child { text-align: right; }
.sheet-name.open { color: #666; font-weight: normal; font-style: italic; font-size: 11pt; border-bottom: 1px solid #333; padding-bottom: 2px; }
.sheet-vs { font-size: 9pt; font-weight: normal; color: #555; }
.sheet-format { text-align: center; margin: 0 0 6px; color: #555; font-size: 8.5pt; }
.sheet-legs { display: grid; gap: 4mm 4mm; }
.sheet-legs.cols-1 { grid-template-columns: minmax(0, 90mm); justify-content: center; }
.sheet-legs.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sheet-legs.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sheet-leg { break-inside: avoid; }
.sheet-leg-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 8.5pt; margin-bottom: 2px; }
.sheet-start { color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-check { display: inline-block; width: 3mm; height: 3mm; border: 1px solid #333; vertical-align: -1px; position: relative; }
.sheet-check.on::after { content: "✕"; position: absolute; inset: -1px 0 0; font-size: 2.6mm; line-height: 3mm; text-align: center; color: #111; font-weight: bold; }
/* ausgefüllte Bögen */
.sheet-table th.won { background: #e3eedd; }
.sheet-table td.co { font-weight: bold; }
.sheet-table td.bust { color: #a33; font-size: 7pt; }
.sheet-table.cricket td.mark { font-size: 10pt; font-weight: bold; }
.sheet-name.won::after { content: " ✓"; font-size: 0.7em; }
.print-box.filled { text-align: center; font-weight: bold; line-height: 1.45em; }
.sheet-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 8pt; }
.sheet-table th { border: 1px solid #555; padding: 1px 3px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: #f1f2f4; }
.sheet-table tr.sub th { font-weight: normal; color: #555; font-size: 7pt; }
.sheet-table td { border: 1px solid #9aa1aa; height: 5mm; padding: 0 3px; text-align: center; }
.sheet-table .b { border-left: 2px solid #111; }
.sheet-table tr.start td { color: #555; font-weight: 600; background: #f7f7f8; }
.sheet-table.cricket td { height: 7mm; }
.sheet-table.cricket .mid { width: 12mm; font-weight: bold; background: #f1f2f4; }
.sheet-table.cricket tr.points td { height: 8mm; }
.sheet-table.cricket tr.points .mid { font-size: 7pt; font-weight: 600; }
.sheet-foot { margin-top: 5mm; display: grid; grid-template-columns: 1fr 1fr; gap: 3mm 8mm; align-items: start; break-inside: avoid; }
.sheet-result { font-size: 11pt; align-self: center; }
.sheet-result small { color: #555; font-size: 8pt; }
.sheet-extra { border-collapse: collapse; font-size: 8pt; width: 100%; }
.sheet-extra th, .sheet-extra td { border: 1px solid #9aa1aa; padding: 2px 4px; text-align: left; height: 6mm; }
.sheet-extra th { background: #f1f2f4; font-weight: 600; }
.sheet-signs { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8mm; margin-top: 4mm; }
.sheet-sign { display: flex; flex-direction: column; gap: 1mm; }
.sheet-sign .sheet-line { min-width: 0; width: 100%; height: 7mm; }
.sheet-sign small { color: #555; font-size: 7.5pt; }
@media print {
   .print-options { display: none !important; }
   .print-sheet { break-after: page; padding: 0; }
   .print-sheet:last-of-type { break-after: auto; }
}
