/* Jリーグ xG ラボ — paper, rules and data. */

:root {
  --paper: #fbfaf7;
  --surface: #fffefb;
  --ink: #1b1a17;
  --muted: #5f5a52;
  --faint: #8b857b;
  --line: #e4dfd6;
  --line-strong: #c9c2b6;
  --soft: #f3f0e9;
  --link: #1f4e79;
  --link-hover: #153a5b;
  --pos: #2c6844;
  --neg: #9c3b2b;
  --chart-actual: #e16b22;
  --chart-expected: #1769a6;
  --sans: "Hiragino Sans", "Noto Sans CJK JP", "Noto Sans JP", "Yu Gothic",
    "Meiryo", system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", "Menlo", "Consolas", monospace;
  --font: var(--sans);
  --font-mono: var(--mono);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #151a20;
  --surface: #1d252e;
  --ink: #edf1f5;
  --muted: #bac5cf;
  --faint: #97a5b2;
  --line: #35414d;
  --line-strong: #526171;
  --soft: #252f39;
  --link: #8fc9ff;
  --link-hover: #bddfff;
  --pos: #89d8a8;
  --neg: #f5a296;
  --chart-actual: #ffad67;
  --chart-expected: #79c0ff;
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.75;
  font-feature-settings: "palt" 1;
}

a { color: var(--link); }
a:hover { color: var(--link-hover); }
img { max-width: 100%; }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.wrap {
  width: min(1080px, calc(100% - 48px));
  margin-inline: auto;
}

.page { padding-bottom: 8px; }

.skip-link {
  position: absolute;
  top: -60px;
  left: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  z-index: 20;
}
.skip-link:focus { top: 8px; }

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

/* Masthead */

.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line-strong);
}

.header-inner {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 28px;
  padding: 12px 0 0;
}

.brand { display: flex; align-items: center; gap: 10px; padding-bottom: 7px; text-decoration: none; flex: 0 0 auto; }
.brand-logo { display: block; width: 44px; height: 44px; object-fit: contain; border-radius: 50%; flex: 0 0 auto; }
.brand-text { display: grid; line-height: 1.25; }
.brand-text strong {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  padding: 4px 0 10px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--line-strong); }
.nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 600;
}
.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-around;
  align-self: flex-end;
  flex: 0 0 70px;
  width: 70px;
  height: 32px;
  margin-bottom: 7px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle::before {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 30px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 3px #0002;
  content: "";
  transition: transform 180ms ease;
}
.theme-toggle[aria-checked="true"]::before { transform: translateX(32px); }
.theme-icon { position: relative; z-index: 1; width: 16px; height: 16px; }
.theme-toggle[aria-checked="false"] .theme-icon-sun,
.theme-toggle[aria-checked="true"] .theme-icon-moon { color: var(--ink); }
.theme-toggle:hover { border-color: var(--ink); }
@media (prefers-reduced-motion: reduce) {
  .theme-toggle::before { transition: none; }
}

.site-footer {
  margin-top: 56px;
  padding: 22px 0 28px;
  border-top: 1px solid var(--line-strong);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px 32px;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.8;
}
.footer-grid p { margin: 0; }
.footer-grid strong { color: var(--muted); font-weight: 600; }
.footer-links { display: flex; flex-wrap: wrap; gap: 3px 18px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }

/* Page heads */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-top: 14px;
  color: var(--faint);
  font-size: 11px;
}
.breadcrumb a { color: var(--faint); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); text-decoration: underline; }
.breadcrumb .sep { color: var(--line-strong); }

.page-intro {
  padding: 30px 0 16px;
  border-bottom: 1px solid var(--ink);
}
.page-intro h1 {
  margin: 6px 0 6px;
  font-family: var(--sans);
  font-size: clamp(30px, 4vw, 38px);
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.25;
}
.intro-note { margin: 0; color: var(--muted); font-size: 13.5px; }

.page-meta {
  margin: 12px 0 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .02em;
}

.page-head {
  margin: 0;
  padding: 30px 0 16px;
  border-bottom: 1px solid var(--ink);
}
.page-head h1 {
  margin: 6px 0 6px;
  font-family: var(--sans);
  font-size: clamp(28px, 3.6vw, 34px);
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.3;
}
.page-head p { max-width: 74ch; margin: 0; color: var(--muted); font-size: 13.5px; }
.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin-top: 12px;
  color: var(--faint);
  font-size: 12px;
}
.page-head-actions a { text-decoration: none; }
.page-head-actions a:hover { text-decoration: underline; }

.eyebrow {
  margin: 0;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
}

h1, h2, h3 {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .01em;
}

.section { margin: 34px 0; }
.compact-section { margin: 26px 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}
.section-head h2 { margin: 0; font-size: 21px; line-height: 1.4; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }

.section-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.section-line h2 { margin: 0; font-size: 20px; }
.section-line a, .section-link {
  color: var(--link);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}
.section-line a:hover, .section-link:hover { text-decoration: underline; }

.small-note { color: var(--faint); font-size: 11px; }
.muted { color: var(--muted); }

.lead {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.95;
}

.plain-copy {
  max-width: 56em;
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.95;
}
.plain-copy p {
  margin: 0 0 .8em;
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.95;
}
.plain-copy p:last-child { margin-bottom: 0; }

.prose { max-width: 72ch; }
.prose p { margin: 0 0 .85em; font-family: var(--sans); font-size: 14.5px; line-height: 1.95; }
.prose p:last-child { margin-bottom: 0; }
.prose code, .model-note code {
  padding: 1px 5px;
  background: var(--soft);
  font-family: var(--mono);
  font-size: .88em;
}

