/* NBA Game Analyzer HUD: tokens, stage, score bug, rails and cards.
   Court styles live in court.css; scrubber, controls, modes and motion in bottom.css.
   Fixed 1920x1080 stage scaled to the viewport; stacked flow layout below 1024px. */

:root {
  --frame: #0B0D11;
  --panel: #14181E;
  --panel-2: #1B2027;
  --panel-3: #232932;
  --line: #2A313B;
  --line-2: #3A424E;
  --ink: #F3F4F6;
  --ink-2: #B7BEC8;
  --ink-3: #8A93A0;
  --court: #171B21;
  --court-paint: #1E232B;
  --court-line: #4E5868;
  --good: #45C49C;
  --warn: #E8C24A;
  --serious: #F0705C;
  --critical: #D43A8E;
  --home: #F3F4F6;
  --away: #8A93A0;
  --radius: 5px;
  --radius-lg: 8px;
  --font: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-cond: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--frame);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }

.viewport { position: relative; margin: 0 auto; overflow: hidden; }

.stage {
  position: relative;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
  display: grid;
  grid-template-columns: 376px minmax(0, 1fr) 376px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px 14px;
  padding: 16px;
  background: var(--frame);
}

.k {
  font-size: 10px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.num { font-variant-numeric: tabular-nums lining-nums; }

.status { position: absolute; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center; padding: 24px; text-align: center; font-size: 16px; color: var(--ink-2); background: var(--frame); }
.status.show { display: flex; }

/* Concept panel: what this is, over the stage on a first visit */

.about { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 28px; background: rgba(6, 8, 11, 0.86); }
.about[hidden] { display: none; }
.about-panel { width: min(760px, 100%); max-height: 100%; overflow-y: auto; padding: 30px 34px 26px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55); }
.about-eyebrow { margin: 0 0 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.about-title { margin: 0 0 10px; font-family: var(--font-cond); font-size: 31px; font-weight: 700; font-stretch: 78%; line-height: 1.05; letter-spacing: -0.01em; text-wrap: balance; color: var(--ink); }
.about-lede { margin: 0 0 22px; max-width: 60ch; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.about-list { display: flex; flex-direction: column; gap: 15px; margin: 0; padding: 0 0 22px; list-style: none; border-bottom: 1px solid var(--line); }
.about-item { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; }
.about-num { font-family: var(--font-cond); font-size: 13px; font-weight: 700; font-stretch: 78%; line-height: 1.35; color: var(--ink-3); }
.about-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.about-item-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 9px; margin: 0; }
.about-item-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.about-tag { flex: none; padding: 2px 7px; border-radius: 9px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.about-tag-live { background: rgba(69, 196, 156, 0.14); color: var(--good); }
.about-tag-next { background: var(--panel-3); color: var(--ink-3); }
.about-item-text { margin: 0; max-width: 66ch; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.about-section-label { margin: 0 0 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.about-market { padding: 20px 0 0; }
.about-lanes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.about-lane { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 14px 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.about-lane-name { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.03em; color: var(--ink); }
.about-stats { display: flex; flex-direction: column; gap: 9px; margin: 0; }
.about-stat { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.about-stat-value { font-family: var(--font-cond); font-size: 19px; font-weight: 700; font-stretch: 72%; line-height: 1.1; color: var(--ink); }
.about-stat-text { margin: 0; font-size: 12px; line-height: 1.45; color: var(--ink-2); }
.about-sources { margin: 12px 0 0; font-size: 10px; line-height: 1.45; color: var(--ink-3); }

.about-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.about-start { height: 36px; padding: 0 18px; background: var(--ink); border-color: var(--ink); color: var(--frame); font-size: 13px; }
.about-start:hover { background: #fff; border-color: #fff; }
.about-uses { margin: 0; flex: 1 1 320px; min-width: 0; font-size: 11px; line-height: 1.45; color: var(--ink-3); }

html.overlay .about { display: none; }
html.stacked .about { position: fixed; padding: 16px; }
html.stacked .about-panel { padding: 22px 20px 20px; }
html.stacked .about-title { font-size: 26px; }
html.stacked .about-lanes { grid-template-columns: minmax(0, 1fr); }

/* Top: score bug and win probability strip */

.top { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }

.bug {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  height: 66px;
  padding: 0 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.bug-team { display: flex; align-items: center; gap: 14px; height: 100%; min-width: 0; }
.bug-home { flex-direction: row-reverse; }
.bug-bar { width: 6px; height: 34px; border-radius: 2px; background: var(--away); flex: none; }
.bug-home .bug-bar { background: var(--home); }
.bug-id { display: flex; flex-direction: column; gap: 3px; }
.bug-home .bug-id { align-items: flex-end; }
.bug-tri { font-family: var(--font-cond); font-stretch: 75%; font-weight: 800; font-size: 30px; line-height: 1; letter-spacing: 0.02em; }
.bug-name { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.bug-score {
  display: inline-block;
  margin-left: auto;
  min-width: 2.2ch;
  text-align: center;
  font-family: var(--font-cond);
  font-stretch: 68%;
  font-weight: 800;
  font-size: 48px;
  line-height: 1;
  color: var(--ink-2);
}
.bug-home .bug-score { margin-left: 0; margin-right: auto; }
.bug-team.leading .bug-score { color: var(--ink); }
.bug-meta { display: flex; flex-direction: column; gap: 3px; min-width: 64px; }
.bug-home .bug-meta { align-items: flex-end; text-align: right; }
.bug-fouls { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.bug-meta-row { display: flex; gap: 8px; }
.bug-home .bug-meta-row { flex-direction: row-reverse; }
.bug-bonus { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--warn); }
.bug-bonus:empty { display: none; }
.bug-run { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.bug-run:empty { display: none; }

.bug-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 260px; }
.bug-time { display: flex; align-items: baseline; gap: 10px; }
.bug-period { font-size: 15px; font-weight: 700; letter-spacing: 0.06em; color: var(--ink-2); }
.bug-clock { display: inline-block; min-width: 4.4ch; text-align: center; font-family: var(--font-cond); font-stretch: 75%; font-weight: 700; font-size: 34px; line-height: 1; }
.bug-series { display: flex; gap: 8px; font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.bug-series b { color: var(--ink-2); font-weight: 700; }

.wp { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 12px; height: 22px; padding: 0 6px; }
.wp-label { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.wp-team { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.wp-tri { font-weight: 700; color: var(--ink-2); }
.wp-pct { display: inline-block; min-width: 3.2ch; font-family: var(--font-cond); font-stretch: 75%; font-weight: 700; font-size: 16px; }
.wp-pct-away { text-align: right; }
.wp-track { position: relative; height: 10px; border-radius: 5px; background: var(--panel-2); overflow: hidden; }
.wp-fill { position: absolute; top: 0; bottom: 0; width: 50%; transition: width 420ms var(--ease); }
.wp-fill-away { left: 0; background: var(--away); }
.wp-fill-home { right: 0; background: var(--home); }
.wp-split { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--frame); transition: left 420ms var(--ease); }
.wp[data-state="none"] .wp-fill { opacity: 0.18; }
.wp[data-state="none"] .wp-split { opacity: 0; }

/* Rails */

.rail { display: flex; flex-direction: column; gap: 8px; min-height: 0; min-width: 0; grid-row: 2; }
.rail-away { grid-column: 1; }
.center { grid-column: 2; grid-row: 2; }
.rail-home { grid-column: 3; }
.rail-head { display: flex; align-items: center; gap: 8px; height: 22px; padding: 0 4px; flex: none; }
.rail-bar { width: 4px; height: 16px; border-radius: 2px; background: var(--away); }
.rail-home .rail-bar { background: var(--home); }
.rail-tri { font-family: var(--font-cond); font-stretch: 75%; font-weight: 800; font-size: 18px; line-height: 1; }
.rail-name { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.rail-head .k { margin-left: auto; }

.cards { display: flex; flex-direction: column; gap: 5px; }

.card {
  display: grid;
  gap: 4px;
  padding: 7px 12px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--away);
  border-radius: var(--radius-lg);
}
.rail-home .card { border-left: 1px solid var(--line); border-right: 3px solid var(--home); }

.card-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; line-height: 1; height: 22px; }
.card-jersey { min-width: 2ch; text-align: right; font-family: var(--font-cond); font-stretch: 75%; font-weight: 700; font-size: 14px; color: var(--ink-3); }
.card-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-cond); font-stretch: 75%; font-weight: 800; font-size: 22px; line-height: 1; letter-spacing: 0.01em; text-transform: uppercase; }
.card-pos { font-size: 11px; color: var(--ink-3); }
.card-min { margin-left: auto; font-size: 13px; line-height: 1; color: var(--ink-2); }

.card-stats { display: grid; grid-template-columns: 1fr 1fr 1fr 1.25fr 1.15fr; gap: 6px; }
.stat { display: flex; flex-direction: column; gap: 3px; line-height: 1; }
.stat .v { display: inline-block; font-family: var(--font-cond); font-stretch: 75%; font-weight: 700; font-size: 19px; line-height: 1; }

.card-turbo { display: flex; align-items: center; gap: 8px; height: 12px; line-height: 1; }
.card-turbo .k { width: 40px; }
.turbo { display: flex; flex: 1; gap: 3px; height: 9px; }
.turbo-cell { flex: 1; border-radius: 2px; background: var(--panel-3); transition: background-color 320ms var(--ease); }
.turbo-cell.on { background: var(--ink-2); }
.turbo[data-band="mid"] .turbo-cell.on { background: var(--warn); }
.turbo[data-band="low"] .turbo-cell.on { background: var(--serious); }
.turbo-value { min-width: 3ch; text-align: right; font-size: 12px; color: var(--ink-2); }

.card-pills { display: flex; align-items: center; gap: 6px; }

.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  cursor: default;
  white-space: nowrap;
}
.pill:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); transition: background-color 320ms var(--ease); }
.pill-label { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.pill-tier { font-weight: 700; }
.pill-score { color: var(--ink-2); }
.pill[data-tier="Low"] .pill-dot { background: var(--good); }
.pill[data-tier="Moderate"] .pill-dot { background: var(--warn); }
.pill[data-tier="Elevated"] .pill-dot { background: var(--serious); }
.pill[data-tier="High"] .pill-dot { background: var(--critical); }
.pill[data-tier="Low"] { background: color-mix(in srgb, var(--good) 12%, var(--panel-2)); border-color: color-mix(in srgb, var(--good) 30%, var(--line)); }
.pill[data-tier="Moderate"] { background: color-mix(in srgb, var(--warn) 12%, var(--panel-2)); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.pill[data-tier="Elevated"] { background: color-mix(in srgb, var(--serious) 14%, var(--panel-2)); border-color: color-mix(in srgb, var(--serious) 34%, var(--line)); }
.pill[data-tier="High"] { background: color-mix(in srgb, var(--critical) 16%, var(--panel-2)); border-color: color-mix(in srgb, var(--critical) 36%, var(--line)); }

.tip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 6;
  min-width: 230px;
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--panel-3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 140ms var(--ease), transform 140ms var(--ease), visibility 0s 140ms;
}
.pill:hover .tip, .pill:focus-visible .tip { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.rail-home .tip { left: auto; right: 0; }
.tip-title { margin-bottom: 4px; font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.tip-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.tip-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--ink); }
.tip-list li b { color: var(--ink-2); }
.tip-empty { color: var(--ink-3); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border: 1px solid var(--line); border-radius: 11px; font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.chip-label { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.chip[data-form="hot"] { background: var(--ink); border-color: var(--ink); color: var(--frame); }
.chip[data-form="hot"] .chip-label { color: var(--frame); }
.chip[data-form="cold"] { border-style: dashed; color: var(--ink-3); }

.bench { display: flex; align-items: flex-start; gap: 8px; margin-top: auto; padding: 7px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); flex: none; }
.bench > .k { width: 40px; padding-top: 2px; }
.bench-list { list-style: none; margin: 0; padding: 0; flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 1px 12px; min-width: 0; max-height: 68px; overflow: hidden; }
.bench-list li { display: flex; align-items: baseline; gap: 5px; min-width: 0; font-size: 12px; line-height: 16px; white-space: nowrap; }
.bench-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-cond); font-stretch: 75%; font-weight: 700; font-size: 13px; text-transform: uppercase; }
.bench-list .k { font-size: 9px; }
.bench-min { color: var(--ink-3); }
