/* ===== RESET & CUSTOM PROPS ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:           #05090f;
  --bg2:          #080d17;
  --card:         rgba(9, 18, 34, 0.88);
  --card-solid:   #090e1a;
  --inp:          rgba(255,255,255,0.05);
  --border:       rgba(60,110,190,0.18);
  --border-hi:    rgba(0,229,255,0.45);
  --text:         #b8cfe4;
  --text-dim:     #5c7fa0;   /* ≥4.5:1 on every themed card (was #4a6a88, dipped to 2.94) */
  --text-bright:  #e4f2ff;
  --cyan:         #00e5ff;
  --green:        #00ff88;
  --purple:       #8844ff;
  --orange:       #ff8833;
  --red:          #ff3366;
  --gold:         #ffcc44;
  --g-main:       linear-gradient(135deg,#00e5ff,#00ff88);
  --g-purple:     linear-gradient(135deg,#8844ff,#00e5ff);
  --g-fire:       linear-gradient(135deg,#ff8833,#ff3366);
  --shadow:       0 8px 40px rgba(0,0,0,0.55);
  --glow-c:       0 0 30px rgba(0,229,255,0.12);
  --glow-g:       0 0 30px rgba(0,255,136,0.12);
  --header-bg:       rgba(5,9,15,0.90);
  --grid-line:       rgba(0,229,255,0.025);
  --dropdown-bg:     #0b1626;
  --scrollbar-thumb: rgba(0,229,255,0.20);
  --scrollbar-hover: rgba(0,229,255,0.40);
  --card-hover-b:    rgba(0,229,255,0.25);
  --pill-act-b:      rgba(0,229,255,0.50);
  --pill-act-bg:     rgba(0,229,255,0.10);
  --badge-bg:        rgba(0,229,255,0.08);
  --badge-b:         rgba(0,229,255,0.20);
  --toggle-bg:       rgba(0,229,255,0.20);
  --range-track:     rgba(0,229,255,0.15);
  --row-hover:       rgba(0,229,255,0.04);
  --r:            14px;
  --r-sm:         8px;
  --mono:         'JetBrains Mono', monospace;
}
/* ===== LIGHT THEME ===== */
body.light {
  --bg:          #eef2f7;
  --bg2:         #e4eaf2;
  --card:        rgba(255,255,255,0.92);
  --card-solid:  #ffffff;
  --inp:         rgba(0,30,80,0.06);
  --border:      rgba(60,110,190,0.18);
  --border-hi:   rgba(0,140,200,0.5);
  --text:        #2c4a6e;
  --text-dim:    #5a7794;   /* ≥4.5:1 on every themed card (was #6a8aaa at 3.54) */
  --text-bright: #0d1e35;
  --cyan:        #0077aa;
  --green:       #007a40;
  --purple:      #5522bb;
  --orange:      #bb4d00;
  --red:         #aa1133;
  --gold:        #886600;
  --shadow:      0 8px 40px rgba(0,0,0,0.10);
  --glow-c:      0 0 20px rgba(0,120,170,0.06);
  --glow-g:      0 0 20px rgba(0,120,64,0.06);
  --header-bg:       rgba(238,242,247,0.93);
  --grid-line:       rgba(60,110,190,0.05);
  --dropdown-bg:     #ffffff;
  --scrollbar-thumb: rgba(60,110,190,0.25);
  --scrollbar-hover: rgba(60,110,190,0.45);
  --card-hover-b:    rgba(0,120,200,0.20);
  --pill-act-b:      rgba(0,120,200,0.50);
  --pill-act-bg:     rgba(0,120,200,0.10);
  --badge-bg:        rgba(0,100,180,0.08);
  --badge-b:         rgba(0,100,180,0.20);
  --toggle-bg:       rgba(0,120,200,0.20);
  --range-track:     rgba(0,120,200,0.15);
  --row-hover:       rgba(0,100,180,0.04);
}

/* ===== THEME TOGGLE ===== */
.theme-btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .8rem; border-radius: 20px;
  border: 1px solid var(--border); background: var(--inp);
  color: var(--text); font-size: .72rem; font-family: inherit;
  cursor: pointer; transition: all .2s; user-select: none;
  white-space: nowrap;
}
.theme-btn:hover { border-color: var(--border-hi); color: var(--cyan); }
.theme-btn .theme-icon { font-size: .9rem; line-height: 1; }
.theme-btn.auto-on {
  border-color: var(--border-hi); color: var(--cyan);
  background: var(--badge-bg); box-shadow: var(--glow-c);
}
body.light .theme-btn.auto-on {
  font-weight: 600;
}
.refresh-meta { display: flex; align-items: center; gap: .5rem; }
.refresh-time { font-size: .65rem; color: var(--text-dim); font-family: var(--mono); white-space: nowrap; }

/* ===== SHARE TOAST ===== */
.share-toast {
  position: fixed; bottom: 1.75rem; left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--card-solid); border: 1px solid var(--border-hi);
  color: var(--cyan); padding: .5rem 1.35rem;
  border-radius: 20px; font-size: .78rem;
  font-family: var(--mono); font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,.55), var(--glow-c);
  opacity: 0; transition: opacity .22s, transform .22s;
  pointer-events: none; z-index: 999; white-space: nowrap;
}
.share-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== LOADING INDICATOR ===== */
.loading-badge {
  font-size: .7rem; color: var(--text-dim);
  display: flex; align-items: center; gap: .4rem;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.loading-badge.visible { opacity: 1; }

/* ===== COLLAPSIBLE SECTIONS ===== */
.collapse-btn {
  background: none; border: none; cursor: pointer; flex-shrink: 0;
  color: var(--text-dim); font-size: 1rem; line-height: 1;
  padding: .25rem .4rem; border-radius: 4px;
  transition: transform .25s cubic-bezier(.4,0,.2,1), color .2s;
  display: inline-flex; align-items: center;
}
.collapse-btn:hover { color: var(--cyan); }
.collapse-btn.is-collapsed { transform: rotate(-90deg); }
.section-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem;
  padding: .75rem 1.1rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.section-bar .section-title { font-size: .85rem; }

/* Connected section block: section-bar snaps to content below */
.section-block { display: flex; flex-direction: column; }
.section-block > .section-bar { border-radius: var(--r) var(--r) 0 0; }
.section-content {
  background: var(--card); backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--r) var(--r); box-shadow: var(--shadow);
  overflow: hidden;
}

