:root {
  --bg: #0f1420;
  --panel: #161d2e;
  --panel-border: #232c42;
  --text: #e6e9f0;
  --text-dim: #8891a7;
  --accent: #4f8cff;
  --live: #ff5566;
  --finished: #58d68d;
  --scheduled: #8891a7;
  --off: #d9a53b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--panel-border);
}

.topbar h1 { font-size: 1.3rem; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.mode-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
}
.mode-mock { color: var(--off); border-color: var(--off); }
.mode-live { color: var(--finished); border-color: var(--finished); }

.day-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px;
}

.day-label { font-weight: 600; min-width: 220px; text-align: center; }

.nav-btn {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 8px;
}
.nav-btn:hover { background: var(--panel); }
.nav-btn.inline { padding: 0 2px; font-weight: 600; }
.nav-btn.inline:hover { background: none; text-decoration: underline; }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.league { margin-bottom: 28px; }

.prediction-explainer, .parlay-ideas {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 24px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.prediction-explainer summary, .parlay-ideas summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}
.prediction-explainer summary:hover, .parlay-ideas summary:hover { color: var(--accent); }
.prediction-explainer ul { margin: 8px 0; padding-left: 20px; }
.prediction-explainer li { margin-bottom: 6px; }
.prediction-explainer b { color: var(--text); }
.prediction-explainer p { margin: 10px 0 0; }
.prediction-explainer p:first-of-type { margin-top: 10px; }
.daily-bets { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 12px; padding: 12px 16px; margin-bottom: 24px; }
.daily-bets > summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.daily-bets > summary:hover { color: var(--text); }
.daily-bets .bet-plan { background: transparent; border-left: 0; border-top: 1px solid var(--panel-border); margin-top: 10px; padding-left: 0; }
.bet-plan { margin-top: 8px; border-left: 3px solid var(--accent); padding: 8px 10px; background: var(--panel); }
.bet-plan summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.bet-plan-note { color: var(--text-dim); font-size: .82rem; margin-top: 6px; }
.bet-plan-warning { color: #ef9292; font-weight: 600; }
.bet-controls-wrap { padding: 2px 0 4px; }
.bet-controls { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.bet-controls label, .stake-control { color: var(--text-dim); font-size: .82rem; }
.currency-input, .bet-count-input, .bet-stake-input { color: var(--text); background: var(--bg); border: 1px solid var(--panel-border); border-radius: 5px; }
.currency-input { width: 88px; margin-left: 5px; padding: 5px 6px; }
.bet-count-input { width: 76px; margin-left: 4px; padding: 3px 5px; }
.bet-stake-input { width: 76px; margin-left: 3px; padding: 2px 4px; color: var(--text); background: var(--panel); border: 1px solid var(--panel-border); border-radius: 4px; }
.reset-stakes { border: 1px solid var(--panel-border); border-radius: 5px; padding: 5px 9px; color: var(--text-dim); background: transparent; cursor: pointer; font-size: .78rem; }
.reset-stakes:hover { color: var(--text); border-color: var(--accent); }
.bet-row { border: 1px solid var(--panel-border); border-left: 4px solid var(--accent); border-radius: 8px; margin-top: 9px; padding: 9px 10px; background: var(--bg); }
.bet-title { color: var(--text); font-size: .92rem; line-height: 1.35; }
.bet-detail { color: var(--text-dim); font-size: .82rem; margin-top: 3px; }
.bet-lower .bet-title { color: #78d49a; }
.bet-medium .bet-title { color: #f2c66d; }
.bet-higher .bet-title { color: #ef9292; }
.rec-section-title { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--panel-border); color: var(--text); font-size: .82rem; font-weight: 700; }
.custom-parlay { margin-top: 6px; color: var(--text-dim); font-size: .84rem; }
.custom-parlay-eligible { color: #78d49a; font-weight: 600; }
.custom-parlay-check { color: var(--text-dim); font-size: .78rem; margin-top: 3px; }

.league h2 {
  font-size: 1.1rem;
  margin: 0 0 12px;
}
.league h2 .country { color: var(--text-dim); font-weight: 400; font-size: 0.85rem; }

.matches {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.match {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 14px 16px;
}

.teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.team { font-weight: 600; }
.team-shield { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; margin-right: 8px; }
.team.away { text-align: right; }
.team-link { cursor: pointer; }
.team-link:hover, .team-link:focus-visible { color: var(--accent); text-decoration: underline; outline: none; }

.score, .kickoff {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text-dim);
  text-align: center;
  min-width: 64px;
}
.match.status-live .score { color: var(--live); }
.match.status-finished .score { color: var(--finished); }
.score-link { cursor: pointer; }
.score-link:hover, .score-link:focus-visible { text-decoration: underline; outline: none; }

.meta {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.status-pill {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--scheduled);
  border: 1px solid var(--panel-border);
}
.status-live .status-pill { color: var(--live); border-color: var(--live); }
.status-finished .status-pill { color: var(--finished); border-color: var(--finished); }
.status-postponed .status-pill, .status-cancelled .status-pill { color: var(--off); border-color: var(--off); }

.round { font-size: 0.7rem; color: var(--text-dim); }

.prediction {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
}

.prediction-status {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
}

.prediction-bar {
  display: flex;
  height: 4px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-border);
  margin-bottom: 8px;
}
.prediction-bar span { height: 100%; }
.bar-home { background: var(--accent); }
.bar-draw { background: var(--text-dim); }
.bar-away { background: var(--off); }

.prediction-pcts {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.prediction-pcts .pct b {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}
.pct-home b { color: var(--accent); }
.pct-draw b { color: var(--text); }
.pct-away b { color: var(--off); }
.pct-draw { text-align: center; }
.pct-away { text-align: right; }

.market-compare {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--panel-border);
}
.market-compare + .market-compare {
  margin-top: 6px;
  padding-top: 0;
  border-top: none;
}
.market-bar {
  height: 3px;
  opacity: 0.6;
  margin-bottom: 6px;
}
.market-meta {
  display: block;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-decoration: none;
}
a.market-meta:hover { color: var(--text); text-decoration: underline; }
.market-icon {
  width: 12px;
  height: 12px;
  margin-right: 2px;
  vertical-align: -1px;
  border-radius: 2px;
}
.market-volume { font-variant-numeric: tabular-nums; }

.empty, .error { color: var(--text-dim); text-align: center; padding: 24px; }
.error { color: var(--live); }

.standings-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

.standings-table th, .standings-table td {
  padding: 8px 10px;
  text-align: center;
}

.standings-table thead th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--panel-border);
}

.standings-table tbody tr:not(:last-child) td {
  border-bottom: 1px solid var(--panel-border);
}

.standings-table .col-rank { color: var(--text-dim); width: 28px; }
.standings-table .col-team { text-align: left; font-weight: 600; }
.standings-table .col-pts { font-weight: 700; color: var(--accent); }

.standings-table tbody tr:nth-child(-n+4) .col-rank { color: var(--finished); }
.standings-table tbody tr:nth-last-child(-n+3) .col-rank { color: var(--live); }

dialog#team-history-modal {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 0;
  width: min(420px, calc(100vw - 32px));
}
dialog#team-history-modal::backdrop { background: rgba(0, 0, 0, 0.6); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--panel-border);
}
.modal-header h3 { margin: 0; font-size: 1rem; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.modal-close:hover { color: var(--text); }

#team-history-body { padding: 8px 16px 16px; }

.history-row {
  display: grid;
  grid-template-columns: 72px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.85rem;
}
.history-row:not(:last-child) { border-bottom: 1px solid var(--panel-border); }
.history-date { color: var(--text-dim); font-size: 0.75rem; }
.history-opponent { font-weight: 600; }
.history-venue { color: var(--text-dim); font-size: 0.7rem; }
.history-score { font-variant-numeric: tabular-nums; font-weight: 700; }

.history-result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
}
.history-result.W { background: color-mix(in srgb, var(--finished) 20%, transparent); color: var(--finished); }
.history-result.D { background: color-mix(in srgb, var(--scheduled) 25%, transparent); color: var(--text); }
.history-result.L { background: color-mix(in srgb, var(--live) 20%, transparent); color: var(--live); }

