/* ScoutIQ — stadium-night palette, scoreboard type. */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url("fonts/barlow-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  --bg: #f2f4f1;
  --surface: #ffffff;
  --sunken: #e6eae5;
  --ink: #17222e;
  --muted: #5a6875;
  --line: #cfd6d2;
  --run: #b88700;        /* goal-post yellow, darkened for text on light */
  --run-fill: #f2c230;
  --pass: #2f78ad;
  --pass-fill: #74b4de;
  --warn: #b5432c;
  --warn-bg: #fbe9e4;
  --ok: #2d7a4f;
  --focus: #2f78ad;
  --radius-s: 4px;
  --radius-m: 8px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15212d; --surface: #1d2c3b; --sunken: #122030; --ink: #edf1ee; --muted: #9db0bf;
    --line: #2f4356; --run: #f2c230; --run-fill: #f2c230; --pass: #74b4de; --pass-fill: #74b4de;
    --warn: #f0937e; --warn-bg: #3a2522; --ok: #7fcf9f; --focus: #f2c230; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15212d; --surface: #1d2c3b; --sunken: #122030; --ink: #edf1ee; --muted: #9db0bf;
  --line: #2f4356; --run: #f2c230; --run-fill: #f2c230; --pass: #74b4de; --pass-fill: #74b4de;
  --warn: #f0937e; --warn-bg: #3a2522; --ok: #7fcf9f; --focus: #f2c230; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.45; font-variant-numeric: tabular-nums;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.1; margin: 0 0 .5rem; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 .75rem; max-width: 72ch; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.25rem;
  border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5;
}
.brand { font-family: var(--display); font-weight: 700; font-size: 1.5rem; letter-spacing: .01em; text-decoration: none; }
.brand span { color: var(--run); }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a { padding: .4rem .75rem; border-radius: var(--radius-s); text-decoration: none; font-weight: 500; color: var(--muted); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--sunken); }
.nav a:hover { color: var(--ink); }
.who { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .875rem; color: var(--muted); }
.who select { font: inherit; }
main { padding: 1.25rem; max-width: 1800px; margin: 0 auto; }

/* controls */
button, .btn {
  font: inherit; font-weight: 600; border-radius: var(--radius-s); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: .5rem .9rem; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: .4rem; min-height: 40px;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
button.danger { color: var(--warn); border-color: var(--warn); }
button.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--pass); text-decoration: underline; font-weight: 500; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: .45rem .6rem; min-height: 40px;
}
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 1.1rem; height: 1.1rem; accent-color: var(--ink); }
label { font-weight: 500; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.field > span { font-size: .875rem; color: var(--muted); font-weight: 500; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.seg button { border: 0; border-radius: 0; min-width: 3rem; justify-content: center; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* press box */
.press { display: grid; grid-template-columns: minmax(240px, 270px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.rail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem; }
.rail .seg { width: 100%; }
.rail .seg button { flex: 1; }
.downs button { font-family: var(--display); font-size: 1.35rem; min-height: 48px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.pair .field { margin-bottom: .3rem; }
.pair input { width: 100%; font-family: var(--display); font-size: 1.35rem; font-weight: 600; min-height: 48px; }
.hint { margin: 0 0 .9rem; }
.small-seg { width: 100%; }
.small-seg button { flex: 1; min-height: 42px; }
.opp-picker select { font-family: var(--display); font-weight: 600; font-size: 1.25rem; min-height: 48px; }
.persp { display: grid; gap: .35rem; }
.persp label { display: flex; gap: .55rem; align-items: start; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-s); cursor: pointer; font-weight: 500; }
.persp label:has(input:checked) { border-color: var(--ink); background: var(--sunken); }
.persp input { margin-top: .2rem; }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .4rem 0; }
.games-box { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-s); padding: .25rem .5rem; }
.games-box .season { font-weight: 600; font-size: .875rem; color: var(--muted); margin: .5rem 0 .2rem; }
.games-box label { display: flex; gap: .5rem; align-items: center; font-weight: 400; padding: .2rem 0; }
.games-box time { margin-left: auto; color: var(--muted); font-size: .875rem; white-space: nowrap; padding-left: .5rem; }
.run-btn { width: 100%; justify-content: center; font-size: 1.1rem; min-height: 52px; margin-top: .5rem; }

/* the down marker: the one loud element */
.marker { display: flex; align-items: baseline; gap: 1.25rem; flex-wrap: wrap; margin: 0 0 1rem; }
.marker .dd { font-family: var(--display); font-weight: 700; font-size: clamp(2.6rem, 6vw, 4.5rem); line-height: .95; letter-spacing: -.01em; }
.marker .spot { font-family: var(--display); font-weight: 500; font-size: clamp(1.4rem, 3vw, 2rem); color: var(--muted); }
.context { color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }
.context strong { color: var(--ink); font-weight: 600; }

.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem 1.1rem; min-width: 0; }
.panel header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .25rem; }
.panel h2 { margin: 0; }
.n { font-family: var(--display); font-size: 1.15rem; font-weight: 600; }
.constraints { font-size: .875rem; color: var(--muted); margin-bottom: .9rem; }
.badge { display: inline-block; font-size: .8rem; font-weight: 600; padding: .1rem .45rem; border-radius: var(--radius-s); background: var(--warn-bg); color: var(--warn); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .5rem 0 .4rem; }
.split .big { font-family: var(--display); font-weight: 700; font-size: 2.8rem; line-height: 1; }
.split .run .big { color: var(--run); }
.split .pass .big { color: var(--pass); text-align: right; }
.split .pass { text-align: right; }
.split .lbl { font-weight: 600; }
.bar { height: 14px; border-radius: 7px; overflow: hidden; display: flex; background: var(--sunken); margin-bottom: .35rem; }
.bar .r { background: var(--run-fill); }
.bar .p { background: var(--pass-fill); }
.den { font-size: .875rem; color: var(--muted); margin-bottom: .9rem; }
.empty { padding: 1.5rem 0; font-family: var(--display); font-size: 1.6rem; font-weight: 600; color: var(--muted); }
table { border-collapse: collapse; width: 100%; font-size: .925rem; }
th, td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .85rem; }
td.num, th.num { text-align: right; }
.bk { margin-top: .9rem; }
.bk h3 { font-size: 1.05rem; margin-bottom: .2rem; }
.meter { display: inline-block; height: 8px; background: var(--muted); opacity: .35; border-radius: 4px; vertical-align: middle; }
.note { border-left: 3px solid var(--line); padding: .4rem .75rem; color: var(--muted); font-size: .875rem; margin-top: .75rem; }

