/* TV 16:9. Everything in vh so it scales with the screen.
   Column: top bar 9vh, the board (fills), the sponsor band (auto, ~11vh).
   Board: two flat columns split by a 1px rule, no boxes. Left .82fr stacks the
   arena (fills) over the queue (auto); the standings take the right 1.18fr. */
body { overflow: hidden; display: flex; flex-direction: column; height: 100vh; }

/* Top bar */
#top {
  height: 9vh; padding: 0 3.2vh; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 3vh;
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 2.4vh; min-width: 0; }
/* CBR 2026 + Petrobras badge (white artwork, made for the black bar); near-square, so it
   takes most of the bar's height to keep its lettering readable. */
.brand .cbr { height: 7.6vh; width: auto; display: block; }
.brand h1 {
  font-size: 2.6vh; font-weight: 600; letter-spacing: -.01em; white-space: nowrap;
  padding-left: 2.4vh; border-left: 1px solid var(--raised); line-height: 4.4vh;
}
#phases { list-style: none; display: flex; align-items: baseline; gap: 3.2vh; font-size: 2.1vh; color: var(--faint); white-space: nowrap; }
#phases li.active { color: var(--text); font-weight: 600; font-size: 3.2vh; letter-spacing: -.01em; }
#phases li.active .pn { color: var(--muted); font-weight: 500; }

/* Board */
#tv { flex: 1; min-height: 0; display: grid; grid-template-columns: .82fr 1.18fr; }
#left { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--rule); }
.sec-h { font-size: 2.1vh; font-weight: 500; color: var(--muted); display: flex; align-items: baseline; gap: 1.2vh; }
.sec-sub { font-size: 2.1vh; font-weight: 400; color: var(--faint); }