.stat-desc {
  font-size: .65rem; color: var(--text-dim); line-height: 1.5; margin-top: .25rem;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.55;
}

/* Grid background */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none; z-index: 0;
}
body > * { position: relative; z-index: 1; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

/* ===== GLASSMORPHISM CARD ===== */
.card {
  background: var(--card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  transition: border-color .3s, box-shadow .3s;
}
.card:hover { border-color: var(--card-hover-b); box-shadow: var(--shadow), var(--glow-c); }

/* ===== GRADIENT TEXT ===== */
.g-text { background: var(--g-main); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.g-text-p { background: var(--g-purple); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* ===== HEADER ===== */
header {
  position: sticky; top: 0; z-index: 200;
  background: var(--header-bg);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  min-height: 58px;
  display: flex; align-items: center; flex-wrap: wrap;
  padding: 0 1.75rem; gap: 1rem;
}
.logo { font-size: 1.1rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; flex-shrink: 0; }
.logo-nba { background: var(--g-main); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.logo-sub { font-weight: 300; font-size: .7rem; color: var(--text-dim); letter-spacing: .2em; display: block; margin-top: -4px; }
.logo-tag { font-weight: 400; font-size: .6rem; color: var(--text-dim); letter-spacing: .05em; display: block; margin-top: 1px; text-transform: none; }
.header-badges {
  display: flex; gap: 1rem; flex-wrap: wrap; flex: 1; min-width: 0;
  font-family: var(--mono); font-size: .68rem;
}
.hbadge { display: flex; align-items: center; gap: .4rem; }
.hbadge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 6px var(--cyan); flex-shrink: 0; }
.hbadge-val { color: var(--cyan); font-weight: 700; }
.hbadge-lbl { color: var(--text-dim); }
.header-right { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .85rem; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--inp); color: var(--text); font-size: .75rem; font-family: inherit; cursor: pointer; transition: all .2s; }
.btn:hover { border-color: var(--border-hi); color: var(--cyan); }
.btn-primary { background: linear-gradient(135deg, var(--badge-bg), var(--pill-act-bg)); border-color: var(--border-hi); color: var(--cyan); }
.btn-primary:hover { background: linear-gradient(135deg, var(--pill-act-bg), var(--badge-bg)); }
.btn-clear { color: var(--text-dim); border-color: rgba(255,51,102,.2); }
.btn-clear:hover { border-color: rgba(255,51,102,.55); color: var(--red); background: rgba(255,51,102,.07); }
.theme-select {
  padding: .35rem .65rem; border-radius: 20px;
  border: 1px solid var(--border); background: var(--inp);
  color: var(--text); font-size: .72rem; font-family: inherit;
  cursor: pointer; outline: none; transition: all .2s;
  max-width: 172px;
}
.theme-select:hover { border-color: var(--border-hi); color: var(--cyan); }
/* --glow-c is a complete shadow value, so it is used bare (not nested in another
   shadow declaration, which would produce invalid CSS and render nothing). */
.theme-select.themed { border-color: var(--border-hi); color: var(--cyan); background: transparent; box-shadow: var(--glow-c); }
body.light .theme-select.themed { box-shadow: none; }
.site-footer-disc { font-size: .63rem; color: var(--text-dim); margin-right: auto; padding-left: .5rem; }
.site-footer-disc a { color: var(--text-dim); text-decoration: underline; text-underline-offset: 2px; }
.site-footer-disc a:hover { color: var(--cyan); }

/* ===== FOOTER ===== */
.site-footer { border-top: 1px solid var(--border); padding: .6rem 1.75rem; display: flex; justify-content: flex-end; align-items: center; gap: 1.25rem; font-family: var(--mono); font-size: .68rem; color: var(--text-dim); }
.site-footer-copy { margin-right: auto; }
.site-footer-label { margin-right: .4rem; }
.site-footer-val { color: var(--text); }
.mastodon-link { display: inline-flex; align-items: center; gap: .35rem; color: var(--text-dim); text-decoration: none; font-size: .72rem; transition: color .2s; }
.mastodon-link:hover { color: #6364ff; }

/* ===== LAYOUT ===== */
.container { max-width: 1700px; margin: 0 auto; padding: 1.5rem 1.75rem; display: flex; flex-direction: column; gap: 1.5rem; }

/* ===== FILTER PANEL ===== */
.filter-panel { padding: 1rem 1.25rem; display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-end; position: relative; z-index: 10; }
.filter-group { display: flex; flex-direction: column; gap: .4rem; min-width: 160px; }
.filter-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); font-weight: 600; }

/* Range slider */
.range-wrap { display: flex; flex-direction: column; gap: .5rem; }
.range-inputs { display: flex; align-items: center; gap: .5rem; font-family: var(--mono); font-size: .78rem; }
.range-inputs input[type="range"] {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 4px; background: var(--range-track); border-radius: 2px; outline: none;
}
.range-inputs input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--cyan); cursor: pointer;
  box-shadow: 0 0 8px var(--cyan);
  border: 2px solid var(--bg);
}
.range-inputs input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--cyan); cursor: pointer;
  box-shadow: 0 0 8px var(--cyan); border: 2px solid var(--bg);
}
.range-val { color: var(--cyan); min-width: 2.2rem; text-align: center; font-weight: 700; font-size: .75rem; }
.range-sep { color: var(--text-dim); }

