/* Chalkline broadcast identity (draft 1): our own system, no league or club marks. */
:root {
  --night: #0b0f13;      /* page ground */
  --panel: #141a21;      /* panels, bars */
  --raised: #1b232c;     /* cards, inputs */
  --line: #29333e;       /* rules, tracks */
  --chalk: #edf1f5;      /* text; score bug cells */
  --soft: #c9d3dd;       /* body text on panels */
  --muted: #9aa8b6;      /* secondary text, 7.0:1 on panel */
  --mint: #6fdca0;       /* brand; verified; the run */
  --floodlight: #ffc24a; /* live now; cannot tell */
  --home: #5ab4ff;
  --away: #ff8a3d;
  --neutral: #6b7785;
  --grass: #10261a;
  --grass-2: #12301f;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: Barlow, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--night); color: var(--chalk); font: 15px/1.45 var(--body); }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--mint); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
a { color: var(--mint); }

.caps, .panel h2, .kicker, .chip, .badge, .feed .kind {
  font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
}

/* --- top bar ------------------------------------------------------------------- */
.bar {
  display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--panel); border-bottom: 2px solid var(--mint);
}
.brand { display: flex; align-items: center; gap: 10px; }
.mark * { fill: none; stroke: var(--mint); stroke-width: 2; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 24px; letter-spacing: .06em; }
.tag {
  font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); padding: 2px 8px;
}
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.field, .toggle { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
select, .ask input {
  background: var(--raised); border: 1px solid var(--line); padding: 8px 10px; max-width: 240px; font-size: 14px;
}
.seg { display: inline-flex; border: 1px solid var(--line); }
.seg button { background: transparent; border: 0; padding: 9px 13px; min-height: 40px; color: var(--muted); font-size: 14px; }
.seg button.on { background: var(--raised); color: var(--chalk); font-weight: 600; box-shadow: inset 0 -3px 0 var(--mint); }
.seg.dark { background: rgba(11, 15, 19, .88); }
.ghost-btn {
  background: transparent; border: 1px solid var(--line); padding: 8px 12px; min-height: 40px; font-size: 14px; color: var(--chalk);
}
.ghost-btn.dark { background: rgba(11, 15, 19, .88); }
.ghost-btn:hover, .seg button:hover { color: var(--chalk); border-color: var(--muted); }

/* --- layout -------------------------------------------------------------------- */
.layout {
  display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start;
  max-width: 1440px; margin: 0 auto; padding: 20px 24px;
}
.stage { flex: 999 1 720px; min-width: 0; display: flex; flex-direction: column; }
.side { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 600px) { .layout { padding: 12px 16px; } .bar { padding: 10px 16px; } }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 14px 16px; }
.panel h2 { margin: 0; font-size: 16px; color: var(--muted); }
.fine { color: var(--muted); font-size: 12px; margin: 4px 0 10px; }