.note {
  padding: 14px 18px;
  background: var(--soft);
  border-left: 3px solid var(--ink);
}
.note h2 { margin: 0 0 8px; font-size: 18px; }
.note p { margin: 0 0 .6em; color: var(--muted); font-size: 13px; line-height: 1.85; }
.note p:last-child { margin-bottom: 0; }
.note a { font-weight: 600; }

.panel { background: transparent; border: 0; }
.panel-pad { padding: 0; background: transparent; }

/* Tables */

.table-scroll {
  overflow-x: auto;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line-strong);
}
.table-hint { display: none; margin: 0 0 8px; color: var(--faint); font-size: 11px; }
.table-instruction { margin: 10px 0 8px; color: var(--faint); font-size: 11.5px; }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.zero { color: var(--muted); }
.strong { font-weight: 700; }

.data-table,
.compact-table,
.compare-table,
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th,
.data-table td,
.compact-table th,
.compact-table td,
.compare-table th,
.compare-table td,
.standings-table th,
.standings-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child,
.compact-table th:first-child,
.compact-table td:first-child,
.compare-table th:first-child,
.compare-table td:first-child,
.standings-table th:first-child,
.standings-table td:first-child,
.standings-table th:nth-child(2),
.standings-table td:nth-child(2) { text-align: left; }