/* Pill toggles */
.pills { display: flex; flex-wrap: wrap; gap: .35rem; }
.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border-radius: 20px; border: 1px solid var(--border); background: var(--inp); font-size: .7rem; cursor: pointer; transition: all .2s; user-select: none; color: var(--text); }
/* Visually hidden but still focusable — display:none would remove these from
   the tab order and make every pill keyboard-inaccessible. */
.pill input {
  position: absolute; opacity: 0;
  width: 1px; height: 1px; margin: 0; pointer-events: none;
}
/* Forward the hidden input's focus ring to the visible pill */
.pill:has(input:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 2px; }
.pill.active { border-color: var(--pill-act-b); background: var(--pill-act-bg); color: var(--cyan); }
.pill.active.playoff  { border-color: rgba(255,204,68,.4); background: rgba(255,204,68,.08); color: var(--gold); }
.pill.active.nba_cup  { border-color: rgba(136,68,255,.5); background: rgba(136,68,255,.1); color: var(--purple); }
.pill.active.asg      { border-color: rgba(255,136,51,.4); background: rgba(255,136,51,.08); color: var(--orange); }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: .6rem; font-size: .75rem; }
.toggle { position: relative; width: 38px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: rgba(255,255,255,.1); border-radius: 10px; transition: .3s; border: 1px solid var(--border); cursor: pointer; }
.toggle-slider::before { content:''; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; background: var(--text-dim); border-radius: 50%; transition: .3s; }
.toggle input:checked + .toggle-slider { background: var(--toggle-bg); border-color: var(--cyan); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }

