/* v3 layout: 1920x1080 canvas, plain CSS (Chromium 114 baseline: grid, :not() lists, container query units). */

@font-face { font-family: "Barlow Condensed"; font-weight: 500; src: url("fonts/barlow-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; src: url("fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; src: url("fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; src: url("fonts/barlow-condensed-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; src: url("fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }

:root {
  --bg: #0b0f14;
  --line: #232c36;      /* box outlines */
  --ink: #ffffff;
  --text: #e8edf2;      /* names */
  --dim: #7c8a98;       /* labels */
  --out: #5b6670;       /* fouled out */
  --yellow: #f6c21c;    /* exclusions 1 and 2, shot clock */
  --red: #ef3b36;       /* exclusion 3 */
  /* team colours: replaced from the team panel via data-var on .board */
  --home: #2f7de1;
  --home-ink: #ffffff;
  --away: #f07c2a;
  --away-ink: #000000;
  --roster: 420px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; background: var(--bg); }
body { color: var(--ink); font-family: "Barlow Condensed", "Arial Narrow", sans-serif; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
ol { list-style: none; }
.lbl {
  font-family: "Barlow Semi Condensed", "Barlow Condensed", sans-serif;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.board {
  position: relative;
  display: grid;
  grid-template-columns: var(--roster) minmax(0, 1fr) var(--roster);
  background: var(--bg);
  overflow: hidden;
}

/* ---------- rosters (full height, both edges) ---------- */
.roster { padding: 28px 20px; min-height: 0; }
.roster.home { border-left: 8px solid var(--home); padding-left: 24px; }
.roster.away { border-right: 8px solid var(--away); padding-right: 24px; }
.roster[data-visible="false"] { visibility: hidden; }
.roster ol { height: 100%; display: flex; flex-direction: column; justify-content: space-between; }
.player {
  flex: 1 1 0;
  max-height: 72px;
  min-height: 0;
  container-type: size;      /* rows shrink when the roster is long; text follows via cqh */
  display: flex;
  align-items: center;
  gap: 16px;
}
.roster.away .player { flex-direction: row-reverse; }
.cap {
  flex: none;
  width: 72px;
  height: 80cqh;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 62cqh;
  font-weight: 800;
  line-height: 1;
}
.home .cap { background: var(--home); color: var(--home-ink); }
.away .cap { background: var(--away); color: var(--away-ink); }
.name {
  min-width: 0;
  font-size: 46cqh;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.roster.away .name { text-align: right; }

/* exclusion dots: yellow, yellow, red from left to right on both sides; hollow until filled */
.dots { flex: none; display: flex; gap: 8px; }
.dots i { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--yellow); opacity: 0.55; }
.dots i:nth-child(3) { border-color: var(--red); }
.player[data-exclusions="1"] .dots i:nth-child(1),
.player[data-exclusions="2"] .dots i:nth-child(-n+2),
.player[data-exclusions="3"] .dots i { background: var(--yellow); opacity: 1; }
.player[data-exclusions="3"] .dots i:nth-child(3) { background: var(--red); }

/* serving an exclusion now: inverted cap with a yellow ring (reads on any team colour) */
.player[data-excluded="true"] .cap { background: var(--ink); color: #000; box-shadow: 0 0 0 3px var(--yellow); }
/* fouled out: grey cap and name */
.player[data-fouled-out="true"] .cap { background: #232a32; color: var(--out); box-shadow: none; }
.player[data-fouled-out="true"] .name { color: var(--out); }

/* ---------- middle ---------- */
.middle {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 250px;
  column-gap: 20px;
  padding: 36px 24px;
  min-width: 0;
  min-height: 0;
}

/* team panels: logo, score, exclusions */
.team { display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 0; }
.logo-slot { width: 200px; height: 200px; flex: none; display: flex; align-items: center; justify-content: center; }
.logo { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo:not([src]), .logo[data-empty="true"] { display: none; }
.logo-fallback {
  display: none;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  align-items: center;
  justify-content: center;
  padding: 14px;
  font-size: 46px;          /* fits a 10-character short name over two lines */
  font-weight: 800;
  line-height: 1;
  text-align: center;
  overflow-wrap: anywhere;
  overflow: hidden;
}
.home .logo-fallback { background: var(--home); color: var(--home-ink); }
.away .logo-fallback { background: var(--away); color: var(--away-ink); }
.logo[data-empty="true"] + .logo-fallback, .logo:not([src]) + .logo-fallback { display: flex; }
.score { font-size: 220px; font-weight: 800; line-height: 0.95; }

.excl {
  align-self: stretch;
  flex: 1;
  min-height: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.excl .lbl { font-size: 20px; }
.team.away .excl .lbl { text-align: right; }
.excl ol { display: flex; flex-direction: column; gap: 10px; }
.excl li { display: flex; align-items: center; justify-content: space-between; }
.team.away .excl li { flex-direction: row-reverse; }
.excl-cap { width: 60px; height: 46px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 800; }
.home .excl-cap { background: var(--home); color: var(--home-ink); }
.away .excl-cap { background: var(--away); color: var(--away-ink); }
.excl-clock { font-size: 52px; font-weight: 700; line-height: 1; }
.excl li:nth-child(n+5) { display: none; }  /* template + the three ending soonest */
body[data-display-layer-exclusions="false"] .excl ol { visibility: hidden; }

/* centre stack: phase, game clock, timeouts, shot */
.centre { position: relative; display: flex; flex-direction: column; min-width: 0; }

.phase { height: 120px; display: flex; align-items: center; justify-content: center; gap: 18px; }
.phase-text { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.ph { display: none; font-size: 72px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
.to-clock { display: none; font-size: 36px; font-weight: 700; margin-top: 4px; }
.arrow { display: none; width: 56px; height: 56px; flex: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.arrow.home { fill: var(--home); }
.arrow.away { fill: var(--away); }

/* which label shows, highest priority first: final, timeout, halftime/break, period (or OT) */
body[data-game-final="true"] .ph-final { display: inline; }
body:not([data-game-final="true"])[data-game-timeout-active="true"] .ph-timeout,
body:not([data-game-final="true"])[data-game-timeout-active="true"] .to-clock { display: inline; }
body:not([data-game-final="true"])[data-game-timeout-active="true"][data-game-timeout-side="home"] .arrow.home,
body:not([data-game-final="true"])[data-game-timeout-active="true"][data-game-timeout-side="away"] .arrow.away { display: block; }
body:not([data-game-final="true"]):not([data-game-timeout-active="true"])[data-game-break-active="true"][data-game-period="2"] .ph-half,
body:not([data-game-final="true"]):not([data-game-timeout-active="true"])[data-game-break-active="true"]:not([data-game-period="2"]) .ph-break { display: inline; }
body:not([data-game-final="true"]):not([data-game-timeout-active="true"]):not([data-game-break-active="true"]):not([data-game-overtime="true"]) .ph-period,
body:not([data-game-final="true"]):not([data-game-timeout-active="true"]):not([data-game-break-active="true"])[data-game-overtime="true"] .ph-ot { display: inline; }

.game-clock { text-align: center; font-size: 210px; font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.break-clock { display: none; color: #9fb3c8; }
body[data-game-break-active="true"]:not([data-game-final="true"]) .game-clock .clock { display: none; }
body[data-game-break-active="true"]:not([data-game-final="true"]) .game-clock .break-clock { display: inline; }
body[data-game-final="true"] .game-clock .clock { color: #9fb3c8; }

.timeouts { margin-top: 16px; display: flex; justify-content: space-between; }
.to { border: 3px solid transparent; border-radius: 10px; padding: 4px 12px; display: flex; flex-direction: column; line-height: 1; }
.to.away { align-items: flex-end; }
.to .lbl { font-size: 16px; }
.to b { font-size: 54px; font-weight: 800; }
body[data-game-timeout-active="true"][data-game-timeout-side="home"] .to.home { border-color: var(--home); }
body[data-game-timeout-active="true"][data-game-timeout-side="away"] .to.away { border-color: var(--away); }

.shot { margin-top: 12px; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.shot-clock { font-size: 150px; font-weight: 800; color: var(--yellow); min-height: 150px; }
.shot .lbl { font-size: 22px; margin-top: 6px; }
body[data-game-break-active="true"] .shot-clock,
body[data-game-final="true"] .shot-clock { visibility: hidden; }

.signal { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-size: 26px; color: var(--yellow); display: none; }
body[data-sys-serial-stale="true"] .signal { display: block; }
body[data-sys-serial-stale="true"] .game-clock,
body[data-sys-serial-stale="true"] .shot-clock { opacity: 0.35; }

.reconnecting { position: absolute; right: 30px; top: 6px; font-size: 22px; color: var(--dim); display: none; }
body[data-connection="closed"][data-ready="true"] .reconnecting { display: block; }

body[data-bg="transparent"] .board { background: transparent; }
