/* ===========================================================================
   AH Predictions — the one stylesheet.

   1. Tokens          palette, type, spacing scale
   2. Bootstrap map   point Bootstrap's dark theme at the tokens
   3. Base            body, type, links, focus
   4. Layout          header, main, footer, page head, sections
   5. Components      buttons, forms, tabs, data tables, pills, notices,
                      stat strip, loading
   6. Pages           predictions, track record, team explorer, players

   Colour carries meaning, never decoration: turf = value / win, amber =
   caution / push, red = negative / loss. Everything else is chalk on dark.
   =========================================================================== */

/* ---- 1. Tokens ------------------------------------------------------------- */
:root {
  --bg-base: #0B0F0D;
  --bg-surface: #141A17;
  --bg-raised: #1A221E;
  --chalk: #F2F4EF;
  --chalk-dim: #C5CEC8;           /* body copy, ledes */
  --mist: #8B9A91;                /* labels, secondary text (6.6:1 on base) */
  --turf: #3F8F5C;
  --turf-bright: #5FB07A;         /* turf for text on dark */
  --card-amber: #E8A33D;
  --card-red: #D8554A;
  --red-text: #E3695E;            /* red for text on dark */

  --turf-tint: rgba(63, 143, 92, 0.10);
  --amber-tint: rgba(232, 163, 61, 0.10);
  --red-tint: rgba(216, 85, 74, 0.10);

  --hairline: rgba(139, 154, 145, 0.16);
  --row-divider: rgba(242, 244, 239, 0.06);
  --tile-border: var(--hairline);
  --line-input: #56645C;          /* control borders, 3:1 against base */

  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --fs-11: .6875rem;
  --fs-12: .75rem;
  --fs-13: .8125rem;
  --fs-14: .875rem;
  --fs-15: .9375rem;
  --fs-18: 1.125rem;
  --fs-24: 1.5rem;

  --sp-1: .25rem;   /*  4px */
  --sp-2: .5rem;    /*  8px */
  --sp-3: .75rem;   /* 12px */
  --sp-4: 1rem;     /* 16px */
  --sp-5: 1.5rem;   /* 24px */
  --sp-6: 2rem;     /* 32px */
  --sp-7: 3rem;     /* 48px */

  --radius: 4px;
  --header-h: 52px;
}

/* ---- 2. Bootstrap map ------------------------------------------------------ */
[data-bs-theme="dark"] {
  --bs-body-bg: var(--bg-base);
  --bs-body-color: var(--chalk);
  --bs-body-font-family: var(--font-body);
  --bs-body-font-size: var(--fs-15);
  --bs-emphasis-color: var(--chalk);
  --bs-emphasis-color-rgb: 242, 244, 239;
  --bs-secondary-color: var(--mist);
  --bs-secondary-bg: var(--bg-surface);
  --bs-tertiary-bg: var(--bg-surface);
  --bs-border-color: var(--hairline);
  --bs-border-color-translucent: var(--hairline);
  --bs-border-radius: var(--radius);
  --bs-border-radius-sm: 3px;
  --bs-link-color: var(--turf-bright);
  --bs-link-color-rgb: 95, 176, 122;
  --bs-link-hover-color: var(--chalk);
  --bs-link-hover-color-rgb: 242, 244, 239;
  --bs-primary: var(--turf);
  --bs-primary-rgb: 63, 143, 92;
  --bs-font-sans-serif: var(--font-body);
  --bs-font-monospace: var(--font-mono);
  color-scheme: dark;
}

/* ---- 3. Base --------------------------------------------------------------- */
body {
  font-family: var(--font-body);
  font-size: var(--fs-15);
  line-height: 1.5;
  background: var(--bg-base);
  color: var(--chalk);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--chalk);
}
a { text-underline-offset: 2px; }
.text-muted, .text-secondary { color: var(--mist) !important; }
.mono, .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
::selection { background: rgba(63, 143, 92, 0.45); color: var(--chalk); }

/* Visible focus for keyboard users — this is a tool people tab through. */
:focus-visible {
  outline: 2px solid var(--turf-bright);
  outline-offset: 2px;
}
.form-control:focus-visible, .form-select:focus-visible { outline-offset: 0; }

.skip-link {
  position: absolute; left: var(--sp-4); top: -100px; z-index: 2000;
  background: var(--chalk); color: var(--bg-base); padding: var(--sp-2) var(--sp-3);
  font-weight: 600; border-radius: var(--radius); text-decoration: none;
}
.skip-link:focus { top: var(--sp-2); }