/* Multiselect */
.ms { position: relative; }
.ms-btn { width: 100%; padding: .4rem .75rem; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--inp); color: var(--text); font-size: .75rem; font-family: inherit; cursor: pointer; text-align: left; display: flex; justify-content: space-between; align-items: center; transition: border-color .2s; min-width: 180px; }
.ms-btn:hover { border-color: var(--border-hi); }
.ms-btn .ms-arrow { color: var(--text-dim); transition: transform .2s; }
.ms.open .ms-arrow { transform: rotate(180deg); }
.ms-dropdown { position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 240px; background: var(--dropdown-bg); border: 1px solid var(--border-hi); border-radius: var(--r-sm); box-shadow: 0 16px 48px rgba(0,0,0,.6); z-index: 300; display: none; overflow: hidden; }
.ms.open .ms-dropdown { display: block; }
.ms-search { width: 100%; padding: .5rem .75rem; background: rgba(255,255,255,.04); border: none; border-bottom: 1px solid var(--border); color: var(--text-bright); font-size: .75rem; font-family: inherit; outline: none; }
.ms-actions { display: flex; gap: 0; border-bottom: 1px solid var(--border); }
.ms-actions button { flex: 1; padding: .3rem; font-size: .65rem; background: none; border: none; color: var(--text-dim); cursor: pointer; transition: color .2s; }
.ms-actions button:hover { color: var(--cyan); }
.ms-list { max-height: 220px; overflow-y: auto; }
.ms-item { display: flex; align-items: center; gap: .6rem; padding: .4rem .75rem; cursor: pointer; font-size: .73rem; transition: background .15s; }
.ms-item:hover { background: var(--badge-bg); }
.ms-item input[type="checkbox"] { accent-color: var(--cyan); width: 13px; height: 13px; cursor: pointer; }
.ms-conf { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ms-conf.East { background: #ff6644; }
.ms-conf.West { background: #4488ff; }
.ms-item-name { flex: 1; color: var(--text); }
.ms-item-abbr { font-family: var(--mono); font-size: .65rem; color: var(--text-dim); }

/* ===== STAT CARDS ===== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media(max-width:900px) { .stat-grid { grid-template-columns: repeat(2,1fr); } }
@media(max-width:500px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card { padding: 1.25rem 1.4rem; position: relative; }
.stat-card::after { content:''; position: absolute; inset: 0; border-radius: var(--r); background: radial-gradient(ellipse at top right, var(--card-glow, rgba(0,229,255,.06)), transparent 70%); pointer-events: none; }
.stat-card.green  { --card-glow: rgba(0,255,136,.07); }
.stat-card.purple { --card-glow: rgba(136,68,255,.07); }
.stat-card.orange { --card-glow: rgba(255,136,51,.07); }
.stat-icon { font-size: 1.4rem; margin-bottom: .5rem; }
.stat-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-dim); font-weight: 600; }
.stat-value { font-family: var(--mono); font-size: 2.2rem; font-weight: 700; line-height: 1.1; color: var(--text-bright); margin: .3rem 0 .2rem; }
.stat-value.cyan   { color: var(--cyan); text-shadow: var(--glow-c); }
.stat-value.green  { color: var(--green); text-shadow: 0 0 20px rgba(0,255,136,.3); }
.stat-value.purple { color: var(--purple); text-shadow: 0 0 20px rgba(136,68,255,.3); }
.stat-value.orange { color: var(--orange); }
.stat-sub { font-size: .7rem; color: var(--text-dim); }
.stat-sub strong { color: var(--text); }
.stat-bar { margin-top: .7rem; height: 3px; background: rgba(255,255,255,.07); border-radius: 2px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 2px; transition: width .8s cubic-bezier(.4,0,.2,1); }
.sig-stars { font-size: .8rem; margin-left: .3rem; }
.sig-badge {
  display: inline-block; font-size: .6rem; font-weight: 700; letter-spacing: .05em;
  padding: .15rem .45rem; border-radius: 3px; text-transform: uppercase; margin-top: .35rem;
}
.sig-badge.sig-yes { background: rgba(0,255,136,.12); color: var(--green); border: 1px solid rgba(0,255,136,.3); }
.sig-badge.sig-no  { background: rgba(255,51,102,.12); color: var(--red);  border: 1px solid rgba(255,51,102,.3); }

/* ===== SCORE LIST CARDS (second stat row) ===== */
.sc-card { padding: 1.1rem 1.4rem 1rem; }
.sc-card .stat-label { margin-bottom: .6rem; display: block; }
.sl-list { display: flex; flex-direction: column; gap: .1rem; }
.sl-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: .28rem .4rem; border-radius: 5px; cursor: pointer;
  transition: background .15s; gap: .5rem;
}
.sl-item:hover,
.sl-item:focus-visible { background: var(--row-hover); outline: none; }
.sl-item:focus-visible { box-shadow: inset 0 0 0 1px var(--border-hi); }
.sl-combo { font-family: var(--mono); font-size: .8rem; display: flex; align-items: center; gap: .22rem; }
.sl-w { color: var(--text-bright); }
.sl-l { color: var(--text-dim); }
.sl-w.sl-prime { color: var(--green); }
.sl-l.sl-prime { color: var(--green); }
.sl-sep { color: var(--text-dim); font-size: .7rem; }
.sl-right { display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; }
.sl-count { font-family: var(--mono); font-size: .72rem; color: var(--cyan); white-space: nowrap; }
.sl-date  { font-family: var(--mono); font-size: .64rem; color: var(--text-dim); white-space: nowrap; }
.sl-empty { color: var(--text-dim); font-size: .72rem; padding: .4rem; }

/* ===== CHARTS ROW ===== */
.charts-row { display: flex; flex-direction: column; }
.chart-card { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; min-width: 0; overflow: hidden; }
.chart-card + .chart-card { border-top: 1px solid var(--border); }
.chart-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.chart-title { font-size: .85rem; font-weight: 700; color: var(--text-bright); }
.chart-badge { font-size: .65rem; padding: .2rem .5rem; border-radius: 4px; background: var(--badge-bg); border: 1px solid var(--badge-b); color: var(--cyan); font-family: var(--mono); }
.chart-wrap { position: relative; flex: 1; min-height: 280px; overflow: hidden; }
.chart-wrap canvas { max-width: 100%; max-height: 360px; }

/* ===== SCORE DENSITY CHART ===== */
.density-wrap { padding: 1.25rem 1.25rem .75rem; overflow-x: auto; }
.density-wrap canvas { display: block; max-width: 100%; }

/* ===== HEATMAP ===== */
.hm-controls { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; align-items: center; }
.hm-legend { display: flex; align-items: center; gap: .6rem; font-size: .68rem; color: var(--text-dim); }
.hm-legend-bar { width: 120px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #05051e 0%, #3c148c 1%, #1450dc 4%, #00c8c8 12%, #1ed246 23%, #dcdc00 40%, #ff8200 65%, #ff1414 100%); border: 1px solid var(--border); }
body.light .hm-legend-bar { background: linear-gradient(90deg, #c8d8ea 0%, #3c148c 1%, #1450dc 4%, #00c8c8 12%, #1ed246 23%, #dcdc00 40%, #ff8200 65%, #ff1414 100%); }
.hm-legend-labels { display: flex; justify-content: space-between; width: 120px; font-family: var(--mono); font-size: .6rem; }
.heatmap-wrap { width: 100%; overflow-x: auto; }
.heatmap-wrap canvas { display: block; cursor: crosshair; }
.hm-pct-group { display: flex; gap: .2rem; align-items: center; border-left: 1px solid var(--border); padding-left: .5rem; }
.hm-pct-group .pill { font-size: .62rem; padding: .22rem .5rem; }
.hm-tooltip {
  position: fixed; pointer-events: none; z-index: 400;
  background: var(--card-solid); color: var(--text);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-sm); padding: .6rem .85rem;
  font-size: .72rem; font-family: var(--mono);
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
  opacity: 0; transition: opacity .15s;
  line-height: 1.7; min-width: 210px;
}
.hm-tooltip .click-hint {
  margin-top: .4rem; font-size: .63rem; color: var(--text-dim);
  border-top: 1px solid var(--border); padding-top: .35rem;
}
.hm-tooltip.visible { opacity: 1; }
.hm-tooltip .prime-tag { color: var(--green); font-size: .65rem; margin-left: .3rem; }

/* ===== SCORE MODAL ===== */
.score-modal {
  display: none; position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 1rem;
}
.score-modal.open { display: flex; }
.score-modal-box {
  background: var(--card-solid); border: 1px solid var(--border-hi);
  border-radius: var(--r); box-shadow: 0 24px 80px rgba(0,0,0,.55);
  width: 100%; max-width: 720px; max-height: 82vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.score-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.score-modal-title {
  font-size: .95rem; font-weight: 700;
  color: var(--text-bright); font-family: var(--mono);
}
.score-modal-close {
  background: none; border: none; color: var(--text-dim);
  font-size: 1.3rem; cursor: pointer; line-height: 1;
  padding: .1rem .4rem; border-radius: 4px; transition: color .2s;
}
.score-modal-close:hover { color: var(--text-bright); }
.score-modal-body { overflow-y: auto; padding: 1rem 1.25rem; flex: 1; }
.score-modal-body table {
  width: 100%; border-collapse: collapse; font-size: .75rem;
}
.score-modal-body thead th {
  text-align: left; padding: .45rem .7rem;
  font-size: .62rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-dim); font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.score-modal-body tbody tr { border-bottom: 1px solid rgba(60,110,190,.07); }
.score-modal-body tbody tr:hover { background: var(--row-hover); }
.score-modal-body tbody td {
  padding: .4rem .7rem; white-space: nowrap; font-family: var(--mono);
}
.score-modal-body .score-cell {
  font-weight: 700; color: var(--cyan); letter-spacing: .05em;
}

/* ===== RECENT GAMES FREQUENCY COLUMNS ===== */
.rc-freq {
  font-family: var(--mono); font-size: .72rem;
  color: var(--text-dim); white-space: nowrap;
}
.rc-freq-combined {
  cursor: pointer; color: var(--cyan);
  font-weight: 600; border-radius: 4px;
  transition: background .15s, color .15s;
}
.rc-freq-combined:hover {
  background: rgba(0,229,255,0.12); color: var(--text-bright);
}

/* ===== RECENT GAMES ===== */
.recent-card { padding: 1.25rem; }
.recent-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem;
}
.recent-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.recent-select {
  padding: .35rem .65rem; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--inp);
  color: var(--text); font-size: .75rem; font-family: inherit;
  outline: none; cursor: pointer; transition: border-color .2s;
}
.recent-select:hover, .recent-select:focus { border-color: var(--border-hi); }
/* Score columns */
.rc-score { font-family: var(--mono); font-weight: 700; font-size: .82rem; white-space: nowrap; }
.rc-prime { color: var(--green); }
.prime-sup { color: var(--green); font-size: .5rem; vertical-align: super; line-height: 0; margin-left: 1px; }
.row-both-prime td:first-child { border-left: 2px solid rgba(0,255,136,0.35); }
/* The Diff card animates its magnitude via animNum (which cannot emit a "+"),
   so the sign is rendered separately and stays put during the count-up. */
#sv-diff::before { content: attr(data-sign); }

/* Team-table OT / playoff columns: count plus share of that team's games */
.td-share { font-size: .62rem; opacity: .75; margin-left: .15rem; }
.td-ot      { color: var(--orange); }
.td-playoff { color: var(--gold); }

/* Postseason / overtime composition chips on the Total Games card */
.stat-splits { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.split-chip {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .13rem .42rem; border-radius: 999px;
  font-size: .6rem; font-weight: 600; letter-spacing: .03em;
}
.split-val { font-family: var(--mono); font-weight: 700; }
.split-playoff { background: rgba(255,204,68,.12); color: var(--gold);   border: 1px solid rgba(255,204,68,.35); }
.split-ot      { background: rgba(255,136,51,.12); color: var(--orange); border: 1px solid rgba(255,136,51,.35); }

/* Game-type badges */
.gtype {
  display: inline-block; padding: .12rem .38rem; border-radius: 4px;
  font-size: .6rem; font-weight: 700; letter-spacing: .04em; white-space: nowrap;
}
/* Each badge carries a border as well as a tint: the fills are faint enough
   that tint alone is easy to miss, and OT vs All-Star previously rendered in
   an identical orange. */
.gtype-reg    { color: var(--text-dim); border: 1px solid transparent; }
.gtype-playoff{ background: rgba(255,204,68,.16); color: var(--gold);   border: 1px solid rgba(255,204,68,.45); }
.gtype-ot     { background: rgba(255,136,51,.16); color: var(--orange); border: 1px solid rgba(255,136,51,.45); }
.gtype-cup    { background: rgba(136,68,255,.14); color: var(--purple); border: 1px solid rgba(136,68,255,.40); }
.gtype-asg    { background: rgba(0,229,255,.12);  color: var(--cyan);   border: 1px solid rgba(0,229,255,.38); }

/* Row-level emphasis. Prime rows already claim the left edge, so postseason
   and overtime tint the row and mark the right edge instead — a playoff game
   that also went to OT shows both without either signal being lost. */
.row-playoff td { background: rgba(255,204,68,.045); }
.row-ot      td { background: rgba(255,136,51,.04); }
.row-playoff.row-ot td { background: rgba(255,170,50,.07); }
.row-playoff td:last-child { border-right: 2px solid rgba(255,204,68,.45); }
.row-ot:not(.row-playoff) td:last-child { border-right: 2px solid rgba(255,136,51,.40); }

/* ===== TABLE ===== */
.table-card { padding: 1.25rem; }
.table-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: .5rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .75rem; }
thead th {
  text-align: left; padding: .55rem .8rem;
  font-size: .62rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-dim); font-weight: 600;
  border-bottom: 1px solid var(--border);
  cursor: pointer; white-space: nowrap; user-select: none;
}
thead th:hover { color: var(--cyan); }
thead th.sort-asc::after  { content: ' ↑'; color: var(--cyan); }
thead th.sort-desc::after { content: ' ↓'; color: var(--cyan); }
tbody tr { border-bottom: 1px solid rgba(60,110,190,.08); transition: background .15s; }
tbody tr:hover { background: var(--row-hover); }
tbody td { padding: .5rem .8rem; vertical-align: middle; white-space: nowrap; font-family: var(--mono); }
.td-team { display: flex; flex-direction: column; font-family: 'Inter', sans-serif; }
.td-abbr { font-weight: 700; font-size: .8rem; color: var(--text-bright); font-family: var(--mono); }
.td-city { font-size: .62rem; color: var(--text-dim); font-family: 'Inter', sans-serif; }
.td-conf { display: inline-block; padding: .15rem .45rem; border-radius: 4px; font-size: .6rem; font-weight: 700; letter-spacing: .06em; }
.td-conf.East { background: rgba(255,102,68,.12); color: #ff9977; }
.td-conf.West { background: rgba(68,136,255,.12); color: #77aaff; }
.diff-pos { color: var(--green); }
.diff-neg { color: var(--red); }
.z-high-pos { color: var(--green); }
.z-high-neg { color: var(--red); }
.z-mid  { color: var(--orange); }
.z-low  { color: var(--text-dim); }
.mini-bar { width: 70px; height: 4px; background: rgba(255,255,255,.08); border-radius: 2px; display: inline-block; vertical-align: middle; overflow: hidden; }
.mini-bar-fill { height: 100%; border-radius: 2px; }

/* ===== LOADING ===== */
.skeleton { background: linear-gradient(90deg,rgba(255,255,255,.03) 25%,rgba(255,255,255,.07) 50%,rgba(255,255,255,.03) 75%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: 4px; }
@keyframes sk { 0%{background-position:100% 50%} 100%{background-position:0% 50%} }
.loading-overlay { display: flex; align-items: center; justify-content: center; min-height: 80px; color: var(--text-dim); font-size: .8rem; gap: .6rem; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--toggle-bg); border-top-color: var(--cyan); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== MISC ===== */
.section-title { font-size: .85rem; font-weight: 700; color: var(--text-bright); }
.section-sub { font-size: .68rem; color: var(--text-dim); margin-top: .15rem; }
.no-data { text-align: center; padding: 3rem; color: var(--text-dim); font-size: .8rem; }
.search-input { padding: .38rem .7rem; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--inp); color: var(--text); font-size: .75rem; font-family: inherit; outline: none; transition: border-color .2s; }
.search-input:focus { border-color: var(--border-hi); }

/* ===== ABOUT ===== */
.about-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
}
@media(max-width: 860px) { .about-grid { grid-template-columns: 1fr; } }

.about-card {
  padding: 1.6rem 1.75rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.about-card:nth-child(even)  { border-right: none; }
.about-card:nth-last-child(-n+2) { border-bottom: none; }
@media(max-width: 860px) {
  .about-card { border-right: none; }
  .about-card:last-child { border-bottom: none; }
  .about-card:nth-last-child(2) { border-bottom: 1px solid var(--border); }
}

.about-icon {
  font-size: 1.4rem; line-height: 1; margin-bottom: .6rem;
}
.about-h {
  font-size: .88rem; font-weight: 700; color: var(--text-bright);
  margin-bottom: .65rem; letter-spacing: .01em;
}
.about-card p {
  font-size: .78rem; color: var(--text); line-height: 1.7;
  margin-bottom: .7rem;
}
.about-card p:last-child { margin-bottom: 0; }
.about-card strong { color: var(--text-bright); font-weight: 600; }
.about-card em { color: var(--cyan); font-style: normal; }
.about-card code {
  font-family: var(--mono); font-size: .74rem;
  background: var(--badge-bg); border: 1px solid var(--badge-b);
  padding: .15rem .45rem; border-radius: 4px; color: var(--cyan);
  white-space: nowrap;
}
.about-list {
  font-size: .78rem; color: var(--text); line-height: 1.7;
  padding-left: 1.1rem; margin-bottom: .7rem;
}
.about-list li { margin-bottom: .45rem; }
.about-list li:last-child { margin-bottom: 0; }
.about-list strong { color: var(--text-bright); font-weight: 600; }

/* ===== BELOW-EXPECTED ROW ANNOTATION ===== */
/* Marks teams whose actual prime rate sits under their expected rate. The ⓘ is
   focusable so the explanation is reachable without a mouse. */
.td-abbr-row { display: inline-flex; align-items: center; gap: .1rem; }
/* The badge is 16px visually but carries an 8px transparent ring of padding so
   the real pointer/touch target clears 24px without disturbing the layout. */
.below-note {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; padding: 0; margin: 0;
  border-radius: 50%; border: 1px solid var(--badge-b);
  background: var(--badge-bg); color: var(--cyan);
  font-size: .62rem; font-weight: 700; font-family: var(--mono); line-height: 1;
  cursor: pointer; flex-shrink: 0;
  transition: border-color .15s, background .15s, color .15s;
}
.below-note::after {           /* invisible 28px hit area */
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
}
.below-note:hover,
.below-note:focus-visible {
  border-color: var(--border-hi);
  background: var(--pill-act-bg);
  color: var(--text-bright);
}
/* Tint the badge by direction so the table scans at a glance. Kept subtle —
   the Diff column is the primary signal; this is a secondary cue. */
.below-note--below { border-color: rgba(255,51,102,.28); color: var(--red); background: rgba(255,51,102,.07); }
.below-note--above { border-color: rgba(0,255,136,.22);  color: var(--green); background: rgba(0,255,136,.06); }
.below-note--below:hover, .below-note--below:focus-visible { border-color: rgba(255,51,102,.6); }
.below-note--above:hover, .below-note--above:focus-visible { border-color: rgba(0,255,136,.5); }
tr.row-below-expected td:first-child { border-left: 2px solid rgba(255,136,51,.45); }

/* Tooltip body styling for the below-expected explanation.
   The shared .hm-tooltip only sets min-width, so an explicit max-width is
   required or the prose stretches to the full viewport width. */
#belowTooltip { max-width: min(360px, calc(100vw - 24px)); white-space: normal; }
.below-tip-title { color: var(--text-bright); font-weight: 700; margin-bottom: .35rem; }
.below-tip-grid {
  display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem;
  margin: .35rem 0; padding: .35rem 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.below-tip-grid span:nth-child(odd) { color: var(--text-dim); }
.below-tip-grid span:nth-child(even) { text-align: right; color: var(--text-bright); }
.below-tip-note { font-size: .68rem; line-height: 1.6; color: var(--text); }
.below-tip-sig  { margin-top: .3rem; font-size: .67rem; color: var(--text-dim); }

/* ===== ACCESSIBILITY ===== */
/* Visible keyboard focus. :focus-visible keeps the ring off mouse clicks while
   guaranteeing keyboard users always see where they are. */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 3px;
}
.pill:focus-visible,
.theme-btn:focus-visible,
.btn:focus-visible,
.collapse-btn:focus-visible,
thead th:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.search-input:focus-visible,
.ms-search:focus-visible,
.recent-select:focus-visible,
.theme-select:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
  border-color: var(--border-hi);
}
/* Range thumbs need the ring on the control itself */
.range-inputs input[type="range"]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* Skip link — first tab stop, lets keyboard users bypass the header */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 900;
  background: var(--card-solid); color: var(--cyan);
  border: 1px solid var(--border-hi); border-radius: var(--r-sm);
  padding: .55rem 1rem; font-size: .78rem; font-weight: 600;
}
.skip-link:focus { left: .75rem; top: .75rem; }

/* Screen-reader-only text */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Sortable headers: keyboard-reachable and direction announced via aria-sort */
thead th[data-col] { cursor: pointer; }
thead th[aria-sort="ascending"]::after  { content: ' ↑'; color: var(--cyan); }
thead th[aria-sort="descending"]::after { content: ' ↓'; color: var(--cyan); }

/* Non-blocking error banner (replaces alert()) */
.error-banner {
  display: none; align-items: center; gap: .6rem;
  padding: .65rem 1rem; border-radius: var(--r-sm);
  background: rgba(255,51,102,.10); border: 1px solid rgba(255,51,102,.38);
  color: var(--red); font-size: .78rem;
}
.error-banner.visible { display: flex; }
.error-banner button {
  margin-left: auto; background: none; border: 1px solid rgba(255,51,102,.4);
  color: var(--red); border-radius: 4px; cursor: pointer;
  font-size: .7rem; font-family: inherit; padding: .2rem .55rem;
}
.error-banner button:hover { background: rgba(255,51,102,.15); }

/* Active-filter count badge on the Clear button */
.filter-count {
  display: none; margin-left: .3rem;
  background: var(--badge-bg); border: 1px solid var(--badge-b);
  color: var(--cyan); border-radius: 10px;
  padding: 0 .35rem; font-size: .6rem; font-weight: 700;
  font-family: var(--mono);
}
.filter-count.visible { display: inline-block; }

/* Respect reduced-motion: kill count-ups, spins, and long transitions */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .spinner { border-top-color: var(--cyan); }
}

/* ===== HEADLINE VERDICT ===== */
.verdict {
  display: flex; align-items: center; gap: 1.1rem;
  padding: 1.1rem 1.5rem;
  background: var(--card); backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.verdict::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--g-main);
}
.verdict-mark {
  font-family: var(--mono); font-size: 2.1rem; line-height: 1;
  color: var(--cyan); flex-shrink: 0; min-width: 2.4rem; text-align: center;
}
.verdict-body { min-width: 0; }
.verdict-line {
  font-size: 1.02rem; font-weight: 600; color: var(--text-bright);
  line-height: 1.45; letter-spacing: -.01em;
}
.verdict-line strong { font-family: var(--mono); font-weight: 700; }
.verdict-sub { font-size: .74rem; color: var(--text-dim); margin-top: .3rem; line-height: 1.5; }

