
/* Layout: dark scorer's-table bar over a cool paper floor; scoreboard numerals in condensed type, everything else quiet. */
:root {
  --bar: #151a24;
  --bar-fg: #eef1f6;
  --bar-chip: #252c3a;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #eceff4;
  --line: #d9dee7;
  --fg: #141922;
  --muted: #677081;
  --accent: #d96a22;
  --accent-fg: #ffffff;
  --accent-soft: #fbe9dc;
  --win: #18925a;
  --live: #d33a2f;
  --live-bg: #fde4e1;
  --warn: #8a5a00;
  --warn-bg: #fff0c9;
  --t1: #8a93a3;
  --t2: #1d2330;
  --made: #18925a;
  --miss: #d33a2f;
  --court: #f7efe3;
  --court-line: #b9a58a;
  --font-display: "Barlow Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --font-body: "Barlow", "Segoe UI", system-ui, sans-serif;
  --r: 8px;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 15px; line-height: 1.4; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bar); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, td, .tab { font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bar); color: var(--bar-fg);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 8px;
  display: flex; align-items: center; gap: 12px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 17px; line-height: .95; letter-spacing: .01em; background: none; border: 0; padding: 0; color: inherit; text-align: left; flex: none; }
.brand small { display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-top: 2px; }
.datechip { background: var(--bar-chip); border: 0; border-radius: 6px; padding: 7px 10px; font-family: var(--font-display); font-size: 13px; font-weight: 600; flex: none; color: var(--bar-fg); }
.ticker { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.ticker::-webkit-scrollbar { display: none; }
.tk { background: var(--bar-chip); border: 1px solid transparent; border-radius: 6px; padding: 4px 8px; display: grid; grid-template-columns: auto auto auto; column-gap: 7px; align-items: center; font-family: var(--font-display); font-size: 13px; line-height: 1.15; flex: none; color: var(--bar-fg); text-align: left; }
.tk.on { border-color: var(--accent); }
.tk .ab { font-weight: 600; opacity: .85; }
.tk .sc { font-weight: 700; text-align: right; }
.tk .st { grid-row: 1 / 3; grid-column: 3; font-size: 11px; opacity: .75; text-align: center; min-width: 30px; }
.tk .st.live { color: var(--live); opacity: 1; }

main { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 22px 60px; max-width: 1180px; margin: 0 auto; }

/* ---------- buttons ---------- */
.btn { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; font-weight: 500; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--fg); }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn.danger { color: var(--live); }
.btn.danger.armed { background: var(--live); border-color: var(--live); color: #fff; }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; font-size: 14px; font-weight: 500; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--fg); color: var(--bg); }
select.sel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 14px; }

/* ---------- home ---------- */
.dayhead { display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap; margin-bottom: 22px; }
.dayhead h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(26px, 4vw, 34px); margin: 0; line-height: 1; letter-spacing: .005em; }
.daynav { display: flex; gap: 6px; }
.spacer { flex: 1; }
.comp { font-family: var(--font-display); font-weight: 700; font-size: 20px; margin: 24px 0 10px; letter-spacing: .01em; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 22px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; display: grid; grid-template-columns: 1fr auto; align-items: center; text-align: left; width: 100%; color: inherit; }
.card:hover { border-color: var(--muted); }
.card .rows { display: grid; gap: 8px; }
.trow { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; column-gap: 12px; }
.trow .ab { font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 1; }
.trow .rec { font-size: 12px; color: var(--muted); }
.trow .sc { font-family: var(--font-display); font-weight: 700; font-size: 24px; min-width: 44px; text-align: right; padding-right: 14px; }
.trow.w .ab, .trow.w .sc { color: var(--win); }
.cstat { font-family: var(--font-display); font-size: 13px; color: var(--muted); font-weight: 600; text-align: right; min-width: 48px; }
.cstat.live { color: var(--live); }
.badge { --tc: #555; width: 34px; height: 34px; border-radius: 50%; background: var(--tc); color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: .02em; flex: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
.badge.lg { width: clamp(56px, 11vw, 96px); height: clamp(56px, 11vw, 96px); font-size: clamp(16px, 3vw, 26px); }
.badge.sm { width: 24px; height: 24px; font-size: 9px; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 28px 24px; color: var(--muted); max-width: 640px; }
.empty h2 { color: var(--fg); font-family: var(--font-display); font-size: 22px; margin: 0 0 6px; }
.empty p { margin: 0 0 14px; }
.empty .row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- game header ---------- */
.ghead { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px 16px; max-width: 760px; margin: 0 auto; }
.gside { display: grid; justify-items: center; gap: 10px; text-align: center; }
.gside .rec { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.gside .meta { font-size: 12px; color: var(--muted); line-height: 1.35; }
.gmid { display: grid; grid-template-columns: auto auto auto; column-gap: clamp(14px, 4vw, 40px); row-gap: 4px; align-items: center; justify-items: center; }
.gmid .ab { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 6vw, 46px); line-height: 1; }
.gmid .big { font-family: var(--font-display); font-weight: 600; font-size: clamp(34px, 7vw, 52px); line-height: 1.05; }
.gmid .big.w { color: var(--win); }
.gmid .vs { font-family: var(--font-display); font-weight: 700; font-size: clamp(22px, 4vw, 32px); }
.gmid .k { font-family: var(--font-display); font-size: 17px; color: var(--muted); letter-spacing: .04em; }
.gmid .v { font-family: var(--font-display); font-size: 20px; }
.gstatus { text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 20px; margin: 14px 0 4px; }
.gstatus.live { color: var(--live); }
.gstatus.live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--live); margin-right: 7px; vertical-align: 3px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .gstatus.live::before { animation: none; } }
.gsub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.gcontrols { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 26px; }