.data-table thead th,
.compact-table thead th,
.compare-table thead th,
.standings-table thead th {
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

.standings-table thead th,
.matches-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table tbody tr:hover,
.compact-table tbody tr:hover,
.compare-table tbody tr:hover,
.standings-table tbody tr:hover { background: var(--soft); }

.data-table tbody tr:last-child td,
.compact-table tbody tr:last-child td,
.compare-table tbody tr:last-child td,
.standings-table tbody tr:last-child td { border-bottom: 0; }

.compare-table .is-key { background: #f4f1e8; }
.compare-table th[scope="row"] { color: var(--muted); font-weight: 400; }

.rank-cell { color: var(--faint); font-family: var(--mono); font-size: 11px; }

/* Standings */

.standings-scroll {
  overflow-x: auto;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line-strong);
}

.standings-table { font-size: 14px; }
.standings-table th,
.standings-table td { padding: 7px 8px; line-height: 1.45; }
.standings-table thead th { font-size: 12px; }
.standings-table .standings-team { min-width: 7em; }
.standings-table .rank-cell { font-size: 13px; }

.standings-table thead button {
  padding: 1px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.standings-table thead button:hover { color: var(--ink); text-decoration: underline; }
.standings-table th[aria-sort] { background: var(--soft); }
.standings-table th[aria-sort] button { color: var(--ink); }
.standings-table th[aria-sort="ascending"] button::after { content: " ↑"; font-family: var(--mono); }
.standings-table th[aria-sort="descending"] button::after { content: " ↓"; font-family: var(--mono); }

.standings-team .team-cell { gap: 7px; }
.standings-team .team-cell img { width: 18px; height: 18px; }
.standings-team .team-cell a { font-size: 14px; font-weight: 700; }
.standings-table .standings-team { min-width: 7.5em; }
.standings-table .col-extra { background: #faf8f2; }

.table-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 18px;
  margin: 6px 0 2px;
}
.table-heading h2 { margin: 0; font-size: 18px; }
.table-heading h2 span { color: var(--faint); font-family: var(--sans); font-size: 11px; font-weight: 400; }
.table-heading p { margin: 0; color: var(--faint); font-size: 10.5px; }
.table-heading a { font-weight: 600; text-decoration: none; }
.table-heading a:hover { text-decoration: underline; }

.table-footnote {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-top: 6px;
  color: var(--faint);
  font-size: 10px;
}
.table-footnote a { margin-left: auto; color: var(--link); font-weight: 600; text-decoration: none; }
.table-footnote a:hover { text-decoration: underline; }

.team-cell { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.team-cell > * { flex: 0 0 auto; }
.team-cell img { width: 20px; height: 20px; object-fit: contain; }
.team-cell a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); text-decoration: none; }
.team-cell a img { width: 20px; height: 20px; object-fit: contain; }
.compact-table td .opponent-link { display: inline-flex; align-items: center; gap: 5px; }
.compact-table td .opponent-link .emblem { width: 18px; height: 18px; }
.team-cell a:hover { color: var(--link); text-decoration: underline; }
.emblem { width: 22px; height: 22px; object-fit: contain; }
.empty-state { margin: 0; padding: 24px 16px; color: var(--muted); text-align: center; }

/* Badges, chips, buttons */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}
.badge-j1 { color: #1f4e79; border-color: #b7c9d9; background: #f2f6fa; }
.badge-j2 { color: #7a4f1c; border-color: #d8c3a4; background: #fbf5ea; }
.badge-j3 { color: #5b4a7a; border-color: #c9bfd9; background: #f6f3fa; }

.chip {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 2px;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1;
}
.chip-w { color: #2c6844; background: #e3efdf; }
.chip-d { color: #6b665e; background: #ece9e2; }
.chip-l { color: #9c3b2b; background: #f6e2dc; }
.form-row { display: inline-flex; gap: 2px; }
.form-row a:hover { filter: brightness(.94); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--soft); color: var(--ink); }
.btn-primary { background: var(--link); border-color: var(--link); color: #fff; }
.btn-primary:hover { background: var(--link-hover); border-color: var(--link-hover); color: #fff; }
.btn-light, .btn-ghost { background: var(--surface); }

/* League tabs */

.standings-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0 0;
  border-bottom: 1px solid var(--ink);
}
.standings-title h1 {
  margin: 0;
  font-family: var(--sans);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.2;
}
.standings-updated { margin: 3px 0 5px; color: var(--faint); font-family: var(--mono); font-size: 10px; }
.standings-top .league-switch { margin: 0; border-bottom: 0; }

.league-switch {
  display: flex;
  gap: 26px;
  margin: 14px 0 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}
.league-switch button,
.league-switch a {
  margin: 0;
  padding: 6px 0 9px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.league-switch button:hover,
.league-switch a:hover { color: var(--ink); border-bottom-color: var(--line-strong); }
.league-switch button[aria-selected="true"],
.league-switch a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
  background: transparent;
}
.league-switch-links a:last-child { margin-left: auto; }

.league-panel { padding-top: 18px; }

/* Latest matches on the home page */

.latest-list { border-top: 0; }
.latest-row {
  display: grid;
  grid-template-columns: 52px 30px minmax(0, 1fr) 16px;
  gap: 10px;
  align-items: start;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 12.5px;
  text-decoration: none;
}
.latest-row:hover { background: var(--soft); }
.latest-row time,
.latest-row .league-code { color: var(--faint); font-family: var(--mono); font-size: 10.5px; white-space: nowrap; }
.latest-detail { display: grid; grid-template-columns: minmax(0, 1fr) 430px; align-items: center; min-width: 0; gap: 16px; }
.latest-match { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 7px; font-weight: 700; }
.latest-match strong { font-family: var(--mono); font-size: 12px; }
.latest-team { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.latest-match-xg { color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 400; white-space: nowrap; }
.latest-match .emblem { width: 16px; height: 16px; }
.latest-probs { display: block; padding-left: 12px; border-left: 1px solid var(--line-strong); }
.latest-prob-labels { display: flex; flex-wrap: nowrap; gap: 2px 16px; color: var(--faint); font-size: 10.5px; white-space: nowrap; }
.latest-prob-labels .is-actual { color: var(--ink); font-weight: 700; }
@media (max-width: 920px) {
  .latest-detail { display: block; }
  .latest-probs { margin-top: 7px; padding: 6px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .latest-prob-labels { flex-wrap: wrap; }
}
.row-arrow { color: var(--link); text-align: right; text-decoration: none; }

/* Team header and pages */

.team-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  padding: 18px 0 16px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line-strong);
}
.team-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
.team-identity img { width: 58px; height: 58px; object-fit: contain; flex: 0 0 auto; }
.team-head h1 { margin: 0 0 3px; font-family: var(--sans); font-size: clamp(28px, 4vw, 36px); line-height: 1.2; }
.team-page .section-line h2 { font-family: var(--sans); }
.meta-line { margin: 0; color: var(--muted); font-size: 12px; }

.team-kpi-area { min-width: min(100%, 410px); }
.team-kpi-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 12px; padding: 3px; background: var(--soft); border: 1px solid var(--line); }
.team-kpi-tabs button { min-height: 38px; padding: 6px 10px; border: 1px solid transparent; border-radius: 2px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.team-kpi-tabs button:hover { color: var(--ink); background: #fff9; }
.team-kpi-tabs button[aria-selected="true"] { border-color: var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px #0001; }
.team-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.team-kpis[hidden] { display: none; }
.team-kpis div {
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.team-kpis div:first-child { margin-left: 0; padding-left: 0; border-left: 0; }
.team-kpis dt { color: var(--faint); font-size: 10px; letter-spacing: .04em; }
.team-kpis dd { margin: 1px 0 0; font-family: var(--mono); font-size: 19px; font-weight: 700; line-height: 1.25; }
.team-kpis small { display: block; color: var(--muted); font-size: 11px; }
.team-kpis .rank-pill { display: inline-block; margin-top: 4px; padding: 1px 7px; border-radius: 2px; font-weight: 700; }
.rank-pill.rank-top { color: #fff; background: #176044; }
.rank-pill.rank-mid { color: #213c5d; background: #dce9f4; }
.rank-pill.rank-low { color: #7c3228; background: #f5e0d7; }
.team-points-chart { max-width: none; }
.chart.team-points-chart svg { width: auto; max-width: none; min-width: 0; }
.team-points-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.team-points-actual { stroke: var(--chart-actual); }
.team-points-expected { stroke: var(--chart-expected); }
.team-points-dot { fill: var(--surface); stroke-width: 2; cursor: help; }
.team-points-dot:hover, .team-points-dot:focus { r: 7; fill: #fff7cb; outline: none; stroke-width: 4; filter: drop-shadow(0 0 3px #2228); }
.chart-legend .legend-actual { background: var(--chart-actual); }
.chart-legend .legend-expected { background: var(--chart-expected); }
.team-points-tooltip { position: fixed; z-index: 100; max-width: min(330px, calc(100vw - 24px)); padding: 8px 11px; color: #fff; background: #202b36; border-radius: 3px; box-shadow: 0 3px 12px #0004; font-size: 12px; line-height: 1.5; pointer-events: none; }
.team-points-chart svg a image { cursor: pointer; }
.team-points-chart svg a:hover image, .team-points-chart svg a:focus image { filter: drop-shadow(0 0 3px var(--link)); outline: 1px solid var(--link); }

.compact-table a { text-decoration: none; }
.compact-table a:hover { text-decoration: underline; }
.team-result-link { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); font-weight: 700; white-space: nowrap; }
.team-result-link:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.result-mark {
  display: inline-block;
  width: 17px;
  height: 17px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}
.result-w { color: #2c6844; background: #e3efdf; }
.result-d { color: #6b665e; background: #ece9e2; }
.result-l { color: #9c3b2b; background: #f6e2dc; }
.venue-mark { color: var(--faint); font-size: 10px; }

.prob-legend-inline { gap: 14px; margin-bottom: 6px; }
.prob-key { display: inline-flex; align-items: center; gap: 5px; color: var(--faint); font-size: 10.5px; }
.prob-key::before { content: ""; width: 10px; height: 10px; background: var(--line-strong); }
.prob-key-win::before { background: #2c6844; }
.prob-key-draw::before { background: #c9c2b6; }
.prob-key-loss::before { background: #9c3b2b; }

.prob-history { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-strong); }
.prob-history li { border-bottom: 1px solid var(--line); }
.prob-row {
  display: grid;
  grid-template-columns: 44px 88px minmax(110px, 1fr) 106px 62px;
  gap: 10px;
  align-items: center;
  padding: 6px 2px;
  color: var(--ink);
  font-size: 11.5px;
  text-decoration: none;
}
.prob-row:hover { background: var(--soft); }
.prob-date { color: var(--faint); font-family: var(--mono); font-size: 10px; }
.prob-opponent { font-weight: 600; white-space: nowrap; }
.prob-stack { display: flex; width: 100%; height: 8px; overflow: hidden; background: var(--line); }
.prob-stack i { display: block; height: 100%; }
.prob-win { background: #2c6844; }
.prob-draw { background: #c9c2b6; }
.prob-loss { background: #9c3b2b; }
.prob-values { color: var(--faint); font-family: var(--mono); font-size: 9.5px; white-space: nowrap; }
.prob-xp { text-align: right; font-family: var(--mono); font-size: 11px; }

.back-link { margin: 28px 0; font-size: 12px; }
.back-link a { color: var(--muted); text-decoration: none; }
.back-link a:hover { color: var(--ink); text-decoration: underline; }

/* Teams index */

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0 26px;
  border-top: 1px solid var(--line-strong);
}
.team-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.team-card:hover { background: var(--soft); }
.team-card-emblem { width: 26px; height: 26px; object-fit: contain; flex: 0 0 auto; }
.team-card-body { display: grid; min-width: 0; }
.team-card-name { overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.team-card:hover .team-card-name { color: var(--link); text-decoration: underline; }
.team-card-meta { overflow: hidden; color: var(--faint); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.team-card-diff { font-size: 10.5px; }
.team-card-diff small { color: var(--faint); font-size: 9px; }

/* Matches */

.filter-bar,
.sort-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 18px;
  margin-bottom: 14px;
  padding: 10px 0;
  background: transparent;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.filter-bar label,
.sort-bar label { display: grid; gap: 2px; color: var(--faint); font-size: 10px; font-weight: 600; }
.filter-bar select,
.filter-bar input,
.sort-bar select {
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
}
.filter-bar select { min-width: 120px; }
.filter-bar input { min-width: 190px; }
.sort-bar select { min-width: 210px; }
.filter-count,
.sort-count { margin-left: auto; color: var(--faint); font-family: var(--mono); font-size: 10.5px; }
.sort-note { width: 100%; color: var(--faint); font-size: 10.5px; }

.matches-table th, .matches-table td { text-align: center; }
.matches-table th:first-child, .matches-table td:first-child { text-align: center; }
.matches-table td { font-size: 12px; }
.match-teams { font-weight: 700; }
.match-teams-link { display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink); text-decoration: none; }
.match-teams-link:hover { color: var(--link); text-decoration: underline; }
.match-teams .team-cell { gap: 5px; }
.match-teams .team-cell img { width: 18px; height: 18px; }
.match-teams .vs { color: var(--faint); font-size: 9.5px; font-weight: 400; }
.match-score { font-weight: 700; }
.match-detail-link { color: var(--link); text-decoration: none; }
.match-detail-link:hover { text-decoration: underline; }
.header-sub { color: var(--faint); font-size: 9px; font-weight: 400; }
.slash { margin: 0 2px; color: var(--faint); }

/* Posts */

.post-list { margin-top: 4px; border-top: 2px solid var(--ink); }
.post-card {
  display: grid;
  gap: 6px;
  padding: 16px 4px 15px;
  border-bottom: 1px solid var(--line);
}
.post-card:hover { background: var(--soft); }
.post-card-head { display: flex; justify-content: space-between; gap: 12px; color: var(--faint); font-size: 11px; }
.post-meta { display: inline-flex; align-items: center; gap: 8px; }
.post-match-link { color: var(--link); font-size: 11px; text-decoration: none; }
.post-match-link:hover { text-decoration: underline; }

.post-score { display: flex; align-items: center; gap: 10px; }
.post-team { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; }
.post-team.away { margin-left: auto; }
.post-team a { color: var(--ink); text-decoration: none; }
.post-team a:hover { color: var(--link); text-decoration: underline; }
.post-team-emblem { width: 23px; height: 23px; object-fit: contain; }
.post-score strong { font-family: var(--mono); font-size: 23px; letter-spacing: -.03em; }
.post-score .dash { margin: 0 3px; color: var(--faint); font-size: .55em; }
.post-metrics { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--faint); font-size: 11px; }
.post-metrics b { color: var(--ink); font-family: var(--mono); font-weight: 700; }
.post-summary summary { color: var(--link); font-size: 11px; cursor: pointer; }
.post-summary .tweet-text {
  margin: 8px 0 0;
  padding: 8px 0 8px 12px;
  border-left: 2px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.9;
}
.post-review {
  margin: 8px 0 0;
  padding-left: 12px;
  border-left: 2px solid var(--line-strong);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.85;
}
.post-actions { display: flex; gap: 7px; margin-top: 8px; }

/* Match detail */

.match-hero { margin: 22px 0 30px; }
.hero-grid { display: block; }

.score-card {
  padding: 16px 0 14px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line-strong);
}
.match-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px; color: var(--muted); font-size: 11px; }
.meta-sep { color: var(--line-strong); }

.scoreboard { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 14px; margin: 20px 0 14px; }
.team-side-link { display: grid; justify-items: center; gap: 4px; color: var(--ink); text-decoration: none; }
.team-side-link:hover .team-name { color: var(--link); text-decoration: underline; }
.team-side-link .emblem { width: 58px; height: 58px; }
.team-name { font-family: var(--sans); font-size: 19px; font-weight: 600; }
.match-analysis .prose, .match-analysis .article-text { max-width: none; }
.match-stats-section { max-width: 780px; margin-inline: auto; }
.match-stats-table { table-layout: fixed; font-size: 13px; }
.match-stats-table th, .match-stats-table td { padding: 8px 14px; }
.match-stats-table th:first-child { width: 42%; }
.match-stats-table th:not(:first-child) { width: 29%; }
.compare-team { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--ink); white-space: nowrap; }
.compare-team img { width: 26px; height: 26px; object-fit: contain; }
.venue { color: var(--faint); font-size: 9.5px; letter-spacing: .08em; }
.score-box { display: grid; justify-items: center; gap: 3px; }
.score-line { display: flex; align-items: baseline; gap: 7px; font-family: var(--mono); font-size: clamp(38px, 5vw, 50px); font-weight: 700; letter-spacing: -.06em; line-height: 1; }
.score-line .dash { color: var(--faint); font-size: .55em; }
.xg-line { color: var(--faint); font-family: var(--mono); font-size: 10.5px; }
.result-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.result-badge { padding: 0 6px; border: 1px solid var(--line); border-radius: 2px; color: var(--muted); font-size: 10px; }
.result-badge.neutral { color: var(--link); border-color: #b7c9d9; background: #f2f6fa; }

.prob-block { margin-top: 14px; }
.prob-bar { display: flex; height: 6px; overflow: hidden; background: var(--line); }
.prob-bar span { display: block; height: 100%; }
.prob-home { background: var(--link); }
.prob-draw { background: var(--line-strong); }
.prob-away { background: var(--neg); }
.prob-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 11.5px; }
.prob-item { display: flex; align-items: baseline; gap: 6px; color: var(--muted); }
.prob-label { display: inline-flex; align-items: center; gap: 5px; }
.prob-label::before { content: ""; width: 6px; height: 6px; background: var(--link); }
.prob-item:nth-child(2) .prob-label::before { background: var(--line-strong); }
.prob-item:nth-child(3) .prob-label::before { background: var(--neg); }
.prob-item strong { color: var(--ink); font-family: var(--mono); font-size: 12px; }
.probability-chart { max-width: 760px; margin: 18px auto 0; }
.probability-chart-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 13px; }
.probability-chart-head span, .probability-chart figcaption { color: var(--muted); font-size: 11px; }
.probability-chart svg { display: block; width: 100%; height: auto; margin-top: 7px; }
.prob-grid { stroke: var(--line); stroke-width: 1; }
.prob-axis { fill: var(--muted); font: 11px var(--mono); }
.prob-slice { fill: #f0c66e; opacity: .42; }
.prob-marker { stroke: #5b4423; stroke-width: 1.5; stroke-dasharray: 4 3; }
.prob-curve { fill: none; stroke-width: 3; stroke-linejoin: round; }
.prob-point { stroke: var(--surface); stroke-width: 2; }
.prob-curve-home { stroke: #1769a6; fill: #1769a6; }
.prob-curve-draw { stroke: #776b59; fill: #776b59; }
.prob-curve-away { stroke: #bb4937; fill: #bb4937; }
polyline.prob-curve { fill: none; }
.prob-current { margin: -3px 0 6px; text-align: center; font-size: 12px; }
.prob-current strong { font-family: var(--mono); }
.prob-chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px 18px; font-size: 12px; }
.prob-chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.prob-chart-legend i { width: 10px; height: 3px; background: currentColor; }
.prob-chart-legend strong { color: var(--ink); font-family: var(--mono); }
.prob-legend-home { color: #1769a6; }
.prob-legend-draw { color: #776b59; }
.prob-legend-away { color: #bb4937; }
.probability-chart figcaption { margin-top: 5px; text-align: center; }
.prob-method-link { margin: 12px 0 0; text-align: center; font-size: 12px; }

.tweet-card {
  padding: 4px 0 0 16px;
  background: transparent;
  border-left: 3px solid var(--line-strong);
}
.tweet-label { display: flex; justify-content: space-between; color: var(--faint); font-size: 10px; letter-spacing: .05em; }
.tweet-text {
  margin: 10px 0 12px;
  overflow-wrap: anywhere;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.9;
  white-space: pre-wrap;
}
.tweet-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tweet-note { margin: 10px 0 0; color: var(--faint); font-size: 10.5px; line-height: 1.7; }

/* Charts */

.chart-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 18px; margin-bottom: 8px; }
.chart-title { margin: 0; font-size: 15px; }
.chart-sub { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.chart-wrap {
  margin-top: 0;
  padding-top: 6px;
}
.chart-empty { margin: 0; color: var(--muted); font-size: 12px; }
.chart-panel { padding-top: 6px; }
.chart-panel-spaced { margin-top: 14px; }
.chart { max-width: 880px; margin: 0; }
.chart.team-history-chart { max-width: none; }
.chart.team-history-chart svg { width: auto; max-width: none; min-width: 0; }
.chart.team-history-chart svg a image { cursor: pointer; }
.chart.team-history-chart svg a:hover image,
.chart.team-history-chart svg a:focus image { filter: drop-shadow(0 0 3px var(--link)); outline: 1px solid var(--link); }
.chart-scroll { overflow-x: auto; }
.chart svg { display: block; width: 100%; min-width: 520px; height: auto; }
.chart text { font-family: var(--sans); font-size: 10.5px; fill: var(--muted); }
.chart .axis-label { fill: var(--faint); font-size: 9px; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .reference-line { stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .reference-label { fill: var(--faint); font-size: 9px; }
.chart .axis-line { stroke: var(--line-strong); stroke-width: 1; }
.chart .period-line { stroke: var(--line-strong); stroke-dasharray: 3 4; }
.chart .period-label { fill: var(--faint); font-size: 8.5px; }
.chart .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-home { stroke: var(--link); }
.chart .series-away { stroke: var(--neg); }
.chart .point { fill: var(--surface); stroke-width: 1.8; }
.chart .point-home { stroke: var(--link); }
.chart .point-away { stroke: var(--neg); }
.chart .goal-line { stroke: var(--neg); stroke-width: 1; stroke-dasharray: 2 3; opacity: .28; }
.chart .goal-label { fill: var(--neg); font-size: 8.5px; font-weight: 700; }
.chart .end-label { font-family: var(--mono); font-size: 9.5px; font-weight: 700; }
.chart .end-label-home { fill: var(--link); }
.chart .end-label-away { fill: var(--neg); }
.chart figcaption { margin-top: 6px; color: var(--faint); font-size: 10.5px; line-height: 1.7; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 11px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { display: inline-block; width: 14px; height: 2px; background: var(--link); }
.chart-legend .away i { background: var(--neg); }
.chart-legend .goal i { width: 7px; height: 7px; border-radius: 50%; background: var(--neg); opacity: .45; }
.chart-hint { display: none; margin: 6px 0 0; color: var(--faint); font-size: 10.5px; }

.data-details { margin-top: 12px; padding-top: 9px; border-top: 1px solid var(--line); }
.data-details summary { color: var(--link); font-size: 11px; cursor: pointer; }
.data-details[open] summary { margin-bottom: 8px; }

/* Match events and lineups */

.event-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 28px; }
.event-grid .panel { padding: 0; border-top: 1px solid var(--line); }
.event-list { list-style: none; margin: 0; padding: 0; }
.event {
  display: grid;
  grid-template-columns: 40px 36px minmax(64px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.7;
}
.event:last-child { border-bottom: 0; }
.event-minute { color: var(--faint); font-family: var(--mono); font-size: 10px; }
.event-score { color: var(--faint); font-family: var(--mono); font-size: 9.5px; }
.event-team { font-weight: 700; white-space: nowrap; }
.event.away .event-team { color: var(--neg); }
.event-text { color: var(--muted); }

.sub-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.sub-list li { padding: 6px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.65; }
.sub-list .minute { display: inline-block; min-width: 28px; color: var(--faint); font-family: var(--mono); font-size: 9.5px; }
.sub-list .team-tag { display: inline-block; min-width: 56px; color: var(--ink); font-weight: 700; }
.sub-swap { display: inline-flex; flex-wrap: wrap; gap: 1px 4px; }
.sub-out { color: var(--muted); }
.sub-in { color: var(--ink); font-weight: 700; }
.sub-arrow { color: var(--faint); }

.lineup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.lineup { padding: 10px 0 0; border-top: 1px solid var(--line); }
.lineup-head { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.lineup-head img { width: 20px; height: 20px; object-fit: contain; }
.lineup-head strong { font-size: 12px; }
.formation { padding: 0 5px; border: 1px solid var(--line); border-radius: 2px; color: var(--muted); font-family: var(--mono); font-size: 9.5px; }
.lineup p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.85; }
.article-text { max-width: 72ch; color: var(--muted); font-family: var(--sans); font-size: 13.5px; line-height: 1.95; }
.article-text p { margin: 0 0 1em; }
.article-text p:last-child { margin-bottom: 0; }
.article-title { max-width: 72ch; margin: 0 0 14px; color: var(--ink); font-family: "Noto Sans CJK JP", var(--sans); font-size: clamp(19px, 2.4vw, 24px); line-height: 1.45; }
.article-lead { max-width: 72ch; margin: 0 0 16px; padding-left: 12px; border-left: 2px solid var(--line-strong); color: var(--ink); font-size: 14px; line-height: 1.85; }

/* Model */

.model-page .page-head { margin-bottom: 22px; }
.model-page .page-head h1 { font-family: "Noto Sans CJK JP", var(--sans); font-size: clamp(30px, 4.2vw, 42px); font-weight: 800; letter-spacing: -.035em; }
.model-tool-button { display: inline-flex; align-items: center; min-height: 40px; margin-top: 16px; padding: 7px 14px; border: 1px solid var(--link); background: var(--link); color: #fff; font-size: 13px; font-weight: 700; text-decoration: none; }
.model-tool-button:hover { background: var(--link-hover); color: #fff; }
.model-article { max-width: 840px; }
.intro-article { padding-top: 24px; border-top: 1px solid var(--line-strong); }
.intro-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 22px; margin-top: 24px; }
.intro-links .model-tool-button { margin-top: 0; }
.intro-links > a:not(.model-tool-button) { color: var(--link); font-size: 13px; font-weight: 700; }
.model-article section { padding: 24px 0; border-top: 1px solid var(--line-strong); }
.model-article h2 { margin: 0 0 14px; font-family: var(--sans); font-size: 22px; line-height: 1.4; }
.model-article p, .model-article li { max-width: 46em; font-size: 15px; line-height: 1.95; }
.model-article p { margin: 0 0 1em; }
.model-step-number { display: block; margin-bottom: 6px; color: var(--link); font-family: var(--mono); font-size: 11px; font-weight: 700; }
.model-coeff-wrap { margin: 18px 0; }
.model-coeff-table { width: min(100%, 600px); border-collapse: collapse; font-size: 13px; }
.model-coeff-table caption { margin-bottom: 6px; color: var(--muted); font-size: 11px; text-align: left; }
.model-coeff-table th, .model-coeff-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.model-coeff-table th:first-child { text-align: left; }
.model-coeff-table thead th { border-bottom-color: var(--line-strong); color: var(--muted); font-weight: 600; }
.model-coeff-table td { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.model-article ul { margin: 0 0 1em; padding-left: 1.5em; }
.model-calculator { display: block; width: 100%; height: 430px; margin-top: 18px; border: 1px solid var(--line-strong); background: #f7f4ed; }
.model-article .model-tool-link { margin: 7px 0 0; font-size: 12px; }
.model-example { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 18px 0; padding: 18px 20px; border-left: 3px solid var(--link); background: var(--soft); }
.model-example span { display: grid; gap: 2px; color: var(--muted); font-size: 12px; }
.model-example strong { color: var(--ink); font-family: var(--mono); font-size: 21px; }
.model-article .model-formula { max-width: none; margin: 16px 0; padding: 12px 16px; background: var(--soft); font-family: var(--sans); font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.model-figure { margin: 20px 0 26px; }
.model-figure img { display: block; width: 100%; height: auto; border: 1px solid var(--line); background: #fff; }
.model-figure figcaption { margin-top: 6px; color: var(--muted); font-size: 11px; }
@media (max-width: 560px) { .model-calculator { height: 490px; } }

.tool-panel { width: min(100%, 680px); margin: 28px 0 56px; padding: 24px; border: 1px solid var(--line-strong); background: var(--surface); }
.tool-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.tool-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.tool-form input { width: 100%; min-height: 48px; padding: 7px 12px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font-family: var(--mono); font-size: 22px; font-weight: 700; }
.tool-diff { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.tool-diff strong { color: var(--ink); font-family: var(--mono); font-size: 17px; }
.tool-results { display: grid; gap: 12px; }
.tool-result-row { display: grid; grid-template-columns: 95px minmax(0, 1fr) 60px; gap: 12px; align-items: center; font-size: 13px; }
.tool-result-row strong { text-align: right; font-family: var(--mono); font-size: 16px; }
.tool-track { height: 14px; background: var(--line); }
.tool-bar { display: block; width: 0; height: 100%; transition: width .18s ease; }
.tool-home { background: var(--chart-expected); }
.tool-draw { background: #776b59; }
.tool-away { background: #bb4937; }
.tool-xp { display: flex; flex-wrap: wrap; gap: 8px 26px; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line-strong); }
.tool-xp p { margin: 0; font-size: 13px; }
.tool-xp strong { margin-left: 4px; font-family: var(--mono); font-size: 19px; }
.tool-note { max-width: 58ch; margin: 20px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.tool-note a { white-space: nowrap; }
@media (max-width: 560px) {
  .tool-panel { padding: 16px; }
  .tool-form { gap: 10px; }
  .tool-result-row { grid-template-columns: 80px minmax(0, 1fr) 51px; gap: 7px; font-size: 11px; }
  .tool-result-row strong { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .tool-bar { transition: none; } }

.toc { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 14px 0 22px; }
.toc a {
  padding: 0;
  border: 0;
  color: var(--link);
  font-size: 12px;
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 4px;
}
.toc a:hover { color: var(--ink); text-decoration-color: var(--ink); }

.model-stack { border-top: 1px solid var(--line-strong); }
.model-step {
  display: grid;
  grid-template-columns: 34px 190px minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.model-step strong { display: block; margin: 0; font-size: 14px; }
.model-step p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.route-num { color: var(--faint); font-family: var(--mono); font-size: 9.5px; font-weight: 700; }

.model-box {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--soft);
  overflow-x: auto;
}
.model-box code { font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.model-note { margin: 8px 0 0; color: var(--faint); font-size: 11px; }
.model-footnote { margin: 7px 0 0; color: var(--faint); font-size: 10.5px; }
.model-subhead { margin-top: 20px; }

.points-band-wrap { display: inline-flex; align-items: center; gap: 7px; }
.points-band { position: relative; display: inline-block; width: 80px; height: 8px; background: var(--line); }
.points-band-range { position: absolute; top: 2px; height: 4px; background: var(--line-strong); }
.points-band-box { position: absolute; top: 1px; height: 6px; background: #9db7cd; }
.points-band-mid { position: absolute; top: 0; width: 1px; height: 8px; background: var(--link); }

/* Responsive */

@media (max-width: 920px) {
  .header-inner { flex-wrap: wrap; gap: 0 12px; }
  .nav { order: 3; width: 100%; }
  .theme-toggle { order: 2; margin-left: auto; }
  .hero-grid { grid-template-columns: 1fr; }
  .team-head { align-items: flex-start; flex-direction: column; gap: 14px; }
  .team-kpi-area { width: 100%; }
  .team-kpis { width: 100%; }
  .team-kpis div { flex: 1; }
  .event-grid { grid-template-columns: 1fr; }
  .lineup-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .standings-scroll { overflow-x: auto; }
}

@media (max-width: 680px) {
  .wrap { width: calc(100% - 28px); }
  .brand-text strong { font-size: 19px; }
  .nav { gap: 14px; }
  .nav a { font-size: 12px; padding-bottom: 8px; }
  .page-intro { padding-top: 24px; }
  .page-head { padding-top: 24px; }
  .table-hint, .chart-hint { display: block; }
  .latest-row { grid-template-columns: 44px 26px minmax(0, 1fr) 16px; gap: 6px; padding: 10px 2px; }
  .latest-probs { width: 100%; margin-top: 3px; padding: 6px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .latest-prob-labels { flex-wrap: wrap; gap: 2px 10px; }
  .col-gp { display: none; }
  .standings-table th,
  .standings-table td { padding: 2px 5px; }
  .standings-table .standings-team { min-width: 6.2em; }
  .standings-team .team-cell img { width: 18px; height: 18px; }
  .standings-team .team-cell a { font-size: 12px; }
  .chip { width: 18px; height: 18px; font-size: 8.5px; }
  .form-row { gap: 1px; }
  .prob-row {
    grid-template-columns: 40px 68px minmax(0, 1fr) 54px;
    grid-template-rows: auto auto;
    gap: 2px 6px;
  }
  .prob-date, .prob-opponent, .prob-stack, .prob-xp { grid-row: 1; }
  .prob-values { display: block; grid-column: 3; grid-row: 2; font-size: 9px; }
  .team-kpis { gap: 8px; }
  .team-kpis div { margin-left: 8px; padding-left: 8px; }
  .team-kpis div:first-child { margin-left: 0; padding-left: 0; }
  .team-head { padding-top: 16px; }
  .team-identity img { width: 50px; height: 50px; }
  .scoreboard { gap: 6px; }
  .team-side-link .emblem { width: 46px; height: 46px; }
  .team-name { font-size: 15px; }
  .score-box { min-width: 96px; }
  .post-score { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; }
  .post-team { font-size: 14px; }
  .post-team.home { justify-self: start; }
  .post-team.away { justify-self: end; margin-left: 0; }
  .post-score strong { justify-self: center; text-align: center; }
  .event { grid-template-columns: 36px 32px minmax(0, 1fr); }
  .event-text { grid-column: 1 / -1; }
  .sub-list { grid-template-columns: 1fr; }
  .filter-bar label,
  .sort-bar label { width: 100%; }
  .filter-bar select,
  .filter-bar input,
  .sort-bar select { width: 100%; }
  .filter-count,
  .sort-count { margin-left: 0; }
  .model-step { grid-template-columns: 30px minmax(0, 1fr); gap: 2px 12px; }
  .model-step p { grid-column: 2; }
  .team-grid { grid-template-columns: 1fr 1fr; gap: 0 18px; }
  .points-band { width: 60px; }
}

@media (max-width: 560px) {
  .header-inner { flex-wrap: wrap; gap: 0; padding: 12px 0 0; }
  .brand { padding-bottom: 8px; }
  .nav { width: 100%; flex-wrap: wrap; justify-content: flex-start; gap: 0 15px; overflow-x: visible; }
  .nav a { padding: 4px 3px 8px; font-size: 12px; }
  .standings-top { gap: 14px; padding-top: 12px; }
  .standings-title h1 { font-size: 24px; }
}

/* Dark surfaces and status colors that use fixed colors in the light theme. */
:root[data-theme="dark"] .compare-table .is-key,
:root[data-theme="dark"] .standings-table .col-extra { background: #202b35; }
:root[data-theme="dark"] .badge-j1 { color: #aed7ff; border-color: #4a6680; background: #223547; }
:root[data-theme="dark"] .badge-j2 { color: #ffd096; border-color: #806747; background: #3b3023; }
:root[data-theme="dark"] .badge-j3 { color: #d5c2ff; border-color: #685a83; background: #302a42; }
:root[data-theme="dark"] .chip-w,
:root[data-theme="dark"] .result-w { color: #a7e8be; background: #254536; }
:root[data-theme="dark"] .chip-d,
:root[data-theme="dark"] .result-d { color: #d3d1cd; background: #41423f; }
:root[data-theme="dark"] .chip-l,
:root[data-theme="dark"] .result-l { color: #ffc0b7; background: #51332f; }
:root[data-theme="dark"] .rank-pill.rank-mid { color: #bedfff; background: #29445e; }
:root[data-theme="dark"] .rank-pill.rank-low { color: #ffc0b7; background: #52342f; }
:root[data-theme="dark"] .team-kpi-tabs button:hover { background: var(--surface); }
:root[data-theme="dark"] .result-badge.neutral { color: var(--link); border-color: #4a6680; background: #223547; }
:root[data-theme="dark"] .prob-legend-home { color: #79c0ff; }
:root[data-theme="dark"] .prob-legend-draw { color: #c5b9a6; }
:root[data-theme="dark"] .prob-legend-away { color: #ff9c8b; }
:root[data-theme="dark"] .prob-curve-home { stroke: #79c0ff; }
:root[data-theme="dark"] .prob-curve-draw { stroke: #c5b9a6; }
:root[data-theme="dark"] .prob-curve-away { stroke: #ff9c8b; }
:root[data-theme="dark"] .prob-point.prob-curve-home { fill: #79c0ff; }
:root[data-theme="dark"] .prob-point.prob-curve-draw { fill: #c5b9a6; }
:root[data-theme="dark"] .prob-point.prob-curve-away { fill: #ff9c8b; }
:root[data-theme="dark"] polyline.prob-curve { fill: none; }
:root[data-theme="dark"] .prob-marker { stroke: #ffda92; }
:root[data-theme="dark"] .tool-form input { background: var(--paper); }
:root[data-theme="dark"] .tool-draw { background: #c5b9a6; }
:root[data-theme="dark"] .tool-away { background: #ff9c8b; }
:root[data-theme="dark"] .model-figure img { background: #fff; }
:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .model-tool-button { color: #14212e; }
:root[data-theme="dark"] .btn-primary:hover,
:root[data-theme="dark"] .model-tool-button:hover { color: #14212e; }

@media (max-width: 430px) {
  .team-grid { grid-template-columns: 1fr; }
  .league-switch { gap: 20px; }
  .standings-top { align-items: center; }
  .standings-title h1 { font-size: 22px; }
}