/* ===== EXPORT BUTTONS ===== */
.btn-export { padding: .22rem .6rem; font-size: .65rem; color: var(--text-dim); }
.btn-export:hover { border-color: var(--border-hi); color: var(--cyan); }

/* ===== HEATMAP MOBILE SCROLL ===== */
.hm-hint { display: none; font-size: .65rem; color: var(--text-dim); padding: 0 0 .5rem; }
.heatmap-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }

/* ===== SCORIGAMI ===== */
.gami-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
  padding: 1.15rem 1.4rem 0;
}
@media(max-width:900px) { .gami-stats { grid-template-columns: repeat(2,1fr); } }
@media(max-width:500px) { .gami-stats { grid-template-columns: 1fr; } }
.gami-stat {
  background: var(--inp); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: .75rem .9rem; text-align: center;
}
.gami-stat-val { font-family: var(--mono); font-size: 1.35rem; font-weight: 700; line-height: 1.15; }
.gami-stat-val.cyan { color: var(--cyan); }
.gami-stat-val.green { color: var(--green); }
.gami-stat-val.orange { color: var(--orange); }
.gami-stat-val.purple { color: var(--purple); }
.gami-stat-lbl {
  font-size: .62rem; color: var(--text-dim); margin-top: .3rem;
  text-transform: uppercase; letter-spacing: .05em;
}
.gami-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;
  padding: 1.15rem 1.4rem 1.4rem;
}
@media(max-width:860px) { .gami-grid { grid-template-columns: 1fr; } }
.gami-card {
  background: var(--inp); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 1rem 1.15rem;
  /* Paired cards hold different numbers of rows; stretching them to the row
     height keeps the two columns aligned instead of leaving a ragged edge. */
  display: flex; flex-direction: column;
}
.gami-card .gami-list { flex: 1; }
.gami-card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.gami-card-title { font-size: .78rem; font-weight: 700; color: var(--text-bright); }
.gami-card-badge {
  font-family: var(--mono); font-size: .62rem; color: var(--cyan);
  background: var(--badge-bg); border: 1px solid var(--badge-b);
  padding: .1rem .45rem; border-radius: 999px; white-space: nowrap;
}
.gami-card-sub { font-size: .66rem; color: var(--text-dim); line-height: 1.5; margin: .4rem 0 .7rem; }
.gami-list { display: flex; flex-direction: column; gap: .1rem; }
.gami-row {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  padding: .3rem .4rem; border-radius: 5px; transition: background .15s;
}
.gami-row.is-clickable { cursor: pointer; }
.gami-row.is-clickable:hover,
.gami-row.is-clickable:focus-visible { background: var(--row-hover); outline: none; }
.gami-row.is-clickable:focus-visible { box-shadow: inset 0 0 0 1px var(--border-hi); }
.gami-combo { font-family: var(--mono); font-size: .8rem; display: flex; align-items: center; gap: .22rem; }
.gami-w { color: var(--text-bright); }
.gami-l { color: var(--text-dim); }
.gami-w.is-prime, .gami-l.is-prime { color: var(--green); }
.gami-sep { color: var(--text-dim); font-size: .7rem; }
.gami-star { color: var(--purple); font-size: .7rem; margin-left: .1rem; }
.gami-left  { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; min-width: 0; }
.gami-flags { display: inline-flex; gap: .2rem; }
.gami-flags .gtype { font-size: .54rem; padding: .06rem .28rem; }
.gami-right { display: flex; flex-direction: column; align-items: flex-end; gap: .08rem; }
.gami-metric { font-family: var(--mono); font-size: .7rem; color: var(--orange); white-space: nowrap; }
.gami-metric.cool { color: var(--cyan); }
.gami-note { font-family: var(--mono); font-size: .62rem; color: var(--text-dim); white-space: nowrap; }

