/* =========================================
   styles/tv.css – Hallen-Bildschirm (live.html?tv)
   Gezeichnet für 1280 × 720, per zoom auf den Bildschirm vergrößert (src/live/tv.js)
========================================= */

#tv {
    display: none;
}

body.tv {
    overflow: hidden;
    cursor: none;
    background: var(--bg);
}

.tv-pre body > header,
.tv-pre body > main,
.tv-pre body > footer,
body.tv > header,
body.tv > main,
body.tv > footer {
    display: none;
}

body.tv #tv {
    --gap: 22px;
    display: grid;
    grid-template-rows: 62px 1fr;
    width: 1280px;
    height: 720px;
    position: relative;
    overflow: hidden;
    transform-origin: top left;
}

/* ----- Kopf ----- */
.tv-top {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 26px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.tv-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 24px;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.tv-note {
    flex: 1;
    min-width: 0;
    margin-left: 14px;
    padding: 7px 16px;
    border-radius: 999px;
    background: var(--warn-soft);
    color: var(--warn);
    font-weight: 700;
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-note[hidden] + .tv-state {
    margin-left: auto;
}

.tv-state {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted);
    flex: none;
}

.tv-state.live { background: var(--accent); }
.tv-state.off { background: var(--danger); }

.tv-clock {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 34px;
    letter-spacing: -0.02em;
}

/* ----- Aufteilung ----- */
.tv-body {
    display: grid;
    grid-template-columns: 430px 1fr;
    min-height: 0;
}

.tv-tables[hidden] {
    display: none;
}

.tv-body:has(.tv-tables[hidden]) {
    grid-template-columns: 1fr;
}

/* ----- Tische ----- */
.tv-tables {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 14px 16px 16px 26px;
    border-right: 1px solid var(--border);
}

.tv-tables-head,
.tv-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    height: 38px;
    flex: none;
}

.tv-tables-head {
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.tv-tlist {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-rows: repeat(var(--n), minmax(0, 1fr));
    gap: 6px;
    /* Schrift folgt der Zeilenhöhe: bei vielen Tischen kleiner */
    font-size: clamp(11px, calc(560px / var(--n) / 3.1), 21px);
}

.tv-t {
    display: grid;
    grid-template-columns: 2.6em minmax(0, 1fr) auto;
    align-items: center;
    gap: 0 0.7em;
    padding: 0 0.8em 0 0;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
    min-height: 0;
}

.tv-nr {
    align-self: stretch;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.35em;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.tv-t.free {
    background: transparent;
}

.tv-t.free .tv-nr {
    background: var(--surface-2);
    color: var(--muted);
}

.tv-pl {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    line-height: 1.22;
}

.tv-pl b,
.tv-nextup,
.tv-who b {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-free,
.tv-nextup {
    color: var(--muted);
    font-weight: 500;
}

.tv-nextup {
    font-size: 0.82em;
}

.tv-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    font-size: 0.6em;
    line-height: 1.3;
    color: var(--muted);
    white-space: nowrap;
    max-width: 9.5em;
    overflow: hidden;
}

.tv-meta .num {
    color: var(--text-2);
    font-weight: 700;
}

.tv-t.new {
    border-color: var(--warn);
    background: var(--warn-soft);
    animation: tv-pulse 1.6s ease-in-out infinite;
}

.tv-t.new .tv-nr {
    background: var(--warn);
    color: #1b1300;
}

.tv-call {
    color: var(--warn);
    font-weight: 800;
    font-size: 1.25em;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

@keyframes tv-pulse {
    50% { box-shadow: 0 0 0 4px var(--warn-soft); }
}

/* ----- Wechselnde Ansicht ----- */
.tv-stage {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    padding: 14px 26px 0 22px;
}

.tv-head h2 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 25px;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-sub {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-strong);
    white-space: nowrap;
}

.tv-dots {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tv-dots i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border-strong);
}

.tv-dots i.on {
    background: var(--accent);
}

.tv-dots small {
    margin-left: 6px;
    font-size: 13px;
    color: var(--muted);
}

.tv-view {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.tv-pages {
    height: 100%;
    columns: var(--cols, 1);
    column-gap: var(--gap);
    column-fill: auto;
    transition: transform 0.5s ease;
}

.tv-pages > *,
.tv-pages .lg-grid > *,
.tv-pages .sw-live > *,
.tv-two > * {
    break-inside: avoid;
}

.tv-view.fit .tv-pages {
    columns: auto;
    height: auto;
    width: max-content;
    max-width: none;
    transform-origin: top left;
    transition: none;
}

.tv-bar {
    height: 3px;
    flex: none;
    margin: 8px 0 10px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.tv-bar span {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--accent);
    transform-origin: left;
    transform: scaleX(0);
}

@keyframes tv-run {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.tv-empty {
    display: grid;
    place-items: center;
    height: 100%;
    color: var(--muted);
    font-size: 20px;
}

/* Als nächstes / Zuletzt gespielt */
.tv-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
    height: 100%;
}

.tv-two > :only-child {
    grid-column: 1 / -1;
    max-width: 560px;
}

.tv-block h3 {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}

.tv-row {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    height: 62px;
    padding: 0 14px 0 0;
    margin-bottom: 6px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
}

.tv-lead,
.tv-score {
    align-self: stretch;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 20px;
    background: var(--surface-2);
    color: var(--text-2);
}

.tv-score {
    font-size: 18px;
    color: var(--text);
}

.tv-who {
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-size: 17px;
    line-height: 1.25;
}

.tv-who .lose {
    color: var(--muted);
    font-weight: 500;
}

.tv-rmeta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    white-space: nowrap;
}

.tv-rmeta small {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
}

/* Bausteine der Live-Seite auf dem Bildschirm */
body.tv .tv-pages .lg-grid,
body.tv .tv-pages .sw-live {
    display: block;
}

body.tv .tv-pages .lg-card,
body.tv .tv-pages .card {
    margin: 0 0 12px;
    box-shadow: none;
}

body.tv .tv-pages [data-player],
body.tv .tv-pages tr {
    cursor: none;
}

body.tv .tv-pages .rank-table td {
    padding: 7px 8px;
}

body.tv .tv-pages .rank-table th {
    padding: 6px 8px;
}

body.tv .tv-pages .rank-table .hide-xs {
    display: table-cell;
}

body.tv .tv-pages .tie-card,
body.tv .tv-pages .standing-state,
body.tv .tv-pages summary.lk-fold-head::marker {
    display: none;
}

body.tv .tv-view.fit .section-title {
    display: none;
}

body.tv .tv-view.fit .lk-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.tv-winners {
    max-width: 620px;
    margin: 24px auto 0;
    zoom: 1.35;
}

/* ----- Noch nicht live / Pause ----- */
.tv-splash {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: var(--bg);
    text-align: center;
}

.tv-splash[hidden] {
    display: none;
}

.tv-splash h1 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 46px;
    letter-spacing: -0.02em;
}

.tv-splash p {
    font-size: 22px;
    color: var(--text-2);
}
