/* ── TV Mode / Beamer View ──────────────────────────────────────────── */

* { margin: 0; padding: 0; box-sizing: border-box; }
body.tv-body {
    font-family: 'Inter', system-ui, sans-serif;
    overflow: hidden;
    height: 100vh; width: 100vw;
    display: flex; flex-direction: column;
}

/* Dark Theme */
.tv-dark {
    --tv-bg: #0a0a0f;
    --tv-card: #1a1a2e;
    --tv-border: #2a2a3e;
    --tv-text: #e0e0e8;
    --tv-text-muted: #8888aa;
    --tv-primary: #c41e2a;
    --tv-accent: #FFD700;
    --tv-green: #22c55e;
}

/* Light Theme */
.tv-light {
    --tv-bg: #f5f5f5;
    --tv-card: #ffffff;
    --tv-border: #ddd;
    --tv-text: #1a1a2e;
    --tv-text-muted: #666;
    --tv-primary: #c41e2a;
    --tv-accent: #d4a017;
    --tv-green: #16a34a;
}

.tv-body { background: var(--tv-bg); color: var(--tv-text); }

/* Header */
.tv-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 2rem;
    background: var(--tv-card); border-bottom: 3px solid var(--tv-primary);
}
.tv-brand { font-size: 1.4rem; font-weight: 700; }
.tv-brand i { color: var(--tv-primary); margin-right: 0.5rem; }
.tv-clock { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Content */
.tv-content {
    flex: 1; padding: 1.5rem 2rem; overflow: hidden;
    display: flex; flex-direction: column; gap: 1rem;
}
.tv-loading {
    display: flex; align-items: center; justify-content: center;
    height: 100%; font-size: 2rem; gap: 1rem; color: var(--tv-text-muted);
}

/* Board Grid */
.tv-boards {
    display: grid; gap: 1rem;
    flex: 1;
}
.tv-boards.count-1 { grid-template-columns: 1fr; }
.tv-boards.count-2 { grid-template-columns: 1fr 1fr; }
.tv-boards.count-3 { grid-template-columns: 1fr 1fr 1fr; }
.tv-boards.count-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.tv-board {
    background: var(--tv-card); border: 1px solid var(--tv-border);
    border-radius: 1rem; padding: 1.5rem; display: flex; flex-direction: column;
}
.tv-board-header {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.85rem; color: var(--tv-text-muted);
    margin-bottom: 0.75rem; font-weight: 600;
}
.tv-board-header .board-name { color: var(--tv-primary); font-weight: 700; }
.tv-board-header .board-type { font-size: 0.75rem; }

.tv-match {
    display: grid; grid-template-columns: 1fr auto 1fr;
    align-items: center; flex: 1;
}
.tv-player {
    text-align: center;
}
.tv-player-name {
    font-size: 1.3rem; font-weight: 700;
    margin-bottom: 0.5rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tv-player.throwing { position: relative; }
.tv-player.throwing .tv-player-name { color: var(--tv-accent); }
.tv-player.throwing::after {
    content: '◄';
    position: absolute;
    top: 0; right: 0.5rem;
    color: var(--tv-accent);
    font-size: 0.8rem;
    animation: throwPulse 1s infinite;
}
.tv-player.throwing:last-child::after {
    content: '►';
    right: auto; left: 0.5rem;
}
@keyframes throwPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.tv-remaining {
    font-size: 4rem; font-weight: 900;
    line-height: 1; margin-bottom: 0.3rem;
}

.tv-vs {
    display: flex; flex-direction: column; align-items: center;
    padding: 0 1.5rem;
}
.tv-legs {
    font-size: 2.5rem; font-weight: 900; color: var(--tv-primary);
}
.tv-leg-label { font-size: 0.7rem; color: var(--tv-text-muted); text-transform: uppercase; }

.tv-page-indicator {
    text-align: center; font-size: 0.8rem; color: var(--tv-text-muted); padding: 0.25rem;
}

/* No active matches */
.tv-no-matches {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.75rem; padding: 3rem 0;
}
.tv-no-matches i { font-size: 4rem; color: var(--tv-text-muted); }
.tv-no-matches span { font-size: 1.5rem; color: var(--tv-text-muted); }
.tv-no-matches-sub { font-size: 0.9rem !important; }

/* Recent Results Grid */
.tv-section-title {
    font-size: 1.2rem; margin-bottom: 0.75rem; color: var(--tv-text);
}
.tv-section-title i { color: var(--tv-primary); margin-right: 0.5rem; }

.tv-recent-results { margin-bottom: 1rem; }
.tv-results-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}
.tv-result-card {
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--tv-card); border: 1px solid var(--tv-border);
    border-radius: 0.75rem; padding: 0.75rem 1rem;
}
.tv-result-player {
    flex: 1; font-weight: 600; font-size: 0.95rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tv-result-player:last-child { text-align: right; }
.tv-result-player.winner { color: var(--tv-green); }
.tv-result-score {
    font-weight: 900; font-size: 1.2rem; color: var(--tv-primary);
    flex-shrink: 0; padding: 0 0.5rem;
}

/* Standings Table */
.tv-standings { margin-top: 0.5rem; }
.tv-standings-table {
    width: 100%; border-collapse: collapse; font-size: 1rem;
}
.tv-standings-table th {
    text-align: left; padding: 0.5rem 0.75rem;
    color: var(--tv-text-muted); font-weight: 600; font-size: 0.8rem;
    border-bottom: 2px solid var(--tv-border);
}
.tv-standings-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--tv-border);
}
.tv-standings-table tr.top td { background: rgba(34,197,94,0.08); }
.tv-standings-table tr.bottom td { background: rgba(239,68,68,0.06); }
.tv-standings-table td.pos { font-weight: 800; color: var(--tv-text-muted); }
.tv-standings-table td.player-name { font-weight: 600; }
.tv-standings-table td.wins { color: var(--tv-green); font-weight: 600; }
.tv-standings-table td.points { font-weight: 800; color: var(--tv-primary); }

/* Bottom Ticker */
.tv-ticker {
    background: var(--tv-primary); color: #fff;
    padding: 0.5rem 2rem; font-size: 1rem; font-weight: 600;
    overflow: hidden; white-space: nowrap;
}
.tv-ticker-content {
    display: inline-block;
    animation: tickerScroll 30s linear infinite;
}
@keyframes tickerScroll {
    0%   { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}