/* ---- 4. Layout ------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 1030;
  background: var(--bg-base);
  border-bottom: 1px solid var(--hairline);
}
.site-header .navbar { min-height: var(--header-h); padding: 0; }
.brand {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-15);
  color: var(--chalk); text-decoration: none; letter-spacing: -0.01em;
  margin-right: var(--sp-5);
}
.brand:hover { color: var(--chalk); }
.brand img { display: block; }
.brand-scope {
  font-family: var(--font-mono); font-size: var(--fs-11); font-weight: 400;
  color: var(--mist); letter-spacing: .02em;
}
.site-nav .nav-link {
  font-size: var(--fs-14); font-weight: 500; color: var(--mist);
  padding: var(--sp-3) var(--sp-3) !important;
  border-bottom: 2px solid transparent;
}
.site-nav .nav-link:hover, .site-nav .nav-link:focus-visible { color: var(--chalk); }
.site-nav .nav-link.active, .site-nav .nav-link[aria-current="page"] {
  color: var(--chalk);
  border-bottom-color: var(--turf);
}
.site-header .navbar-toggler {
  border: 1px solid var(--line-input); padding: var(--sp-1) var(--sp-2);
}
.site-header .navbar-toggler:focus { box-shadow: none; }
.site-header .navbar-toggler-icon { width: 1.2em; height: 1.2em; }
@media (min-width: 768px) {
  .site-nav .nav-link { padding: 15px var(--sp-3) 13px !important; }
}
@media (max-width: 767.98px) {
  .site-nav { padding-bottom: var(--sp-2); }
  .site-nav .nav-link { border-bottom: 0; border-left: 2px solid transparent; padding-left: var(--sp-3) !important; }
  .site-nav .nav-link.active { border-left-color: var(--turf); }
}
.dropdown-menu {
  --bs-dropdown-bg: var(--bg-surface);
  --bs-dropdown-border-color: var(--hairline);
  --bs-dropdown-link-color: var(--chalk);
  --bs-dropdown-link-hover-bg: var(--bg-raised);
  --bs-dropdown-link-hover-color: var(--chalk);
  --bs-dropdown-link-active-bg: var(--turf);
  --bs-dropdown-link-active-color: var(--bg-base);
  --bs-dropdown-font-size: var(--fs-14);
  border-radius: var(--radius);
}

.site-main { padding-top: var(--sp-5); padding-bottom: var(--sp-7); }

.site-footer {
  border-top: 1px solid var(--hairline);
  font-size: var(--fs-12);
  color: var(--mist);
  padding: var(--sp-5) 0 var(--sp-6);
}
.footer-grid {
  display: grid; gap: var(--sp-4) var(--sp-6);
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 1.3fr 1fr 1fr; }
}
.footer-grid p { margin: 0; line-height: 1.6; }
.footer-head {
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-13);
  color: var(--chalk); margin-bottom: var(--sp-1) !important;
}

/* Page head: title, one plain sentence about the page, freshness on the right. */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-2) var(--sp-5);
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--hairline);
}
.page-title {
  font-size: var(--fs-24); line-height: 1.2; margin: 0 0 var(--sp-1);
}
.page-lede {
  color: var(--chalk-dim); font-size: var(--fs-14); margin: 0; max-width: 72ch;
}
.page-meta {
  font-family: var(--font-mono); font-size: var(--fs-12); color: var(--mist);
  white-space: nowrap;
}

.section { margin-top: var(--sp-6); }
.section:first-child { margin-top: 0; }
.section-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: var(--sp-1) var(--sp-4); margin-bottom: var(--sp-2);
}
.section-title {
  font-family: var(--font-display); font-size: var(--fs-15); font-weight: 600;
  margin: 0;
}
.section-meta { font-size: var(--fs-12); color: var(--mist); }
.fine-print {
  font-size: var(--fs-12); color: var(--mist); line-height: 1.6; max-width: 90ch;
}
.fine-print p { margin: 0 0 var(--sp-2); }

/* ---- 5. Components --------------------------------------------------------- */

/* Buttons */
.btn {
  --bs-btn-font-size: var(--fs-13);
  --bs-btn-font-weight: 500;
  --bs-btn-padding-y: .3rem;
  --bs-btn-padding-x: .75rem;
  --bs-btn-border-radius: var(--radius);
  --bs-btn-focus-box-shadow: none;
}
.btn-sm {
  --bs-btn-font-size: var(--fs-12);
  --bs-btn-padding-y: .2rem;
  --bs-btn-padding-x: .55rem;
}
.btn-primary {
  --bs-btn-bg: var(--turf);
  --bs-btn-border-color: var(--turf);
  --bs-btn-color: #07110B;
  --bs-btn-hover-bg: var(--turf-bright);
  --bs-btn-hover-border-color: var(--turf-bright);
  --bs-btn-hover-color: #07110B;
  --bs-btn-active-bg: var(--turf-bright);
  --bs-btn-active-border-color: var(--turf-bright);
  --bs-btn-active-color: #07110B;
  font-weight: 600;
}
.btn-outline-primary, .btn-outline-secondary {
  --bs-btn-color: var(--chalk-dim);
  --bs-btn-border-color: var(--line-input);
  --bs-btn-hover-bg: var(--bg-raised);
  --bs-btn-hover-border-color: var(--mist);
  --bs-btn-hover-color: var(--chalk);
  --bs-btn-active-bg: var(--bg-raised);
  --bs-btn-active-border-color: var(--chalk-dim);
  --bs-btn-active-color: var(--chalk);
  --bs-btn-disabled-color: var(--mist);
  --bs-btn-disabled-border-color: var(--hairline);
}
.btn-link { --bs-btn-color: var(--mist); --bs-btn-hover-color: var(--chalk); text-decoration: none; }
/* Segmented controls: the selected option reads as pressed, not as a CTA. */
.btn-check:checked + .btn, .btn.active {
  background: var(--bg-raised); border-color: var(--chalk-dim); color: var(--chalk);
}