/* Arena: who is flying and how long they have left */
#arena { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 2.6vh 3.6vh 3vh; }
.arena-body { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.arena-team { display: flex; align-items: center; gap: 2.2vh; min-width: 0; }
.arena-team .logo { width: 8.4vh; height: 8.4vh; font-size: 3vh; }
.arena-name {
  font-family: "Barlow Condensed", "Inter", sans-serif; font-weight: 700;
  font-size: 7vh; line-height: 1; letter-spacing: -.005em; overflow-wrap: anywhere;
}
.countdown {
  margin-top: 1.6vh; font-family: "Barlow Condensed", "Inter", sans-serif; font-weight: 700;
  font-size: min(24vh, 13vw); line-height: .9; letter-spacing: -.01em;
  color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.countdown .cd-ms { font-size: .32em; font-weight: 600; letter-spacing: 0; color: var(--faint); margin-left: .08em; }
.countdown.low { color: var(--negative); }
.slot { margin-top: 2.2vh; height: .7vh; background: #222; overflow: hidden; }
.slot i { display: block; height: 100%; background: var(--accent); }
.slot.low i { background: var(--negative); }
.slot-cap { margin-top: 1.2vh; display: flex; justify-content: space-between; font-size: 2.2vh; color: var(--faint); font-variant-numeric: tabular-nums; }
.slot-cap b { color: var(--muted); font-weight: 500; }
.slot.low + .slot-cap b { color: var(--negative); }
/* 00:00: the slot is over and the room should see it until the referee calls the next team. */
.slot-cap.up b { font-size: 3.4vh; font-weight: 700; line-height: 1; }
/* Paused: the digits step back and the word steps up, so a frozen clock never reads as running. */
.countdown.paused, .countdown.paused.low { color: var(--muted); }
.slot.paused i, .slot.paused.low i { background: var(--muted); }
.slot-cap.paused b, .slot.low + .slot-cap.paused b { font-size: 3.4vh; font-weight: 700; line-height: 1; color: var(--text); }
.arena-msg { font-family: "Barlow Condensed", "Inter", sans-serif; font-size: 7vh; font-weight: 700; line-height: 1; }
.arena-msg-sub { margin-top: 1.4vh; font-size: 2.2vh; color: var(--faint); }
/* Phase over: what comes next, so the end of a phase points forward instead of at an empty arena. */
.arena-next { margin-top: 5vh; padding-top: 2.6vh; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 1vh; }
.arena-next .lbl { font-size: 2.1vh; font-weight: 500; color: var(--muted); }
.arena-next b { font-family: "Barlow Condensed", "Inter", sans-serif; font-size: 5vh; font-weight: 700; line-height: 1.05; }
#phases li.done { color: var(--muted); }
#phases li .dn { font-size: .8em; color: var(--faint); }

/* Queue: the flight order after the current team */
#queue { padding: 2.8vh 3.6vh 3.2vh; border-top: 1px solid var(--rule); }
#queue-list { list-style: none; margin-top: 1.2vh; }
#queue-list li { display: flex; align-items: center; gap: 1.6vh; padding: .8vh 0; font-size: 2.5vh; color: var(--muted); min-width: 0; }
#queue-list li .logo { width: 4.2vh; height: 4.2vh; font-size: 1.5vh; }
#queue-list li .q-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#queue-list li.first { color: var(--text); font-size: 3.4vh; font-weight: 600; padding-bottom: 1.2vh; }
#queue-list li.first .logo { width: 5.6vh; height: 5.6vh; font-size: 2vh; }
#queue-list li.empty { color: var(--faint); }

/* Standings */
/* Height is what the standings run out of with 11 teams, so the wrappers give it back: top padding
   matches #arena so both section heads stay level, and the head-to-rows gaps are tight. */
#standings { overflow: hidden; display: flex; flex-direction: column; min-width: 0; padding: 2.6vh 3.6vh 1.6vh; }
#rank { width: 100%; border-collapse: collapse; margin-top: .8vh; font-size: 3vh; }
#rank th { font-size: 2.2vh; font-weight: 500; color: var(--faint); text-align: right; padding: 0 1.4vh .6vh; white-space: nowrap; }
#rank th.active { color: var(--text); }
#rank td { text-align: right; padding: .26em 1.4vh; line-height: 1.15; border-top: 1px solid var(--rule); white-space: nowrap; }
#rank td.pos, #rank td.ph, #rank td.total { font-family: "Barlow Condensed", "Inter", sans-serif; font-variant-numeric: tabular-nums; font-size: 1.18em; line-height: 1; }
#rank .pos { text-align: right; width: 1%; color: var(--muted); padding-left: .6vh; font-weight: 600; }
#rank .lg { width: 1%; padding-right: 0; }
#rank td.lg { line-height: 0; }
#rank td.lg .logo { font-size: .4em; width: 2.78em; height: 2.78em; }
/* The name is what the room reads first: one weight step up from body, full white. */
#rank .name { text-align: left; max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
#rank td.ph { color: var(--muted); font-weight: 600; }
/* The phase being flown reads as a whole column, not just its header. */
#rank td.ph.active { color: var(--text); font-weight: 700; }
#rank td.ph.active.nil { color: var(--faint); font-weight: 600; }
#rank .total { font-weight: 700; padding-right: .6vh; }
#rank td.nil { color: var(--faint); font-weight: 600; }
#rank tr.lead td.total { color: var(--accent); }
#rank tr.lead td.pos { color: var(--text); }
#rank tr.lead td.name { font-weight: 600; }
/* The team in the arena: a tint across the row and a plain-text marker, no badge. */
#rank tr.flying td { background: #08283a; border-top-color: transparent; }
#rank tr.flying + tr td { border-top-color: transparent; }
#rank tr.flying td.name::after { content: "na arena"; margin-left: 1.4vh; font-size: .6em; font-weight: 600; color: var(--accent); }

.tie-note { margin-top: auto; padding-top: 1.2vh; font-size: 2.1vh; line-height: 1.3; color: var(--faint); }

#offline {
  position: fixed; top: 10.4vh; left: 50%; transform: translateX(-50%); z-index: 10;
  background: var(--pill-negative-bg); color: var(--pill-negative-ink);
  padding: .8vh 1.8vh; border-radius: 99vh; font-size: 2vh; font-weight: 500;
}
#offline[hidden] { display: none; }
/* No fresh data for 5 s: the clock has stopped on this screen, so it greys out and the notice
   grows to arena size. */
body.stale #offline { font-size: 3.4vh; font-weight: 700; padding: 1.4vh 3.4vh; }
body.stale .countdown, body.stale .countdown.low { color: var(--dim); }

/* Organisers, supporters and sponsors: each mark from the official files, set in the three
   groups the CBR uses, run edge to edge like a stadium board. The ground is a light grey rather
   than white so the band stays a step below the clock; logos multiply into it, so their own white
   backgrounds disappear and their colours stay true. Logo heights are in em, balanced by visual
   weight in tv.html; tv.js sets the font-size so the whole row fits the screen width. */
#sponsors {
  flex: none; display: flex; justify-content: space-between; gap: 1.3em;
  padding: 1vh 3.2vh 1.4vh; background: #e4e4e4; font-size: 6vh;
}
.sp-group { flex: 1 1 auto; display: flex; flex-direction: column; gap: .14em; }
.sp-group h2 {
  font-size: max(.24em, 1.4vh); font-weight: 600; color: #3d3d3d; letter-spacing: .01em;
  display: flex; align-items: center; gap: .6em; white-space: nowrap;
}
.sp-group h2::after { content: ""; flex: 1; height: 1px; background: #a8a8a8; }
.sp-logos { height: 1em; display: flex; align-items: center; justify-content: space-between; gap: .42em; }
.sp-logos img { display: block; width: auto; mix-blend-mode: multiply; }
