/* ==========================================================================
   Serie A Analytics: shared styles for every page.
   Colours are defined once as "custom properties" (variables) on :root,
   then redefined for dark mode, so the rest of the file never uses raw hex.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f3f2ec; /* warm chalk */
  --surface: #ffffff;
  --surface-2: #f7f6f1;
  --border: #e1dfd6;
  --text: #14171a;
  --text-muted: #5a5f5a;
  --accent: #0d6b44; /* links: pitch green */
  --on-accent: #ffffff; /* text on an accent-coloured fill */

  --pitch: #0c1210; /* header and hero: near-black, like a floodlit night match */
  --on-pitch: #ffffff;
  --on-pitch-muted: #9fb3a8;
  --line: #2c3a33; /* hairlines on the dark header */
  --neon: #3ddc84; /* bright pitch green for highlights on the dark header */
  --on-neon: #06301a;

  --it-green: #009246;
  --it-red: #ce2b37;

  /* Outcome colours: home = blue, draw = neutral grey, away = orange */
  --home: #2a78d6;
  --draw: #a9a8a3;
  --away: #eb6834;
  /* text drawn on top of each coloured bar segment (chosen for contrast) */
  --on-home: #ffffff;
  --on-draw: #0b0b0b;
  --on-away: #0b0b0b;

  --good: #0a7d3b;
  --bad: #b3261e;
  --zone-cl: #1e6fd9;
  --zone-europe: #e08a00;
  --zone-releg: #c62828;

  --kit-outline: rgba(0, 0, 0, 0.45); /* shirt outlines: dark on light pages */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 23, 26, 0.06), 0 4px 14px rgba(20, 23, 26, 0.05);
  --font: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Barlow Condensed", "Barlow", -apple-system, sans-serif;
}

/* Dark mode: follows the operating system unless a page forces light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1411;
    --surface: #16201b;
    --surface-2: #1b2721;
    --border: #2a3731;
    --text: #f1f4f1;
    --text-muted: #b3beb7;
    --accent: #7fd3a8;
    --on-accent: #0b0b0b;
    --home: #3987e5;
    --draw: #6b6a66;
    --away: #d95926;
    --on-home: #0b0b0b;
    --on-draw: #ffffff;
    --good: #5fcf8c;
    --bad: #f08a80;
    --shadow: none;
    --kit-outline: rgba(255, 255, 255, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1411;
  --surface: #16201b;
  --surface-2: #1b2721;
  --border: #2a3731;
  --text: #f1f4f1;
  --text-muted: #b3beb7;
  --accent: #7fd3a8;
  --home: #3987e5;
  --draw: #6b6a66;
  --away: #d95926;
  --on-home: #0b0b0b;
  --on-draw: #ffffff;
  --good: #5fcf8c;
  --bad: #f08a80;
  --shadow: none;
  --kit-outline: rgba(255, 255, 255, 0.6);
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--accent); }

.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 16px; /* the side gutter on phones */
}

h1, h2, h3 { font-family: var(--font-display); letter-spacing: 0.01em; }
h1 { font-size: 2.4rem; line-height: 1.05; margin: 0 0 8px; text-transform: uppercase; }
h2 { font-size: 1.5rem; margin: 40px 0 12px; text-transform: uppercase; }
.muted { color: var(--text-muted); }
.small { font-size: 0.875rem; }

/* ---------- Header: green-white-red stripe, then a mown pitch ---------- */

.site-header {
  background: var(--pitch);
  color: var(--on-pitch);
  border-top: 5px solid;
  border-image: linear-gradient(90deg, var(--it-green) 0 33.3%, #ffffff 33.3% 66.6%, var(--it-red) 66.6%) 1;
}
.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--on-pitch);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.brand svg { width: 30px; height: 30px; flex: none; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.nav a {
  color: var(--on-pitch-muted);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--on-pitch); }
.nav a[aria-current="page"] { color: var(--on-pitch); border-bottom-color: var(--neon); }
@media (max-width: 420px) {
  .nav { gap: 4px 14px; font-size: 0.95rem; } /* fit all five tabs on one line on phones */
}

/* ---------- Hero: continues the dark header, with a whole pitch drawn faintly ---------- */
/* The pitch is an SVG sized to 85% of the hero's height, so it is never cut off. */