/* Forms */
.form-label {
  font-size: var(--fs-12); font-weight: 500; color: var(--mist);
  margin-bottom: var(--sp-1);
}
.form-control, .form-select {
  background-color: var(--bg-base);
  border-color: var(--line-input);
  color: var(--chalk);
  font-size: var(--fs-13);
  border-radius: var(--radius);
}
.form-control::placeholder { color: var(--mist); opacity: 1; }
.form-control:focus, .form-select:focus {
  background-color: var(--bg-base);
  color: var(--chalk);
  border-color: var(--turf-bright);
  box-shadow: none;
}
.form-text { color: var(--mist); font-size: var(--fs-12); }
.form-check-input {
  background-color: var(--bg-base); border-color: var(--line-input);
}
.form-check-input:checked { background-color: var(--turf); border-color: var(--turf); }
.form-check-input:focus { box-shadow: none; border-color: var(--turf-bright); }

/* Filter bar: one row of labelled controls above a data view. */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
}
.filter-bar .field { display: flex; flex-direction: column; min-width: 0; }

/* Underline tabs */
.tabs {
  display: flex; gap: var(--sp-4); border-bottom: 1px solid var(--hairline);
  margin-bottom: var(--sp-3); overflow-x: auto; scrollbar-width: none;
}
.tabs button, .tabs a {
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--mist); font-size: var(--fs-13); font-weight: 500;
  padding: var(--sp-2) 0; margin-bottom: -1px; white-space: nowrap; text-decoration: none;
}
.tabs button:hover, .tabs a:hover { color: var(--chalk); }
.tabs .active, .tabs [aria-selected="true"] { color: var(--chalk); border-bottom-color: var(--turf); }

/* Data tables. Numbers are Plex Mono with tabular figures and right-aligned,
   so columns line up digit for digit. Headers stick under the site header on
   wide screens; on narrow screens the table scrolls sideways with the first
   column pinned, and lower-priority columns (.p2, .p3) drop out first. */
.table-scroll { position: relative; }
@media (max-width: 991.98px) {
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-13);
  font-variant-numeric: tabular-nums;
}
.data-table th, .data-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--row-divider);
  vertical-align: middle;
  text-align: left;
}
.data-table thead th {
  position: sticky; top: var(--header-h); z-index: 2;
  background: var(--bg-base);
  color: var(--mist);
  font-family: var(--font-body);
  font-size: var(--fs-11);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--hairline);
  padding-top: 9px; padding-bottom: 7px;
}
@media (max-width: 991.98px) {
  .data-table thead th { position: static; }
}
.data-table th:first-child, .data-table td:first-child { padding-left: 0; }
.data-table th:last-child, .data-table td:last-child { padding-right: 0; }
.data-table .num, .data-table td.num, .data-table th.num {
  text-align: right; font-family: var(--font-mono); white-space: nowrap;
}
.data-table th.num { font-family: var(--font-body); }
.data-table .ctr { text-align: center; }
.data-table tbody tr:hover > * { background: rgba(242, 244, 239, 0.025); }
.data-table tbody tr:last-child > * { border-bottom-color: var(--hairline); }
.data-table .sub { display: block; color: var(--mist); font-size: var(--fs-12); font-weight: 400; }
.data-table tbody th { font-weight: 500; }
.data-table .group-row > th {
  position: static; text-transform: none; letter-spacing: 0;
  font-family: var(--font-display); font-size: var(--fs-14); color: var(--chalk);
  padding-top: var(--sp-5); background: transparent;
}
/* Sortable headers are buttons, so they work from the keyboard. */
.data-table th button.sort {
  all: unset; cursor: pointer; display: inline-flex; gap: 3px; align-items: center;
}
.data-table th button.sort:focus-visible { outline: 2px solid var(--turf-bright); outline-offset: 2px; }
.data-table th[aria-sort="ascending"] button.sort::after { content: "\2191"; color: var(--chalk); }
.data-table th[aria-sort="descending"] button.sort::after { content: "\2193"; color: var(--chalk); }

/* Pinned first column inside a horizontal scroller. */
@media (max-width: 991.98px) {
  .table-scroll > .data-table.pin-first > * > tr > :first-child {
    position: sticky; left: 0; z-index: 1;
    background: var(--bg-base);
    box-shadow: 1px 0 0 var(--hairline);
    padding-right: var(--sp-3);
  }
}
@media (max-width: 991.98px) { .data-table .p3 { display: none; } }
@media (max-width: 767.98px) { .data-table .p2 { display: none; } }

/* Value colouring for numbers that have a sign worth reading. */
.pos { color: var(--turf-bright) !important; }
.neg { color: var(--red-text) !important; }
.zero { color: var(--mist) !important; }
.text-success { color: var(--turf-bright) !important; }
.text-danger { color: var(--red-text) !important; }
.text-warning { color: var(--card-amber) !important; }

/* Grade: one letter in a fixed box. A/B are the bets (value), C a lean
   (caution), D no real edge. */