/* ===== RESPONSIVE ===== */
/* Tablet: hide refresh timestamp, shrink padding */
@media(max-width:768px) {
  header { padding: 0 1.1rem; gap: .75rem; }
  .container { padding: 1rem 1.1rem; gap: 1rem; }
  .refresh-time { display: none; }
}
/* Phone: two-row header — logo + controls on row 1, badges on row 2 */
@media(max-width:600px) {
  header { padding: .55rem 1rem; gap: .6rem; min-height: unset; }
  .logo { order: 1; flex-shrink: 0; }
  /* Without these the fixed-width team-theme select forces the header past the
     viewport, giving the whole page a horizontal scrollbar on phones. */
  .header-right { order: 2; margin-left: auto; gap: .4rem; flex-shrink: 1; min-width: 0; }
  .theme-select { max-width: 104px; padding: .3rem .45rem; font-size: .68rem; }
  /* Range inputs default to an intrinsic min-width and will not shrink; without
     this the two season sliders push the filter panel past the viewport. */
  .range-inputs { gap: .35rem; }
  .range-inputs input[type="range"] { min-width: 0; }
  .range-val { min-width: 1.9rem; font-size: .7rem; }
  .header-badges {
    order: 3; width: 100%;
    border-top: 1px solid var(--border);
    padding-top: .5rem; padding-bottom: .4rem;
    gap: .75rem; justify-content: space-around;
    font-size: .63rem;
  }
  .hbadge-lbl { display: none; }       /* value + dot only on tiny screens */
  .btn-lbl { display: none; }          /* ↻ icon only for auto-refresh */
  #themeLabel { display: none; }       /* ◑ icon only for theme toggle */
  .refresh-meta { gap: .3rem; }
  .theme-btn { padding: .3rem .55rem; font-size: .7rem; }
  .container { padding: .75rem .75rem; gap: .75rem; }
  .filter-panel { gap: .85rem; padding: .85rem 1rem; }

  /* Verdict: stack the mark above the copy so the sentence keeps its width */
  .verdict { flex-direction: column; align-items: flex-start; gap: .6rem; padding: 1rem 1.1rem; }
  .verdict-mark { font-size: 1.7rem; min-width: 0; text-align: left; }
  .verdict-line { font-size: .92rem; }

  /* Touch users need to know the grid pans; pointer users get a cursor cue */
  .hm-hint { display: block; }
  .gami-stats { padding: 1rem 1rem 0; }
  .gami-grid  { padding: 1rem; }
  .gami-card  { padding: .85rem .95rem; }
}
/* Very small phones */
@media(max-width:380px) {
  .header-badges { display: none; }    /* stat cards below cover this info */
}