.hero {
  position: relative;
  overflow: hidden;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 130' fill='none' stroke='white' stroke-opacity='0.13' stroke-width='1.2'%3E%3Crect x='1' y='1' width='198' height='128' rx='2'/%3E%3Cline x1='100' y1='1' x2='100' y2='129'/%3E%3Ccircle cx='100' cy='65' r='20'/%3E%3Ccircle cx='100' cy='65' r='1.2' fill='white' fill-opacity='0.13'/%3E%3Crect x='1' y='31' width='32' height='68'/%3E%3Crect x='1' y='49' width='11' height='32'/%3E%3Cpath d='M33 51 A16 16 0 0 1 33 79'/%3E%3Crect x='167' y='31' width='32' height='68'/%3E%3Crect x='188' y='49' width='11' height='32'/%3E%3Cpath d='M167 51 A16 16 0 0 0 167 79'/%3E%3C/svg%3E")
      right max(16px, calc(50% - 400px)) center / auto 85% no-repeat,
    var(--pitch);
  color: var(--on-pitch);
  padding: 26px 0 30px;
  border-bottom: 1px solid var(--line);
}
.hero .container { position: relative; z-index: 1; }
.hero p { color: var(--on-pitch-muted); margin: 0; max-width: 560px; }
.hero a { color: var(--neon); }

main.container { padding-top: 32px; padding-bottom: 64px; } /* breathing room below the header (.container only sets the sides) */

.site-footer { border-top: 1px solid var(--border); padding: 20px 0 40px; }

/* ---------- Headline stats ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--text-muted); font-size: 0.875rem; }
.stat-value.compact { font-size: 1.35rem; }
@media (max-width: 600px) {
  /* On phones: two small tiles side by side, the wide one underneath */
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat.wide { grid-column: 1 / -1; }
  .stat-value { font-size: 1.6rem; }
}

/* ---------- Matchday strip (sits inside the hero) ---------- */
/* A row of chips you can swipe sideways, like the date bar in sports apps. */

.md-strip { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.md-scroller {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none; /* hide the scrollbar (Firefox) */
  padding: 4px 2px;
  flex: 1;
  position: relative; /* so chip positions are measured from the strip's own edge */
  /* fade the chips out at both edges to hint that the row scrolls */
  mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
}
.md-scroller::-webkit-scrollbar { display: none; } /* hide the scrollbar (Chrome, Safari) */
.md-chip {
  flex: none;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 84px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--on-pitch);
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.md-chip:hover { border-color: var(--on-pitch-muted); }
.md-chip .md-num { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; letter-spacing: 0.03em; line-height: 1.1; }
.md-chip .md-dates { font-size: 0.72rem; color: var(--on-pitch-muted); white-space: nowrap; }
.md-chip.is-next .md-dates { color: var(--neon); font-weight: 600; }
.md-chip[aria-pressed="true"] { background: var(--neon); border-color: var(--neon); color: var(--on-neon); }
.md-chip[aria-pressed="true"] .md-dates { color: var(--on-neon); }
.strip-arrow {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--on-pitch);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.strip-arrow:disabled { opacity: 0.3; cursor: default; }
@media (max-width: 600px) {
  .strip-arrow { display: none; } /* on phones you swipe the strip instead */
}

/* ---------- Talking points ---------- */

.section-kicker {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 12px 0 10px;
}
.points { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) {
  /* On phones the cards become a row you swipe, so the matches stay near the top */
  .points {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    margin: 0 -16px;
    padding: 2px 16px 6px;
    scroll-padding: 0 16px;
  }
  .points::-webkit-scrollbar { display: none; }
  .point { flex: 0 0 82%; scroll-snap-align: start; }
}
.point {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.point-icon {
  grid-row: span 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  background: var(--surface-2);
}
.point-kicker { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.point-headline { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; line-height: 1.15; }
.point-detail { font-size: 0.875rem; color: var(--text-muted); }

/* Hidden visually but still read out by screen readers */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Match cards ---------- */

.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.875rem; color: var(--text-muted); margin: 4px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.day-heading {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 22px 0 8px;
}

.match {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.match-teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); /* names may shrink, never overlap the score */
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.team-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  min-width: 0;
}
.team-name.away { justify-content: flex-end; text-align: right; }
.team-name .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) {
  .team-name { font-size: 1.05rem; gap: 6px; }
  .score { font-size: 1.35rem; min-width: 2.6em; padding: 0 6px; }
  .match-teams { gap: 8px; }
}
.kit { width: 24px; height: 23px; flex: none; } /* mini kit shirt (drawn in js/teams.js) */
.kit-outline { stroke: var(--kit-outline); }
.score {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  min-width: 3.2em;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--surface-2);
}
.kickoff { font-size: 1.15rem; color: var(--text-muted); }