.grade {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.4rem; height: 1.4rem; border-radius: 3px;
  font-family: var(--font-mono); font-weight: 600; font-size: var(--fs-12);
  border: 1px solid var(--hairline); color: var(--mist);
}
.grade-a { background: var(--turf); border-color: var(--turf); color: #07110B; }
.grade-b { border-color: var(--turf); color: var(--turf-bright); }
.grade-c { border-color: rgba(232, 163, 61, 0.55); color: var(--card-amber); }

/* Small uppercase tag for states (low sample, no projection, unmapped …). */
.tag, .low-n-tag {
  display: inline-block; vertical-align: middle;
  font-family: var(--font-mono); font-size: var(--fs-11); font-weight: 500;
  letter-spacing: .03em; text-transform: uppercase; white-space: nowrap;
  padding: 0 .35rem; border-radius: 3px;
  border: 1px solid var(--hairline); color: var(--mist);
}
.tag-warn, .low-n-tag { border-color: rgba(232, 163, 61, 0.5); color: var(--card-amber); }
.low-n-tag { margin-left: var(--sp-1); }
.sample-note { color: var(--card-amber); }

/* Notices: empty, error and info states. A rule on the left, never a box of
   colour. */
.notice {
  border-left: 2px solid var(--line-input);
  padding: var(--sp-2) var(--sp-4);
  margin: var(--sp-4) 0;
  font-size: var(--fs-14);
  color: var(--chalk-dim);
}
.notice strong, .notice .notice-title { color: var(--chalk); font-weight: 600; }
.notice p { margin: 0; }
.notice p + p { margin-top: var(--sp-1); }
.notice-warn { border-left-color: var(--card-amber); }
.notice-error { border-left-color: var(--card-red); }
/* Bootstrap alerts still rendered by client-side code read the same way. */
.alert {
  --bs-alert-bg: transparent;
  --bs-alert-border-color: transparent;
  --bs-alert-color: var(--chalk-dim);
  --bs-alert-padding-y: var(--sp-2);
  --bs-alert-padding-x: var(--sp-4);
  border: 0; border-left: 2px solid var(--line-input); border-radius: 0;
  font-size: var(--fs-14);
}
.alert-warning { border-left-color: var(--card-amber); }
.alert-danger { border-left-color: var(--card-red); }

/* Stat strip: a row of figures divided by rules — no tiles. */
.stat-strip {
  display: flex; flex-wrap: wrap;
  border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
  margin-bottom: var(--sp-5);
}
.stat {
  flex: 1 1 8rem; padding: var(--sp-3) var(--sp-4) var(--sp-3) 0;
  margin-right: var(--sp-4);
}
.stat + .stat { border-left: 1px solid var(--row-divider); padding-left: var(--sp-4); margin-right: 0; }
.page-head + .stat-strip { border-top: 0; }
.stat-label {
  display: block; font-size: var(--fs-11); font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--mist); margin-bottom: 2px;
}
.stat-value {
  display: block; font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: var(--fs-24); font-weight: 500; line-height: 1.2; color: var(--chalk);
}
.stat-sub { display: block; font-size: var(--fs-12); color: var(--mist); }
@media (max-width: 575.98px) {
  .stat { flex-basis: 45%; }
  .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stat-value { font-size: var(--fs-18); }
}

/* Loading */
.loading {
  display: flex; align-items: center; gap: var(--sp-2);
  color: var(--mist); font-size: var(--fs-13); padding: var(--sp-3) 0;
}
.loading::before {
  content: ""; width: 12px; height: 12px; flex: 0 0 auto;
  border: 2px solid var(--hairline); border-top-color: var(--chalk-dim);
  border-radius: 50%; animation: spin .8s linear infinite;
}
.loading-inline { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--mist); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .loading::before { animation: none; }
  .spinner-border { animation: none; }
}

/* Panels: a bordered surface for content that genuinely groups (drawers,
   pitch visuals). Not for wrapping every table. */
.panel {
  border: 1px solid var(--hairline); border-radius: var(--radius);
  background: var(--bg-surface); padding: var(--sp-4);
}
.card {
  --bs-card-bg: var(--bg-surface);
  --bs-card-border-color: var(--hairline);
  --bs-card-border-radius: var(--radius);
  --bs-card-inner-border-radius: var(--radius);
  --bs-card-cap-bg: transparent;
  box-shadow: none !important;
}
.badge { font-weight: 600; border-radius: 3px; }

/* Bootstrap tables still rendered by client-side code. */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--chalk);
  --bs-table-hover-bg: rgba(242, 244, 239, 0.025);
  --bs-table-hover-color: var(--chalk);
  --bs-table-border-color: var(--row-divider);
  font-variant-numeric: tabular-nums;
}
.table > thead th, .table-light, .table-light > th, .table-light > td {
  background: transparent !important; color: var(--mist) !important;
  font-size: var(--fs-11); font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  border-bottom: 1px solid var(--hairline);
}
.table td.text-center, .table td.text-end, .table th.text-center, .table th.text-end {
  font-family: var(--font-mono);
}
.table > thead th.text-center, .table > thead th.text-end { font-family: var(--font-body); }