/* alerts */
.alert { border: 1px solid var(--warn); background: var(--warn-bg); color: var(--ink); border-radius: var(--radius-m); padding: .75rem 1rem; margin-bottom: 1rem; }
.alert.ok { border-color: var(--ok); background: transparent; }
.alert strong { display: block; margin-bottom: .2rem; }
.blocking { list-style: none; padding: 0; margin: .3rem 0 0; }
.blocking li { padding: .3rem 0; border-top: 1px solid var(--line); }
.blocking li:first-child { border-top: 0; }

/* import */
.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.section > h2 { display: flex; gap: .6rem; align-items: baseline; }
.step { font-family: var(--display); color: var(--muted); font-weight: 600; }
.drop { border: 2px dashed var(--line); border-radius: var(--radius-m); padding: 2rem; text-align: center; }
.drop.over { border-color: var(--ink); background: var(--sunken); }
.group { border-top: 1px solid var(--line); padding: 1rem 0; }
.group:first-of-type { border-top: 0; }
.group-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
.group-head h3 { margin: 0; }
.counts { font-size: .9rem; color: var(--muted); }
.gnote { font-size: .875rem; color: var(--warn); margin: .3rem 0; }
.game { display: grid; grid-template-columns: minmax(160px, 1fr) auto auto auto; gap: .75rem; align-items: end; padding: .6rem 0; }
.game .lbl { font-weight: 600; }
.conflict { grid-column: 1 / -1; border: 1px solid var(--warn); border-radius: var(--radius-s); padding: .6rem .75rem; background: var(--warn-bg); }
.conflict label { display: flex; gap: .5rem; align-items: center; font-weight: 400; padding: .15rem 0; }
.rows-table { max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-s); margin-top: .5rem; }
.rows-table table { font-size: .85rem; }
.rows-table thead th { position: sticky; top: 0; background: var(--surface); }
.rows-table tr.hint td { border-top: 2px solid var(--run-fill); }
.hint-tag { font-size: .75rem; color: var(--run); font-weight: 600; display: block; }
.summary-table td, .summary-table th { white-space: nowrap; }
.actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.receipt dt { font-weight: 600; }
.receipt dd { margin: 0 0 .5rem; }
.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: var(--radius-m); z-index: 20; }

@media (max-width: 900px) {
  .press { grid-template-columns: 1fr; }
  .rail { position: static; }
  .panels { grid-template-columns: 1fr; }
  .game { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  main { padding: .75rem 16px; }
  .topbar { flex-wrap: wrap; gap: .5rem; padding: .5rem 16px; }
  .who { margin-left: 0; width: 100%; }
  .game { grid-template-columns: 1fr; }
  .split .big { font-size: 2.3rem; }
}

/* Compact, collapsible tendency details */
.bk-details, .bk-more { border: 1px solid var(--line); border-radius: var(--radius-s); margin-top: .4rem; }
.bk-details > summary, .bk-more > summary { cursor: pointer; padding: .55rem .7rem; font-family: var(--display); font-weight: 600; font-size: 1.1rem; }
.bk-details > table, .bk-more > table { margin-top: .25rem; }
.bk-more { margin: .5rem; }
.bk-details > summary:hover, .bk-more > summary:hover { background: var(--sunken); }

/* Wide, scan-friendly result cards; collapse metadata and formations. */
.result-context { margin: 0 0 .75rem; font-size: .875rem; color: var(--muted); }
.result-context > summary { cursor: pointer; font-weight: 600; }
.result-context ul { margin: .5rem 0; padding-left: 1.5rem; }
.panels { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
.panel { padding: .85rem 1rem; }
.breakdown-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 255px), 1fr)); gap: .75rem; align-items: start; }
.breakdown-grid > .bk { margin-top: .25rem; min-width: 0; }
.breakdown-grid .bk-details { margin-top: 0; }
.breakdown-grid td:first-child { overflow-wrap: anywhere; }
@media (max-width: 560px) { .breakdown-grid { grid-template-columns: 1fr; } }