/* ---------- stat sections ---------- */
.sect { margin: 0 auto 34px; max-width: 980px; }
.sect > h2 { font-family: var(--font-display); font-weight: 700; font-size: 24px; text-align: center; margin: 0 0 10px; letter-spacing: .01em; }
.sect > .note { text-align: center; color: var(--muted); font-size: 12px; margin: -6px 0 12px; }
.factors { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 26px; max-width: 760px; margin: 0 auto; }
.fac h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 16px; font-weight: 600; text-align: center; letter-spacing: .03em; }
.frow { display: grid; grid-template-columns: 38px 1fr 46px; align-items: center; gap: 8px; height: 26px; }
.frow .ab { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.frow .val { font-family: var(--font-display); font-size: 15px; text-align: right; line-height: 1; }
.frow .val small { display: block; font-size: 11px; color: var(--muted); }
.track-bar { height: 14px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.track-bar i { display: block; height: 100%; background: var(--t1); border-radius: 2px; }
.frow.a .track-bar i { background: var(--t2); }

.mini { margin: 0 auto; border-collapse: collapse; font-family: var(--font-display); font-size: 16px; }
.mini th { font-weight: 600; padding: 3px 12px; text-align: center; }
.mini td { padding: 3px 12px; text-align: center; }
.mini td:first-child, .mini th:first-child { text-align: left; font-weight: 600; }
.mini thead th { border-bottom: 1px solid var(--line); }

.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.box { border-collapse: collapse; width: 100%; font-size: 13.5px; white-space: nowrap; }
.box caption { text-align: left; padding: 10px 12px 6px; font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.box th { font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--muted); letter-spacing: .03em; padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); background: var(--surface); }
.box td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--surface-2); }
.box th:first-child, .box td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 168px; border-right: 1px solid var(--surface-2); }
.box tr.tot td { font-weight: 700; background: var(--surface-2); }
.box tr.tot td:first-child { background: var(--surface-2); }
.box .jn { display: inline-block; width: 24px; color: var(--muted); font-family: var(--font-display); font-weight: 600; }
.box .st { font-weight: 600; }
.box .pos { color: var(--muted); font-size: 11px; margin-left: 3px; }
.box .pos-g { color: var(--win); }
.box .neg { color: var(--live); }
.box .dim { color: var(--muted); }
.dnp { padding: 8px 12px; color: var(--muted); font-size: 12.5px; }
.boxes { display: grid; gap: 22px; }

