/*
 * The show: one 1920x1080 broadcast frame. It extends the match HUD's system (viewer/src/broadcast/style.css)
 * so the match and the frame around it read as one channel:
 *   Colour  opaque ink panels, warm paper type. Paper cells mark state (the leader, a pinned message, a closed
 *           track). Builders green marks the brand tile and the live state, nothing else.
 *   Type    Inter Tight. Built for the back of a lecture hall and a phone: nothing under 22 px, team names 30+.
 *   Corners square. Motion: 240 ms cuts and fades; the ticker changes item, it never scrolls.
 *   Layout  match: stage 1536x864 top left, rail 384 wide on the right, band 216 high across the bottom (an L).
 *           boards and slates cover the stage and rail; the band stays.
 */
@font-face { font-family: "Inter Tight"; src: url("/fonts/InterTight-var.woff2") format("woff2"); font-weight: 100 900; font-display: block; }

:root {
  --ink: #0d0e0d;
  --ink-2: #1a1c1a;
  --ink-3: #262926;
  --paper: #f1efe8;
  --green: #0b964a;
  --dim: rgba(241, 239, 232, 0.68);
  --faint: rgba(241, 239, 232, 0.42);
  --rule: rgba(241, 239, 232, 0.14);
  --grot: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --stage-w: 1536px;
  --stage-h: 864px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; background: #000; overflow: hidden; }
body { color: var(--paper); font-family: var(--grot); font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased; cursor: none; }

#frame { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; background: var(--ink); overflow: hidden; }

.lbl { font-size: 22px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1; }
.dim { color: var(--dim); }

/* ---------------------------------------------------------------- stage */
#stage { position: absolute; left: 0; top: 0; width: var(--stage-w); height: var(--stage-h); background: #000; overflow: hidden; }
#stage iframe { width: 100%; height: 100%; border: 0; display: block; background: #0d0e0d; }

/* ---------------------------------------------------------------- the clock (rail, boards header, slates) */
.clock-value { font-weight: 800; letter-spacing: -0.03em; line-height: 0.9; font-variant-numeric: tabular-nums; }
.clock-sub { color: var(--dim); font-weight: 600; }

/* ---------------------------------------------------------------- rail */
#rail { position: absolute; left: var(--stage-w); top: 0; width: calc(1920px - var(--stage-w)); height: var(--stage-h); background: var(--ink); display: flex; flex-direction: column; border-left: 2px solid var(--ink-3); }
#rail .clock { height: 196px; padding: 30px 32px 0; background: var(--ink-2); flex: none; }
#rail .clock-label { color: var(--dim); }
#rail .clock-value { font-size: 66px; margin-top: 16px; }
#rail .clock-sub { font-size: 22px; margin-top: 14px; }

.railboard { flex: 1; padding: 30px 32px 0; position: relative; overflow: hidden; }
.railboard .rb { position: absolute; inset: 30px 32px 0; animation: fadeIn 240ms var(--ease) both; }
.rb-head { display: flex; align-items: center; gap: 12px; }
.sponsor { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; background: var(--paper); color: var(--ink); font-size: 20px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
.state { font-size: 20px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.state.live { color: var(--paper); }
.state.final { color: var(--paper); }
.state.final::before { content: ""; display: inline-block; width: 12px; height: 12px; background: var(--paper); margin-right: 8px; vertical-align: 1px; }
.state.live::before { content: ""; display: inline-block; width: 12px; height: 12px; background: var(--green); margin-right: 8px; vertical-align: 1px; }
.rb-name { font-size: 46px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; margin-top: 18px; }
.rb-metric { font-size: 22px; color: var(--dim); font-weight: 600; margin-top: 10px; }
.rb-rows { margin-top: 22px; border-top: 2px solid var(--rule); }
.rb-kind { margin-top: 14px; }
.rb-row { display: grid; grid-template-columns: 44px 1fr; column-gap: 12px; align-items: center; height: 64px; border-bottom: 2px solid var(--rule); }
.rb-row .rk { font-size: 34px; font-weight: 800; text-align: left; }
.rb-row > div:last-child { min-width: 0; }
.rb-row .tm { font-size: 28px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.1; }
.rb-row .sc { font-size: 22px; font-weight: 600; color: var(--dim); margin-top: 2px; }
.rb-row.first { background: var(--paper); color: var(--ink); margin: 0 -32px; padding: 0 32px; border-bottom-color: transparent; }
.rb-row.first .sc { color: rgba(13, 14, 13, 0.7); }
.rb-empty { margin-top: 28px; font-size: 30px; font-weight: 700; line-height: 1.2; }
.rb-empty small { display: block; margin-top: 14px; font-size: 24px; color: var(--dim); font-weight: 600; line-height: 1.3; }
.rb-count { position: absolute; left: 0; right: 0; bottom: 16px; font-size: 22px; font-weight: 650; color: var(--dim); }
/* a showdown is on: it counts for nothing, said in the rail so a commentary line can't push it off */
.railnote { flex: none; display: none; padding: 20px 32px 22px; background: var(--paper); color: var(--ink); }
#frame.exhibition .railnote { display: block; }
.railnote .lbl { font-size: 20px; }
.rn-text { font-size: 24px; font-weight: 700; line-height: 1.25; margin-top: 10px; }
.raildots { height: 56px; flex: none; display: flex; gap: 8px; align-items: center; padding: 0 32px; }
.raildots i { display: block; height: 6px; flex: 1; background: var(--ink-3); }
.raildots i.on { background: var(--paper); }

/* ---------------------------------------------------------------- band: one line, then the ticker */
#band { position: absolute; left: 0; top: var(--stage-h); width: 1920px; height: calc(1080px - var(--stage-h)); display: flex; flex-direction: column; background: var(--ink); border-top: 2px solid var(--ink-3); }
.line { height: 120px; display: flex; align-items: stretch; background: var(--ink); }
.line-tag { flex: none; display: flex; align-items: center; padding: 0 28px; min-width: 200px; justify-content: center; background: var(--ink-2); font-size: 22px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }
.line-text { flex: 1; display: flex; align-items: center; padding: 0 36px; font-size: 44px; font-weight: 750; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-text span.sub { color: var(--dim); font-weight: 600; margin-left: 18px; font-size: 34px; }
.line.cast .line-tag { background: var(--green); color: #fff; }
.line.pin { background: var(--paper); color: var(--ink); }
.line.pin .line-tag { background: var(--ink); color: var(--paper); }
/* a banner (words.md §10): the one moment the band turns green */
.line.banner .line-tag { background: var(--paper); color: var(--ink); }
.line.banner .line-text { background: var(--green); color: #fff; font-weight: 800; letter-spacing: 0.01em; }
.line .in { animation: fadeIn 240ms var(--ease) both; }

.ticker { flex: 1; display: flex; align-items: stretch; background: var(--ink-2); }
.ticker-brand { flex: none; width: 200px; display: flex; align-items: center; justify-content: center; background: var(--green); }
.ticker-brand img { width: 150px; display: block; }
.ticker-tag { flex: none; display: flex; align-items: center; padding: 0 24px; font-size: 22px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); background: var(--paper); white-space: nowrap; }
.ticker-text { flex: 1; display: flex; align-items: center; padding: 0 30px; font-size: 34px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker-url { flex: none; display: flex; align-items: center; padding: 0 36px; font-size: 26px; font-weight: 700; color: var(--dim); letter-spacing: 0.01em; }
.ticker-url.rehearsal { background: #b8860b; color: var(--ink); text-transform: uppercase; letter-spacing: 0.1em; font-size: 22px; font-weight: 800; }
.ticker .in { animation: tickIn 320ms var(--ease) both; }

/* ---------------------------------------------------------------- boards scene */
#boards, #slate { position: absolute; left: 0; top: 0; width: 1920px; height: var(--stage-h); background: var(--ink); display: none; }
#frame[data-scene="boards"] #boards { display: block; animation: fadeIn 240ms var(--ease) both; }
#frame[data-scene="slate"] #slate { display: flex; animation: fadeIn 240ms var(--ease) both; }

.boards-head { height: 168px; display: flex; align-items: center; gap: 40px; padding: 0 56px; background: var(--ink-2); }
.wordmark { height: 46px; display: block; }
.boards-title { flex: 1; }
.boards-sub { font-size: 34px; font-weight: 750; margin-top: 12px; }
.boards-next { text-align: right; }
.boards-next .lbl { color: var(--dim); }
.boards-next .nx { font-size: 34px; font-weight: 750; margin-top: 12px; white-space: nowrap; }
.boards-next .nx b { font-weight: 800; }
.clock-wide { padding-left: 40px; border-left: 2px solid var(--rule); min-width: 380px; }
.clock-wide .clock-label { color: var(--dim); }
.clock-wide .clock-value { font-size: 72px; margin-top: 10px; }
.clock-wide .clock-sub { display: none; }

.boardcols { position: absolute; left: 56px; right: 56px; top: 200px; bottom: 28px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; column-gap: 28px; }
.col { display: flex; flex-direction: column; min-width: 0; animation: riseIn 420ms var(--ease) both; }
/* four tracks: 2x2, top 5 each */
.boardcols.grid2 { grid-auto-flow: row; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; column-gap: 56px; row-gap: 20px; }
.cell-head { display: flex; align-items: center; gap: 14px; height: 52px; }
.cell-name { font-size: 40px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cell-head .state { margin-left: auto; }
.cell .col-rows { margin-top: 12px; }
.cell .col-row { height: 44px; }
.cell .col-row .rk, .cell .col-row .tm { font-size: 30px; }
.cell .col-row .sc { font-size: 28px; }
.cell .col-row.first { height: 52px; }
.cell .col-row.first .tm { font-size: 32px; }
.col-head { display: flex; align-items: center; gap: 12px; }
.col-name { font-size: 50px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; margin-top: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-metric { font-size: 22px; color: var(--dim); font-weight: 600; margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-rows { margin-top: 18px; border-top: 2px solid var(--rule); }
.col-row { display: grid; grid-template-columns: 48px 1fr auto; column-gap: 12px; align-items: center; height: 54px; border-bottom: 2px solid var(--rule); }
.col-row .rk { font-size: 28px; font-weight: 800; }
.col-row .tm { font-size: 28px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-row .sc { font-size: 26px; font-weight: 700; color: var(--dim); }
.col-row.first { height: 72px; background: var(--paper); color: var(--ink); padding: 0 14px; margin: 0 -14px; border-bottom-color: transparent; }
.col-row.first .tm { font-size: 34px; font-weight: 800; }
.col-row.first .sc { color: var(--ink); }
.col-empty { margin-top: 26px; font-size: 32px; font-weight: 700; line-height: 1.2; }
.col-empty small { display: block; margin-top: 14px; font-size: 25px; color: var(--dim); font-weight: 600; line-height: 1.35; }
.col-foot { margin-top: auto; padding-top: 14px; font-size: 22px; font-weight: 650; color: var(--dim); }

/* one track at a time, big: each sponsor's track gets its own moment between matches */
.spotlight { position: absolute; left: 56px; right: 56px; top: 200px; bottom: 28px; display: none; }
#boards.spot .boardcols { display: none; }
#boards.spot .spotlight { display: grid; grid-template-columns: 560px 1fr; column-gap: 64px; animation: fadeIn 240ms var(--ease) both; }
.sp-right { display: flex; flex-direction: column; min-width: 0; }
.sp-winner { display: flex; align-items: center; gap: 24px; height: 140px; flex: none; padding: 0 28px; margin: 0 -28px 16px; background: var(--paper); color: var(--ink); }
.sp-winner .win { flex: none; padding: 8px 14px; background: var(--green); color: #fff; font-size: 24px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.sp-winner .tm { flex: 1; min-width: 0; font-size: 64px; font-weight: 850; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-winner .sc { flex: none; font-size: 40px; font-weight: 750; }
.sp-rows.after-win { grid-template-rows: repeat(4, 1fr); }
.sp-rows.after-win .sp-row { height: 96px; }
.sp-name { font-size: 92px; font-weight: 800; letter-spacing: -0.03em; line-height: 0.95; margin-top: 26px; }
.sp-line { font-size: 30px; font-weight: 600; color: var(--dim); line-height: 1.3; margin-top: 26px; }
.sp-metric { font-size: 26px; font-weight: 700; margin-top: 26px; }
.sp-count { font-size: 26px; font-weight: 650; color: var(--dim); margin-top: 12px; }
.sp-rows { display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: column; grid-template-rows: repeat(5, 1fr); column-gap: 40px; align-content: start; border-top: 2px solid var(--rule); }
.sp-row { display: grid; grid-template-columns: 56px 1fr auto; column-gap: 14px; align-items: center; height: 112px; border-bottom: 2px solid var(--rule); }
.sp-row .rk { font-size: 40px; font-weight: 800; }
.sp-row .tm { font-size: 38px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-row .sc { font-size: 32px; font-weight: 700; color: var(--dim); }
.sp-row.first { background: var(--paper); color: var(--ink); padding: 0 18px; margin: 0 -18px; border-bottom-color: transparent; }
.sp-row.first .sc { color: var(--ink); }
.sp-row .win { display: inline-block; vertical-align: 6px; margin-right: 16px; padding: 6px 12px; background: var(--green); color: #fff; font-size: 20px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.sd-name { font-size: 76px; }
.sp-rows.dense { grid-template-rows: repeat(8, 1fr); }
.sp-rows.dense .sp-row { height: 79px; }
.sp-rows.dense .rk { font-size: 32px; }
.sp-rows.dense .tm { font-size: 32px; }
.sp-rows.dense .sc { font-size: 26px; }
.sp-row .pr { margin-left: 14px; font-size: 22px; font-weight: 600; color: var(--dim); }
.sp-row.first .pr { color: rgba(13, 14, 13, 0.7); }
/* after the close: runs left to score per track */
.scoringcols { position: absolute; left: 56px; right: 56px; top: 200px; bottom: 28px; display: none; grid-auto-flow: column; grid-auto-columns: 1fr; column-gap: 28px; }
#boards.scoring .boardcols { display: none; }
#boards.scoring .scoringcols { display: grid; }
.scoringcols .col-name { font-size: 42px; }
.sc-big { margin-top: 56px; font-size: 76px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.sc-big.num { font-size: 176px; letter-spacing: -0.05em; }
.sc-small { margin-top: 18px; font-size: 32px; font-weight: 650; color: var(--dim); }
.sp-empty { align-self: center; font-size: 46px; font-weight: 750; line-height: 1.2; }
.sp-empty small { display: block; margin-top: 18px; font-size: 32px; color: var(--dim); font-weight: 600; }

/* ---------------------------------------------------------------- slates */
#slate { flex-direction: column; justify-content: center; padding: 0 140px; }
.slate-mark { position: absolute; left: 140px; top: 96px; height: 56px; }
.slate-kicker { color: var(--dim); font-size: 28px; }
.slate-title { font-size: 168px; font-weight: 800; letter-spacing: -0.045em; line-height: 0.92; margin-top: 26px; }
.slate-title { white-space: nowrap; }
.slate-lines { margin-top: 34px; max-width: 1500px; }
.slate-line { font-size: 44px; font-weight: 650; color: var(--dim); line-height: 1.25; }
.slate-line + .slate-line { margin-top: 12px; }
.slate-list { margin-top: 10px; }
.slate-list.grid16 { display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: column; grid-template-rows: repeat(8, auto); column-gap: 64px; }
.sl-row { display: flex; gap: 22px; align-items: baseline; padding: 10px 0; border-bottom: 2px solid var(--rule); font-size: 40px; font-weight: 750; white-space: nowrap; overflow: hidden; }
.grid16 .sl-row { font-size: 42px; padding: 9px 0; }
.sl-row .a { color: var(--dim); min-width: 64px; flex: none; }
.sl-row .b { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sl-row .b.dim { color: var(--dim); font-weight: 650; }
.slate-list:not(.grid16) .sl-row { font-size: 56px; padding: 18px 0; }
.slate-list:not(.grid16) .sl-row .a { min-width: 620px; }
#frame[data-slate="sixteen"] .slate-mark, #frame[data-slate="winners"] .slate-mark { display: none; }
.slate-clock { position: absolute; right: 140px; bottom: 96px; text-align: right; }
.slate-clock .clock-label { color: var(--dim); font-size: 26px; }
.slate-clock .clock-value { font-size: 104px; margin-top: 12px; }
.slate-clock .clock-sub { font-size: 28px; margin-top: 12px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes tickIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* a phone (show.js fit): the match fills the width; the rail and the ticker would be unreadable at that scale */
body.narrow #rail, body.narrow #band { display: none; }