.forecast-title { display: flex; justify-content: space-between; gap: 8px; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.verdict { margin-top: 8px; font-weight: 600; font-size: 0.95rem; }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); }
.verdict.neutral { color: var(--text); }
.verdict .detail { font-weight: 400; color: var(--text-muted); }

/* "Compare with bookmakers" panel under each match */
details.more-info { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 8px; }
details.more-info summary { cursor: pointer; color: var(--accent); font-size: 0.875rem; font-weight: 600; }
details.more-info[open] summary { margin-bottom: 10px; }
.forecasts { display: grid; grid-template-columns: 7em 1fr; gap: 6px 10px; align-items: center; }
.forecast-label { font-size: 0.8rem; color: var(--text-muted); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 0.85rem; color: var(--text-muted); }
.facts strong { color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  /* On phones, put each label above its bar so the bar gets the full width */
  .forecasts { grid-template-columns: 1fr; gap: 2px; }
  .forecasts .prob-bar { margin-bottom: 6px; }
}

.empty { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 20px 16px; color: var(--text-muted); }

/* ---------- Probability bar ---------- */
/* Three segments whose widths are the home/draw/away probabilities,
   separated by a 2px gap so neighbouring colours never touch. */

.prob-bar { display: flex; gap: 2px; height: 26px; }
.prob-bar.big { height: 32px; }
.prob-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2px;
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s;
}
.prob-seg:first-child { border-radius: 6px 0 0 6px; }
.prob-seg:last-child { border-radius: 0 6px 6px 0; }
.prob-seg.home { background: var(--home); color: var(--on-home); }
.prob-seg.draw { background: var(--draw); color: var(--on-draw); }
.prob-seg.away { background: var(--away); color: var(--on-away); }
/* Played matches: the outcome that happened stays bright, the others fade */
.prob-bar.decided .prob-seg:not(.happened) { opacity: 0.25; }

