/*
 * Scorebook Ledger theme.
 * The live screen is a fixed canvas; app.js scales the root font size to fit the window.
 * Wide (.lv.wide, 80 x 50 rem): Fire HD 10 at 1280x800 CSS px — our cards | their numbers | pad.
 * Compact (60 x 37.5 rem): Fire HD 8 at 960x600 and smaller iPads — cards | pad, footer below.
 * Keep it cheap: no blur, no transitions, no large shadows.
 */
:root {
  --paper: #F4F7F6;
  --card: #FFFFFF;
  --ink: #101820;
  --ink2: #4A5A60;
  --ledger: #1D5C55;
  --rule: #C7D5D1;
  --accent: #2340C8;
  --accent-soft: #E4E9FB;
  --warn: #D98E04;
  --warn-soft: #FDF1D8;
  --out: #C62828;
  --out-soft: #FBE3E3;
  --f-num: "Roboto Condensed", "sans-serif-condensed", "Avenir Next Condensed", "Bahnschrift SemiCondensed", Bahnschrift, "Arial Narrow", sans-serif;
  --f-body: Roboto, -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--f-body); line-height: 1.3;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
}
input, select, textarea { -webkit-user-select: text; user-select: text; }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  -webkit-appearance: none; appearance: none; border: 0; background: none; padding: 0;
  cursor: pointer; touch-action: manipulation; text-align: inherit;
}
button:disabled { cursor: default; opacity: 0.35; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.boot { padding: 2rem; color: var(--ink2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Launch animation (#splash in index.html) ---------- */
/* Transform and opacity only, so it stays smooth on the Fire tablets. */
#splash {
  position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 50; background: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.4rem;
  transition: opacity 0.5s ease;
}
#splash.done { opacity: 0; pointer-events: none; }
/* Timeline (about 4 s, then a 0.5 s fade): badge 0.1–1.1 s, tiger 0.5–1.5 s, ring 1.1–2.4 s,
   light sweep 1.7–2.6 s, name 2.0–2.8 s, then the full logo holds. app.js fades it at 4 s. */
.sp-mark { position: relative; width: 36vmin; height: 36vmin; max-width: 15rem; max-height: 15rem; }
.sp-mark:before { content: ""; position: absolute; left: -7%; top: -7%; right: -7%; bottom: -7%; border-radius: 50%; border: 3px solid #4E6AF7;
  opacity: 0; animation: sp-ring 1.3s ease-out 1.1s both; }
.sp-badge { position: relative; width: 100%; height: 100%; border-radius: 50%; background: #fff; overflow: hidden;
  box-shadow: 0 0 0 0.35rem rgba(35, 64, 200, 0.35); animation: sp-pop 1s cubic-bezier(0.2, 1.4, 0.4, 1) 0.1s both; }
.sp-badge img { position: absolute; left: 4%; top: 4%; width: 92%; height: 92%; animation: sp-tiger 1s cubic-bezier(0.2, 0.9, 0.3, 1) 0.5s both; }
.sp-badge:after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 60%; transform: translateX(-180%) skewX(-18deg);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0)); animation: sp-shine 0.9s ease-in-out 1.7s both; }
.sp-word { color: #fff; font-family: var(--f-num); font-weight: 700; font-size: 1.9rem; letter-spacing: 0.32em; padding-left: 0.32em; text-align: center; line-height: 1.1;
  animation: sp-word 0.8s ease-out 2s both; }