/* Error pages */
.error-page { padding: var(--sp-7) 0; max-width: 40rem; }
.error-code { font-family: var(--font-mono); color: var(--mist); font-size: var(--fs-13); margin-bottom: var(--sp-2); }
.error-page h1 { font-size: 2rem; margin-bottom: var(--sp-3); }
.error-page p { color: var(--chalk-dim); }
.error-links { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-top: var(--sp-4); padding: 0; list-style: none; }

/* ---- 6. Pages -------------------------------------------------------------- */

/* ---- Predictions ----------------------------------------------------------- */
.predictions-filters .form-control,
.predictions-filters .form-select { min-width: 11rem; }
.league-chips { border: 0; padding: 0; margin: 0; min-width: 0; }
.league-chips legend { float: none; width: auto; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.chip {
  position: relative; display: inline-flex; align-items: center;
  min-height: 31px; padding: 0 var(--sp-3);
  border: 1px solid var(--line-input); border-radius: var(--radius);
  font-size: var(--fs-13); color: var(--chalk-dim);
  cursor: pointer; text-decoration: none; user-select: none; white-space: nowrap;
}
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip:hover { border-color: var(--mist); color: var(--chalk); }
.chip.is-on, .chip:has(input:checked) {
  background: var(--bg-raised); border-color: var(--chalk-dim); color: var(--chalk);
}
.chip:has(input:focus-visible) { outline: 2px solid var(--turf-bright); outline-offset: 2px; }
.filter-bar .field-actions { flex-direction: row; align-items: center; gap: var(--sp-2); }
.range-toggle { margin-bottom: var(--sp-4); }
.range-note { font-size: var(--fs-13); color: var(--mist); margin: calc(-1 * var(--sp-2)) 0 var(--sp-4); }
.filter-bar .day-nav { flex-direction: row; gap: var(--sp-1); margin-left: auto; }

.results-line {
  display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4);
  font-size: var(--fs-13); color: var(--mist); margin-bottom: var(--sp-1);
}
.results-line > :first-child { color: var(--chalk); }
.table-key {
  font-size: var(--fs-12); color: var(--mist); line-height: 1.8;
  margin: 0 0 var(--sp-3); max-width: 110ch;
}
.table-key b { color: var(--chalk-dim); font-weight: 600; }
.table-key .grade { width: 1.15rem; height: 1.15rem; font-size: var(--fs-11); vertical-align: -3px; }

.predictions-table th:first-child,
.predictions-table td:first-child { padding-left: var(--sp-3); }
.predictions-table .group-row > th { padding-left: 0; }
.group-count {
  font-family: var(--font-mono); font-size: var(--fs-12); font-weight: 400;
  color: var(--mist); margin-left: var(--sp-2);
}
.prediction-row { cursor: pointer; }
.match-cell { font-weight: 400; min-width: 13rem; }
.row-toggle {
  all: unset; cursor: pointer; display: inline-flex; align-items: baseline;
}
.row-toggle::before {
  content: ""; display: inline-block; flex: 0 0 auto; width: 6px; height: 6px; margin-right: 9px;
  border-right: 1.5px solid var(--mist); border-bottom: 1.5px solid var(--mist);
  transform: translateY(-2px) rotate(-45deg); transition: transform .15s ease;
}
.prediction-row.expanded .row-toggle::before { transform: translateY(-4px) rotate(45deg); }
.row-toggle:focus-visible { outline: 2px solid var(--turf-bright); outline-offset: 3px; border-radius: 2px; }
.teams { color: var(--chalk); font-weight: 500; }
.teams .vs { color: var(--mist); font-weight: 400; margin: 0 2px; }
.match-cell .sub { padding-left: 15px; font-family: var(--font-mono); }
.predictions-table .kick { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--chalk-dim); white-space: nowrap; }
.predictions-table .odds { color: var(--chalk-dim); }
.predictions-table .projected { font-weight: 500; }
.proj-goals {
  display: block; font-family: var(--font-mono); font-size: var(--fs-11); font-weight: 400;
  color: var(--mist); white-space: nowrap;
}
.crest { width: 16px; height: 16px; object-fit: contain; vertical-align: -3px; margin-right: 5px; }
.pick { white-space: nowrap; }
.pick-team { font-weight: 500; color: var(--chalk); }
.pick-line { color: var(--chalk-dim); margin-left: var(--sp-1); font-size: var(--fs-12); }
.prediction-row:not(.is-bet) .pick-team { font-weight: 400; color: var(--chalk-dim); }

@media (max-width: 575.98px) {
  .predictions-table th, .predictions-table td { padding-left: 6px; padding-right: 6px; }
  .predictions-table th:first-child, .predictions-table td:first-child { padding-left: var(--sp-2); }
  .match-cell { min-width: 0; max-width: 46vw; }
  .row-toggle { display: inline; }
  .row-toggle::before { margin-right: 6px; }
  .match-cell .sub { padding-left: 12px; }
  .pick-team {
    display: inline-block; max-width: 26vw; overflow: hidden; text-overflow: ellipsis;
    vertical-align: bottom;
  }
  .pick-line { display: block; margin-left: 0; }
}