.split2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px 40px; max-width: 760px; margin: 0 auto; }
.refs { display: flex; justify-content: center; gap: 10px 26px; flex-wrap: wrap; margin-bottom: 12px; }
.ref { display: grid; justify-items: center; font-size: 14px; }
.ref b { font-family: var(--font-display); font-size: 22px; line-height: 1; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; max-width: 760px; margin: 0 auto; }
.chart h3 { font-family: var(--font-display); font-size: 17px; margin: 0 0 6px; text-align: center; font-weight: 600; }
.court { width: 100%; max-width: 100%; display: block; }
.court .fl { fill: var(--court); }
.court .ln { fill: none; stroke: var(--court-line); stroke-width: 2.5; }
.court .mk { fill: var(--made); stroke: var(--surface); stroke-width: 1.5; }
.court .ms { fill: none; stroke: var(--miss); stroke-width: 3; }
.court .pend { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.legend { display: flex; justify-content: center; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* minutes */
.mins td.strip { width: 46%; min-width: 220px; }
.strip svg { display: block; width: 100%; height: 14px; }
.strip .bg { fill: var(--surface-2); }
.strip .on { fill: var(--t2); }
.strip .pd { stroke: var(--bg); stroke-width: 2; }

/* play-by-play */
.pbp { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.pbp h3 { margin: 0; padding: 8px 14px; font-family: var(--font-display); font-size: 16px; background: var(--surface-2); letter-spacing: .03em; }
.pe { display: grid; grid-template-columns: 52px 34px 1fr auto auto; gap: 10px; align-items: center; padding: 7px 14px; border-top: 1px solid var(--surface-2); font-size: 14px; }
.pe .ck { font-family: var(--font-display); color: var(--muted); font-size: 14px; }
.pe .ds { min-width: 0; }
.pe .ds .tag { display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: 5px; }
.pe .sc { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.pe.score .ds { font-weight: 600; }
.pe .x { background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 4px; }
.pe .x:hover { color: var(--live); background: var(--surface-2); }

/* ---------- modal & toast ---------- */
#toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 8px; font-size: 14px; max-width: calc(100% - 32px); }

@media (max-width: 560px) {
  .ghead { grid-template-columns: 1fr; }
  .gside { display: none; }
  .pe { grid-template-columns: 44px 26px 1fr auto auto; gap: 8px; padding: 7px 10px; }
  .bar { gap: 8px; }
}

@media (max-width: 560px) {
  .mini th, .mini td { padding: 3px 6px; }
  .mini { font-size: 15px; max-width: 100%; }
  .sect > .note { padding: 0 2px; }
}

main { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }

/* ---------- date picker ---------- */
.dayhead h1 { margin: 0; }
.h1btn { font: inherit; letter-spacing: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; border-bottom: 2px dotted var(--muted); }
.h1btn:hover { border-bottom-color: var(--accent); }
.datepick { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 14px; color: var(--fg); min-height: 30px; }

/* ---------- kills, runs, foul trouble ---------- */
.sel.sm { padding: 2px 6px; font-size: 13px; margin: 0 4px; }
.runbests { display: flex; justify-content: center; gap: 8px 28px; flex-wrap: wrap; margin-bottom: 12px; font-family: var(--font-display); font-size: 17px; }
.runbests b { font-size: 20px; }
.sect .scroll.ins { max-width: 760px; margin: 12px auto 0; }
.sect .boxes .scroll.ins { margin: 0; max-width: none; }
.sect .scroll.ins .box th:first-child, .sect .scroll.ins .box td:first-child { min-width: 0; }
.boxes .scroll.ins .box th:first-child, .boxes .scroll.ins .box td:first-child { min-width: 168px; }
.pips { display: inline-flex; gap: 4px; vertical-align: middle; }
.pips i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: block; }
.pips i.on { background: var(--fg); border-color: var(--fg); }
.pips i.on.trouble { background: var(--warn); border-color: var(--warn); }
.pips i.on.danger, .pips i.on.out { background: var(--live); border-color: var(--live); }
.pill { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.pill.trouble { background: var(--warn-bg); color: var(--warn); }
.pill.danger, .pill.out { background: var(--live-bg); color: var(--live); }
.mini td.bonus { color: var(--live); font-weight: 700; }

.runctl { display: flex; justify-content: center; align-items: center; gap: 4px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.boxes .scroll.ins .box.kt th:first-child, .boxes .scroll.ins .box.kt td:first-child { min-width: 0; width: 1%; position: static; }
.box.kt th, .box.kt td { text-align: left; }
.box.kt td:first-child .tag { margin-left: 4px; }

.trow .tn { min-width: 0; }
.trow .nm { font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .rk { display: inline-block; min-width: 22px; margin-right: 6px; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600; text-align: center; vertical-align: 2px; }
.trow.w .nm { color: var(--win); }

.tk .rk { font-style: normal; font-size: 10px; font-weight: 700; margin-right: 3px; padding: 0 3px; border-radius: 3px; background: rgba(255,255,255,.16); vertical-align: 1px; }

.frow.usc .track-bar i { background: #990000; }
table.cl { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 10px; }
table.cl th { font-family: var(--font-display); font-weight: 600; font-size: 12px; color: var(--muted); letter-spacing: .03em; padding: 2px 6px; text-align: left; border-bottom: 1px solid var(--line); }
table.cl td { padding: 2px 6px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--surface-2); line-height: 1.25; }
table.cl td.q { color: var(--muted); font-family: var(--font-display); font-weight: 600; width: 1%; }
table.cl tr.newq td { border-top: 1px solid var(--line); }
table.cl .tm { font-family: var(--font-display); font-weight: 700; font-size: 14px; }