#match-stats-body { padding: 4px 20px 20px; }

.stats-score {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 10px;
  margin: 4px 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--panel-border);
}
.stats-score-team {
  font-weight: 600;
  font-size: 0.9rem;
}
.stats-score-team.home { text-align: right; color: var(--accent); }
.stats-score-team.away { text-align: left; color: var(--off); }
.stats-score-value {
  font-size: 1.3rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stats-comparison {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.stat-value {
  font-weight: 700;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.stat-value.home { text-align: right; color: var(--accent); }
.stat-value.away { text-align: left; color: var(--off); }
.stat-label {
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: center;
  white-space: nowrap;
}

.stat-bar {
  display: flex;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-border);
}
.stat-bar-home { background: var(--accent); }
.stat-bar-away { background: var(--off); }

.parlay-ideas .parlay-league { font-size: 0.95rem; margin: 12px 0 6px; color: var(--text); }
.parlay { border-top: 1px dashed var(--panel-border); padding: 8px 0; }
.parlay-head { color: var(--text); font-weight: 600; margin-bottom: 4px; }
.parlay-leg { padding-left: 12px; margin-bottom: 2px; }
.parlay-note { font-size: 0.75rem; margin: 8px 0 0; }
.parlay-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.parlay-actions .parlay-note { margin: 0; }
.parlay-btn {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.parlay-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.parlay-btn:disabled { opacity: 0.6; cursor: default; }
.parlay-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin: 6px 0; }
.parlay-table th, .parlay-table td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--panel-border); }
.parlay-table th:first-child, .parlay-table td:first-child { text-align: left; }
.parlay-table th { color: var(--text); font-weight: 600; }
.parlay-legs { margin: 6px 0; }
.parlay-recent { display: flex; flex-direction: column; padding: 6px 0; border-top: 1px dashed var(--panel-border); }
.parlay-recent-head { color: var(--text); font-weight: 600; }
.parlay-status-won .parlay-recent-head { color: var(--finished); }
.parlay-status-lost .parlay-recent-head { color: var(--live); }