/* Recommended bets: a turf rule on the left and a faint turf wash. Solid
   colour, so a pinned first cell carries it too. */
.predictions-table .prediction-row.is-bet > *,
.table-scroll > .predictions-table > tbody > tr.is-bet > :first-child { background: #101C15; }
.predictions-table .prediction-row.is-bet:hover > * { background: #132219; }
.predictions-table .prediction-row.is-bet > :first-child { box-shadow: inset 2px 0 0 var(--turf); }
.prediction-row.no-pred .teams { color: var(--chalk-dim); font-weight: 400; }
.prediction-row.expanded > * { border-bottom-color: transparent; }

/* The detail row: team form and match info for one fixture. */
.detail-row > td { padding: 0 0 var(--sp-4) !important; cursor: default; box-shadow: none !important; }
.detail-row:hover > * { background: transparent !important; }
@media (max-width: 991.98px) {
  .detail-row > td { position: sticky; left: 0; }
  .detail { max-width: calc(100vw - 2 * var(--bs-gutter-x, 1.5rem) / 2); }
}
.detail {
  border: 1px solid var(--hairline); border-radius: var(--radius);
  background: var(--bg-surface);
  padding: var(--sp-1) var(--sp-4) var(--sp-3);
}
.detail .tabs { margin-bottom: var(--sp-4); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); }
@media (min-width: 992px) { .detail-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-6); } }
.detail-team { font-size: var(--fs-14); margin: 0 0 var(--sp-2); }
.detail-team .sub {
  font-family: var(--font-mono); font-size: var(--fs-11); font-weight: 400;
  color: var(--mist); text-transform: uppercase; letter-spacing: .05em; margin-left: var(--sp-1);
}
.detail-note { font-size: var(--fs-12); color: var(--mist); margin: var(--sp-1) 0 var(--sp-3); }
.data-table.compact { font-size: var(--fs-12); }
.data-table.compact th, .data-table.compact td { padding: 4px 6px; }
.data-table.compact thead th { position: static; background: transparent; padding-top: 0; }
.data-table.compact tbody th { font-weight: 500; color: var(--chalk-dim); white-space: nowrap; padding-left: 0; }
.data-table.compact tbody tr:hover > * { background: transparent; }

.xg-roll { display: flex; align-items: center; gap: var(--sp-4); }
.xg-roll-val { display: flex; flex-direction: column; line-height: 1.2; flex: 0 0 auto; }
.xg-roll-val .k {
  font-size: var(--fs-11); font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--mist);
}
.xg-roll-val .v { font-family: var(--font-mono); font-size: var(--fs-18); font-weight: 500; }
.xg-roll-val.for .v { color: var(--turf-bright); }
.xg-roll-val.against .v { color: var(--red-text); }
.xg-chart { flex: 1 1 auto; min-width: 0; max-width: 240px; margin: 0; }
.xg-spark { display: block; width: 100%; height: 40px; }
.xg-chart figcaption { font-size: var(--fs-11); color: var(--mist); margin-top: 2px; }

.info-list {
  display: grid; grid-template-columns: 11rem minmax(0, 1fr);
  gap: var(--sp-3) var(--sp-4); margin: 0; font-size: var(--fs-13);
}
.info-list dt { color: var(--mist); font-weight: 500; }
.info-list dd { margin: 0; color: var(--chalk); }
.info-list .sub { display: block; color: var(--mist); font-size: var(--fs-12); }
@media (max-width: 575.98px) {
  .info-list { grid-template-columns: minmax(0, 1fr); gap: var(--sp-1); }
  .info-list dd + dt { margin-top: var(--sp-2); }
}
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-4); }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li + li { margin-top: 2px; }
.ref-statline { display: flex; flex-wrap: wrap; gap: 2px var(--sp-3); margin-top: 2px; }
.ref-stat { white-space: nowrap; font-family: var(--font-mono); }
/* Disciplinary cards, drawn as cards in their own colours. */
.card-icon {
  display: inline-block; width: 7px; height: 10px; border-radius: 1px;
  margin-right: 4px; vertical-align: -1px;
}
.card-icon.yellow { background: var(--card-amber); }
.card-icon.red { background: var(--card-red); }

/* ---- Track record ----------------------------------------------------------- */
.roi-grid {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-6);
  margin-top: var(--sp-5);
}
@media (min-width: 992px) { .roi-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-6) var(--sp-7); } }
.roi-block .data-table th:first-child { width: 40%; }
.sample-note { font-size: var(--fs-13); margin: calc(-1 * var(--sp-3)) 0 var(--sp-4); }

/* Form guide: last N settled bets as W / P / L cells, like a league table's
   form column. The letter carries the result; colour only reinforces it. */
