:root {
  color-scheme: light;
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: #14243e;
  background: #f5f7fb;
  --navy: #101c39;
  --muted: #52617a;
  --line: #dfe5ee;
  --mint: #63e7bd;
  --green: #127052;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.shell { width: min(1232px, calc(100% - 64px)); margin-inline: auto; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { color: var(--navy); text-decoration: none; font-size: 27px; letter-spacing: -.07em; font-weight: 850; }
.brand span { color: var(--green); }
.main-nav { display: flex; gap: clamp(14px, 3vw, 32px); }
.main-nav a { color: #344564; text-decoration: none; font-size: 14px; font-weight: 650; }
.main-nav a:hover, .main-nav a[aria-current=page] { color: var(--green); text-decoration: underline; text-underline-offset: 5px; }
.hero {
  isolation: isolate;
  position: relative;
  overflow: hidden;
  min-height: 168px;
  margin-block: 22px 24px;
  border-radius: 12px;
  padding: 24px 31px;
  color: white;
  background: var(--navy);
  display: flex;
  align-items: center;
}
.hero-art, .hero::after { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero-art { object-fit: cover; object-position: 70% 63%; }
.hero::after { content: ""; background: linear-gradient(90deg, #101c39 10%, #101c39e8 34%, #101c3920 70%); }
h1, h2, h3, p, dl, dd { margin: 0; }
.hero-title span { display: block; color: var(--mint); font-size: 13px; font-weight: 720; margin-bottom: 7px; }
h1 { font-size: clamp(27px, 4vw, 46px); line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 19px; letter-spacing: -.035em; }

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(239px, 280px);
  grid-template-areas: "results sources";
  gap: 16px 22px;
  align-items: start;
  margin-bottom: 44px;
}
.predictions { grid-area: results; min-width: 0; }
.sources { grid-area: sources; }
.section-heading, .filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.section-heading { margin-bottom: 10px; }
.section-heading h2 { font-size: clamp(20px, 3vw, 27px); }
.filters { padding: 7px 8px; margin-bottom: 12px; border: 1px solid var(--line); background: #fff; border-radius: 10px; }
.date-control { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.date-control label { color: var(--muted); font-size: 13px; }
.date-control small { margin-left: 3px; font-size: 11px; }
input, button { font: inherit; }
input[type=date] { color: inherit; min-height: 40px; max-width: 100%; background: white; border: 1px solid #ccd7e5; border-radius: 7px; padding: 5px 8px; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #167758; outline-offset: 3px; }
.switch, .days { display: flex; align-items: stretch; }
.switch { padding: 3px; background: #e9edf5; border-radius: 8px; }
.days { gap: 4px; }
.switch button, .days button { border: 0; background: transparent; border-radius: 6px; padding: 6px 12px; min-height: 40px; color: #40506c; font-size: 14px; white-space: nowrap; }
.switch button[aria-pressed=true] { color: var(--navy); background: white; box-shadow: 0 1px 3px #152a4226; font-weight: 700; }
.days button[aria-pressed=true] { color: white; background: var(--navy); font-weight: 700; }
.days button[aria-pressed=false]:hover { background: #edf1f7; }

.games { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px; }
.game, .panel, #status:not([hidden]) { border: 1px solid var(--line); background: white; border-radius: 11px; }
.game { padding: 13px; }
.game-meta { display: flex; justify-content: space-between; align-items: center; gap: 7px; font-size: 12px; }
.game-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.game-league { color: var(--green); font-weight: 800; letter-spacing: .065em; }
.matchup { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 8px; margin-block: 15px 13px; font-size: 14px; text-align: center; }
.team { display: grid; justify-items: center; gap: 5px; overflow-wrap: anywhere; line-height: 1.45; }
.team-badge { width: 43px; height: 43px; }
.team-logo { display: block; width: 100%; height: 100%; object-fit: contain; }
.team-code { display: grid; place-items: center; width: 100%; height: 100%; background: #edf1fa; color: #233e6c; border: 1px solid #dfe6f1; border-radius: 50%; font-size: 11px; font-weight: 850; letter-spacing: .02em; }
.team:last-child .team-code { background: #e3f3ed; color: #155e48; border-color: #d1e9e0; }
.vs { align-self: start; margin-top: 12px; color: var(--muted); font-size: 12px; font-weight: 550; }
.game ul { padding: 0; margin: 0; list-style: none; display: grid; gap: 6px; }
.game li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 6px; padding: 8px 10px; background: #eef3fa; border-radius: 7px; font-size: 14px; }
.play { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.direction { font-weight: 720; }
.outcome { white-space: nowrap; color: #536078; font-size: 11px; font-weight: 650; padding: 3px 6px; border-radius: 4px; background: #fff; }
.outcome.win { color: #126443; }
.outcome.loss { color: #9b3624; }

.panel { padding: 15px; }
.source-list { display: grid; gap: 5px; margin-top: 9px; }
.source { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 5px 7px; border: 1px solid transparent; border-radius: 7px; text-decoration: none; color: inherit; }
.source-active { background: #eef3fa; border-color: #e3eaf5; }
.source-active:hover { border-color: #b5c6de; }
.source strong { font-size: 13px; }
.source small { color: var(--muted); font-size: 11px; }
.source-active small { color: var(--green); }
.source-icon { display: grid; place-items: center; width: 29px; height: 29px; background: white; border: 1px solid var(--line); border-radius: 50%; font-size: 15px; }
.chart-icon { display: flex; align-items: end; justify-content: center; gap: 2px; padding-bottom: 6px; }
.chart-icon i { width: 3px; height: 6px; border-radius: 1px; background: #307f71; }
.chart-icon i:nth-child(2) { height: 10px; }
.chart-icon i:nth-child(3) { height: 14px; }
#status { padding: 14px; color: var(--muted); }
#retry { background: var(--navy); color: white; border: 0; border-radius: 7px; padding: 10px 14px; margin-top: 9px; }

.stats-page { padding-block: 30px 44px; }
.stats-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.stats-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stats-metrics div { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 13px 15px; }
.stats-metrics dt { color: var(--muted); font-size: 13px; }
.stats-metrics dd { margin-top: 4px; font-variant-numeric: tabular-nums; font-size: clamp(20px, 4vw, 32px); font-weight: 780; }
.stats-section { margin-top: 16px; }
.stats-caption, #stats-status { color: var(--muted); font-size: 13px; line-height: 1.5; margin-block: 8px 12px; }
.stats-table-scroll { max-width: 100%; overflow-x: auto; }
.stats-daily-scroll { max-height: 24rem; }
.stats-table-scroll table { width: 100%; border-spacing: 0; color: var(--navy); font-size: 13px; font-variant-numeric: tabular-nums; }
.stats-table-scroll th, .stats-table-scroll td { padding: 8px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.stats-table-scroll th { color: var(--muted); background: #edf2f8; font-weight: 650; }
.stats-daily-scroll th { position: sticky; top: 0; z-index: 1; }
.stats-daily-scroll th:first-child { z-index: 2; }
.stats-table-scroll :is(th, td):first-child { position: sticky; left: 0; text-align: left; }
.stats-table-scroll td:first-child { background: #fff; }
.stats-table-scroll button, #stats-status button { border: 1px solid #cbd7e5; border-radius: 6px; background: #fff; color: var(--navy); padding: 6px 8px; }
.stats-table-scroll button[aria-pressed=true] { border-color: var(--green); background: #e3f3ed; color: var(--green); font-weight: 700; }
.stats-table-scroll .is-positive { color: var(--green); }
.stats-table-scroll .is-negative { color: #9b3624; }

@media (min-width: 1080px) {
  .games { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 850px) {
  .shell { width: calc(100% - 28px); }
  .topbar-inner { min-height: 55px; }
  .hero { min-height: 126px; margin-block: 14px; padding: 15px; }
  .hero-art { object-position: right 65%; }
  .dashboard { grid-template-columns: minmax(0, 1fr); grid-template-areas: "sources" "results"; grid-template-rows: auto; gap: 14px; }
  .sources { padding: 9px; }
  .sources h2 { font-size: 15px; }
  .source-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .source { grid-template-columns: auto minmax(0, 1fr); column-gap: 4px; row-gap: 1px; padding: 4px; }
  .source-icon { grid-row: span 2; width: 22px; height: 22px; font-size: 12px; }
  .chart-icon { padding-bottom: 4px; }
  .source strong { font-size: 12px; }
}
@media (max-width: 540px) {
  .games { grid-template-columns: minmax(0, 1fr); }
  .hero::after { background: linear-gradient(90deg, #101c39f5, #101c39ac 46%, transparent 95%); }
  .date-control small { display: none; }
  .days button, .switch button { padding-inline: 9px; }
  .stats-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-section { padding: 10px; }
}
