/* Shared styles for the report and the dashboard.
   Design tokens follow the "warm instrument panel" look: dark by default, cream light theme. */
@font-face { font-family: "Geist"; src: url("../fonts/GeistVF.woff") format("woff"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../fonts/GeistMonoVF.woff") format("woff"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Bebas Neue"; src: url("../fonts/BebasNeue-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("../fonts/InstrumentSerif-Regular.woff2") format("woff2"); font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("../fonts/InstrumentSerif-Italic.woff2") format("woff2"); font-style: italic; font-display: swap; }

:root {
  color-scheme: dark;
  /* NFL palette: deep navy, league red, white, turf green, gold */
  --bg: #050b18;
  --surface: #0b1730;
  --surface2: #112044;
  --line: #1d3260;
  --fg: #f5f7fb;
  --dim: #a6b4d0;
  --faint: #8496bf;
  --focus: #ffb612;
  --accent: #e5141a;        /* fills: buttons, bars, active chips */
  --accent-text: #ff6262;   /* red text and links on navy */
  --accent-ink: #ffffff;    /* text on an accent fill */
  --gold: #ffb612;
  --turf: #1f7a3a;
  --up: #3ddc84;
  --down: #ff5c5c;
  --glow-a: rgba(229, 20, 26, 0.16);
  --glow-b: rgba(1, 51, 105, 0.70);
  --grid: rgba(255, 255, 255, 0.08);
  --yard: rgba(255, 255, 255, 0.05);
  /* categorical chart slots, fixed order (dark steps) */
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, monospace;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f4f9;
  --surface: #ffffff;
  --surface2: #e6ebf4;
  --line: #ccd5e6;
  --fg: #0a1a33;
  --dim: #46587a;
  --faint: #566790;
  --focus: #0a4fc4;
  --accent: #d50a0a;
  --accent-text: #b50808;
  --accent-ink: #ffffff;
  --gold: #a87400;
  --turf: #1f7a3a;
  --up: #12995a;
  --down: #d03b3b;
  --glow-a: rgba(213, 10, 10, 0.08);
  --glow-b: rgba(1, 51, 105, 0.10);
  --grid: rgba(0, 0, 0, 0.09);
  --yard: rgba(1, 51, 105, 0.06);
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
.ambient {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60vw 45vh at 12% -5%, var(--glow-a), transparent 70%),
    radial-gradient(70vw 55vh at 100% 0%, var(--glow-b), transparent 72%),
    repeating-linear-gradient(90deg, var(--yard) 0 2px, transparent 2px 96px);
}
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
nav, main, header, footer { position: relative; z-index: 1; }
a { color: var(--accent-text); text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--surface2); padding: 1px 6px; border-radius: 6px; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-weight: 600; font-size: 17px; }
.brand em { font-size: 21px; color: var(--accent-text); }
.brand-ball { width: 26px; height: 16px; flex: none; filter: drop-shadow(0 0 8px rgba(229,20,26,.45)); }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  color: var(--dim); text-decoration: none; padding: 7px 14px; border-radius: 999px; font-size: 14px;
  font-weight: 500; transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--fg); }
.nav-links a[aria-current="page"] { color: var(--fg); background: var(--surface2); }
.theme-toggle {
  background: none; border: 1px solid var(--line); color: var(--dim); width: 34px; height: 34px;
  border-radius: 50%; cursor: pointer; font-size: 16px; margin-left: 6px;
}
.theme-toggle:hover { color: var(--fg); border-color: var(--faint); }

/* hero */
.hero { max-width: 900px; margin: 0 auto; padding: 72px 24px 28px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-text); }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 7vw, 72px); line-height: 1.02; margin: 14px 0 10px; letter-spacing: -0.01em; }
h1 em { color: var(--accent-text); }
.byline { font-family: var(--mono); font-size: 13px; color: var(--dim); margin: 0 0 22px; }
.lede { font-size: 18px; color: var(--dim); max-width: 760px; }
.btn {
  display: inline-block; margin-top: 12px; padding: 11px 20px; border-radius: 999px; background: var(--accent);
  color: var(--accent-ink); font-weight: 600; text-decoration: none; font-size: 15px; border: 0; cursor: pointer; font-family: var(--sans);
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-text); }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }

/* kpis */
.kpis { max-width: 1100px; margin: 0 auto; padding: 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { padding: 16px 20px 18px; border-radius: 14px; border-top: 3px solid var(--accent); background: linear-gradient(180deg, var(--surface2), var(--surface) 60%); }
.kpi-value { font-family: var(--mono); font-size: clamp(22px, 3vw, 30px); font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 13px; color: var(--dim); margin-top: 4px; }

/* findings */
.finding {
  max-width: 1100px; margin: 0 auto; padding: 56px 24px; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 40px; align-items: start; position: relative;
}
/* sideline hash marks between sections */
.finding::before {
  content: ""; position: absolute; left: 24px; right: 24px; top: 0; height: 9px;
  background: repeating-linear-gradient(90deg, var(--line) 0 2px, transparent 2px 14px);
  border-top: 2px solid var(--line);
}
.finding-text h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 3.2vw, 36px); line-height: 1.12; margin: 10px 0 16px; }
.finding-text p { color: var(--dim); margin: 0 0 14px; }
.finding-text ul { color: var(--dim); padding-left: 20px; }
.finding-text li { margin-bottom: 8px; }
.finding-text strong { color: var(--fg); font-weight: 600; }
.glossary { color: var(--dim); margin: 0 0 14px; }
.glossary dt { color: var(--fg); font-weight: 600; margin-top: 10px; }
.glossary dd { margin: 2px 0 0; }
.finding-text.wide { grid-column: 1 / -1; max-width: 800px; }
.data-section { grid-template-columns: 1fr; }
.chart-card { margin: 0; padding: 20px 20px 12px; }
.chart-box { position: relative; width: 100%; }
.numbers { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.numbers summary { cursor: pointer; font-size: 13px; color: var(--dim); font-family: var(--mono); }
.numbers summary:hover { color: var(--accent-text); }
.tablewrap { overflow: auto; max-height: 340px; margin-top: 10px; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th, table.data td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { position: sticky; top: 0; background: var(--surface2); color: var(--dim); font-weight: 500; font-family: var(--mono); font-size: 12px; }
table.data td { font-family: var(--mono); }
table.data th.t, table.data td.t { text-align: left; }
table.data th { white-space: normal; vertical-align: bottom; }
table.data td { vertical-align: top; }
table.data td.w { white-space: normal; min-width: 14em; }
.chart-card { min-width: 0; }
.footer { text-align: center; color: var(--faint); font-size: 13px; padding: 40px 24px 60px; border-top: 1px solid var(--line); }

/* dashboard */
.dash { max-width: 1280px; margin: 0 auto; padding: 32px 24px 60px; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.dash-head h1 { font-size: clamp(32px, 5vw, 48px); margin: 6px 0 0; }
.status { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.filters { padding: 18px 20px; margin-bottom: 18px; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 20px; align-items: start; }
.filters .seg { margin-top: 0; }
.field label, .field .lbl { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
select {
  width: 100%; background: var(--surface2); color: var(--fg); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-family: var(--sans); font-size: 14px;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
select:focus-visible, input:focus-visible { outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--surface2); color: var(--dim); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
  font-size: 13px; cursor: pointer; font-family: var(--sans);
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.filter-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.filter-actions .btn { margin: 0; padding: 8px 16px; font-size: 14px; }
.controls { display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 18px; padding: 14px 20px; align-items: flex-start; }
.controls .field { flex: 1 1 260px; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.summary .kpi-value { font-size: clamp(20px, 2.3vw, 28px); overflow-wrap: anywhere; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.panel { padding: 18px 20px 14px; }
.panel h2 { margin: 0 0 2px; font-size: 15px; font-weight: 600; }
.panel .sub { color: var(--faint); font-size: 12px; margin: 0 0 10px; font-family: var(--mono); }
.panel .chart-box { height: 300px; }
.panel.tall .chart-box { height: 560px; }
.panel.span2 { grid-column: 1 / -1; }
.table-panel { padding: 18px 20px; }
.table-panel .tablewrap { max-height: 420px; }
.table-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.table-head h2 { margin: 0; font-size: 15px; }
.table-head select { width: auto; }
table.data th.sortable { cursor: pointer; }
table.data th.sortable:hover { color: var(--accent-text); }
.method { color: var(--dim); font-size: 13px; margin-top: 18px; }
.empty { color: var(--dim); text-align: center; padding: 40px 0; }

@media (max-width: 860px) {
  .finding { grid-template-columns: 1fr; gap: 24px; padding: 40px 16px; }
  .charts { grid-template-columns: 1fr; }
  .hero { padding-top: 44px; }
  .nav { padding: 12px 16px; }
  .dash, .kpis { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

/* dashboard additions */
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.loading { padding: 28px; text-align: center; color: var(--dim); }
.progress { height: 6px; border-radius: 999px; background: var(--surface2); overflow: hidden; margin: 0 auto 14px; max-width: 420px; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.pair { display: flex; align-items: center; gap: 8px; }
.pair span { color: var(--faint); font-size: 13px; }
.field.wide2 { grid-column: span 2; }
.field.wide3 { grid-column: span 3; }
.field.wide4 { grid-column: 1 / -1; }
.field.search { position: relative; }
input[type="search"] {
  width: 100%; background: var(--surface2); color: var(--fg); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-family: var(--sans); font-size: 14px;
}
.results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.35);
}
.results li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.results li:hover { background: var(--surface2); }
.results li span { color: var(--dim); font-family: var(--mono); font-size: 12px; }
.results li.none { color: var(--dim); cursor: default; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; margin-bottom: 18px; font-size: 14px; color: var(--dim); }
.banner span { color: var(--fg); }
.notice { margin: -8px 0 18px; padding: 12px 18px; font-size: 14px; color: var(--fg); border-left: 3px solid var(--accent); }
.hint { color: var(--faint); font-size: 12px; margin: 6px 0 0; }
.summary.small { margin-top: -4px; }
.summary.small .kpi { padding: 12px 16px; }
.summary.small .kpi-value { font-size: 20px; }
.table-tools { display: flex; align-items: center; gap: 10px; }
.table-tools select { width: auto; }
.btn.small { padding: 6px 12px; font-size: 13px; margin: 0; }
.filter-note { color: var(--faint); font-size: 12px; }
.panel .empty { padding: 60px 10px; }
@media (max-width: 860px) { .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .field.wide3 { grid-column: 1 / -1; } .banner { flex-direction: column; align-items: flex-start; } }

/* players / teams switch and deep dive */
.viewbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 14px 20px; margin-bottom: 18px; }
.viewbar .hint { margin: 0; max-width: 620px; }
.seg { display: inline-flex; background: var(--surface2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-top: 6px; }
.seg button { border: 0; background: transparent; color: var(--dim); padding: 7px 20px; border-radius: 999px; font-family: var(--sans); font-size: 14px; font-weight: 500; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.deep { padding: 18px 0 0; margin-top: 22px; border-top: 1px solid var(--line); }
.deep .chart-box { height: 420px; }
.deep .tablewrap { max-height: 360px; }

/* team badges and the field widget */
.badge { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.badge img, .badge i { width: 22px; height: 22px; flex: none; border-radius: 50%; object-fit: contain; }
.badge i { display: inline-block; text-align: center; font: 700 8px/22px var(--mono); color: var(--ink, #fff); font-style: normal; background: var(--c, var(--surface2)); }
.badge img { background: rgba(255,255,255,.92); padding: 2px; }
.fieldcard { max-width: 1180px; margin: 12px auto 0; padding: 18px 18px 14px; position: relative; overflow: hidden; }
.fieldbody h2 { display: none; }
.fieldcard h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; margin: 0 0 2px; }
.field-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.field-head p { margin: 0; color: var(--dim); font-size: 14px; max-width: 560px; }
.field-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field-tools select { width: auto; }
.fieldcard { perspective: 1200px; }
.field-wrap { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 2px 4px rgba(2,8,24,.35), 0 28px 50px -26px rgba(2,8,24,.9);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .35s cubic-bezier(.22,1,.36,1), box-shadow .35s, border-color .3s; will-change: transform; }
.field-wrap:hover { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 4px 8px rgba(2,8,24,.4), 0 40px 60px -28px rgba(2,8,24,.95); }
.field-wrap::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; opacity: 0; transition: opacity .35s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(255,255,255,.07), transparent 60%), linear-gradient(180deg, rgba(255,255,255,.06), transparent 22%); }
.field-wrap:hover::after { opacity: 1; }
:root[data-theme="light"] .field-wrap { box-shadow: inset 0 1px 0 #fff, 0 2px 4px rgba(10,26,51,.1), 0 26px 44px -28px rgba(10,26,51,.45); }
@media (prefers-reduced-motion: reduce) { .field-wrap { transform: none; transition: none; } }
.field-wrap canvas { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; cursor: default; touch-action: manipulation; }
.field-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 190px; padding: 10px 12px; border-radius: 12px; font-size: 13px;
  background: rgba(5, 11, 24, .94); color: #f5f7fb; border: 1px solid var(--line); box-shadow: 0 10px 26px rgba(0,0,0,.45);
}
.field-tip b { display: block; font-size: 14px; margin-bottom: 2px; }
.field-tip .badge span { display: none; }
.field-tip .badge i { display: none; }
.field-tip .row { display: flex; justify-content: space-between; gap: 14px; color: #a6b4d0; font-family: var(--mono); font-size: 12px; }
.field-tip .go { color: #ffb612; margin-top: 6px; font-size: 12px; }
.field-caption { color: var(--faint); font-size: 12px; margin: 8px 2px 0; font-family: var(--mono); }
.teamlist { margin-top: 10px; }
.teamlist summary { cursor: pointer; font-family: var(--mono); font-size: 12px; color: var(--dim); }
.teamlist ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 12px; }
.teamlist a { display: flex; align-items: center; gap: 5px; padding: 4px 6px; border-radius: 8px; text-decoration: none; color: var(--fg); font-size: 13px; }
.teamlist a:hover, .teamlist a:focus-visible { background: var(--surface2); }
@media (max-width: 640px) { .field-wrap canvas { aspect-ratio: 4 / 3; } }
@media (max-width: 860px) { .fieldcard { padding: 14px 12px; } }

/* dashboard: presets, collapsed panels, action bar */
:root { --nav-h: 64px; }
.presets { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin: 0 0 16px; }
.presets .lbl { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; }
.preset {
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 999px; padding: 8px 15px;
  font: 500 14px/1.2 var(--sans); cursor: pointer; min-height: 38px;
}
.preset:hover { border-color: var(--accent); color: var(--accent-text); }
.fieldpanel, .advanced { margin-bottom: 16px; padding: 0; }
.fieldpanel > summary, .advanced > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-radius: 20px;
}
.fieldpanel > summary::-webkit-details-marker, .advanced > summary::-webkit-details-marker { display: none; }
.fieldpanel > summary::before, .advanced > summary::before { content: "\25B8"; color: var(--accent-text); transition: transform .15s; }
.fieldpanel[open] > summary::before, .advanced[open] > summary::before { transform: rotate(90deg); }
.fp-title { font-weight: 600; font-size: 15px; }
.fp-current { margin-left: auto; color: var(--dim); font-family: var(--mono); font-size: 12px; text-align: right; }
.fp-body, .adv-body { padding: 0 18px 16px; }
.adv-body h2 { margin: 0; font-size: 15px; }
.adv-body .sub { color: var(--dim); font-size: 13px; margin: 2px 0 10px; }
.field-status { margin: 0 0 10px; font-size: 14px; color: var(--fg); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field-status .btn { margin: 0; }
.more-toggle {
  margin-top: 14px; background: none; border: 1px dashed var(--faint); color: var(--dim); border-radius: 999px; padding: 7px 15px;
  font: 500 13px var(--sans); cursor: pointer; min-height: 36px;
}
.more-toggle:hover { color: var(--fg); border-color: var(--accent); }
.more-toggle::before { content: "+ "; }
.more-toggle[aria-expanded="true"]::before { content: "\2212 "; }
.more-grid { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.sentence { margin: 14px 0 0; color: var(--dim); font-size: 14px; }
.actionbar {
  position: sticky; top: var(--nav-h); z-index: 15; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px);
}
.actionbar .btn { margin: 0; }
.filter-count { margin-right: auto; font-family: var(--mono); font-size: 12px; color: var(--dim); }
.minrow { margin-top: 14px; }
.minrow select { max-width: 380px; }
.glossary-box { flex: 1 1 100%; border-top: 1px solid var(--line); padding-top: 10px; }
.glossary-box summary { cursor: pointer; font-family: var(--mono); font-size: 12px; color: var(--dim); }
.glossary-box .glossary { max-height: 300px; overflow: auto; margin: 10px 0 0; padding-right: 8px; font-size: 14px; }
.sortbtn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; text-align: inherit; white-space: nowrap; }
.sortbtn:hover { color: var(--accent-text); }
.tablewrap:focus-visible { outline-offset: 0; }
.skip { position: absolute; left: 12px; top: -64px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 10px; font-weight: 600; text-decoration: none; }
.skip:focus { top: 10px; }
.results li.active { background: var(--surface2); }

/* the field's touch tooltip (a second tap, or this button, opens the team) */
.field-tip.sticky { pointer-events: auto; }
.field-tip .go-btn { margin: 8px 0 0; width: 100%; min-height: 44px; }
figcaption.chart-caption { font-size: 13px; color: var(--dim); margin: 0 0 10px; }
table.data caption { caption-side: top; text-align: left; color: var(--dim); font-size: 12px; padding: 4px 0 8px; }

/* headings and focus targets must not hide under the sticky nav (and, on the dashboard, the sticky bar under it) */
html { scroll-padding-top: 80px; }
html:has(.actionbar) { scroll-padding-top: 150px; }

/* phones */
@media (max-width: 600px) {
  .filter-grid { grid-template-columns: minmax(0, 1fr); }
  .field.wide2 { grid-column: auto; }
  .field.wide3 { grid-column: auto; }
  select, input[type="search"] { font-size: 16px; min-height: 44px; }
  .chip, .seg button, .preset, .more-toggle, .btn.small, .btn, .field-tools select, .sortbtn { min-height: 44px; }
  .chip { padding: 4px 14px; display: inline-flex; align-items: center; }
  .seg button { padding: 7px 22px; }
  .theme-toggle { width: 44px; height: 44px; }
  .field-tools .btn.small, .seg button { min-height: 44px; }
  .table-tools select { min-height: 44px; }
  .numbers summary, .teamlist summary, .glossary-box summary { min-height: 44px; display: flex; align-items: center; }
  .fp-current { display: none; }
  .actionbar { gap: 8px; position: static; }
  .filter-count { flex: 1 1 100%; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .summary .kpi { padding: 12px 14px; }
  html:has(.actionbar) { scroll-padding-top: 80px; }
}
@media (max-width: 480px) {
  :root { --nav-h: 56px; }
  .nav { padding: 6px 12px; min-height: 56px; }
  .brand { font-size: 15px; gap: 8px; white-space: nowrap; }
  .brand em { font-size: 18px; }
  .nav-links { gap: 2px; }
  .nav-links a { padding: 0 9px; font-size: 13px; min-height: 44px; display: inline-flex; align-items: center; }
  .theme-toggle { margin-left: 2px; }
}
@media (max-width: 400px) { .brand em { display: none; } }

/* conditional formatting in the season tables on the report: red = lowest, green = highest (scripts/build_report.py sets --cs per cell).
   Each shaded cell is a soft rounded tile; the middle of the range stays unfilled, the ends carry a marker as well as a color. */
.tablewrap.has-cs { max-height: 440px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.has-cs table.data th, .has-cs table.data td { padding: 5px 10px; border-bottom: 1px solid color-mix(in srgb, var(--line) 45%, transparent); }
.has-cs table.data th { background: var(--surface2); border-bottom: 1px solid var(--line); z-index: 3; } /* above the shaded tiles, which are positioned, so rows scrolling under the header are hidden by it */
.has-cs table.data td:first-child { color: var(--dim); }
table.data td.cs { position: relative; isolation: isolate; background: none; }
table.data td.cs::before { content: ""; position: absolute; inset: 2px 3px; border-radius: 7px; background: var(--cs); z-index: -1; }
table.data td.cs.hi, table.data td.cs.lo { font-weight: 700; padding-left: 24px; }
table.data td.cs.hi::before { box-shadow: inset 0 0 0 1px rgba(46, 189, 115, 0.75); }
table.data td.cs.lo::before { box-shadow: inset 0 0 0 1px rgba(232, 72, 64, 0.75); }
table.data td.cs.hi::after, table.data td.cs.lo::after { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-size: 10px; line-height: 1; }
table.data td.cs.hi::after { content: "\25B2"; content: "\25B2" / ""; color: rgb(46, 189, 115); }
table.data td.cs.lo::after { content: "\25BC"; content: "\25BC" / ""; color: rgb(232, 72, 64); }
.cs-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 10px 0 0; font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.cs-legend i { width: 120px; height: 8px; border-radius: 6px; background: linear-gradient(90deg, rgba(232, 72, 64, 0.62), rgba(140, 150, 175, 0.12) 50%, rgba(46, 189, 115, 0.62)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 80%, transparent); }
.cs-legend em { flex-basis: 100%; font-style: normal; color: var(--faint); }
.numbers-who { margin-top: 12px; }
.numbers-who summary { cursor: pointer; font-size: 12.5px; color: var(--dim); font-family: var(--mono); }
.numbers-who summary:hover { color: var(--accent-text); }

/* report: the text above each chart and above its table, centered and tidied */
.chart-card figcaption.chart-caption { text-align: center; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.02em; line-height: 1.55; color: var(--faint); margin: 2px auto 14px; max-width: 46ch; text-wrap: balance; }
.chart-card table.data caption { caption-side: top; text-align: center; font-family: var(--serif); font-size: 19px; line-height: 1.2; color: var(--fg); padding: 14px 18px 8px; text-wrap: balance; }
.chart-card table.data caption::before { content: "The numbers behind it"; display: block; margin-bottom: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-text); }
.chart-card .cs-legend { justify-content: center; text-align: center; }
.chart-card .cs-legend em { text-align: center; }