.form-guide-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.form-guide { display: flex; gap: 3px; list-style: none; margin: 0; padding: 0; }
.form-cell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 2px;
  font-family: var(--font-mono); font-size: var(--fs-11); font-weight: 600; cursor: default;
}
.form-cell.win { background: var(--turf); color: #07110B; }
.form-cell.loss { background: var(--card-red); color: #1C0805; }
.form-cell.push { background: var(--card-amber); color: #1C1205; }

/* ---- Shared small pieces ------------------------------------------------- */
.status-line { margin-bottom: var(--sp-4); font-size: var(--fs-13); color: var(--mist); }
.field-md { min-width: 11rem; }
.field-lg { min-width: 15rem; }
@media (max-width: 575.98px) { .field-lg, .field-md { min-width: 0; width: 100%; } .filter-bar .field { flex: 1 1 100%; } }
.chip-sm { min-height: 26px; padding: 0 var(--sp-2); font-size: var(--fs-12); background: none; }
button.chip { background: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; flex: 0 0 auto;
  background: none; color: var(--mist);
  border: 1px solid var(--line-input); border-radius: var(--radius);
}
.icon-btn:hover { color: var(--chalk); border-color: var(--mist); }

/* ---- Team Explorer --------------------------------------------------------- */
.team-summary { margin-bottom: var(--sp-5); }
.team-title { font-size: var(--fs-24); margin: 0 0 var(--sp-1); }
.manager-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2);
  font-size: var(--fs-13); margin-bottom: var(--sp-3);
}
.manager-line .stat-label { margin: 0; }
.manager-line .ref-sep { color: var(--mist); }
.mgr-formation {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500;
  border: 1px solid var(--hairline); border-radius: 3px; padding: 0 .35rem; color: var(--chalk);
}
#summary { margin-bottom: var(--sp-3); }
#summary .form-guide { margin-top: 6px; }
.result-strip {
  display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0;
  border-bottom: 1px solid var(--hairline);
}
.result-cell {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--sp-2) var(--sp-4) var(--sp-3) 0; margin-right: var(--sp-4);
  font-size: var(--fs-13); min-width: 9rem;
}
.result-cell + .result-cell { border-left: 1px solid var(--row-divider); padding-left: var(--sp-4); margin-right: 0; }
.result-date { font-family: var(--font-mono); font-size: var(--fs-11); color: var(--mist); }
.result-opp { color: var(--chalk); font-weight: 500; white-space: nowrap; }
.result-score { font-family: var(--font-mono); display: inline-flex; align-items: center; gap: var(--sp-1); }
.result-score .form-cell { width: 16px; height: 16px; font-size: 10px; }
@media (max-width: 575.98px) {
  .result-strip { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .result-cell, .result-cell + .result-cell { border-left: 0; padding-left: 0; margin-right: 0; min-width: 0; }
  .result-opp { white-space: normal; }
}

.explorer-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
@media (min-width: 992px) { .explorer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.explorer-panel > .card-body { padding: var(--sp-3) var(--sp-4) var(--sp-4); }
.panel-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--sp-2); margin-bottom: var(--sp-3);
}
.panel-tools { display: flex; align-items: center; gap: var(--sp-2); }
.panel-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4);
  margin-bottom: var(--sp-2); font-size: var(--fs-13);
}
.player-shots { margin-top: var(--sp-3); }

.pitch-wrap { position: relative; }
.pitch-tip {
  /* Above the fullscreen overlay (z 1050) so hover tooltips keep working
     when a panel is pinned. */
  position: fixed; z-index: 2000; pointer-events: none; display: none;
  background: var(--bg-raised); color: var(--chalk);
  border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 6px 9px; font-size: var(--fs-12); line-height: 1.4; max-width: 240px;
}
.tip-sub { color: var(--mist); }
.cap-meta { color: var(--mist); font-family: var(--font-mono); font-size: var(--fs-11); }
.shot-dot { cursor: pointer; }

/* Fullscreen: pin the panel over the viewport, keeping the live SVG and its
   listeners in place. */
.card.fs-overlay {
  position: fixed; inset: 0; z-index: 1050; overflow: auto;
  border-radius: 0; margin: 0; border: 0;
}
.card.fs-overlay > .card-body { max-width: 1100px; width: 100%; margin: 0 auto; }
.card.fs-overlay .pitch-wrap svg,
.card.fs-overlay .goal-card svg {
  max-height: calc(100vh - 230px); width: auto; max-width: 100%;
  margin: 0 auto; display: block;
}
.card.fs-overlay .avgpos-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card.avgpos-card.fs-overlay svg {
  max-height: calc(100vh - 90px); width: auto; max-width: 100%;
  margin: 0 auto; display: block;
}
body.fs-lock { overflow: hidden; }

.shot-stats {
  display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-5);
  padding: var(--sp-2) 0; margin-bottom: var(--sp-2);
  border-top: 1px solid var(--row-divider); border-bottom: 1px solid var(--row-divider);
}
.shot-stat { display: flex; flex-direction: column-reverse; }
.shot-stat-val { font-family: var(--font-mono); font-size: var(--fs-18); font-weight: 500; line-height: 1.2; }
.shot-stat-label { font-size: var(--fs-11); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--mist); }
.shot-stat-note { font-size: var(--fs-12); color: var(--mist); align-self: flex-end; }