.sp-word small { display: block; font-size: 0.85rem; letter-spacing: 0.62em; padding-left: 0.62em; color: #9DB0FF; margin-top: 0.3rem; }
@keyframes sp-pop { 0% { transform: scale(0.2); opacity: 0; } 55% { transform: scale(1.07); opacity: 1; } 78% { transform: scale(0.97); } 100% { transform: scale(1); opacity: 1; } }
@keyframes sp-tiger { from { transform: scale(1.35); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes sp-ring { 0% { transform: scale(0.85); opacity: 0; } 30% { opacity: 0.9; } 100% { transform: scale(1.3); opacity: 0; } }
@keyframes sp-shine { from { transform: translateX(-180%) skewX(-18deg); } to { transform: translateX(260%) skewX(-18deg); } }
@keyframes sp-word { from { opacity: 0; transform: translateY(0.6rem); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .sp-mark:before, .sp-badge, .sp-badge img, .sp-badge:after, .sp-word { animation: none; }
  .sp-badge:after { display: none; }
}

/* ---------- Test mode: amber frame round the screen and a small bar at the bottom ---------- */
body.test-mode::after {
  content: ""; position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 40; pointer-events: none;
  box-shadow: inset 0 0 0 4px var(--warn);
}
#testbar {
  position: fixed; left: 50%; bottom: 0.35rem; z-index: 41; transform: translateX(-50%);
  display: flex; align-items: center; gap: 0.6rem; padding: 0.2rem 0.25rem 0.2rem 0.8rem; border-radius: 1rem;
  background: var(--warn); color: var(--ink); font-family: var(--f-num); font-weight: 700; font-size: 0.75rem; letter-spacing: 0.08em;
}
#testbar button { min-height: 1.8rem; padding: 0 0.8rem; border-radius: 0.9rem; background: var(--ink); color: #fff; font-weight: 700; letter-spacing: 0.04em; }

/* ---------- Sign-in screen (cloud sync) ---------- */
.gate {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.9rem;
  padding: 2rem; text-align: center; background: var(--ink); color: #fff;
}
.gate h1 { margin: 0.4rem 0 0; font-size: 1.6rem; }
.gate p { margin: 0; max-width: 28rem; color: #C9D6D4; }
.gate p b { color: #fff; }
.gate .btn { min-width: 16rem; }
.gate-msg { color: #FFD9A0 !important; font-size: 0.9rem; }

/* ---------- Shared bits ---------- */
.eyebrow {
  font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ledger); font-weight: 700;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 3rem; padding: 0 1.1rem; border-radius: 0.375rem;
  border: 2px solid var(--ink); background: var(--card); font-weight: 700; font-size: 0.95rem;
  text-align: center;
}
.btn:active { background: var(--accent-soft); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.pri:active { background: var(--ink); border-color: var(--ink); }
.btn.ghost { border-color: var(--rule); }
.btn.danger { border-color: var(--out); color: var(--out); }
.btn.danger.armed { background: var(--out); color: #fff; }
.btn.sm { min-height: 2.5rem; padding: 0 0.8rem; font-size: 0.85rem; }

/* Foul boxes: the scorebook's printed squares, slashed in pencil when used. */
.boxes { display: inline-flex; gap: 0.18rem; vertical-align: middle; }
.box {
  position: relative; width: 0.95rem; height: 0.95rem; border: 1.5px solid var(--ledger);
  background: var(--card); overflow: hidden;
}
.box.on::after {
  content: ""; position: absolute; left: -25%; top: 50%; width: 150%; height: 2.5px;
  margin-top: -1.25px; background: var(--ink); transform: rotate(-45deg);
}
.warn .box { border-color: var(--warn); }
.warn .box.on::after { background: var(--warn); }
.out .box { border-color: var(--out); }
.out .box.on::after { background: var(--out); }

/* ---------- Live game ---------- */
.lv {
  position: fixed; left: 0; top: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.lv-top {
  flex: none; height: 4.6rem; display: flex; align-items: stretch;
  background: var(--ink); color: #fff;
}
.lv-home, .lv-undo, .lv-q {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem; letter-spacing: 0.04em;
}
.lv-home { width: 4.2rem; border-right: 1px solid #2A3640; }
.lv-fs {
  flex: none; width: 3.6rem; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.72rem; letter-spacing: 0.04em; color: #9FB2B0; border-right: 1px solid #2A3640;
}
.lv-fs:active { background: #24313B; }
/* Four corner brackets drawn with gradients (no icon font needed on old Android). */
.fs-ic {
  display: block; width: 1.1rem; height: 1.1rem; margin-bottom: 0.25rem;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 0.4rem 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 0 / 2px 0.4rem no-repeat,
    linear-gradient(currentColor, currentColor) 100% 0 / 0.4rem 2px no-repeat,
    linear-gradient(currentColor, currentColor) 100% 0 / 2px 0.4rem no-repeat,
    linear-gradient(currentColor, currentColor) 0 100% / 0.4rem 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 100% / 2px 0.4rem no-repeat,
    linear-gradient(currentColor, currentColor) 100% 100% / 0.4rem 2px no-repeat,
    linear-gradient(currentColor, currentColor) 100% 100% / 2px 0.4rem no-repeat;
}
.lv-undo { width: 5rem; border-left: 1px solid #2A3640; }
.lv-undo .ic { font-size: 1.35rem; line-height: 1; }
.lv-home:active, .lv-undo:active, .lv-q:active { background: #24313B; }
.lv-q { width: 6rem; border-left: 1px solid #2A3640; border-right: 1px solid #2A3640; }
.lv-q .num { font-size: 2.1rem; line-height: 1; }
.lv-q small { font-size: 0.6rem; letter-spacing: 0.12em; color: #9FB2B0; margin-top: 0.15rem; }

.tm { flex: 1; display: flex; align-items: center; gap: 0.7rem; padding: 0 0.8rem; min-width: 0; }
.tm.them { flex-direction: row-reverse; }
.tm-score { font-family: var(--f-num); font-size: 3.1rem; font-weight: 700; line-height: 1; min-width: 4.2rem; text-align: center; }
.tm.us .tm-score { color: #fff; box-shadow: inset 0 -0.3rem 0 var(--accent); padding: 0.25rem 0.2rem; }
.tm-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.3rem; }
.tm.them .tm-info { align-items: flex-end; }
.tm-name { font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tm-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.72rem; color: #B9C8C6; }
.tm.them .tm-row { flex-direction: row-reverse; }
.tm-row .box { border-color: #6F8885; background: transparent; }
.tm-row .box.on::after { background: #fff; }
.bonus {
  font-family: var(--f-num); font-weight: 700; font-size: 0.72rem; letter-spacing: 0.1em;
  padding: 0.12rem 0.4rem; border-radius: 0.2rem; background: #fff; color: var(--ink);
}
/* Head coach technicals in the top bar. */
.tag-coach {
  display: inline-block; vertical-align: middle; margin-left: 0.35rem; padding: 0.05rem 0.35rem; border-radius: 0.2rem;
  font-family: var(--f-num); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; color: #fff; box-shadow: inset 0 0 0 1.5px #9FB2B0;
}
.tag-coach.warn { background: var(--warn); box-shadow: none; color: var(--ink); }
.tag-coach.out { background: var(--out); box-shadow: none; }
.bonus.next { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px #9FB2B0; }
.tm-to {
  display: flex; align-items: center; gap: 0.35rem; min-height: 2.75rem; padding: 0 0.55rem;
  margin: -0.6rem -0.55rem; border-radius: 0.3rem; color: #B9C8C6; font-size: 0.72rem;
}
.tm-to:active { background: #24313B; }
.pips { display: inline-flex; gap: 0.2rem; align-items: flex-end; }
.pip { width: 0.6rem; height: 1rem; border: 1.5px solid #9FB2B0; }
.pip.s { height: 0.6rem; }
.pip.on { background: #fff; border-color: #fff; }

.lv-main { flex: 1; display: flex; min-height: 0; padding: 0.55rem; gap: 0.55rem; }
.lv-left { width: 25.5rem; flex: none; display: flex; flex-direction: column; gap: 0.4rem; min-height: 0; }
.tabs { display: flex; flex: none; height: 2.5rem; border: 2px solid var(--ink); border-radius: 0.375rem; overflow: hidden; }
.tabs button {
  flex: 1; text-align: center; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.06em;
  text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 0.5rem;
}
.tabs button.on { background: var(--ink); color: #fff; }

.cards { flex: 1; display: flex; flex-direction: column; gap: 0.3rem; min-height: 0; }
.card {
  flex: 1; min-height: 0; display: flex; align-items: center; gap: 0.7rem; padding: 0 0.75rem 0 0;
  background: var(--card); border: 2px solid var(--rule); border-radius: 0.375rem; overflow: hidden;
}
.card .jr {
  align-self: stretch; width: 4rem; flex: none; display: flex; align-items: center; justify-content: center;
  font-family: var(--f-num); font-weight: 700; font-size: 2.1rem; border-right: 2px solid var(--rule);
  background: var(--paper);
}
.card .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.22rem; }
.card .nm b { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .nm small { font-family: var(--f-num); font-size: 0.82rem; color: var(--ink2); white-space: nowrap; }
.card .pts { flex: none; text-align: right; font-family: var(--f-num); font-weight: 700; font-size: 2rem; line-height: 1; min-width: 2.6rem; }
.card .pts small { display: block; font-size: 0.55rem; letter-spacing: 0.12em; color: var(--ink2); font-weight: 700; margin-top: 0.1rem; }
.card.warn { border-color: var(--warn); }
.card.warn .jr { background: var(--warn-soft); }
.card.out { border-color: var(--out); background: var(--out-soft); }
.card.out .jr { background: var(--out); color: #fff; border-color: var(--out); }
.card.hit { background: var(--accent-soft); }
/* Selection comes last so it wins over the foul states. */
.card.sel { border-color: var(--accent); background: var(--accent-soft); }
.card.sel .jr { background: var(--accent); color: #fff; border-color: var(--accent); }
.card.empty { justify-content: center; border-style: dashed; color: var(--ink2); font-weight: 700; padding: 0; }
/* Fouls past the five boxes when there's no foul-out limit (scrimmages). */
.pf-over { margin-left: 0.25rem; font-size: 0.8rem; font-weight: 700; color: var(--ink2); vertical-align: middle; }
.tag-out { font-family: var(--f-num); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; color: var(--out); }
.tag-t {
  display: inline-block; vertical-align: middle; margin-left: 0.3rem; padding: 0 0.25rem;
  font-family: var(--f-num); font-size: 0.7rem; font-weight: 700; line-height: 1.3;
  background: var(--out); color: #fff; border-radius: 0.2rem;
}

.opp { flex: 1; min-height: 0; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 0.4rem; overflow-y: auto; }
.chip {
  width: calc((100% - 1.2rem) / 4); height: 4.6rem; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 0.2rem; background: var(--card); border: 2px solid var(--rule); border-radius: 0.375rem;
}
.chip .num { font-size: 1.7rem; font-weight: 700; line-height: 1; }
.chip small { font-family: var(--f-num); font-size: 0.75rem; color: var(--ink2); }
.chip .boxes .box { width: 0.7rem; height: 0.7rem; }
.chip.sel { border-color: var(--ink); background: var(--ink); color: #fff; }
.chip.sel small { color: #C9D6D4; }
.chip.out { border-color: var(--out); }
.chip.add { border-style: dashed; color: var(--ink2); font-weight: 700; font-size: 0.85rem; }
.chip.team .num { font-size: 1.05rem; letter-spacing: 0.06em; }

.lv-pad { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.pad-head {
  flex: none; height: 3.5rem; display: flex; align-items: center; gap: 0.4rem;
  padding: 0 0.4rem 0 0.75rem; background: var(--card); border: 2px solid var(--rule); border-radius: 0.375rem;
}
.pad-head .lbl { font-weight: 700; font-size: 0.95rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pad-head .lbl em { font-style: normal; color: var(--ink2); font-weight: 400; }
.pad-head.ask { border-color: var(--ledger); background: #E6F0EE; }
.pad-head.ask .lbl { flex: none; color: var(--ledger); }
.pad-head.msg { border-color: var(--warn); background: var(--warn-soft); }
.qk {
  flex: none; min-width: 3.2rem; height: 2.6rem; padding: 0 0.5rem; border-radius: 0.3rem;
  border: 2px solid var(--ledger); background: var(--card); font-family: var(--f-num); font-weight: 700; font-size: 1.15rem; text-align: center;
}
.qk.no { font-family: var(--f-body); font-size: 0.8rem; border-color: var(--rule); color: var(--ink2); margin-left: auto; }
.qk:active { background: var(--ledger); color: #fff; }

.pad { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 1fr; gap: 0.45rem; }
.k {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
  background: var(--card); border: 2px solid var(--ink); border-radius: 0.375rem; text-align: center; min-height: 0;
}
.k b { font-family: var(--f-num); font-size: 1.85rem; line-height: 1; font-weight: 700; }
.k small { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; color: var(--ink2); }
.k:active { background: var(--ink); color: #fff; }
.k:active small { color: #fff; }
.k.make { background: var(--accent); border-color: var(--accent); color: #fff; }
.k.make small { color: #DCE3FF; }
.k.make:active { background: var(--ink); border-color: var(--ink); }
.k.miss { border-style: dashed; }
.k.miss b { color: var(--ink2); }
.k.foul { border-color: var(--out); color: var(--out); }
.k.foul small { color: var(--out); }
.k.foul:active { background: var(--out); color: #fff; }
.k.foul:active small { color: #fff; }
.k.wide { grid-column: span 2; }
.k.stat b { font-size: 1.3rem; letter-spacing: 0.04em; }

.lv-bot { flex: none; height: 3.4rem; display: flex; align-items: center; gap: 0.45rem; padding: 0 0.55rem 0.55rem; }
.lv-bot .btn { min-height: 2.85rem; }
.last { flex: 1; min-width: 0; font-size: 0.85rem; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 0.4rem; }
.last b { color: var(--ink); }
/* Timeout countdown: sits in the footer where the last play is shown. */
.to-clock {
  flex: 1; min-width: 0; height: 2.85rem; display: flex; align-items: center; gap: 0.7rem; padding: 0 0.8rem;
  background: var(--ink); color: #fff; border-radius: 0.375rem;
}
.to-clock .who { flex: 1; min-width: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.to-clock b { font-size: 1.9rem; line-height: 1; font-weight: 700; min-width: 3.6rem; text-align: right; }
.to-clock small { font-size: 0.7rem; color: #9FB2B0; white-space: nowrap; }
.to-clock.done { background: var(--out); }
.to-clock.done small { color: #fff; font-weight: 700; }

/* ---------- Wide live layout (Fire HD 10) ---------- */
.lv.wide .lv-top { height: 5rem; }
/* Both teams side by side: our five cards, then the opponent's numbers; the pad follows the pick. */
.lv.wide .lv-left { width: 45.5rem; flex-direction: row; gap: 0.45rem; }
.col { display: flex; flex-direction: column; gap: 0.4rem; min-height: 0; }
.col.us { width: 26rem; flex: none; }
.col.them { flex: 1; min-width: 0; }
.col-hd {
  flex: none; height: 2.5rem; padding: 0 0.6rem; border: 2px solid var(--rule); border-radius: 0.375rem;
  font-weight: 700; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink2);
}
.col.on .col-hd { background: var(--ink); border-color: var(--ink); color: #fff; }
.lv.wide .card .jr { width: 4.4rem; font-size: 2.3rem; }
.lv.wide .card .nm b { font-size: 1.1rem; }
.lv.wide .card .pts { font-size: 2.2rem; }
/* Opponent rows: grow to match our cards when there are few numbers, scroll when there are many. */
.opp-rows { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0.3rem; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.opp-rows .card { flex: 1 1 0; min-height: 3.4rem; max-height: 7.8rem; }
.opp-rows .card.fixed { flex: 0 0 3rem; min-height: 3rem; }
/* Slim rows for big opponent lists: one line, smaller number, no made-shots line. */
.opp-rows.dense { gap: 0.2rem; }
.opp-rows.dense .card { min-height: 2.4rem; }
.opp-rows.dense .card.fixed { flex-basis: 2.4rem; min-height: 2.4rem; }
.opp-rows.dense .card .jr { font-size: 1.45rem; }
.opp-rows.dense .card .nm small { display: none; }
.opp-rows.dense .card .pts { font-size: 1.5rem; }
.opp-rows.dense .card .pts small { display: none; }
.opp-rows .card.fixed .jr { font-size: 1.4rem; color: var(--ink2); }
.opp-rows .card.empty { font-size: 0.9rem; }
.opp-rows .nm .boxes .box { width: 0.9rem; height: 0.9rem; }
/* Picked opponent: ink rather than our team color, so it's clear which side the pad is on. */
.card.osel { border-color: var(--ink); background: #E8ECEE; }
.card.osel .jr { background: var(--ink); color: #fff; border-color: var(--ink); }
.lv.wide .lv-bot { height: 3.8rem; }
.lv.wide .lv-bot .btn, .lv.wide .to-clock { min-height: 3.2rem; height: 3.2rem; }

/* Drawers (modal sheets) */
.scrim { position: fixed; left: 0; top: 0; right: 0; bottom: 0; background: rgba(16, 24, 32, 0.55); z-index: 10; display: flex; align-items: center; justify-content: center; }
.sheet {
  background: var(--paper); border-radius: 0.5rem; width: 40rem; max-width: 96vw; max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden; border: 2px solid var(--ink);
}
.sheet.sm { width: 26rem; }
.sheet-hd { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.8rem 1rem; background: var(--card); border-bottom: 2px solid var(--rule); }
.sheet-hd h3 { margin: 0; font-size: 1.1rem; }
.sheet-bd { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem; -webkit-overflow-scrolling: touch; }
.sheet-ft { flex: none; display: flex; gap: 0.5rem; justify-content: flex-end; padding: 0.75rem 1rem; border-top: 2px solid var(--rule); background: var(--card); }
.stack { display: flex; flex-direction: column; gap: 0.55rem; }
.stack .btn { min-height: 3.5rem; font-size: 1.05rem; justify-content: space-between; }
.stack .btn small { font-weight: 400; color: var(--ink2); }
.stack .btn.pri small { color: #DCE3FF; }

.bench { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; }
.bp { height: 4.4rem; display: flex; align-items: center; gap: 0.5rem; padding: 0 0.6rem; background: var(--card); border: 2px solid var(--rule); border-radius: 0.375rem; }
.bp .num { font-size: 1.6rem; font-weight: 700; width: 2.2rem; text-align: center; }
.bp span { min-width: 0; font-size: 0.82rem; line-height: 1.2; overflow: hidden; }
.bp span small { display: block; color: var(--ink2); font-family: var(--f-num); }
.bp.on { border-color: var(--accent); background: var(--accent); color: #fff; }
.bp.on span small { color: #DCE3FF; }
.bp.out { border-color: var(--out); color: var(--out); }
/* Half of a swap waiting for its partner. */
.bp.pend { border-color: var(--warn); background: var(--warn-soft); color: var(--ink); box-shadow: inset 0 0 0 2px var(--warn); }
.bp.pend span small { color: var(--ink2); }
.bench-hd { margin: 0.9rem 0 0.4rem; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ledger); }
.sub-hint { margin: 0; padding: 0.6rem 0.8rem; border: 2px solid var(--rule); border-radius: 0.375rem; background: var(--card); font-size: 0.9rem; }
.sub-hint.on { border-color: var(--warn); background: var(--warn-soft); }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; }
.keypad.chg-pick { grid-template-columns: repeat(4, 1fr); }
.keypad.chg-pick button { height: 4rem; line-height: 1.1; }
.keypad.chg-pick small { display: block; font-family: var(--f-body); font-size: 0.7rem; font-weight: 400; color: var(--ink2); }
.keypad.chg-pick .ghost { border-color: var(--rule); font-size: 1.2rem; }
.keypad button { height: 3.6rem; border: 2px solid var(--ink); border-radius: 0.375rem; background: var(--card); font-family: var(--f-num); font-size: 1.6rem; font-weight: 700; text-align: center; }
.keypad button:active { background: var(--ink); color: #fff; }
.kp-show { font-family: var(--f-num); font-size: 2.6rem; font-weight: 700; text-align: center; height: 3.6rem; line-height: 3.6rem; margin-bottom: 0.6rem; border-bottom: 2px solid var(--ledger); }

.log { list-style: none; margin: 0; padding: 0; }
.log-tools { position: sticky; top: -1rem; z-index: 1; margin: -1rem -1rem 0.4rem; padding: 0.8rem 1rem 0.5rem; background: var(--paper); border-bottom: 2px solid var(--rule); display: flex; flex-direction: column; gap: 0.5rem; }
.log-tools input { height: 2.9rem; padding: 0 0.8rem; border: 2px solid var(--ink); border-radius: 0.375rem; font-size: 1rem; background: var(--card); width: 100%; }
.log-team { height: 2.6rem; }
.log-team button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 0.4rem; }
.log-kinds { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.log-kinds button { height: 2.3rem; padding: 0 0.8rem; border: 2px solid var(--rule); border-radius: 1.2rem; background: var(--card); font-weight: 700; font-size: 0.85rem; }
.log-kinds button.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.log-sum { margin: 0; padding: 0.45rem 0.7rem; border-radius: 0.375rem; background: var(--accent-soft); font-size: 0.95rem; }
.log-sum b { font-family: var(--f-num); font-size: 1.05rem; }
.log-sum[hidden] { display: none; }
.log li { display: flex; align-items: center; gap: 0.75rem; padding: 0.45rem 0; border-bottom: 1px solid var(--rule); }
.log .q { font-family: var(--f-num); font-weight: 700; color: var(--ledger); width: 2.4rem; }
.log .d { flex: 1; min-width: 0; }
.log .d.them { color: var(--ink2); }
.log .sc { font-family: var(--f-num); color: var(--ink2); width: 3.6rem; text-align: right; }

/* ---------- Pages (home, roster, settings, report) ---------- */
.pg { min-height: 100vh; }
.pg-hd {
  position: -webkit-sticky; position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1rem; min-height: 4rem;
  background: var(--ink); color: #fff;
}
.pg-hd h1 { margin: 0; font-size: 1.25rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-hd .btn { border-color: #fff; background: transparent; color: #fff; min-height: 2.6rem; }
.pg-hd .btn.pri { background: var(--accent); border-color: var(--accent); }
.pg-hd .back { font-weight: 700; padding: 0 0.6rem; min-height: 2.6rem; display: flex; align-items: center; }
.pg-bd { padding: 1.1rem 1.25rem 3rem; max-width: 60rem; margin: 0 auto; }
.pg h2 { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ledger); margin: 1.5rem 0 0.5rem; padding-bottom: 0.3rem; border-bottom: 2px solid var(--ledger); }
.pg h2:first-child { margin-top: 0.25rem; }
.note { color: var(--ink2); font-size: 0.88rem; }
.empty-state { padding: 1.5rem; border: 2px dashed var(--rule); border-radius: 0.5rem; text-align: center; color: var(--ink2); }
.empty-state .btn { margin-top: 0.75rem; }

.home-top { display: flex; gap: 0.75rem; align-items: stretch; flex-wrap: wrap; }
.live-card {
  flex: 1 1 20rem; display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1.1rem;
  background: var(--accent); color: #fff; border-radius: 0.5rem; min-height: 5rem;
}
.live-card .sc { font-family: var(--f-num); font-size: 2.2rem; font-weight: 700; }
.live-card div { flex: 1; }
.live-card small { display: block; color: #DCE3FF; font-size: 0.8rem; }
.live-card .btn { color: var(--ink); border-color: #fff; }
.record { display: flex; gap: 1.5rem; padding: 0.6rem 1rem; background: var(--card); border: 2px solid var(--rule); border-radius: 0.5rem; }
.record div { display: flex; flex-direction: column; justify-content: center; }
.record b { font-family: var(--f-num); font-size: 1.7rem; line-height: 1; }
.record span { font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink2); font-weight: 700; }

.games { list-style: none; margin: 0; padding: 0; }
.games li { border-bottom: 1px solid var(--rule); }
.games button { width: 100%; display: flex; align-items: center; gap: 1rem; padding: 0.7rem 0.25rem; min-height: 3.5rem; }
.games button:active { background: var(--card); }
.games .wl { font-family: var(--f-num); font-weight: 700; width: 1.6rem; text-align: center; font-size: 1.1rem; }
.games .wl.w { color: var(--accent); }
.games .wl.l { color: var(--ink2); }
.games .wl.live { color: var(--warn); }
.games .wl.scr { color: var(--ledger); }
.tag-scrim {
  display: inline-block; vertical-align: middle; margin-left: 0.4rem; padding: 0.05rem 0.4rem; border-radius: 0.2rem;
  font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; background: var(--ledger); color: #fff;
}
.games .op { flex: 1; min-width: 0; font-weight: 700; }
.games .op small { display: block; font-weight: 400; color: var(--ink2); font-size: 0.8rem; }
.games .sc { font-family: var(--f-num); font-size: 1.25rem; font-weight: 700; }

.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.st { border-collapse: collapse; width: 100%; font-family: var(--f-num); font-variant-numeric: tabular-nums; }
table.st th { font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ledger); text-align: right; padding: 0.35rem 0.45rem; border-bottom: 2px solid var(--ledger); }
table.st td { text-align: right; padding: 0.4rem 0.45rem; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.st .l { text-align: left; }
table.st td.nm { font-family: var(--f-body); font-size: 0.9rem; }
table.st td.b { font-weight: 700; }
table.st tr.tap { cursor: pointer; }
table.st tr.tap:active td { background: var(--accent-soft); }
table.st tr.tot td { font-weight: 700; border-top: 2px solid var(--ledger); }

.leaders { display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: 0.6rem; }
.ldr { background: var(--card); border: 2px solid var(--rule); border-radius: 0.5rem; padding: 0.55rem 0.7rem 0.4rem; }
.ldr h3 { margin: 0 0 0.3rem; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ledger); }
.ldr h3 small { color: var(--ink2); letter-spacing: 0.05em; font-weight: 400; }
.ldr ol { list-style: none; margin: 0; padding: 0; }
.ldr li button { display: flex; align-items: center; gap: 0.5rem; width: 100%; min-height: 2.2rem; font-size: 0.9rem; }
.ldr li + li button { border-top: 1px solid var(--rule); }
.ldr li:first-child button { font-weight: 700; }
.ldr .jr { font-family: var(--f-num); font-weight: 700; width: 1.7rem; text-align: center; color: var(--ink2); }
.ldr li b { margin-left: auto; font-family: var(--f-num); font-size: 1.15rem; }
.ldr .none { margin: 0.2rem 0 0.4rem; color: var(--ink2); }

.form { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; }
.fld { display: flex; flex-direction: column; gap: 0.3rem; flex: 1 1 12rem; min-width: 0; }
.fld.xs { flex: 0 1 6rem; }
.fld label, .fld .lab { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; color: var(--ledger); }
.fld input, .fld select {
  height: 3rem; padding: 0 0.7rem; border: 2px solid var(--rule); border-radius: 0.375rem; background: var(--card);
  font-size: 1rem; width: 100%;
}
.fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--accent); }
.fld input[type=color] { padding: 0.25rem; }
.fld textarea {
  padding: 0.6rem 0.7rem; border: 2px solid var(--rule); border-radius: 0.375rem; background: var(--card);
  font-size: 0.95rem; width: 100%; resize: vertical; font-family: var(--f-body);
}
.form + .fld, .fld + .form { margin-top: 0.75rem; }
.rules-hd { margin: 1rem 0 0.45rem; font-size: 0.8rem; color: var(--ink); }
/* Labels that wrap to two lines shouldn't push their box out of line with the others. */
.form.rules { align-items: flex-end; }

/* Schedule rows: date | opponent and place | result or Start | remove */
.sch-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.25rem; min-height: 3.6rem; }
.sch-row .btn { width: auto; flex: none; min-height: 2.6rem; padding: 0 0.8rem; gap: 0.4rem; }
.sch-when { width: 5.5rem; flex: none; display: flex; flex-direction: column; }
.sch-when b { font-family: var(--f-num); font-size: 1.05rem; }
.sch-when small { font-size: 0.75rem; color: var(--ink2); }
.bad-lines { margin: 0 0 0.75rem; padding-left: 1.2rem; font-size: 0.85rem; color: var(--ink2); }
.seg { display: flex; border: 2px solid var(--ink); border-radius: 0.375rem; overflow: hidden; height: 3rem; }
.seg button { flex: 1; text-align: center; font-weight: 700; font-size: 0.9rem; }
.seg button.on { background: var(--ink); color: #fff; }

.roster { list-style: none; margin: 0; padding: 0; }
.roster li { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0; border-bottom: 1px solid var(--rule); }
.roster input { height: 2.75rem; padding: 0 0.6rem; border: 2px solid var(--rule); border-radius: 0.375rem; background: var(--card); font-size: 1rem; min-width: 0; }
.roster input:focus { border-color: var(--accent); }
.roster .rn { width: 4.5rem; font-family: var(--f-num); font-weight: 700; font-size: 1.2rem; text-align: center; }
.roster .rf, .roster .rl { flex: 1; }

.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 0.45rem; }
.pick .bp { height: 3.6rem; }

.rpt-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 0.75rem 1.25rem; max-width: 60rem; margin: 0 auto; }
.rpt-bar .sp { flex: 1; }
.rpt-wrap { padding: 0 1.25rem 3rem; }
.rpt-wrap .rpt { border: 2px solid var(--rule); border-radius: 0.5rem; }
.pub { font-size: 0.85rem; color: var(--ink2); max-width: 60rem; margin: 0 auto; padding: 0 1.25rem 0.75rem; word-break: break-all; }
.pub b { color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: #fff; padding: 0.75rem 1.1rem; border-radius: 0.375rem; font-weight: 700; font-size: 0.9rem;
  max-width: 90vw;
}

@media print {
  .no-print, .pg-hd, .rpt-bar, .pub, .toast { display: none !important; }
  body, .pg { background: #fff; min-height: 0; }
  .rpt-wrap { padding: 0; }
  .rpt-wrap .rpt { border: 0; }
}

/* No pull-to-refresh during a game (the page itself never scrolls there). */
html.in-game, html.in-game body { overscroll-behavior-y: none; }

/* Subs sheet: a player who will come off when the lineup is saved. */
.bp.leaving { border-style: dashed; border-color: var(--warn); background: var(--warn-soft); color: var(--ink2); }
.bp span small b { font-weight: 700; }

/* ---------- Stats (js/stats.js) ----------
   Stat sheets are paper: the same markup is shown on screen and printed, in the report's ledger style. */
.stat-bar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; max-width: 76rem; margin: 0 auto; padding: 0.9rem 1.25rem 0; }
.stat-bar.sub { padding-top: 0.6rem; }
.stat-bar .seg { height: 2.7rem; }
.stat-tabs { flex: 1 1 34rem; }
.stat-views { flex: 0 1 30rem; }
.stat-views button, .stat-tabs button { padding: 0 0.6rem; }
.stat-hint { color: var(--ink2); font-size: 0.8rem; flex: 1; }
.stat-filter { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ledger); }
.stat-filter select { height: 2.7rem; padding: 0 0.6rem; border: 2px solid var(--ink); border-radius: 0.375rem; background: var(--card); font-size: 0.95rem; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--ink); }
.stat-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.6rem; }
.stat-links button { background: var(--card); border: 2px solid var(--rule); border-radius: 0.5rem; padding: 0.7rem 0.8rem; min-height: 4.6rem; }
.stat-links button:active { border-color: var(--accent); background: var(--accent-soft); }
.stat-links b { display: block; font-size: 1.05rem; }
.stat-links small { display: block; color: var(--ink2); font-size: 0.76rem; margin-top: 0.2rem; }
.print-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.print-pick .bp { height: 3.2rem; }
.print-pick .bp .num { font-size: 1.2rem; width: 1.6rem; }
.print-pick .bp span { font-size: 0.95rem; }

.sx-wrap { max-width: 76rem; margin: 0 auto; padding: 0.9rem 1.25rem 3rem; }
.sx { background: var(--card); border: 2px solid var(--rule); border-radius: 0.5rem; padding: 1.3rem 1.5rem 1.4rem; overflow-x: auto;
  font-size: 0.875rem; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sx-hd { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; border-bottom: 3px solid var(--ink); padding-bottom: 0.55rem; }
.sx-eye { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ledger); font-weight: 700; }
.sx h1 { margin: 0.15rem 0 0; font-family: var(--f-num); font-size: 2rem; line-height: 1; letter-spacing: -0.01em; }
.sx-meta { color: var(--ink2); font-size: 0.8rem; white-space: nowrap; }
.sx-meta b { font-family: var(--f-num); font-size: 1.3rem; color: var(--ink); }
.sx h2 { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ledger); margin: 1.35rem 0 0.45rem; padding-bottom: 0.25rem; border-bottom: 1px solid var(--rule); font-weight: 700; }
.sx h2 small { letter-spacing: 0.04em; text-transform: none; color: var(--ink2); font-weight: 400; font-size: 0.75rem; margin-left: 0.3rem; }
.sx-none { color: var(--ink2); margin: 1rem 0 0.2rem; }
.sx-foot { color: var(--ink2); font-size: 0.74rem; line-height: 1.4; margin: 0.9rem 0 0; }
.sx .pos { color: var(--ledger); }
.sx .neg { color: var(--out); }
.sx small { color: var(--ink2); font-weight: 400; }

/* Headline numbers */
.sx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.3rem, 1fr)); margin-top: 0.9rem; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.sx-kpis > div { padding: 0.55rem 0.7rem 0.5rem; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); min-width: 0; }
.sx-kpis b { display: block; font-family: var(--f-num); font-size: 1.65rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.sx-kpis .big b { font-size: 2.1rem; }
.sx-kpis .pos b { color: var(--ledger); }
.sx-kpis .neg b { color: var(--out); }
.sx-kpis span { display: block; font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink2); font-weight: 700; margin-top: 0.15rem; }
.sx-kpis em { display: block; font-style: normal; font-size: 0.7rem; color: var(--accent); font-weight: 700; margin-top: 0.1rem; }

.sx-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2.2rem; }
@media (max-width: 52rem) { .sx-cols { grid-template-columns: 1fr; } }

.sx-dl { margin: 0; }
.sx-dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; padding: 0.3rem 0; border-bottom: 1px solid var(--rule); }
.sx-dl dt { color: var(--ink); min-width: 0; }
.sx-dl dt small { display: block; font-size: 0.7rem; }
.sx-dl dd { margin: 0; font-family: var(--f-num); font-weight: 700; font-size: 1rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sx-dl dd small { font-family: var(--f-body); font-size: 0.72rem; margin-left: 0.3rem; }

/* Bars (plain divs, so they print) */
.sx-bar { display: inline-block; position: relative; height: 0.6rem; background: #E2EAE8; border-radius: 0.3rem; overflow: hidden; vertical-align: middle; }
.sx-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ledger); border-radius: 0.3rem; }
.sx-shot { display: grid; grid-template-columns: 2.6rem 1fr 6.5rem; align-items: center; gap: 0.6rem; padding: 0.35rem 0; border-bottom: 1px solid var(--rule); }
.sx-shot .lab { font-family: var(--f-num); font-weight: 700; color: var(--ledger); font-size: 0.85rem; }
.sx-shot .sx-bar { width: 100%; height: 0.75rem; }
.sx-shot .sx-bar i { background: var(--accent); }
.sx-shot .v { text-align: right; font-family: var(--f-num); white-space: nowrap; }
.sx-shot .v b { font-size: 1.05rem; }
.sx-shot .v small { margin-left: 0.35rem; font-family: var(--f-num); }
.sx-mix { display: flex; height: 1.1rem; border-radius: 0.3rem; overflow: hidden; background: #E2EAE8; margin-top: 0.4rem; }
.sx-mix i { display: block; height: 100%; }
.sx-mix .m2, .sx-key .m2 { background: var(--accent); }
.sx-mix .m3, .sx-key .m3 { background: var(--ledger); }
.sx-mix .m1, .sx-key .m1 { background: var(--warn); }
.sx-mix .ma, .sx-key .ma { background: #8FA7A2; }
.sx-key { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin-top: 0.45rem; font-size: 0.78rem; }
.sx-key i { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 0.15rem; margin-right: 0.35rem; vertical-align: -0.05rem; }

/* Scoring by period: paired columns, ours in blue, theirs in grey */
.sx-qs { display: flex; gap: 1.4rem; align-items: flex-end; flex-wrap: wrap; padding-top: 1.2rem; }
.sx-q { display: flex; flex-direction: column; align-items: center; width: 5.2rem; }
.sx-q .bars { display: flex; align-items: flex-end; gap: 0.3rem; height: 7rem; width: 100%; justify-content: center; border-bottom: 2px solid var(--ink); }
.sx-q .bars i { position: relative; width: 1.9rem; display: block; min-height: 2px; }
.sx-q .bars i.us { background: var(--accent); }
.sx-q .bars i.th { background: #B7C6C2; }
.sx-q .bars b { position: absolute; left: -0.5rem; right: -0.5rem; bottom: 100%; text-align: center; font-family: var(--f-num); font-size: 0.82rem; padding-bottom: 0.1rem; }
.sx-q .lab { font-family: var(--f-num); font-weight: 700; margin-top: 0.3rem; }
.sx-q .m { font-family: var(--f-num); font-weight: 700; font-size: 0.85rem; }
.sx-q small { font-size: 0.66rem; }
.sx-qkey { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.78rem; padding-bottom: 2.4rem; }
.sx-qkey i { display: inline-block; width: 0.75rem; height: 0.75rem; margin-right: 0.4rem; vertical-align: -0.08rem; }
.sx-qkey i.us { background: var(--accent); }
.sx-qkey i.th { background: #B7C6C2; }

/* Tables */
.sx-t { border-collapse: collapse; width: 100%; font-family: var(--f-num); font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.sx-t th { font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ledger); font-weight: 700; text-align: right; padding: 0.3rem 0.4rem; border-bottom: 2px solid var(--ledger); white-space: nowrap; vertical-align: bottom; }
.sx-t th button { font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; padding: 0.35rem 0; min-width: 1.6rem; text-align: right; }
.sx-t td { text-align: right; padding: 0.34rem 0.4rem; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.sx-t .l { text-align: left; }
.sx-t th.l button { text-align: left; }
.sx-t td.nm { font-family: var(--f-body); font-size: 0.86rem; }
.sx-t td.b, .sx-t th.b { font-weight: 700; }
.sx-t td.dim { color: var(--ink2); white-space: normal; font-family: var(--f-body); font-size: 0.78rem; }
.sx-t tr.dim td { color: #8A9A98; }
.sx-t tr.tot td { border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 700; }
.sx-t tr.tap { cursor: pointer; }
.sx-t tr.tap:active td { background: var(--accent-soft); }
.sx-players td:nth-child(n+2), .sx-players th:nth-child(n+2) { min-width: 2.6rem; }
.sx-jr { display: inline-block; min-width: 1.9rem; font-family: var(--f-num); font-weight: 700; color: var(--ink2); }
.sx-unit { display: inline-flex; gap: 0.2rem; }
.sx-unit span { min-width: 1.75rem; height: 1.55rem; line-height: 1.4rem; text-align: center; border: 1.5px solid var(--ink); border-radius: 0.2rem; font-weight: 700; font-size: 0.82rem; padding: 0 0.15rem; }
.sx-unames { display: block; font-size: 0.68rem; margin-top: 0.15rem; font-family: var(--f-body); white-space: normal; }

/* Leaders */
.sx-ldrs { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.7rem; margin-top: 1rem; }
.sx-ldr { border: 1px solid var(--rule); border-radius: 0.375rem; padding: 0.5rem 0.7rem 0.3rem; break-inside: avoid; }
.sx-ldr h3 { margin: 0 0 0.25rem; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ledger); }
.sx-ldr h3 small { letter-spacing: 0.03em; text-transform: none; }
.sx-ldr ol { list-style: none; margin: 0; padding: 0; }
.sx-ldr li { display: flex; align-items: center; min-height: 1.9rem; font-size: 0.88rem; border-top: 1px solid var(--rule); }
.sx-ldr li:first-child { border-top: 0; font-weight: 700; }
.sx-ldr li:first-child b { color: var(--accent); }
.sx-ldr li b { margin-left: auto; font-family: var(--f-num); font-size: 1.05rem; }
.sx-ldr li.tap { cursor: pointer; }

/* Player page. The jersey sits in a running-score cell with the scorebook's slash through it. */
.sx-hero { display: flex; align-items: center; gap: 1.3rem; padding-bottom: 0.9rem; border-bottom: 3px solid var(--ink); }
.sx-cell { position: relative; flex: none; width: 6.4rem; height: 6.4rem; border: 3px solid var(--ink); display: flex; align-items: center; justify-content: center; background: var(--card); }
.sx-cell span { font-family: var(--f-num); font-weight: 700; font-size: 3.4rem; line-height: 1; position: relative; z-index: 1; }
.sx-cell i { position: absolute; left: 12%; right: 12%; top: 50%; height: 0.35rem; margin-top: -0.175rem; background: var(--accent); opacity: 0.85; transform: rotate(-38deg); }
.sx-hero .who { flex: 1; min-width: 0; }
.sx-hero h1 { font-size: 2.3rem; }
.sx-hero .sub { margin: 0.35rem 0 0; color: var(--ink2); }
.sx-hero .line { display: flex; gap: 1.6rem; }
.sx-hero .line div { text-align: center; }
.sx-hero .line b { display: block; font-family: var(--f-num); font-size: 2.4rem; line-height: 1; }
.sx-hero .line span { font-size: 0.66rem; letter-spacing: 0.14em; color: var(--ledger); font-weight: 700; }
.sx-spark { position: relative; display: flex; align-items: flex-end; gap: 0.35rem; height: 8.5rem; padding-top: 1.2rem; border-bottom: 2px solid var(--ink); margin-bottom: 1.6rem; }
.sx-spark > div { flex: 1 1 0; max-width: 4.5rem; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.sx-spark i { display: block; background: var(--accent); position: relative; min-height: 2px; }
.sx-spark i b { position: absolute; left: 0; right: 0; bottom: 100%; text-align: center; font-family: var(--f-num); font-size: 0.8rem; font-style: normal; }
.sx-spark > div > span { position: absolute; top: 100%; left: -0.3rem; right: -0.3rem; text-align: center; font-size: 0.6rem; color: var(--ink2); padding-top: 0.2rem; white-space: nowrap; overflow: hidden; }
.sx-spark .avg { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed var(--warn); z-index: 1; pointer-events: none; }
.sx-spark > div.tap { cursor: pointer; }
.sx-perq { display: flex; border-left: 1px solid var(--rule); }
.sx-perq div { flex: 1; text-align: center; padding: 0.5rem 0.2rem; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.sx-perq b { display: block; font-family: var(--f-num); font-size: 1.5rem; }
.sx-perq span { font-size: 0.66rem; letter-spacing: 0.1em; color: var(--ledger); font-weight: 700; }
.sx-split td:first-child { font-family: var(--f-body); font-size: 0.82rem; }

/* Printing stat sheets: only the chosen sheets, one per page; wide tables go landscape. */
#print-root { display: none; }
@page { margin: 0.45in; }
@page wide { size: letter landscape; margin: 0.4in; }
@media print {
  html.print-stats body > *:not(#print-root) { display: none !important; }
  html.print-stats #print-root { display: block; }
  html, body { background: #fff !important; }
  .stat-bar { display: none !important; }
  .sx-wrap { padding: 0; max-width: none; }
  .sx { border: 0; border-radius: 0; padding: 0; overflow: visible; font-size: 9pt; break-after: page; page-break-after: always; }
  .sx:last-child { break-after: auto; page-break-after: auto; }
  .sx.wide { page: wide; }
  .sx-t { font-size: 8.5pt; }
  .sx-t td, .sx-t th { padding: 0.2rem 0.3rem; }
  .sx-cols > div, .sx-ldr, .sx-qs, .sx-spark, .sx-kpis { break-inside: avoid; }
  .sx h2 { break-after: avoid; }
  .sx-cols { grid-template-columns: 1fr 1fr; }
  .sx-kpis { grid-template-columns: repeat(auto-fit, minmax(4.4rem, 1fr)); }
  .sx-kpis b { font-size: 1.35rem; }
  .sx-kpis .big b { font-size: 1.6rem; }
  .sx-kpis span { font-size: 0.55rem; letter-spacing: 0.08em; }
  .sx-ldrs { grid-template-columns: repeat(4, 1fr); gap: 0.45rem; }
  .sx-ldr li { min-height: 1.35rem; font-size: 8.5pt; }
  .sx-ldr li b { font-size: 9pt; }
  .sx-unames { font-size: 7pt; }
  .sx-hero .sx-cell { width: 5rem; height: 5rem; }
  .sx-hero .sx-cell span { font-size: 2.7rem; }
}
.sx-dl.two { column-count: 2; column-gap: 2.2rem; }
.sx-dl.two > div { break-inside: avoid; -webkit-column-break-inside: avoid; }

/* Schedule: adding games is a section at the bottom that opens on demand. */
.add-area { margin-top: 1.6rem; border: 2px solid var(--rule); border-radius: 0.5rem; background: var(--card); }
.add-area.open { border-color: var(--ink); }
.add-toggle { display: flex; align-items: center; gap: 0.8rem; width: 100%; padding: 0.8rem 1rem; min-height: 4rem; text-align: left; }
.add-toggle .pm { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--accent); color: #fff; font-size: 1.5rem; line-height: 2.1rem; text-align: center; font-weight: 700; }
.add-toggle b { font-size: 1.05rem; }
.add-toggle small { margin-left: auto; color: var(--ink2); font-size: 0.82rem; }
.add-body { padding: 0 1rem 1rem; border-top: 1px solid var(--rule); }
.add-hd { margin: 1rem 0 0.3rem; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ledger); }

/* ---------- Stat charts ----------
   Series colors: a = our blue, b = opponent grey, c = ledger green, d = amber, e = slate. */
.sx-svg { display: block; width: 100%; height: auto; margin-top: 0.2rem; }
.sx-svg .g { stroke: #E1E9E7; stroke-width: 1; }
.sx-svg .ax { font-size: 11px; fill: var(--ink2); font-family: var(--f-num); }
.sx-svg .ax.ttl { font-size: 11px; font-weight: 700; fill: var(--ledger); letter-spacing: 0.04em; }
.sx-svg .xl { font-size: 10.5px; fill: var(--ink2); font-family: var(--f-body); }
.sx-svg .avg { stroke: var(--warn); stroke-width: 1.6; stroke-dasharray: 5 4; }
.sx-svg .avgt { fill: #9A6503; font-weight: 700; }
.sx-svg .ln { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.sx-svg .pt { stroke: #fff; stroke-width: 1.5; }
.sx-svg .vl { font-size: 10.5px; font-family: var(--f-num); font-weight: 700; }
.sx-svg .ln.a { stroke: var(--accent); } .sx-svg .pt.a, .sx-svg .vl.a { fill: var(--accent); }
.sx-svg .ln.b { stroke: #8FA7A2; } .sx-svg .pt.b, .sx-svg .vl.b { fill: #8FA7A2; }
.sx-svg .ln.c { stroke: var(--ledger); } .sx-svg .pt.c, .sx-svg .vl.c { fill: var(--ledger); }
.sx-svg .ln.d { stroke: var(--warn); } .sx-svg .pt.d, .sx-svg .vl.d { fill: #B87700; }
.sx-svg .dot { fill: var(--accent); fill-opacity: 0.82; stroke: #fff; stroke-width: 1.5; }
.sx-svg .dl { font-size: 11px; font-weight: 700; fill: #fff; font-family: var(--f-num); }
.sx-key i.k { border-radius: 50%; }
.sx-key i.k.a { background: var(--accent); } .sx-key i.k.b { background: #8FA7A2; }
.sx-key i.k.c { background: var(--ledger); } .sx-key i.k.d { background: var(--warn); }

/* Wins up, losses down */
.sx-mbars { position: relative; display: flex; gap: 0.35rem; height: 10rem; margin: 0.4rem 0 2.4rem; }
.sx-mbars:before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px solid var(--ink); }
.sx-mbars > div { position: relative; flex: 1 1 0; max-width: 5.5rem; }
.sx-mbars i { position: absolute; left: 12%; right: 12%; min-height: 2px; }
.sx-mbars i.w { background: var(--accent); }
.sx-mbars i.l { background: var(--out); }
.sx-mbars i b { position: absolute; left: -0.4rem; right: -0.4rem; text-align: center; font-family: var(--f-num); font-size: 0.8rem; font-style: normal; }
.sx-mbars i.w b { bottom: 100%; color: var(--accent); }
.sx-mbars i.l b { top: 100%; color: var(--out); }
.sx-mbars span { position: absolute; top: 100%; left: -0.2rem; right: -0.2rem; text-align: center; font-size: 0.64rem; color: var(--ink2); padding-top: 0.25rem; line-height: 1.15; white-space: nowrap; overflow: hidden; }
.sx-mbars span small { display: block; font-family: var(--f-num); font-size: 0.66rem; }
.sx-mbars > div.tap { cursor: pointer; }

/* Small multiples: a bar per player for each stat */
.sx-mult .hd, .sx-mult .row { display: grid; grid-template-columns: 9.5rem repeat(4, 1fr); gap: 0 1rem; align-items: center; }
.sx-mult .hd span { font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ledger); font-weight: 700; padding-bottom: 0.2rem; }
.sx-mult .row { padding: 0.2rem 0; border-top: 1px solid var(--rule); }
.sx-mult .who { font-size: 0.84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sx-mult .cell { display: flex; align-items: center; gap: 0.4rem; }
.sx-mult .trk { flex: 1; height: 0.7rem; background: #EEF2F1; position: relative; }
.sx-mult .trk i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }
.sx-mult .trk i.c { background: var(--ledger); } .sx-mult .trk i.d { background: var(--warn); } .sx-mult .trk i.e { background: #5E6E74; }
.sx-mult .cell b { width: 2.3rem; text-align: right; font-family: var(--f-num); font-size: 0.9rem; }

/* Diverging bars around zero */
.sx-div .row { display: grid; grid-template-columns: 11rem 1fr 3.4rem; gap: 0.7rem; align-items: center; padding: 0.22rem 0; border-top: 1px solid var(--rule); }
.sx-div .who { font-size: 0.84rem; white-space: nowrap; overflow: hidden; }
.sx-div .trk { position: relative; height: 0.85rem; background: linear-gradient(to right, transparent calc(50% - 1px), var(--ink) calc(50% - 1px), var(--ink) calc(50% + 1px), transparent calc(50% + 1px)); }
.sx-div .trk i { position: absolute; top: 0; bottom: 0; }
.sx-div .trk i.w { background: var(--accent); } .sx-div .trk i.l { background: var(--out); }
.sx-div b { text-align: right; font-family: var(--f-num); }

/* Leaders: a thin bar under each name, relative to the leader */
.sx-ldr li { position: relative; }
.sx-ldr .lbar { position: absolute; left: 0; bottom: -1px; height: 3px; background: var(--accent); opacity: 0.35; }
.sx-ldr li:first-child .lbar { opacity: 0.8; }
@media print { .sx-mbars, .sx-mult, .sx-div, .sx-svg { break-inside: avoid; } }
.sx-key { margin-bottom: 0.3rem; }
.lock-tag { display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0 0.8rem; border: 2px solid var(--ledger); border-radius: 0.375rem; color: var(--ledger); font-weight: 700; font-size: 0.85rem; }

/* Stats search: a box with a jump list under it */
.stat-search { position: relative; flex: 1 1 22rem; max-width: 34rem; }
.stat-search input { width: 100%; height: 2.7rem; padding: 0 0.8rem 0 2.3rem; border: 2px solid var(--ink); border-radius: 0.375rem; background: var(--card) no-repeat 0.7rem 50% / 1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='6.5' cy='6.5' r='5' fill='none' stroke='%231D5C55' stroke-width='2'/%3E%3Cpath d='M10.5 10.5 15 15' stroke='%231D5C55' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  font-size: 0.95rem; }
.stat-search input:focus { border-color: var(--accent); outline: none; }
.sq-res { position: absolute; left: 0; right: 0; top: calc(100% + 0.25rem); z-index: 8; background: var(--card); border: 2px solid var(--ink); border-radius: 0.375rem; max-height: 22rem; overflow-y: auto; box-shadow: 0 6px 16px rgba(16, 24, 32, 0.18); }
.sq-res button { display: flex; align-items: center; gap: 0.7rem; width: 100%; min-height: 2.7rem; padding: 0.3rem 0.8rem; text-align: left; border-bottom: 1px solid var(--rule); }
.sq-res button:first-child { background: var(--accent-soft); }
.sq-res button:active { background: var(--accent-soft); }
.sq-res small { flex: none; width: 3.4rem; font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ledger); font-weight: 700; }
.sq-res span { font-size: 0.92rem; }
.sq-res p { margin: 0; padding: 0.6rem 0.8rem; color: var(--ink2); font-size: 0.85rem; }
.sq-note { margin: 0 0 0.6rem; padding: 0.5rem 0.8rem; background: var(--accent-soft); border-radius: 0.375rem; font-size: 0.88rem; }
.sq-note button { margin-left: 0.6rem; font-weight: 700; color: var(--accent); text-decoration: underline; }
.sx .sq-hit { background: #FFF1C9; box-shadow: 0 0 0 2px #FFF1C9; }
@media print { .stat-search, .sq-note { display: none !important; } }

/* Header search: an icon that grows into a rounded field (and shrinks back) */
.sq-btn { width: 2.6rem; padding: 0 !important; display: inline-flex; align-items: center; justify-content: center; }
.sq-btn svg, .sq-ico svg { width: 1.15rem; height: 1.15rem; display: block; }
.hd-search { position: relative; flex: 0 1 26rem; width: 26rem; max-width: 26rem; min-width: 2.6rem; height: 2.6rem; display: flex; align-items: center;
  background: #fff; border-radius: 1.3rem; color: var(--ink); }
.hd-search .sq-ico { position: absolute; left: 0.75rem; top: 50%; margin-top: -0.575rem; color: var(--ledger); }
.hd-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; padding: 0 2.6rem 0 2.4rem; font-size: 0.95rem; color: var(--ink); border-radius: 1.3rem; }
.hd-search input:focus { outline: none; }
.hd-search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.hd-search .sq-x { position: absolute; right: 0.3rem; top: 50%; margin-top: -1rem; width: 2rem; height: 2rem; border-radius: 50%; font-size: 1.35rem; line-height: 2rem; text-align: center; color: var(--ink2); }
.hd-search .sq-x:active { background: var(--accent-soft); }
.hd-search .sq-res { top: calc(100% + 0.5rem); color: var(--ink); }
.hd-search.grow, .hd-search.shrink { overflow: hidden; }
.hd-search.grow { animation: sq-grow 0.26s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
.hd-search.grow input, .hd-search.grow .sq-x { animation: sq-fade 0.26s ease-out both; }
.hd-search.shrink { animation: sq-shrink 0.17s ease-in both; }
.hd-search.shrink input, .hd-search.shrink .sq-x { opacity: 0; }
@keyframes sq-grow { from { max-width: 2.6rem; } to { max-width: 26rem; } }
@keyframes sq-shrink { from { max-width: 26rem; } to { max-width: 2.6rem; } }
@keyframes sq-fade { from { opacity: 0; } 50% { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hd-search.grow, .hd-search.shrink, .hd-search.grow input, .hd-search.grow .sq-x { animation: none; } }
@media print { .sq-btn, .hd-search { display: none !important; } }

/* Player page jersey (js/stats.js jerseySvg) */
.sx-jersey { flex: none; width: 7.4rem; height: auto; display: block; }
.sx-jersey .jy-team { font-family: var(--f-num); font-weight: 700; font-size: 9.5px; letter-spacing: 1.8px; fill: #fff; }
.sx-jersey .jy-num { font-family: var(--f-num); font-weight: 700; letter-spacing: -1px; }
@media print { .sx-hero .sx-jersey { width: 5.6rem; } }
.pg-hd .back, .pg-hd .btn { flex: none; white-space: nowrap; }

/* Tiger logo: header badge, sign-in screen, stat sheet headers */
.hd-logo { flex: none; width: 2.8rem; height: 2.8rem; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px rgba(78, 106, 247, 0.55); }
.hd-logo img { width: 90%; height: 90%; display: block; }
.gate-logo { display: flex; align-items: center; justify-content: center; width: 7rem; height: 7rem; border-radius: 50%; background: #fff; margin: 0 auto; box-shadow: 0 0 0 4px rgba(35, 64, 200, 0.3); }
.gate-logo img { width: 90%; height: 90%; display: block; }
.sx-hd .sx-logo { flex: none; width: 3.2rem; height: 3.2rem; align-self: center; margin-right: 0.4rem; }
.sx-hd .sx-title { flex: 1; min-width: 0; }

/* New game: their numbers by number pad, with chips and a count */
.opp-entry { display: grid; grid-template-columns: 15rem 1fr; gap: 1.4rem; align-items: start; }
@media (max-width: 40rem) { .opp-entry { grid-template-columns: 1fr; } }
.opp-pad { background: var(--card); border: 2px solid var(--ink); border-radius: 0.5rem; padding: 0.6rem; }
.opp-disp { height: 3.4rem; display: flex; align-items: center; justify-content: center; gap: 0.15rem; border-radius: 0.375rem; background: var(--ink); color: #fff;
  font-family: var(--f-num); font-size: 1.4rem; margin-bottom: 0.5rem; }
.opp-disp b { font-size: 2.2rem; min-width: 2.6rem; text-align: center; }
.opp-disp.empty b { color: #5E6E74; }
.opp-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.opp-keys button { height: 3.2rem; border: 2px solid var(--rule); border-radius: 0.375rem; background: var(--paper); font-family: var(--f-num); font-weight: 700; font-size: 1.45rem; text-align: center; }
.opp-keys button:active { background: var(--accent-soft); border-color: var(--accent); }
.opp-keys .fn { font-size: 1.2rem; color: var(--ink2); }
.opp-keys .add { background: var(--accent); border-color: var(--accent); color: #fff; font-family: var(--f-body); font-size: 1.05rem; }
.opp-keys .add:disabled { opacity: 0.35; }
.opp-count { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.opp-count b { font-family: var(--f-num); font-size: 2.2rem; line-height: 1; }
.opp-count span { font-weight: 700; }
.opp-count em { font-style: normal; margin-left: auto; color: var(--ink2); font-size: 0.85rem; padding: 0.2rem 0.6rem; border: 1px solid var(--rule); border-radius: 1rem; background: var(--card); }
.opp-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.6rem; }
.opp-chip { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.6rem; padding: 0 0.55rem 0 0.75rem; border: 2px solid var(--ink); border-radius: 1.3rem;
  background: var(--card); font-family: var(--f-num); font-weight: 700; font-size: 1.15rem; }
.opp-chip i { font-style: normal; font-family: var(--f-body); font-weight: 400; color: var(--ink2); font-size: 1rem; }
.opp-chip:active { background: var(--out-soft); border-color: var(--out); }
.opp-chip.flash { animation: opp-flash 0.9s ease-out; }
@keyframes opp-flash { 0% { background: #FFE39A; transform: scale(1.12); } 100% { background: var(--card); transform: none; } }

/* Search: landing on a stat highlights it for a couple of seconds */
.sx .sq-flash { animation: sq-flash 2.8s ease-out; border-radius: 0.25rem; }
@keyframes sq-flash { 0%, 65% { background: #FFE39A; box-shadow: 0 0 0 4px #FFE39A; } 100% { background: transparent; box-shadow: 0 0 0 4px transparent; } }
.sx-t .sq-col { background: #FFF0C2; transition: background 0.8s ease-out; }
.sx-t th.sq-col { background: #FFE39A; }
.sx-t .sq-col.sq-col-out { background: transparent; }

/* ---------- Finish-game animation (#finale, js/app.js showFinale) ----------
   Timeline: backdrop 0–0.35 s, card 0.15–0.7 s, badges 0.3–0.9 s, scores count 0.6–1.9 s,
   stamp 2.0 s, confetti from 2.15 s (wins), periods 2.6 s+, top performer 3.0 s, button 3.3 s. */
.fin { position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 60; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: radial-gradient(ellipse at 50% 42%, #1B2A6B 0%, #101820 62%); color: #fff; -webkit-user-select: none; user-select: none;
  -webkit-clip-path: circle(0% at 50% 42%); clip-path: circle(0% at 50% 42%); animation: fin-reveal 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.fin.loss { background: radial-gradient(ellipse at 50% 42%, #2A3238 0%, #101820 62%); }
.fin.tie { background: radial-gradient(ellipse at 50% 42%, #3A3018 0%, #101820 62%); }
.fin.out { animation: fin-out 0.3s ease-in both; }
.fin-rays { position: absolute; left: 50%; top: 42%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; opacity: 0.22;
  background: repeating-conic-gradient(from 0deg, rgba(78, 106, 247, 0.9) 0deg 7deg, transparent 7deg 20deg); animation: fin-spin 40s linear infinite, fin-fade 1.2s ease-out both; }
/* A loss is quiet: no rays, a still, dim glow, and a softer badge. */
.fin.loss .fin-rays { display: none; }
.fin.tie .fin-rays { background: repeating-conic-gradient(from 0deg, rgba(245, 197, 66, 0.7) 0deg 7deg, transparent 7deg 20deg); }
.fin-glow { position: absolute; left: 50%; top: 42%; width: 70vmin; height: 70vmin; margin: -35vmin 0 0 -35vmin; border-radius: 50%;
  background: radial-gradient(circle, rgba(78, 106, 247, 0.45), transparent 65%); animation: fin-pulse 3s ease-in-out 0.4s infinite; }
.fin.loss .fin-glow { background: radial-gradient(circle, rgba(140, 155, 160, 0.16), transparent 65%); animation: none; }
.fin.loss .fin-badge.us { box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.6), 0 0 18px rgba(78, 106, 247, 0.35); }
.fin-card { position: relative; text-align: center; width: min(92vw, 52rem); padding: 1rem; animation: fin-rise 0.55s cubic-bezier(0.2, 0.9, 0.3, 1) 0.15s both; }
.fin-eye { font-family: var(--f-num); font-weight: 700; letter-spacing: 0.32em; text-transform: uppercase; color: #9DB0FF; font-size: 1rem; }
.fin.loss .fin-eye { color: #A9B6BA; }
.fin-score { display: flex; align-items: center; justify-content: center; gap: 2.2rem; margin-top: 1.4rem; }
.fin-team { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; width: 11rem; }
.fin-team b { font-family: var(--f-num); font-size: 1.35rem; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.1; }
.fin-team.us { animation: fin-left 0.6s cubic-bezier(0.2, 0.9, 0.3, 1) 0.3s both; }
.fin-team.them { animation: fin-right 0.6s cubic-bezier(0.2, 0.9, 0.3, 1) 0.3s both; }
.fin-badge { width: 8.5rem; height: 8.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.fin-badge.us { background: radial-gradient(circle at 35% 30%, #4E6AF7, #2340C8 60%, #14278A); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.9), 0 0 40px rgba(78, 106, 247, 0.8); }
.fin-badge.us img { width: 78%; height: 78%; display: block; }
.fin-badge.them { background: radial-gradient(circle at 35% 30%, #5C6B71, #3A464C 60%, #232C31); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35); }
.fin-badge.them span { font-family: var(--f-num); font-weight: 700; font-size: 2.6rem; letter-spacing: 0.04em; color: #E4ECEA; }
.fin-nums { display: flex; align-items: center; gap: 0.6rem; font-family: var(--f-num); font-weight: 700; font-variant-numeric: tabular-nums; }
.fin-nums .n { font-size: 7.5rem; line-height: 1; min-width: 2ch; color: rgba(255, 255, 255, 0.55); }
.fin-nums .n.top { color: #fff; text-shadow: 0 0 28px rgba(157, 176, 255, 0.85); animation: fin-beat 0.5s ease-out 1.9s both; }
.fin.loss .fin-nums .n.top { text-shadow: 0 0 22px rgba(255, 255, 255, 0.35); }
.fin-nums .dash { font-size: 4rem; color: rgba(255, 255, 255, 0.4); }
.fin-stamp { margin-top: 1.1rem; animation: fin-stamp 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) 2s both; }
.fin-stamp span { display: inline-block; padding: 0.15rem 1.6rem 0.2rem; border: 4px solid #fff; border-radius: 0.5rem; font-family: var(--f-num); font-weight: 700; font-size: 3.4rem;
  letter-spacing: 0.3em; padding-left: calc(1.6rem + 0.3em); transform: rotate(-4deg); background: #2340C8; box-shadow: 0 0 40px rgba(78, 106, 247, 0.9); }
.fin.loss .fin-stamp span { background: transparent; border-color: #A9B6BA; color: #DDE5E3; box-shadow: none; }
.fin.tie .fin-stamp span { background: #9A6503; border-color: #F5C542; box-shadow: 0 0 30px rgba(245, 197, 66, 0.6); }
.fin-sub { margin-top: 0.6rem; font-weight: 700; color: #C9D6D3; animation: fin-up 0.4s ease-out 2.4s both; }
.fin-qs { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.4rem; }
.fin-q { min-width: 4.6rem; padding: 0.35rem 0.6rem; border-radius: 0.4rem; background: rgba(255, 255, 255, 0.08); border: 1.5px solid rgba(255, 255, 255, 0.18); animation: fin-up 0.4s ease-out both; }
.fin-q span { display: block; font-size: 0.68rem; letter-spacing: 0.14em; color: #A9B6BA; font-weight: 700; }
.fin-q b { font-family: var(--f-num); font-size: 1.3rem; }
.fin-q.u { border-color: rgba(157, 176, 255, 0.8); background: rgba(35, 64, 200, 0.35); }
.fin-star { margin-top: 1.3rem; font-size: 1.05rem; color: #E4ECEA; animation: fin-up 0.45s ease-out 3s both; }
.fin-star small { display: block; font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase; color: #9DB0FF; font-weight: 700; margin-bottom: 0.2rem; }
.fin-star b { color: #fff; font-family: var(--f-num); font-size: 1.25rem; }
.fin-go { margin-top: 1.5rem; min-height: 3.2rem; padding: 0 2rem; border-radius: 1.6rem; background: #fff; color: #101820; font-weight: 700; font-size: 1.05rem; text-align: center;
  animation: fin-up 0.45s ease-out 3.3s both; }
.fin-go:active { transform: scale(0.97); }
.fin-confetti i { position: absolute; top: -4vh; border-radius: 2px; opacity: 0; animation-name: fin-fall; animation-timing-function: cubic-bezier(0.25, 0.4, 0.5, 1); animation-fill-mode: both; }
/* Tap to skip: everything jumps to its final state. */
.fin.skip *, .fin.still * { animation-delay: 0s !important; animation-duration: 0.01s !important; }
.fin.skip .fin-rays, .fin.still .fin-rays { animation: none !important; }
.fin.still { animation: none; -webkit-clip-path: none; clip-path: none; }
.fin.skip .fin-confetti, .fin.still .fin-confetti { display: none; }
/* Comes in as a circle opening out from the scoreboard. */
@keyframes fin-reveal { from { -webkit-clip-path: circle(0% at 50% 42%); clip-path: circle(0% at 50% 42%); opacity: 0.6; } to { -webkit-clip-path: circle(150% at 50% 42%); clip-path: circle(150% at 50% 42%); opacity: 1; } }
/* A loss: the stamp settles in gently (no slam), and the score doesn't pulse. */
.fin.loss .fin-stamp { animation: fin-settle 0.8s ease-out 2s both; }
.fin.loss .fin-nums .n.top { animation: none; }
@keyframes fin-settle { from { opacity: 0; transform: translateY(-0.6rem) scale(1.06); } to { opacity: 1; transform: none; } }
@keyframes fin-out { to { opacity: 0; transform: scale(1.03); } }
@keyframes fin-spin { to { transform: rotate(360deg); } }
@keyframes fin-fade { from { opacity: 0; } }
@keyframes fin-pulse { 0%, 100% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.12); opacity: 1; } }
@keyframes fin-rise { from { opacity: 0; transform: translateY(2.5rem) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes fin-left { from { opacity: 0; transform: translateX(-4rem) scale(0.7); } to { opacity: 1; transform: none; } }
@keyframes fin-right { from { opacity: 0; transform: translateX(4rem) scale(0.7); } to { opacity: 1; transform: none; } }
@keyframes fin-beat { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes fin-stamp { from { opacity: 0; transform: scale(2.4); } to { opacity: 1; transform: scale(1); } }
@keyframes fin-up { from { opacity: 0; transform: translateY(0.8rem); } to { opacity: 1; transform: none; } }
@keyframes fin-fall { 0% { opacity: 1; transform: translate(0, 0) rotate(0deg); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--drift), 108vh) rotate(var(--spin)); } }
@media (max-width: 46rem) {
  .fin-score { gap: 0.8rem; } .fin-team { width: 7rem; } .fin-badge { width: 5.5rem; height: 5.5rem; } .fin-badge.them span { font-size: 1.7rem; }
  .fin-nums .n { font-size: 4.6rem; } .fin-team b { font-size: 1rem; } .fin-stamp span { font-size: 2.4rem; }
}
@media (max-height: 40rem) {
  .fin-badge { width: 6.5rem; height: 6.5rem; } .fin-nums .n { font-size: 5.6rem; } .fin-score { margin-top: 0.8rem; } .fin-qs { margin-top: 0.9rem; }
  .fin-star { margin-top: 0.8rem; } .fin-go { margin-top: 1rem; }
}

/* One scorer per game: another device is scoring, so this one is view-only */
.lv.view-only .lv-pad, .lv.view-only .lv-undo, .lv.view-only .lv-bot .btn:first-child { opacity: 0.4; }
.vo-bar { position: fixed; left: 50%; bottom: 4.9rem; transform: translateX(-50%); z-index: 9; display: flex; align-items: center; gap: 0.8rem; max-width: calc(100% - 2rem);
  padding: 0.55rem 0.6rem 0.55rem 1rem; background: var(--ink); color: #fff; border-radius: 0.6rem; box-shadow: 0 6px 18px rgba(16, 24, 32, 0.35); font-size: 0.9rem; }
.vo-bar small { color: #A9B6BA; }
.vo-bar .btn { flex: none; }
.vo-dot { flex: none; width: 0.65rem; height: 0.65rem; border-radius: 50%; background: #3DDC84; box-shadow: 0 0 0 0.2rem rgba(61, 220, 132, 0.3); animation: vo-pulse 1.6s ease-in-out infinite; }
@keyframes vo-pulse { 50% { box-shadow: 0 0 0 0.45rem rgba(61, 220, 132, 0); } }

/* Live Box score sheet */
.box-tabs { height: 2.8rem; margin-bottom: 0.6rem; }
.rpt.rpt-mini { max-width: none; padding: 0; border: 0; background: transparent; font-size: 0.85rem; }
.rpt.rpt-mini h2 { margin-top: 0.9rem; }

/* Scouting link on New game */
.sc-link { margin-bottom: 0.7rem; }
.sx-ldrs.watch { grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr)); }

/* Opponent badges: the school's logo (icons/opp/) or their initials */
.ob { display: inline-block; flex: none; width: 2.3rem; height: 2.3rem; border-radius: 50%; background: #fff; object-fit: cover; vertical-align: middle;
  box-shadow: 0 0 0 1px var(--rule); }
.ob-init { display: inline-flex; align-items: center; justify-content: center; background: #5C6B71; color: #fff; box-shadow: none;
  font-family: var(--f-num); font-weight: 700; font-size: 0.72rem; letter-spacing: 0.03em; }
.ob.sch { width: 2.6rem; height: 2.6rem; margin-right: 0.15rem; }
.ob.gl { width: 2.3rem; height: 2.3rem; }
.tm-name .ob.tm-ob { width: 1.35rem; height: 1.35rem; margin: -0.15rem 0.35rem 0 0; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.6); }
.tm-name .ob-init.tm-ob { font-size: 0.5rem; }
.fin-badge.them.logo { background: #fff; overflow: hidden; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.85), 0 0 30px rgba(255, 255, 255, 0.25); }
.fin-badge.them.logo img { width: 100%; height: 100%; display: block; border-radius: 50%; }
.sx-meta .sx-ologo { width: 2.8rem; height: 2.8rem; border-radius: 50%; vertical-align: middle; margin-right: 0.6rem; box-shadow: 0 0 0 1px var(--rule); }
.sx-t .sx-ob { width: 1.35rem; height: 1.35rem; border-radius: 50%; vertical-align: -0.35rem; margin-right: 0.45rem; box-shadow: 0 0 0 1px var(--rule); }

/* Printing: a fixed base size (the screen's scaled base would carry over and make pages wider than the paper,
   so the browser shrinks them), no minimum column widths, and tighter tables, so every sheet fits the page width
   even when the browser prints landscape sheets portrait (iPad Safari ignores the landscape request). */
@media print {
  html { font-size: 12px !important; }
  .sx-players td:nth-child(n+2), .sx-players th:nth-child(n+2) { min-width: 0; }
  .sx-t { font-size: 8pt; }
  .sx-t th { font-size: 6.5pt; letter-spacing: 0.02em; white-space: normal; }
  .sx-t td, .sx-t th { padding: 0.18rem 0.28rem; }
  .sx-t td.nm { font-size: 8pt; }
  .sx-jr { min-width: 1.5rem; }
}

/* Game report: Dalton | Opponent pages */
.rpt-tabs { max-width: 60rem; margin: 0.9rem auto 0; padding: 0 1.25rem; }
.rpt-tabs .seg { height: 3rem; max-width: 34rem; }
.rpt-tabs .seg button { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; }
.rpt-tabs .ob.tab { width: 1.7rem; height: 1.7rem; }
.rpt-tabs .ob-init.tab { font-size: 0.55rem; }

/* ---------- Confirm sheet ---------- */
.scrim.ask { z-index: 45; }
.ask-sheet .sheet-bd h3 { margin: 0 0 0.6rem; font-size: 1.3rem; line-height: 1.25; }
.ask-sheet .sheet-bd p { margin: 0.4rem 0; }
.ask-sheet .sheet-ft .btn { min-width: 7rem; }
.ask-score { font-family: var(--f-num); font-weight: 700; font-size: 1.35rem; letter-spacing: 0.02em; }
.ask-steps { margin: 0.3rem 0 0.6rem; padding-left: 1.3rem; }
.ask-steps li { margin: 0.25rem 0; }

/* ---------- View-only accounts ---------- */
html.readonly [data-x="#new"], html.readonly [data-a="startScheduled"], html.readonly [data-a="deleteGame"],
html.readonly [data-a="reopen"], html.readonly [data-a="publish"], html.readonly [data-a="newSeason"],
html.readonly [data-a="restoreHistory"], html.readonly [data-a="takeOver"], html.readonly [data-a="removeSample"],
html.readonly label[for="imp"] { display: none !important; }
.viewer-note { display: flex; gap: 0.6rem; align-items: baseline; margin: 0 0 1rem; padding: 0.55rem 0.8rem; border-radius: 0.375rem; background: var(--accent-soft); color: var(--ink); font-size: 0.9rem; }
.viewer-note span { flex: 1; }
.vn-x { flex: none; align-self: center; width: 2rem; height: 2rem; margin: -0.3rem -0.4rem -0.3rem 0; border-radius: 50%; font-size: 1.35rem; line-height: 1; color: inherit; opacity: 0.7; }
.vn-x:hover, .vn-x:focus-visible { opacity: 1; background: rgba(127, 127, 127, 0.18); }
.vo-bar .vn-x { margin: 0 -0.3rem 0 0; color: #fff; }
.viewer-note b { flex: none; font-family: var(--f-num); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.8rem; color: var(--accent); }

/* ---------- Battery test ---------- */
#battbar {
  position: fixed; left: 50%; top: 0.35rem; z-index: 42; transform: translateX(-50%);
  display: flex; align-items: center; gap: 0.6rem; padding: 0.2rem 0.25rem 0.2rem 0.8rem; border-radius: 1rem;
  background: var(--ink); color: #fff; font-family: var(--f-num); font-weight: 700; font-size: 0.75rem; letter-spacing: 0.08em; white-space: nowrap;
}
#battbar button { min-height: 1.8rem; padding: 0 0.9rem; border-radius: 0.9rem; background: var(--warn); color: var(--ink); font-weight: 700; letter-spacing: 0.04em; }
#battbar .bt-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #3DDC84; animation: bt-pulse 1.6s ease-in-out infinite; }
@keyframes bt-pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { #battbar .bt-dot { animation: none; } }
.bt-big { margin: 0.2rem 0 0.6rem !important; font-family: var(--f-num); font-size: 1.1rem; color: var(--ink2); }
.bt-big b { font-size: 2.6rem; color: var(--ink); margin-right: 0.3rem; }
.batt-log .op { font-size: 0.88rem; }

/* Stats → By player: a card per player, opening their page. */
.pl-hint { display: block; margin: 0 0 0.6rem; }
.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(19.5rem, 1fr)); gap: 0.6rem; }
.pl-card { display: flex; align-items: center; gap: 0.75rem; width: 100%; min-height: 4.6rem; padding: 0.55rem 0.7rem; text-align: left;
  background: var(--card); border: 2px solid var(--rule); border-radius: 0.5rem; }
.pl-card:active, .pl-card:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.pl-card.dim { opacity: 0.6; }
.pl-num { flex: none; width: 3rem; height: 3rem; display: flex; align-items: center; justify-content: center; border-radius: 0.4rem;
  background: var(--ledger); color: #fff; font-family: var(--f-num); font-weight: 700; font-size: 1.6rem; }
.pl-nm { flex: 1; min-width: 0; }
.pl-nm b { display: block; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-nm small { display: block; color: var(--ink2); font-size: 0.76rem; margin-top: 0.15rem; }
.pl-st { flex: none; display: flex; gap: 0.55rem; }
.pl-st i { font-style: normal; display: flex; flex-direction: column; align-items: center; font-size: 0.62rem; letter-spacing: 0.06em; color: var(--ink2); }
.pl-st b { font-family: var(--f-num); font-size: 1.15rem; color: var(--ink); letter-spacing: 0; }
.pl-go { flex: none; color: var(--ink2); font-size: 1.4rem; }
/* Player page: every jersey, to jump to anyone. */
.pl-strip { display: flex; gap: 0.35rem; overflow-x: auto; padding: 0.1rem 0 0.5rem; margin-bottom: 0.3rem; -webkit-overflow-scrolling: touch; }
.pl-strip button { flex: none; min-width: 3.4rem; min-height: 3rem; padding: 0.25rem 0.45rem; border: 2px solid var(--rule); border-radius: 0.45rem; background: var(--card); }
.pl-strip button b { display: block; font-family: var(--f-num); font-size: 1.15rem; }
.pl-strip button small { display: block; font-size: 0.62rem; color: var(--ink2); max-width: 5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-strip button.on { background: var(--ledger); border-color: var(--ledger); color: #fff; }
.pl-strip button.on small { color: rgba(255, 255, 255, 0.8); }
.stat-ids { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--ink2); }
.stat-ids .seg button { min-height: 2.4rem; padding: 0 0.7rem; font-size: 0.82rem; }
/* Free throws after a foul: who shoots, then made / missed for each shot. */
.pad-head.ask.ft .lbl { flex: 1; }
.qk.ft-n { font-family: var(--f-body); font-size: 0.85rem; border-color: var(--rule); color: var(--ink2); }
.qk.ft-y, .qk.ft-x { min-width: 5.6rem; font-family: var(--f-body); font-size: 1rem; }
.qk.ft-y { background: var(--ledger); color: #fff; }
.qk.ft-x { border-color: var(--out); color: var(--out); }
.qk.ft-x:active { background: var(--out); color: #fff; }
.pad-head.ask .qk { min-width: 2.9rem; }
.pad-head.ask .qk.ft-y, .pad-head.ask .qk.ft-x { min-width: 5.6rem; }

/* Overview first: a game and the Stats screen open on a simple page; "Detailed stats" has the rest. */
.rpt-tabs { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.rpt-tabs .seg { flex: 1 1 18rem; }
.rpt-tabs .seg.rpt-mode { flex: 0 1 22rem; }
.seg.stat-mode { flex: 0 1 22rem; }
.seg.stat-mode button { padding: 0 0.8rem; }
.stat-tabs button.ov-back { flex: none; padding: 0 0.75rem; color: var(--ledger); border-right: 2px solid var(--ink); }
.ov-more { display: flex; align-items: center; gap: 1rem; max-width: 60rem; margin: 1rem auto 0; }
.ov-more .btn { width: auto; flex: none; padding: 0 1.4rem; }
.ov-more span { color: var(--ink2); font-size: 0.85rem; }
.sx-wrap .ov-more { max-width: none; }
.sx-ldrs.ov { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); margin-top: 0.6rem; }
.sx-ldr.ov li { min-height: 2.4rem; font-size: 0.95rem; }
.sx-ldr.ov li b { font-size: 1.2rem; }
.sx-t.ov-games, .sx-t.ov-pl { max-width: 40rem; font-size: 1rem; }
.sx-t.ov-games td, .sx-t.ov-pl td { padding: 0.45rem 0.5rem; }
.sx-t.ov-games td.ov-wl { width: 1.6rem; font-weight: 700; }
.sx-t.ov-games td.nm, .sx-t.ov-pl td.nm { font-size: 0.95rem; }

/* Player ratings: overall rating and five ratings */
.sx-rcard { display: grid; grid-template-columns: auto 1fr; gap: 0.8rem 1.6rem; align-items: center; margin-top: 0.7rem; }
.sx-rcard .ovr { width: 6.2rem; height: 6.2rem; border-radius: 50%; background: var(--ink); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: inset 0 0 0 4px var(--accent); }
.sx-rcard .ovr b { font-family: var(--f-num); font-size: 2.7rem; line-height: 1; }
.sx-rcard .ovr span { font-size: 0.66rem; letter-spacing: 0.16em; font-weight: 700; color: #C9D6D3; }
.sx-rcard .attrs { min-width: 0; }
.sx-rcard .at { display: grid; grid-template-columns: 7rem 1fr 2.2rem; align-items: center; gap: 0.6rem; padding: 0.18rem 0; font-size: 0.86rem; }
.sx-rcard .at .sx-bar { width: 100%; height: 0.7rem; }
.sx-rcard .at .sx-bar i { background: #8FA7A2; }
.sx-rcard .at .sx-bar.md i { background: var(--ledger); }
.sx-rcard .at .sx-bar.hi i { background: var(--accent); }
.sx-rcard .at b { font-family: var(--f-num); font-size: 1.1rem; text-align: right; }
@media print { .sx-rcard { break-inside: avoid; } .sx-rcard .ovr { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* Player accounts: nothing that changes anything. */
html.player [data-a="rmSched"], html.player [data-a="schedToggle"], html.player .add-area,
html.player [data-x="#new"], html.player [data-a="startScheduled"] { display: none !important; }
.live-note { display: flex; align-items: center; gap: 0.5rem; max-width: 60rem; margin: 0.8rem auto 0; padding: 0 1.25rem; font-size: 0.85rem; font-weight: 700; color: var(--out); }
.live-note i { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--out); animation: livepulse 1.6s ease-in-out infinite; }
@keyframes livepulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .live-note i { animation: none; } }

/* ---------- Phones (portrait, up to 600 px wide) ----------
   Everything but the scoring screen (a phone opens a live game as its live overview). */
@media (max-width: 600px) {
  .pg-hd { position: static; flex-wrap: wrap; gap: 0.4rem; padding: 0.5rem 0.6rem; min-height: 0; }
  .pg-hd h1 { flex: 1 1 10rem; font-size: 1.05rem; }
  .pg-hd .btn { min-height: 2.4rem; padding: 0 0.6rem; font-size: 0.82rem; }
  .pg-hd .back { min-height: 2.4rem; padding: 0 0.3rem; }
  .hd-logo { display: none; }
  .hd-search { flex: 1 1 auto; width: auto; max-width: none; }
  .pg-bd { padding: 0.9rem 0.75rem 2.5rem; }
  .record { gap: 1rem; flex-wrap: wrap; padding: 0.5rem 0.75rem; flex: 1 1 100%; }
  .record b { font-size: 1.4rem; }
  .live-card { flex-basis: 100%; gap: 0.7rem; padding: 0.7rem 0.8rem; }
  .live-card .sc { font-size: 1.7rem; }
  .games button { gap: 0.6rem; }
  .games .sc { font-size: 1.05rem; }
  .sch-row { flex-wrap: wrap; }
  .stat-links { grid-template-columns: 1fr 1fr; }
  .leaders { grid-template-columns: 1fr; }
  .seg { height: 2.7rem; }
  .seg button { font-size: 0.82rem; padding: 0 0.4rem; }
  .stat-bar { padding: 0.6rem 0.6rem 0; gap: 0.5rem; }
  .stat-tabs { flex: 1 1 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .stat-tabs button { flex: none; padding: 0 0.7rem; white-space: nowrap; }
  .stat-views { flex: 1 1 100%; overflow-x: auto; }
  .stat-views button { flex: none; white-space: nowrap; padding: 0 0.7rem; }
  .seg.stat-mode { flex: 1 1 100%; }
  .stat-hint { display: none; }
  .stat-filter { margin-left: 0; }
  .sx-wrap { padding: 0.6rem 0.5rem 2.5rem; }
  .sx { padding: 0.9rem 0.75rem 1rem; border-width: 1px; }
  .sx-hd { flex-wrap: wrap; }
  .sx h1 { font-size: 1.55rem; }
  .sx-logo { display: none; }
  .sx-kpis { grid-template-columns: repeat(2, 1fr); }
  .sx-kpis b { font-size: 1.4rem; }
  .sx-kpis .big b { font-size: 1.7rem; }
  .sx-hero { flex-wrap: wrap; gap: 0.8rem; }
  .sx-hero .sx-jersey { width: 4.2rem; }
  .sx-hero h1 { font-size: 1.6rem; }
  .sx-hero .line { gap: 1.1rem; }
  .sx-hero .line b { font-size: 1.7rem; }
  .sx-qs { gap: 0.6rem; }
  .sx-q { width: 4.2rem; }
  .sx-spark { gap: 0.15rem; }
  .sx-spark > div > span { display: none; }
  .sx-spark { margin-bottom: 0.6rem; }
  .sx-ldrs, .sx-ldrs.ov { grid-template-columns: 1fr; }
  .sx-rcard { grid-template-columns: 1fr; justify-items: start; }
  .sx-rcard .ovr { width: 5rem; height: 5rem; }
  .sx-rcard .ovr b { font-size: 2.2rem; }
  .sx-rcard .attrs { width: 100%; }
  .sx-rcard .at { grid-template-columns: 6.2rem 1fr 2rem; }
  .sx-t { font-size: 0.86rem; }
  .sx-t.ov-games, .sx-t.ov-pl { font-size: 0.92rem; }
  .sx-t.ov-games td, .sx-t.ov-pl td { padding: 0.4rem 0.3rem; }
  .pl-grid { grid-template-columns: 1fr; }
  .rpt-tabs { padding: 0 0.6rem; margin-top: 0.6rem; }
  .rpt-tabs .seg, .rpt-tabs .seg.rpt-mode { flex: 1 1 100%; max-width: none; }
  .rpt-bar { padding: 0.6rem; gap: 0.4rem; }
  .rpt-bar .seg { flex: 1 1 100% !important; }
  .rpt-bar .sp { display: none; }
  .rpt-wrap { padding: 0 0.4rem 2.5rem; }
  .rpt-wrap .rpt { border-width: 1px; }
  .pub { padding: 0 0.6rem 0.6rem; }
  .live-note { padding: 0 0.6rem; }
  .ov-more { flex-direction: column; align-items: stretch; gap: 0.5rem; padding: 0 0.2rem; }
  .ov-more .btn { width: 100%; }
  .sheet, .sheet.sm { width: calc(100vw - 1rem) !important; max-width: none; max-height: calc(100vh - 2rem); }
  .gate .btn { min-width: 0; width: 100%; }
  .viewer-note { flex-wrap: wrap; }
}
@media (max-width: 600px) { .pg-hd [data-a="fullscreen"] { display: none; } }

/* Roster for player accounts: read only, each row opens the player's page. */
.roster-view .rv-num { width: 2.6rem; text-align: center; font-family: var(--f-num); font-weight: 700; font-size: 1.35rem; }
.roster-view .rv-go { color: var(--accent); font-weight: 700; font-size: 0.85rem; }

/* My stats; roster email field */
.pg-hd .btn.mine { background: #fff; color: var(--ink); border-color: #fff; }
.roster .re { flex: 1.3; font-size: 0.9rem; }
/* Phones: Home's header is the logo and one line of buttons; every header stays on one line. */
@media (max-width: 600px) {
  .pg-hd { flex-wrap: nowrap; gap: 0.35rem; }
  .home-hd { overflow-x: auto; scrollbar-width: none; }
  .home-hd::-webkit-scrollbar { display: none; }
  .pg-hd h1 { flex: 1 1 auto; min-width: 3rem; }
  .pg-hd .btn, .pg-hd .back, .pg-hd .sq-btn { flex: none; }
  .pg-hd .btn { padding: 0 0.5rem; font-size: 0.78rem; }
  .home-hd h1 { display: none; }
  .home-hd .hd-logo { display: flex; width: 2.4rem; height: 2.4rem; margin-right: auto; }
  .roster li { flex-wrap: wrap; }
  .roster .rn { width: 3.4rem; }
  .roster .re { flex: 1 1 100%; order: 5; }
}