.tooltip {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  font-size: 0.8rem;
  padding: 6px 8px;
  border-radius: 6px;
  max-width: 240px;
}

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--border); }
th { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr:last-child td { border-bottom: none; }
th.team, td.team { text-align: left; width: 100%; }
td.team { font-weight: 600; }
td.team .kit { display: inline-block; vertical-align: -5px; margin-right: 8px; }
td.pts { font-weight: 700; }
tr.total td { border-top: 2px solid var(--border); font-weight: 600; }
/* League table zones: a coloured bar on the left of the position */
td.pos { border-left: 4px solid transparent; }
tr.zone-cl td.pos { border-left-color: var(--zone-cl); }
tr.zone-europe td.pos { border-left-color: var(--zone-europe); }
tr.zone-releg td.pos { border-left-color: var(--zone-releg); }
.zone-key { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 0.85rem; color: var(--text-muted); }
.zone-key span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.zone-key .cl::before { background: var(--zone-cl); }
.zone-key .europe::before { background: var(--zone-europe); }
.zone-key .releg::before { background: var(--zone-releg); }

/* On narrow screens hide the less important columns */
@media (max-width: 520px) {
  .hide-narrow { display: none; }
  th, td { padding: 8px 6px; }
  h1 { font-size: 2rem; }
}

/* ---------- Text pages ---------- */

.prose { max-width: 680px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card h3 { margin: 0 0 6px; font-size: 1.3rem; text-transform: uppercase; }
.card p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }
.card .icon { font-size: 1.6rem; line-height: 1; margin-bottom: 8px; }

/* ---------- Data lab ---------- */

/* Where our model and the bookmakers disagree on a match */
.gap-note { margin: 10px 0 0; font-size: 0.875rem; color: var(--text-muted); }
.gap-note.strong { color: var(--text); }

/* This season's scoreboard: most accurate first */
.leaderboard {
  list-style: none;
  margin: 0 0 8px;
  padding: 6px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  counter-reset: rank;
}
.leaderboard li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  counter-increment: rank;
}
.leaderboard li:last-child { border-bottom: none; }
.leaderboard li::before { content: counter(rank); font-family: var(--font-display); color: var(--text-muted); width: 1.2em; }
.leaderboard li span:first-child { flex: 1; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- How it works: hit rates, worked examples ---------- */

/* Hit rates as simple horizontal bars */
.meters { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.meter { display: grid; grid-template-columns: minmax(0, 12em) 1fr 3.5em; gap: 12px; align-items: center; font-size: 0.95rem; }
.meter-track { height: 14px; background: var(--surface-2); border-radius: 7px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--text-muted); border-radius: 7px; }
.meter.ours .meter-fill { background: var(--accent); }
.meter.ours .meter-label, .meter.ours .meter-value { font-weight: 700; }
.meter.baseline .meter-fill { background: var(--border); }
.meter-value { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) {
  .meter { grid-template-columns: 1fr 3.5em; gap: 4px 10px; }
  .meter-label { grid-column: 1 / -1; font-size: 0.875rem; }
}

td.good-num { color: var(--good); font-weight: 600; }

.leaderboard li .muted { font-weight: 400; }

/* ---------- Table page: Now / Predicted tabs and the simulated table ---------- */

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.segmented button {
  font: inherit;
  font-weight: 600;
  padding: 8px 16px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.segmented button[aria-selected="true"] { background: var(--neon); color: var(--on-neon); }

/* Probability cells: the darker the shade, the likelier (green = good news, red = relegation) */
td.chance { font-variant-numeric: tabular-nums; }
td.chance.good { background: color-mix(in srgb, var(--accent) var(--strength), transparent); }
td.chance.bad { background: color-mix(in srgb, var(--zone-releg) var(--strength), transparent); }
td.chance.strong { color: var(--on-accent); font-weight: 700; }
td.chance.bad.strong { color: #ffffff; }
.sim-table th, .sim-table td { white-space: nowrap; }

/* ---------- Market and team pages ---------- */

/* Six menu items: on phones the menu scrolls sideways instead of wrapping */
@media (max-width: 520px) {
  .nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .nav::-webkit-scrollbar { display: none; }
}

a.team-link { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font-weight: 600; }
a.team-link:hover { text-decoration: underline; }
td.team a.team-link .kit { margin-right: 0; }

/* Price changes: green = good news for the team, red = bad news (a rising relegation chance is bad) */
.change { display: inline-block; font-size: 0.8rem; font-weight: 700; font-variant-numeric: tabular-nums; padding: 1px 7px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.change.up { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.change.down { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.change.flat { color: var(--text-muted); }

.board td.trend { width: 96px; }
.sparkline { width: 84px; height: 26px; display: block; }
@media (max-width: 480px) {
  .board .trend-head, .board td.trend { display: none; }
}
a.point.mover { text-decoration: none; color: inherit; }
a.point.mover:hover { border-color: var(--accent); }
.movers:empty { display: none; }

/* Team page */
.team-title { display: flex; align-items: center; gap: 14px; }
.team-title .kit { width: 52px; height: 50px; }
.hero .kit-outline { stroke: rgba(255, 255, 255, 0.7); } /* keep dark shirts visible on the dark header */
.ticker .stat-value { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 8px 4px; }
.price-chart { width: 100%; height: auto; display: block; }
.price-chart .grid { stroke: var(--border); stroke-width: 1; }
.price-chart .axis-label { fill: var(--text-muted); font-size: 12px; font-family: var(--font); }
.price-chart .hit { cursor: pointer; }
.moves { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.moves li { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.form-row { display: flex; gap: 8px; }
.form-chip {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: #ffffff;
}
.form-chip.small { width: 26px; height: 26px; font-size: 0.9rem; border-radius: 7px; margin-right: 8px; }
.form-chip.W { background: #1f9d55; }
.form-chip.D { background: #8a8d8f; }
.form-chip.L { background: #c62828; }
.results { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.results li { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.match.compact { padding: 10px 14px; }
.compact-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 8px; }
.compact-vs { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.team-grid a.team-link { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }

/* ---------- What if? simulator ---------- */

.whatif { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.whatif-side { position: sticky; top: 12px; } /* results stay in view while you pick */
@media (max-width: 760px) {
  .whatif { grid-template-columns: 1fr; }
  .whatif-side { position: static; }
}
.whatif-md { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 10px; }
.whatif-md summary { cursor: pointer; font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.whatif-md[open] summary { margin-bottom: 8px; }
.pick { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; padding: 6px 0; border-top: 1px solid var(--border); }
.pick button {
  font: inherit; cursor: pointer; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 4px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text);
}
.pick button:hover { border-color: var(--text-muted); }
.pick button[aria-pressed="true"] { background: var(--neon); border-color: var(--neon); color: var(--on-neon); }
.pick-name { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 0.9rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-name .kit { width: 18px; height: 17px; }
.pick-chance { font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pick button[aria-pressed="true"] .pick-chance { color: var(--on-neon); }
.pick .pick-D { min-width: 64px; }
.whatif-bar { display: flex; justify-content: space-between; align-items: center; min-height: 32px; margin-bottom: 6px; }
button.reset { font: inherit; font-weight: 600; font-size: 0.875rem; color: var(--accent); background: none; border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
td.whatif-cell { font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.25; }
td.whatif-cell .change { display: block; width: fit-content; margin: 2px 0 0 auto; } /* badge under the number, so columns stay narrow */
#whatif-results th, #whatif-results td { padding-left: 6px; padding-right: 6px; }

/* Phones: headline changes pinned to the bottom of the screen while picking */
.whatif-summary {
  display: none;
  position: sticky; bottom: 10px; z-index: 5;
  width: 100%; margin-top: 12px;
  font: inherit; font-size: 0.85rem; text-align: left; cursor: pointer;
  flex-wrap: wrap; align-items: center; gap: 4px 10px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--pitch); color: var(--on-pitch);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
@media (max-width: 760px) {
  .whatif-summary:not([hidden]) { display: flex; }
}
.summary-label { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; color: var(--neon); letter-spacing: 0.04em; }
.summary-item { font-weight: 600; white-space: nowrap; }
.summary-more { margin-left: auto; color: var(--on-pitch-muted); font-size: 0.8rem; }

th .th-sub { display: block; font-size: 0.68rem; font-weight: 500; text-transform: none; letter-spacing: 0; white-space: nowrap; }

/* ---------- Match page ---------- */

.match-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.hero-team { display: inline-flex; align-items: center; gap: 10px; }
.hero-team .kit { width: 40px; height: 38px; }
.hero-score { background: rgba(255, 255, 255, 0.1); border-radius: 10px; padding: 0 14px; font-variant-numeric: tabular-nums; }
.match-section h2 { margin-top: 28px; }
.match-section:first-child h2 { margin-top: 0; }
p.report { font-size: 1.1rem; line-height: 1.6; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--neon); border-radius: 0; padding: 14px 16px; margin: 0; }
.scorers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scorers-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.scorers-col.away { text-align: right; }
.scorers-team { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; margin-bottom: 6px; }
.scorer { font-size: 0.95rem; }
/* Two-sided stat bars: home share on the left, away on the right */
.stat-compare { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 16px; }
.stat-row { display: grid; grid-template-columns: 3em 1fr 3em; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.stat-row:first-child { border-top: none; }
.stat-row strong:last-child { text-align: right; }
.stat-row.head { grid-template-columns: 1fr 1fr 1fr; font-weight: 700; font-size: 0.85rem; color: var(--text-muted); }
.stat-row.head span:last-child { text-align: right; }
.stat-label { display: grid; gap: 4px; text-align: center; font-size: 0.85rem; color: var(--text-muted); }
.stat-bar { display: flex; gap: 2px; height: 8px; }
.stat-bar .home { background: var(--home); border-radius: 4px 0 0 4px; }
.stat-bar .away { background: var(--away); border-radius: 0 4px 4px 0; }
.top-scores { display: flex; flex-wrap: wrap; gap: 8px; }
.score-chip { display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.score-chip strong { font-family: var(--font-display); font-size: 1.3rem; }
.score-chip span { font-size: 0.8rem; color: var(--text-muted); }
.form-compare { display: grid; gap: 8px; }
.form-team { display: flex; justify-content: space-between; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.back-link { display: inline-block; margin-top: 28px; font-weight: 600; }
/* Match cards on other pages link here */
a.match-link { display: block; color: inherit; text-decoration: none; }
a.match-link:hover .match { border-color: var(--accent); }
.match-more { display: block; margin-top: 8px; font-size: 0.8rem; font-weight: 600; color: var(--accent); text-align: right; }

/* Stat predictions table on match pages */
.stat-predictions td, .stat-predictions th { white-space: nowrap; }
.stat-predictions td.call.good { color: var(--good); font-weight: 600; }
.stat-predictions td.call.bad { color: var(--bad); font-weight: 600; }
@media (max-width: 480px) {
  .stat-predictions td, .stat-predictions th { white-space: normal; } /* wrap so the table fits a phone */
  .stat-predictions td:first-child { min-width: 5.5em; }
}