.legend-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); margin-top: var(--sp-2); }
.legend-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  min-height: 26px; padding: 0 var(--sp-2);
  background: none; color: var(--chalk-dim); font-size: var(--fs-12);
  border: 1px solid var(--line-input); border-radius: var(--radius); cursor: pointer;
}
.legend-chip:hover { border-color: var(--mist); color: var(--chalk); }
.legend-chip.active { background: var(--bg-raised); border-color: var(--chalk-dim); color: var(--chalk); }
.legend-chip .swatch-shape { width: 13px; height: 13px; display: inline-block; }
.legend-chip .chip-count { font-family: var(--font-mono); font-size: var(--fs-11); color: var(--mist); }
.xg-legend { display: inline-flex; align-items: center; gap: .4rem; margin-left: var(--sp-2); font-size: var(--fs-12); color: var(--mist); }
.xg-legend #xg-legend-swatches svg { display: block; }

.avgpos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: var(--sp-2); }
.avgpos-card svg { width: 100%; height: auto; display: block; }
.player-row { cursor: pointer; }
.player-row.active > * { background: var(--bg-raised) !important; }
.goals-grid { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.goal-card { width: 220px; }
.goal-card svg { width: 100%; height: auto; display: block; }

/* ---- Players, match log, leaderboards ------------------------------------- */
/* Long tables scroll inside a pane so the header stays in view on any screen. */
.table-pane {
  max-height: 72vh; overflow: auto; -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--hairline);
}
.table-pane .data-table thead th { position: sticky; top: 0; }
.table-pane > .data-table.pin-first > * > tr > :first-child {
  position: sticky; left: 0; z-index: 1; background: var(--bg-base);
  box-shadow: 1px 0 0 var(--hairline); padding-left: 0; padding-right: var(--sp-3);
}
.table-pane > .data-table.pin-first > thead > tr > :first-child { z-index: 3; }
.player-table { font-size: var(--fs-12); }
.player-table td, .player-table th { padding: 6px 8px; }
.per90-divider { border-left: 1px solid var(--hairline); }
.summary-row { cursor: pointer; }
.summary-row.active > * { background: var(--bg-raised) !important; }
.strong { font-weight: 600; color: var(--chalk); }
.empty-row { color: var(--mist); text-align: left !important; padding: var(--sp-4) 0 !important; font-family: var(--font-body); }
.player-table tbody > tr > :first-child { white-space: nowrap; }
.xgot-partial { cursor: help; }
.xgot-partial sup { color: var(--card-amber); font-size: .7em; }
.field-sm { width: 7.5rem; }
.page-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-3); }
.data-table td.result { white-space: nowrap; }
.data-table td.result .form-cell { width: 18px; height: 18px; vertical-align: middle; }

.leaders-grid {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-5) var(--sp-6);
}
@media (min-width: 768px) { .leaders-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .leaders-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.leaders-table .rank { width: 2rem; color: var(--mist); padding-right: var(--sp-2); text-align: left; }
.leaders-table tbody th { white-space: normal; color: var(--chalk); }
.leaders-table tbody th .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Team Explorer season panel: the stat strip sits inside a card here. */
.season-panel { margin-bottom: var(--sp-5); }
.season-panel .stat-strip { margin-bottom: 0; }
.season-panel .detail-note:empty { display: none; }

/* Rolling 5-match chart. For/against hues validated for CVD separation on the
   card surface; red/green would collide for deuteranopes. */
.rolling-panel {
  --series-for: #4FA06B;
  --series-against: #9C6AD0;
  margin-bottom: var(--sp-5);
}
.rolling-panel .detail-note:empty { display: none; }
.rolling-legend {
  display: flex; gap: var(--sp-4); font-size: var(--fs-12); color: var(--chalk-dim);
  margin-bottom: var(--sp-1);
}
.rolling-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.line-key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; vertical-align: middle; }
.line-for { background: var(--series-for, #4FA06B); }
.line-against { background: var(--series-against, #9C6AD0); }
.tip-row { display: flex; align-items: center; gap: .4rem; }
.tip-row b { color: var(--chalk); font-family: var(--font-mono); }
.tip-title { font-weight: 600; }
.rolling-chart { width: 100%; min-height: 220px; }
.rolling-svg { display: block; max-width: 100%; height: auto; }
.rolling-svg:focus-visible { outline: 2px solid var(--turf-bright); outline-offset: 2px; }
.rolling-grid { stroke: var(--hairline); stroke-width: 1; }
.rolling-base { stroke: var(--line-input); stroke-width: 1; }
.rolling-warm { fill: rgba(139, 154, 145, 0.06); }
.rolling-axis { fill: var(--mist); font-family: var(--font-mono); font-size: 11px; }
.rolling-end { fill: var(--chalk-dim); font-family: var(--font-mono); font-size: 11px; }
.rolling-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.rolling-line.line-for { stroke: var(--series-for); background: none; }
.rolling-line.line-against { stroke: var(--series-against); background: none; }
.rolling-dot { stroke: var(--bg-surface); stroke-width: 2; }
.dot-for { fill: var(--series-for); }
.dot-against { fill: var(--series-against); }
.rolling-cross { stroke: var(--mist); stroke-width: 1; }
.rolling-table summary { font-size: var(--fs-12); color: var(--mist); cursor: pointer; margin-top: var(--sp-2); }
.rolling-table table { margin-top: var(--sp-2); }