.sgp { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--panel-border); font-size: 0.75rem; color: var(--text-dim); }
.sgp summary { cursor: pointer; color: var(--text); font-weight: 600; }
.sgp summary:hover { color: var(--accent); }
.sgp-idea { margin-top: 6px; }
.sgp-legs { color: var(--text); }
.sgp-legs b { margin-right: 4px; }
.sgp-safe b { color: var(--finished); }
.sgp-balanced b { color: var(--accent); }
.sgp-longshot b { color: var(--off); }
.sgp-note { margin-top: 8px; font-size: 0.7rem; }

.recommendation { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--bg); border-left: 3px solid var(--text-dim); font-size: 0.78rem; }
.rec-strong { border-left-color: var(--finished); }
.rec-lean { border-left-color: var(--accent); }
.rec-toss-up, .rec-tossup { border-left-color: var(--off); }
.rec-pick { color: var(--text); }
.rec-conf { text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.65rem; color: var(--text-dim); border: 1px solid var(--panel-border); border-radius: 999px; padding: 1px 6px; }
.rec-why { color: var(--text-dim); font-size: 0.72rem; margin-top: 2px; }
.rec-parlay { color: var(--text); margin-top: 6px; }
.rec-extra { color: var(--text); margin-top: 4px; }
.rec-extra-market { color: var(--text-dim); }
.recommendation summary { cursor: pointer; color: var(--text); font-weight: 600; }
.recommendation summary:hover { color: var(--accent); }
.recommendation[open] summary { margin-bottom: 6px; }
.rec-icon { vertical-align: -2px; margin-right: 6px; }
.rec-row { color: var(--text); margin-top: 4px; }
.rec-label { color: var(--text-dim); }
.recommendation + .sgp { margin-top: 10px; }
.team .place { color: var(--text-dim); font-size: 0.7rem; font-weight: 400; margin-left: 2px; }

/* -- /about page ------------------------------------------------------- */
.about {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}
.about-title { font-size: 1.4rem; margin: 0 0 8px; }
.about-lede { color: var(--text-dim); margin: 0 0 24px; line-height: 1.5; }
.about-section {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.about-section h2 { font-size: 1rem; margin: 0 0 8px; color: var(--text); }
.about-section p { color: var(--text-dim); line-height: 1.55; margin: 0; }
.about-section ul, .about-section ol { margin: 12px 0 0; padding-left: 20px; }
.about-section li { color: var(--text-dim); line-height: 1.5; margin-bottom: 10px; }
.about-section li:last-child { margin-bottom: 0; }
.about-section b { color: var(--text); }
.about-section code {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.85em;
}
.about-note { border-left: 3px solid var(--off); }
.about-footer { color: var(--text-dim); font-size: 0.85rem; margin-top: 8px; }
.about-subtitle {
  font-size: 1.15rem;
  margin: 32px 0 8px;
  padding-top: 24px;
  border-top: 1px solid var(--panel-border);
  color: var(--text);
}
.about-plain { border-left: 3px solid var(--finished); }
.about-plain h2 { color: var(--finished); }
.about-plain-bottom-line {
  margin-top: 16px !important;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
  color: var(--text) !important;
}

/* -- track record page ----------------------------------------------------- */
.record { max-width: 900px; }
.record .parlay-table { margin-top: 8px; }
.record .parlay-table .pos { color: var(--finished); }
.record .parlay-table .neg { color: var(--live); }
.record-small td { color: var(--text-dim); opacity: 0.7; }
.record-subhead { font-size: 0.85rem; color: var(--text); margin: 16px 0 0; }
.record-chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.record-chart-zero { stroke: var(--panel-border); stroke-dasharray: 4 4; }
.record-chart-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.record-chart-line.pos { stroke: var(--finished); }
.record-chart-line.neg { stroke: var(--live); }
.record .about-section { overflow-x: auto; }
.record-tag {
  font-size: 0.7rem; color: var(--off); border: 1px solid var(--off);
  border-radius: 4px; padding: 0 4px; margin-left: 4px; white-space: nowrap;
}
