/* TV / multiviewer view. Everything is sized in vh so a 16:9 tile of any
   size keeps the same proportions; the page never scrolls. */
html, body.tv { height: 100%; overflow: hidden; }
body.tv {
  padding: 0; display: flex; flex-direction: column;
  background: radial-gradient(120vh 60vh at 50% -20%, var(--flag-tint), transparent 70%), var(--bg);
}
body.tv *::selection { background: transparent; }

.tv-head {
  flex: 0 0 11vh;
  display: flex; align-items: center; gap: 3vh;
  padding: 0 3vh;
  border-bottom: 1px solid var(--line);
  background: rgba(10,12,18,0.7);
}
.tv-brand { font-size: 2.5vh; font-weight: 800; white-space: nowrap; letter-spacing: 0.02em; }
.tv-brand span { color: var(--accent); }
.tv-race { flex: 1; min-width: 0; font-size: 2.5vh; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-race strong { color: var(--text); font-weight: 700; }
.tv-status { display: flex; align-items: center; gap: 1.6vh; white-space: nowrap; }
.tv-status .flag-indicator { font-size: 2.1vh; padding: 0.6vh 1.6vh; border-radius: 0.5vh; }
.tv-status .flag-dot { width: 1.1vh; height: 1.1vh; margin-right: 1vh; }
.tv-status .lap-counter { font-size: 2.3vh; }
.tv-status .lap-counter strong { font-size: 3.4vh; }
.tv-status .stage-badge { font-size: 2.1vh; padding: 0.6vh 1.6vh; border-radius: 0.5vh; }
.tv-status .countdown { padding: 0.7vh 1.8vh; border-radius: 0.5vh; gap: 1.4vh; }
.tv-status .cd-label { font-size: 1.9vh; }
.tv-status .cd-time { font-size: 3.4vh; }

.tv-progress { flex: 0 0 0.8vh; background: var(--surface-3); }
.tv-progress-fill { height: 100%; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform 0.7s var(--ease-out); }
.tv-progress[hidden] { display: none; }

.tv-board { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 1.6vh 3vh 1.2vh; max-width: none; margin: 0; width: 100%; }
.tv-title {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 1.6vh;
  font-size: 2.4vh; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 1.2vh;
}
.tv-title .status-badge { font-size: 2vh; padding: 0.4vh 1.2vh; border-radius: 0.4vh; margin: 0; }
.tv-title .tv-page { margin-left: auto; color: var(--text-dim); font-size: 2.2vh; letter-spacing: 0.1em; }

.tv-rows { flex: 1; min-height: 0; display: grid; grid-auto-rows: 1fr; gap: 0.9vh; transition: opacity 0.25s ease; }
.tv-rows.is-out { opacity: 0; }

.tv-row {
  display: grid;
  grid-template-columns: 7vh minmax(0, 1.15fr) minmax(0, 1fr) 12vh 15vh 15vh;
  align-items: center;
  column-gap: 2vh;
  padding: 0 2.4vh 0 1.6vh;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.8vh;
  font-size: 4vh;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.tv-row.standings { grid-template-columns: 7vh minmax(0, 1.2fr) minmax(0, 1fr) 16vh 13vh; }
.tv-row .pr-bar { transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }
.tv-row.is-leader { background: linear-gradient(90deg, rgba(255,200,92,0.12), var(--surface) 55%); border-color: rgba(255,200,92,0.35); }

.tv-rank { font-size: 3.2vh; font-weight: 800; color: var(--text-dim); text-align: center; }
.tv-rank .rank-medal { width: 4.6vh; height: 4.6vh; font-size: 2.6vh; border-radius: 0.6vh; }
.tv-player { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-driver { display: flex; align-items: center; gap: 1.4vh; min-width: 0; font-size: 3.4vh; font-weight: 500; color: var(--text-dim); }
.tv-pick-pts { flex-shrink: 0; font-weight: 800; color: var(--text); font-size: 3.4vh; margin-left: 0.4vh; }
.tv-driver .driver-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tv-driver .car-badge { height: 5vh; flex-shrink: 0; }
.tv-driver .car-num { font-size: 2.2vh; min-width: 4.4vh; padding: 0.2vh 0.8vh; border-radius: 0.5vh; flex-shrink: 0; }
.tv-driver .mult-badge { font-size: 2.4vh; padding: 0 1.1vh; line-height: 1.6; border-radius: 0.4vh; margin: 0; flex-shrink: 0; }
.tv-pos { text-align: right; font-weight: 800; font-size: 3.8vh; white-space: nowrap; }
.tv-pos.top { color: var(--green); }
.tv-pos.out { color: var(--red); text-decoration: line-through; }
.tv-pos .pit-tag { font-size: 2vh; margin-top: 0.2vh; line-height: 1; }
.tv-pts { text-align: right; font-weight: 800; font-size: 4.4vh; color: var(--green); line-height: 1; }
.tv-pts small { display: block; font-size: 2.1vh; font-weight: 600; color: var(--text-dim); margin-top: 0.4vh; }
.tv-total { text-align: right; font-weight: 800; font-size: 5vh; color: var(--accent); }
.tv-gap { text-align: right; font-size: 3vh; color: var(--text-dim); }
.tv-gap.lead { color: var(--gold); font-size: 2.2vh; font-weight: 800; letter-spacing: 0.1em; }
.tv-empty { display: flex; align-items: center; justify-content: center; font-size: 3vh; color: var(--text-mute); }

.tv-foot {
  flex: 0 0 5vh;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 3vh;
  font-size: 2vh; color: var(--text-dim);
  border-top: 1px solid var(--line);
}
.tv-dots { display: flex; gap: 1vh; }
.tv-dot { width: 1.1vh; height: 1.1vh; border-radius: 0.2vh; background: var(--line-strong); }
.tv-dot.on { background: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .tv-rows { transition: none; }
  .tv-progress-fill { transition: none; }
  body.tv .flag-dot { animation: none; }
}