/* --- pitch --------------------------------------------------------------------- */
.pitch-wrap { position: relative; border: 1px solid var(--line); overflow: hidden; }
.pitch-wrap.cam3d { background: linear-gradient(180deg, #06090c 0%, #121a22 30%, #0b0f13 100%); }
#pitch {
  width: 100%; display: block; transition: transform .5s ease;
  background: repeating-linear-gradient(90deg, var(--grass) 0 9.09%, var(--grass-2) 9.09% 18.18%);
}
.figures { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.figures .p { pointer-events: auto; }
#cam[aria-pressed="true"] { border-color: var(--mint); color: var(--mint); }
.lines * { fill: none; stroke: rgba(255, 255, 255, .5); stroke-width: .25; }
.p { transition: transform .35s linear; cursor: pointer; }
.scene .p { transition: transform .6s ease-in-out; }
.p circle { stroke: var(--night); stroke-width: .25; }
.p.home circle { fill: var(--home); }
.p.away circle { fill: var(--away); }
.p text {
  font: 700 1.6px var(--display); text-anchor: middle; dominant-baseline: central;
  fill: var(--night); pointer-events: none;
}
.p.focus circle { stroke: var(--chalk); stroke-width: .6; }
.p.runner circle { stroke: var(--mint); stroke-width: .6; }
.p.dim { opacity: .45; }
#ball { fill: #fff; stroke: var(--night); stroke-width: .2; transition: transform .35s linear; }
/* A new arrow fades in while the players glide (0.35 s), so it never arrives first. */
.tr-new { animation: tr-in .35s linear; }
@keyframes tr-in { from { opacity: 0; } }
.pass { stroke: rgba(255, 255, 255, .7); stroke-width: .35; stroke-dasharray: 1 .8; }
.pass.complete { stroke: var(--mint); stroke-width: .4; }
.tr { fill: none; stroke-width: .35; stroke-linecap: round; }
.tr.home { stroke: var(--home); }
.tr.away { stroke: var(--away); }
.tr.failed { stroke-dasharray: .9 .7; }
.tr.shot { stroke: var(--mint); stroke-width: .45; }
.tr-x { stroke-width: .35; }
.tr-won { fill: none; stroke-width: .35; }
.tr-from { stroke-width: .25; stroke-dasharray: .5 .4; }
.tr-label { font: 700 1.5px var(--display); fill: var(--mint); }
.ghost-dot { fill: none; stroke: var(--mint); stroke-width: .35; stroke-dasharray: .8 .6; }
.run-arrow { stroke: var(--mint); stroke-width: .5; fill: none; marker-end: url(#arrow); }
.target { fill: rgba(111, 220, 160, .18); stroke: var(--mint); stroke-width: .3; }

.bug {
  position: absolute; top: 12px; left: 12px; display: flex; align-items: stretch;
  font: 700 22px/1 var(--display); box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}
.bug > span { padding: 8px 12px; display: flex; align-items: center; gap: 8px; }
.bug .code { background: var(--chalk); color: var(--night); letter-spacing: .04em; }
.bug .code.home { border-left: 5px solid var(--home); }
.bug .code.away { border-right: 5px solid var(--away); }
.bug .score { background: var(--night); color: var(--chalk); font-variant-numeric: tabular-nums; padding: 8px 14px; }
.bug .score b { font-weight: 700; }
.bug .clock { background: var(--panel); color: var(--floodlight); font-variant-numeric: tabular-nums; }
.ring-track { fill: none; stroke: var(--line); stroke-width: 3; }
.ring { fill: none; stroke: var(--floodlight); stroke-width: 3; transition: stroke-dasharray .35s linear; }
@media (max-width: 600px) { .bug { font-size: 16px; top: 8px; left: 8px; } .bug > span { padding: 6px 8px; } }

.wp {
  position: absolute; top: 58px; left: 12px; width: 236px; background: rgba(11, 15, 19, .88);
  padding: 6px 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}
.wp-bar { display: flex; height: 6px; }
.wp-bar span { display: block; height: 100%; transition: width .35s linear; }
.wp-bar .h { background: var(--home); }
.wp-bar .d { background: var(--neutral); }
.wp-bar .a { background: var(--away); }
.wp-labels { display: flex; justify-content: space-between; margin-top: 4px; font: 600 12px var(--display); letter-spacing: .06em; color: var(--muted); font-variant-numeric: tabular-nums; }
.wp-labels span:first-child { color: var(--home); }
.wp-labels span:last-child { color: var(--away); }
@media (max-width: 600px) { .wp { top: 44px; left: 8px; width: 190px; padding: 4px 6px; } }
.scene-ctl { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.scene-ctl[hidden] { display: none; }
.chip { background: var(--mint); color: var(--night); font-size: 14px; padding: 4px 10px; }
@media (max-width: 600px) {
  .scene-ctl { position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px; background: var(--panel); }
}

/* --- lower third (the story on air) ------------------------------------------- */
.lower { display: flex; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-top: 0; }
.lower[hidden] { display: none; }
.kicker {
  background: var(--mint); color: var(--night); font-size: 15px; padding: 14px 24px 14px 16px; align-self: stretch;
  display: flex; align-items: center; clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
}
.kicker.goal { background: var(--chalk); }
.kicker.plain { background: var(--raised); color: var(--chalk); }
.lower-body { flex: 1 1 320px; min-width: 0; padding: 10px 16px; margin-left: 8px; border-left: 5px solid var(--neutral); }
.lower-body.home { border-left-color: var(--home); }
.lower-body.away { border-left-color: var(--away); }
.lower-name { font: 700 24px/1.1 var(--display); letter-spacing: .03em; text-transform: uppercase; }
.lower-name small { color: var(--muted); font-weight: 600; font-size: inherit; }
.lower-text { color: var(--soft); font-size: 15px; }
.meters { flex: 1 1 260px; padding: 10px 16px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.meters[hidden] { display: none; }
.meter { display: grid; grid-template-columns: 110px minmax(0, 1fr) 44px; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.meter b { color: var(--chalk); font-variant-numeric: tabular-nums; }
.track { height: 8px; background: var(--raised); }
.fill { height: 100%; transition: width .5s ease; }
.fill.with { background: var(--mint); }
.fill.without { background: var(--neutral); }
.meters .fine { margin: 2px 0 0; font-size: 11px; }

/* --- replay timeline ----------------------------------------------------------- */
.replay { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 14px; }
.play { width: 44px; height: 44px; border: 0; background: var(--floodlight); flex: none; display: grid; place-items: center; }
.play path { fill: var(--night); }
.timeline { position: relative; flex: 1 1 300px; min-width: 0; height: 52px; }
.tl-track, .tl-played { position: absolute; left: 0; top: 22px; height: 4px; }
.tl-track { right: 0; background: var(--line); }
.tl-played { width: 0; background: var(--floodlight); }
.tl-played::after {
  content: ""; position: absolute; right: -2px; top: -6px; width: 4px; height: 16px; background: var(--floodlight);
}
.tl-marks { position: absolute; inset: 0 0 12px; pointer-events: none; }
.tl-marks i { position: absolute; transform: translateX(-50%); display: block; }
.tl-marks .up { top: 6px; }
.tl-marks .down { top: 31px; }
.tl-marks .mid { top: 19px; }
.g-run { width: 9px; height: 9px; background: var(--mint); transform: translateX(-50%) rotate(45deg) !important; }
.g-goal { width: 11px; height: 11px; border: 2px solid var(--chalk); border-radius: 50%; }
.g-tick { width: 2px; height: 10px; background: var(--muted); }
.timeline input[type="range"] {
  position: absolute; left: 0; right: 0; top: 10px; width: 100%; height: 28px; margin: 0; opacity: 0; cursor: pointer;
}
.timeline input[type="range"]:focus-visible { opacity: .35; }
.tl-scale { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend > span { display: flex; gap: 6px; align-items: center; }
.legend i { display: inline-block; flex: none; }
.legend .g-run { transform: rotate(45deg) !important; width: 8px; height: 8px; }

.focus-card { background: var(--panel); border: 1px solid var(--line); border-top: 2px solid var(--chalk); padding: 12px 16px; margin-top: 14px; }
.focus-card .stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 8px 0; }
.focus-card .stats div { display: flex; flex-direction: column; }
.focus-card .stats b { font: 700 22px/1 var(--display); font-variant-numeric: tabular-nums; }
.focus-card .stats span { font-size: 11px; color: var(--muted); }

/* --- on-air feed --------------------------------------------------------------- */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.feed li { background: var(--raised); border-top: 3px solid var(--neutral); padding: 0; }
.feed li.home { border-top-color: var(--home); }
.feed li.away { border-top-color: var(--away); }
.feed li.sel { outline: 2px solid var(--mint); outline-offset: -2px; }
.feed li.fresh { animation: fresh 1.2s ease-out; }
@keyframes fresh { from { background: #234133; } to { background: var(--raised); } }
.feed button { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 9px 12px; cursor: pointer; font-size: 14px; color: var(--chalk); }
.feed button:focus-visible { outline: 3px solid var(--mint); outline-offset: -3px; }
.feed .kind { display: flex; justify-content: space-between; font-size: 13px; letter-spacing: .08em; color: var(--muted); }
.feed li.home .kind > span:first-child { color: var(--home); }
.feed li.away .kind > span:first-child { color: var(--away); }
.feed .empty { color: var(--muted); border: 1px dashed var(--line); padding: 9px 12px; background: transparent; }

/* --- desk ---------------------------------------------------------------------- */
.desk { display: flex; flex-direction: column; gap: 4px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.cols.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 600px) { .cols.two { grid-template-columns: minmax(0, 1fr); } }
.instant { border-left: 3px solid var(--line); padding-left: 12px; margin: 8px 0 12px; font-size: 14px; cursor: pointer; }
.instant small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }
.take { background: var(--raised); padding: 12px 14px; }
.take h3 { margin: 0 0 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font: 700 13px var(--display); letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; letter-spacing: .08em; padding: 3px 10px; }
.badge svg path { fill: none; stroke: currentColor; stroke-width: 2; }
.badge.verified { background: rgba(111, 220, 160, .14); color: var(--mint); }
.badge.retry { background: rgba(255, 194, 74, .14); color: var(--floodlight); }
.badge.evidence { background: rgba(154, 168, 182, .14); color: var(--muted); }
.take p { margin: 0; font-size: 15px; line-height: 1.6; }
.sentence { border-radius: 0; }
.sentence.claim { cursor: pointer; text-decoration: underline dotted var(--mint); text-underline-offset: 4px; }
.sentence.interpretation { color: var(--soft); font-style: italic; }
.sentence.sel { background: rgba(111, 220, 160, .16); }
.trace { list-style: none; margin: 10px 0 0; padding: 0; font-size: 11px; color: var(--muted); }
.trace li { margin: 2px 0; }
.writing { color: var(--muted); }
.writing .dots::after { content: "…"; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 33% { content: "."; } 66% { content: ".."; } }
.ask { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ask input { flex: 1 1 180px; min-width: 0; max-width: none; padding: 10px; }
.ask button:not(.ghost-btn) { background: var(--mint); color: var(--night); border: 0; padding: 10px 16px; font-weight: 700; font-size: 14px; }

/* --- model badge, full screen ---------------------------------------------------- */
.mode {
  font: 700 12px var(--display); letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 8px; border: 1px solid var(--line); color: var(--muted);
}
.mode.live { color: var(--mint); border-color: var(--mint); }
.stage:fullscreen { background: var(--night); padding: 24px; overflow: auto; justify-content: center; }

/* --- fact-check a line ------------------------------------------------------------ */
.check { display: flex; flex-direction: column; gap: 4px; }
.check-line { margin: 10px 0 6px; font-size: 15px; line-height: 1.7; }
.num { padding: 1px 4px; font-weight: 700; font-variant-numeric: tabular-nums; }
.num.supported, .num.found { background: rgba(111, 220, 160, .16); color: var(--mint); }
.num.wrong_stat { background: rgba(255, 194, 74, .16); color: var(--floodlight); }
.num.unsupported { background: rgba(255, 122, 122, .16); color: #ff7a7a; }
.badge.flagged { background: rgba(255, 122, 122, .14); color: #ff7a7a; }
.check-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.check-list li { background: var(--raised); padding: 8px 10px; border-left: 3px solid var(--line); }
.check-list li.supported, .check-list li.found { border-left-color: var(--mint); }
.check-list li.wrong_stat { border-left-color: var(--floodlight); }
.check-list li.unsupported { border-left-color: #ff7a7a; }
.check-list code { font: 11px var(--mono); color: var(--muted); word-break: break-all; }

/* --- evidence ------------------------------------------------------------------ */
.evidence { border-top: 2px solid var(--mint); font-size: 13px; }
.evidence table, .take table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.evidence td, .take td { padding: 7px 8px 7px 0; border-top: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.evidence td.v, .take td.v { font-weight: 700; font-variant-numeric: tabular-nums; width: 84px; overflow-wrap: normal; }
.evidence code, .take code { font: 11px var(--mono); color: var(--muted); word-break: break-all; }
.take .fine { margin-top: 0; }
.evidence .tool { margin-top: 12px; font-size: 12px; }
.evidence .tool b { color: var(--chalk); font-size: 13px; }
.evidence ul { margin: 2px 0 6px; padding-left: 18px; color: var(--muted); }
.evidence .cannot li { color: var(--floodlight); }

dialog { background: var(--panel); color: var(--chalk); border: 1px solid var(--line); border-top: 2px solid var(--mint); max-width: min(760px, 92vw); padding: 18px 22px; }
dialog::backdrop { background: rgba(0, 0, 0, .65); }
dialog h2 { font: 700 26px var(--display); letter-spacing: .04em; text-transform: uppercase; margin: 0 0 8px; }
dialog table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0; }
dialog td, dialog th { text-align: left; padding: 7px 6px; border-top: 1px solid var(--line); vertical-align: top; }
dialog th { color: var(--muted); font: 700 13px var(--display); letter-spacing: .08em; text-transform: uppercase; }
.foot { color: var(--muted); font-size: 12px; text-align: center; padding: 8px 16px 24px; }
