/* Live-Wall-Styling für den isolierten iframe (/live). Zusammengeführt aus den Scoped-CSS des
   Shooting-Renderers (Exor.ViewServer.Rendering: UniversalViewport.razor.css + BoardTile.razor.css),
   hier als PLAIN-Selektoren (im iframe gibt es keine Klassenkollision mit dem Website-CSS).
   ::deep wurde entfernt (kein Blazor-Scoped-Kontext). */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: 'Segoe UI', system-ui, sans-serif; }
body { background: #11151c; color: #e8edf4; overflow: hidden; }

#live-root { height: 100vh; padding: .4rem; display: flex; flex-direction: column; }
#live-root > * { flex: 1 1 auto; min-height: 0; }

.live-empty {
    display: flex; align-items: center; justify-content: center; height: 100%;
    color: #7a8494; font-size: 1.2rem; text-align: center; padding: 2rem;
}

.board-grid { display: grid; gap: .35rem; height: 100%; }

/* ---------- Gruppierte Scheiben (Kind "grid" mit GroupId) – wie /targets in der App ---------- */
.scheiben-grid { display: grid; gap: .5rem; height: 100%; min-height: 0; }
.frame-cell { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; }
/* Gruppen-Rahmen (Duell 2:1 / Dreier 3:1 / Hoffnungsrunde 1:1 via inline aspect-ratio), grün wie in der App. */
.pair-frame { display: grid; gap: .3rem; min-height: 0; min-width: 0; max-width: 100%; max-height: 100%;
    border: 3px solid #2faf4a; border-radius: 10px; padding: .3rem; background: #eef7f0; }
.scheiben-grid .board-cell { min-height: 0; min-width: 0; }
/* Im Gruppen-Rahmen bestimmt die Rahmen-Zelle die Form → board-svg NICHT quadratisch zwingen/kappen
   (das SVG bleibt via preserveAspectRatio zentriert). Übersteuert die globale .board-svg-Regel. */
.scheiben-grid .board-svg { aspect-ratio: auto !important; max-width: none; margin-inline: 0; }

/* ---------- Rangliste / Startliste (Kind "list") ---------- */
.ranking { display: flex; flex-direction: column; height: 100%; min-height: 0;
    background: var(--rank-bg, #fff); color: var(--rank-fg, #1a1a1a); }

.rank-title { display: flex; align-items: baseline; gap: .8rem; padding: .3rem .6rem;
    background: #1b2a4a; color: #fff; border-radius: 6px; margin-bottom: .35rem; }
.rt-logo { flex: 0 0 auto; align-self: center; width: 1.9rem; height: 1.9rem; display: block; }
.rt-name { font-size: 1.5rem; font-weight: 700; }
.rt-sub { font-size: 1.1rem; opacity: .9; }
.rt-relay { font-size: 1rem; opacity: .85; }
.rt-date { font-size: 1rem; opacity: .8; margin-left: auto; }

.rank-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rank-empty { color: color-mix(in srgb, currentColor 55%, transparent); padding: 1rem; }
.rank-scroll { flex: 1; min-height: 0; overflow: auto; }

.rank-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: calc(1.1rem * var(--row-scale, 1)); }
.rank-table.fixed-rows { flex: 0 0 auto; border-bottom: 3px solid color-mix(in srgb, currentColor 65%, transparent); }
.rank-table.header-only { flex: 0 0 auto; }
.rank-table th { text-align: left; font-size: calc(.8rem * var(--row-scale, 1)); text-transform: uppercase; letter-spacing: .03em;
    color: color-mix(in srgb, currentColor 60%, transparent);
    border-bottom: 2px solid color-mix(in srgb, currentColor 22%, transparent);
    padding: .25rem .5rem; background: var(--rank-bg, #fff);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-table td { padding: .28rem .5rem; border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rank-table .c-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.rank-table .c-name { font-weight: 600; overflow: hidden; }
.rank-table td.muted { color: color-mix(in srgb, currentColor 55%, transparent); }
.rank-table tr.dim { opacity: .55; font-style: italic; }
/* Gruppengrenze (3er-Gruppe/Paarung) klar stärker als die 1px-Zeilenlinie – kräftiger + mit dem Zoom
   skalierender Abstand, damit die Gruppen auch bei grossen Zeilen (PC) deutlich getrennt sind. */
.rank-table tr.grp-break td { border-top: 3px solid color-mix(in srgb, var(--rank-fg, #1a1a1a) 55%, transparent);
    padding-top: calc(.55rem * var(--row-scale, 1)); }

.namecell { display: flex; align-items: baseline; gap: .6rem; width: 100%; min-width: 0; overflow: hidden; }
.namecell .nm { flex: 0 0 auto; overflow: hidden; white-space: nowrap; }
.namecell .shots { flex: 1 1 auto; min-width: 0; display: flex; justify-content: flex-end; align-items: baseline;
    overflow: hidden; padding-left: 1rem;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 1rem);
            mask-image: linear-gradient(to right, transparent 0, #000 1rem); }
.namecell .shots .shot { flex: 0 0 calc(1.9rem * var(--row-scale, 1)); box-sizing: border-box; text-align: right; padding-right: .15rem;
    font-variant-numeric: tabular-nums; white-space: nowrap;
    font-size: calc(.8rem * var(--row-scale, 1)); color: color-mix(in srgb, currentColor 52%, transparent); }
.namecell .shots .shot-sep { flex: 0 0 calc(.5rem * var(--row-scale, 1)); align-self: stretch; position: relative; }
.namecell .shots .shot-sep::before { content: ""; position: absolute; left: 50%; top: -0.05em; bottom: -0.05em;
    border-left: 1px solid color-mix(in srgb, currentColor 38%, transparent); }
.namecell .shots.head .shot { font-size: calc(.66rem * var(--row-scale, 1)); font-weight: 600;
    color: color-mix(in srgb, currentColor 42%, transparent); }

.rank-table .c-series { overflow: hidden; }
.series-strip { display: flex; justify-content: flex-end; align-items: baseline; overflow: hidden; }
.series-strip .sv { flex: 0 0 calc(2.4rem * var(--row-scale, 1)); box-sizing: border-box; text-align: right; padding-right: .15rem;
    font-variant-numeric: tabular-nums; white-space: nowrap;
    font-size: calc(.8rem * var(--row-scale, 1)); color: color-mix(in srgb, currentColor 52%, transparent); }
.series-strip.head .sv { font-size: calc(.66rem * var(--row-scale, 1)); font-weight: 600;
    color: color-mix(in srgb, currentColor 42%, transparent); }
.series-strip .sv.hi { color: currentColor; font-weight: 800; border-radius: 4px;
    background: color-mix(in srgb, #1f8a3b 18%, transparent); }

.cell-badge { display: inline-block; padding: .04rem .4rem; border-radius: 5px; }

.rank-footer { flex: 0 0 auto; margin-top: .35rem; min-height: 0; overflow: hidden; }
.leader-grid { display: grid; gap: .35rem; height: 100%; min-height: 0; overflow: hidden; }

/* Zieh-Griff zwischen Rangliste und Scheiben-Footer (Maus/Touch) – vom /live-Script eingefügt. */
.footer-resize { flex: 0 0 auto; height: 14px; margin: 1px 0; cursor: ns-resize; position: relative;
    touch-action: none; border-radius: 6px; background: color-mix(in srgb, var(--rank-fg, #1a1a1a) 12%, transparent); }
.footer-resize::before { content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 46px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--rank-fg, #1a1a1a) 45%, transparent); }

.board-cell.waiting { display: flex; align-items: center; justify-content: center;
    color: #5b6675; border: 1px dashed #2b3340; border-radius: 8px; font-size: 1.3rem; }

/* ---------- Podest (Kind "podium") ---------- */
.podium { display: flex; flex-direction: column; height: 100%; min-height: 0;
    background: var(--rank-bg, #fff); color: var(--rank-fg, #1a1a1a); }
.podium .rank-title { display: flex; align-items: baseline; gap: .8rem; padding: .3rem .6rem;
    background: #1b2a4a; color: #fff; border-radius: 6px; margin: 0 0 .35rem; }
.podium-groups { flex: 1; min-height: 0; display: flex; gap: 1rem; }
.podium-group { flex: 1 1 0; min-width: 0; overflow: hidden; display: flex; flex-direction: column; padding: 0 .6rem; }
.podium-group + .podium-group { border-left: 3px solid color-mix(in srgb, currentColor 25%, transparent); }
.podium-cat { text-align: center; font-weight: 700; font-size: 1.6rem; padding: .4rem; opacity: .9; }
.podium-stand { flex: 1; min-height: 0; display: flex; align-items: flex-end; justify-content: center; gap: .55rem; padding: .8rem .3rem; }
.pod-place { flex: 1 1 0; min-width: 0; max-width: 11rem; display: flex; flex-direction: column; align-items: center; }
.pod-card { width: 100%; box-sizing: border-box; border-radius: 12px 12px 0 0; padding: .55rem .5rem; text-align: center;
    color: #1a1a1a; box-shadow: 0 -3px 12px rgba(0,0,0,.3); }
.pod-rank { font-size: 2.1rem; font-weight: 800; line-height: 1; }
.pod-vorname { font-size: .95rem; font-weight: 600; opacity: .85; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-name { font-size: 1.3rem; font-weight: 700; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-verein { font-size: .85rem; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-total { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: .2rem; }
.pod-prize { font-size: .8rem; font-weight: 700; margin-top: .1rem; }
.pod-base { width: 100%; box-sizing: border-box; background: #2b3340; color: #fff; text-align: center; font-weight: 800;
    font-size: 1.7rem; display: flex; align-items: flex-start; justify-content: center; padding-top: .4rem;
    border-radius: 0 0 6px 6px; }
.pod-r1 .pod-base { height: 10rem; }
.pod-r2 .pod-base { height: 7rem; }
.pod-r3 .pod-base { height: 4.5rem; }
.pod-r4 .pod-base { height: 2.5rem; background: #6b7280; }
.pod-r4 { margin-left: 1.8rem; padding-left: 1.2rem; border-left: 2px dashed color-mix(in srgb, currentColor 35%, transparent); opacity: .8; }

/* ---------- Turnierbaum (Kind "bracket") ---------- */
.bracket { display: flex; flex-direction: column; height: 100%; min-height: 0; background: #ffffff; color: #1a1a1a; }
.brk-slot { color: #1a1a1a; }
.brk-title { display: flex; align-items: center; gap: .8rem; padding: .3rem .6rem;
    background: #1b2a4a; color: #fff; border-radius: 6px; margin-bottom: .5rem; }
.brk-name { font-size: 1.4rem; font-weight: 700; }
.brk-cat { font-size: 1.1rem; opacity: .9; }
.brk-date { font-size: 1rem; opacity: .8; margin-left: auto; }
.brk-rounds { flex: 1; min-height: 0; display: flex; gap: .35rem; overflow: auto; padding: .3rem; align-items: stretch; }
.brk-round { display: flex; flex-direction: column; flex: 1 1 0; min-width: 6.5rem; }
.brk-round.outer { flex: 1.4 1 0; }
.brk-round-name { font-weight: 700; text-transform: uppercase; letter-spacing: .03em; font-size: .72rem;
    color: #66718a; text-align: center; margin-bottom: .4rem; }
.brk-matches { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: .3rem; }
.brk-match { width: 100%; border: 1px solid #d6deea; border-radius: 8px; overflow: hidden; background: #fff; }
.brk-slot { display: flex; align-items: center; gap: .35rem; padding: .25rem .4rem;
    border-bottom: 1px solid #eef1f6; font-size: .85rem; }
.brk-slot:last-child { border-bottom: none; }
.brk-slot.win { background: #e7f6ec; font-weight: 700; }
.brk-slot.empty { color: #aab2c0; font-style: italic; }
.bs-nr { width: 1.5rem; flex: none; color: #8a94a6; font-variant-numeric: tabular-nums; }
.bs-name { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-total { flex: none; padding-left: .25rem; font-variant-numeric: tabular-nums; font-weight: 700; }
.brk-round.inner .bs-nr { display: none; }
.brk-round.mirror .brk-slot { flex-direction: row-reverse; }
.brk-round.mirror .bs-name { text-align: right; }
.brk-round.mirror .bs-total { padding-left: 0; padding-right: .25rem; }
.brk-center { display: flex; flex-direction: column; justify-content: center; gap: 1rem; flex: 1.3 1 0; min-width: 8rem; padding: 0 .2rem; }
.center-round { flex: 0 0 auto; }
.center-round .bs-nr { display: none; }
.center-round .brk-matches { flex: 0 0 auto; justify-content: center; gap: 1.4rem; }
.brk-finals { display: flex; flex-direction: column; gap: .7rem; flex: 0 0 auto; }
.brk-final .brk-match { border-width: 2px; border-color: #b9c6dc; }
.brk-slot.hr { box-shadow: inset 0 0 0 2.5px #e0a800; }

/* ---------- Scheiben-Kachel (BoardTile) ---------- */
.board-cell { background: #fff; border: 1px solid #e2e7f0; border-radius: 8px; padding: 3px;
    display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.board-cell.dim { opacity: .55; filter: grayscale(.5); }
.board-hdr { display: flex; justify-content: space-between; align-items: center; gap: .4rem;
    font-size: 1rem; font-weight: 600; padding: 2px 6px; border-radius: 5px; margin-bottom: 2px; flex: 0 0 auto; }
.bname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bnum { font-weight: 800; margin-left: .3rem; font-variant-numeric: tabular-nums; }
/* aspect-ratio + flex-grow lässt die Scheibe in schmal-hohen Kacheln (Hochformat) breiter als die Zelle
   werden → sie lief rechts raus und wurde beschnitten (Zentrum nach rechts verschoben). max-width kappt die
   Breite auf die Zelle, margin-inline zentriert die (dann evtl. nicht ganz quadratische) Fläche. */
.board-svg { position: relative; flex: 1 1 auto; min-height: 0; aspect-ratio: 1 / 1;
    max-width: 100%; margin-inline: auto; overflow: hidden; }
.lastscore { position: absolute; top: 1px; right: 5px; color: #34d96b; font-size: 1.6rem; font-weight: 800; line-height: 1;
    text-shadow: 0 0 2px #000, 1px 1px 1px #000, -1px 1px 1px #000, 1px -1px 1px #000, -1px -1px 1px #000; }
.board-tgtnum { position: absolute; top: 2px; left: 6px; color: #8a94a6; font-size: .95rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.board-overlay { position: absolute; bottom: 2px; left: 4px; line-height: 0; }
.board-overlay svg { filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.board-badge { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-12deg);
    padding: .15rem .6rem; border-radius: 6px; font-weight: 800; font-size: 1.1rem;
    background: rgba(107,114,128,.9); color: #fff; }

/* ---------- Mobile / kleine Formate ----------
   Fast alle Grössen sind rem-basiert → das Verkleinern der Wurzel-Schriftgrösse zoomt die ganze
   Ansicht proportional heraus (mehr Ranglisten-Zeilen sichtbar, kleinere Schriften/Streifen/Podest).
   Die Scheibenbilder (SVG, breitenbasiert) bleiben davon unberührt und werden separat gedeckelt. */
@media (max-width: 640px) {
    html { font-size: 11px; }
    #live-root { padding: .25rem; }
    .rank-title, .podium .rank-title, .brk-title { flex-wrap: wrap; gap: .25rem .5rem; padding: .25rem .45rem; }
    .rt-date { margin-left: 0; }
    .rank-table th, .rank-table td { padding: .16rem .3rem; }
    .namecell { gap: .35rem; }
    .namecell .shots .shot { flex-basis: 1.4rem; }
    .series-strip .sv { flex-basis: 1.9rem; }
    .board-hdr { font-size: .85rem; }
    /* Einzelnes Scheibenbild soll nicht die ganze Höhe fressen. */
    .board-svg { max-height: 52vh; }
}
@media (max-width: 400px) {
    html { font-size: 9.5px; }
    /* Auf sehr schmalen Screens den Schuss-Streifen ausblenden → Name + Total bleiben lesbar. */
    .namecell .shots { display: none; }
}

/* ---------- Handy-Modus (JS-gesteuert via .live-narrow; zuverlässig, da Media-Queries im iframe auf
   iOS nicht greifen). Das Wall-Layout (fixe Höhe + Auto-Scroll) BLEIBT – nur kompakter:
   Schuss-Streifen weg, Footer-Scheiben in ein umbrechendes Raster (4 pro Zeile, mehrere Zeilen),
   etwas mehr Footer-Höhe. Die Wurzel-Schriftgrösse setzt das /live-Script fluid nach der echten Breite. */
/* Schuss-Streifen NUR im Hochformat ausblenden (dort ist es eng). Querformat + Desktop haben Platz → zeigen. */
html.live-portrait .namecell .shots { display: none; }
/* Hochformat: NAME hat Vorrang. Scheibe/Verein/Total schmal → der (flexible) Name gewinnt den Platz.
   Schüsse sind im Hochformat ohnehin ausgeblendet. */
html.live-portrait col.col-tgt { width: 2.6em !important; }
html.live-portrait col.col-rank { width: 3em !important; }
html.live-portrait col.col-nr { width: 2.6em !important; }
html.live-portrait col.col-verein { width: 4.5em !important; }
/* Serien-Spalte („1 2") im Hochformat ausblenden – dort zählt der Name, das Total genügt. */
html.live-portrait col.col-series { width: 0 !important; }
html.live-portrait .series-strip { display: none !important; }
html.live-portrait td.c-series, html.live-portrait th.c-series { padding: 0 !important; }
/* Total NICHT kappen: die fetten Dezimal-Totale (z.B. „200.2") müssen ganz lesbar sein (Template ~6em). */
/* Nicht-Hochformat (Desktop, Beamer, Handy quer): NAME ist die EINZIGE flexible Spalte und würde den ganzen
   Rest schlucken (Schuss-Streifen klebt weit rechts → grosse Lücke). NAME auf Inhaltsbreite (Name + Schüsse)
   begrenzen, VEREIN füllt den freien Platz (Vereinsnamen weniger abgeschnitten). */
html:not(.live-portrait) col.col-verein { width: 11em !important; }
/* Footer-Höhe UND Raster (Zeilen×Spalten) berechnet der JS-Optimierer (layoutFooter) je Gerät/Format –
   KEINE festen Portrait-Overrides mehr (die überstimmten per !important den Optimierer und liessen im
   Hochformat halbe Zeilen leer). Der Optimierer setzt height + grid-template inline. */
