:root {
  --bg: #0d1321;
  --card: #1a2236;
  --card2: #212b45;
  --text: #e8ecf4;
  --muted: #8b96ad;
  --accent: #ffd166;
  --green: #2ecc71;
  --lightgreen: #a3d977;
  --yellow: #f1c40f;
  --gray: #57617a;
  --live: #ff5e5b;
  --border: #2c3655;
}

* { box-sizing: border-box; }

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

main { max-width: 1080px; margin: 0 auto; padding: 0 14px 60px; }

.site-header {
  background: linear-gradient(135deg, #14213d 0%, #1d3557 60%, #264653 100%);
  padding: 22px 16px 14px;
  text-align: center;
  border-bottom: 2px solid var(--accent);
}
.site-header h1 { margin: 0 0 8px; font-size: 1.6rem; letter-spacing: 0.5px; }
.updated-row { display: flex; gap: 10px; justify-content: center; align-items: center; color: var(--muted); font-size: 0.85rem; }
#refreshBtn {
  background: var(--card2); color: var(--text); border: 1px solid #3a4a73;
  border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 0.85rem;
}
#refreshBtn:hover { background: #2d3a5e; }

h2 { margin: 28px 0 12px; font-size: 1.25rem; color: var(--accent); }

/* Collapsible section headers (act like an h2) */
.section-summary {
  cursor: pointer;
  list-style: none;
  margin: 28px 0 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-summary::-webkit-details-marker { display: none; }
.section-summary::before {
  content: '▸';
  font-size: 0.85em;
  transition: transform 0.15s ease;
}
details[open] > .section-summary::before { transform: rotate(90deg); }
.upcoming-heading { margin-top: 18px; }

/* Highlights link on played matches */
.highlights-link {
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  background: var(--card2);
  border: 1px solid #3a4a73;
  border-radius: 6px;
  padding: 2px 9px;
  white-space: nowrap;
}
.highlights-link:hover { background: #2d3a5e; }

/* Leaderboard */
.lb-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 10px; padding: 10px 14px; margin-bottom: 6px;
  border: 1px solid transparent;
}
.lb-row.first { border-color: var(--accent); background: linear-gradient(90deg, #2a2a14, var(--card)); }
.lb-rank { font-size: 1.2rem; font-weight: 700; width: 34px; text-align: center; flex-shrink: 0; }
.lb-name { font-weight: 700; font-size: 1.05rem; flex: 1; }
.lb-total { font-size: 1.35rem; font-weight: 800; color: var(--accent); }
.lb-total small { font-size: 0.7rem; color: var(--muted); font-weight: 400; }
.lb-detail { color: var(--muted); font-size: 0.78rem; display: flex; gap: 8px; flex-wrap: wrap; }
.lb-bar-wrap { flex: 2; height: 10px; background: #0e1526; border-radius: 5px; overflow: hidden; min-width: 80px; }
.lb-bar { height: 100%; background: linear-gradient(90deg, #457b9d, var(--accent)); border-radius: 5px; }

/* Points chips */
.pts {
  display: inline-block; min-width: 20px; text-align: center;
  border-radius: 5px; padding: 1px 6px; font-weight: 700; font-size: 0.78rem;
}
.p5 { background: var(--green); color: #06270f; }
.p3 { background: var(--lightgreen); color: #1d3309; }
.p1 { background: var(--yellow); color: #3d3203; }
.p0 { background: var(--gray); color: #d6dbe8; }
.pf { background: #7b68ee; color: #efeaff; }

/* Rules */
#rules-section details { background: var(--card); border-radius: 10px; padding: 10px 16px; }
#rules-section summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.rules { list-style: none; padding: 8px 0 2px; margin: 0; }
.rules li { margin: 5px 0; }

/* Finals table */
.table-wrap { overflow-x: auto; }
#finals table { border-collapse: collapse; width: 100%; background: var(--card); border-radius: 10px; overflow: hidden; }
#finals th, #finals td { padding: 8px 10px; text-align: left; font-size: 0.88rem; white-space: nowrap; }
#finals th { background: var(--card2); color: var(--muted); font-weight: 600; }
#finals tr.orig-row td, #finals tr.orig-row th { border-top: 2px solid #34406a; }
#finals tr.newbet-row td { border-top: 1px dashed #2a3554; }
#finals tr.actual-row td, #finals tr.actual-row th { border-top: 2px solid #34406a; }
#finals td.hit { background: rgba(46, 204, 113, 0.18); }
#finals td.miss-final { background: rgba(255, 94, 91, 0.10); }
#finals .fpts { color: var(--accent); font-weight: 700; }
#finals th.fname { vertical-align: middle; color: var(--text); font-weight: 700; background: var(--card2); }
#finals td.bet-tag { color: var(--muted); font-size: 0.8rem; }
#finals td.bet-tag small { display: block; font-size: 0.66rem; opacity: 0.65; }
.finals-legend { margin: 8px 2px 0; line-height: 1.4; }

/* Win probabilities */
.wc-title { margin: 22px 0 4px; font-size: 1.05rem; color: var(--accent); }
.wc-note { margin: 0 2px 10px; line-height: 1.4; }
.wc-row {
  background: var(--card); border-radius: 9px; padding: 9px 13px; margin-bottom: 6px;
  border: 1px solid transparent;
}
.wc-row.wc-lead { border-color: rgba(255, 209, 102, 0.45); background: linear-gradient(90deg, #2a2a14, var(--card)); }
.wc-head { display: flex; align-items: baseline; gap: 10px; }
.wc-name { font-weight: 700; font-size: 1rem; flex: 1; }
.wc-total { font-size: 1.05rem; font-weight: 800; color: var(--text); white-space: nowrap; }
.wc-total small { font-size: 0.68rem; color: var(--muted); font-weight: 400; }
.wc-pct { font-size: 1.15rem; font-weight: 800; color: var(--accent); width: 66px; text-align: right; white-space: nowrap; }
.wc-pct small { font-size: 0.68rem; color: var(--muted); font-weight: 400; }
.wc-break {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  margin: 5px 0 7px; color: var(--muted); font-size: 0.76rem;
}
.wc-break b { color: var(--text); font-weight: 700; }
.wc-bar-wrap { height: 8px; background: #0e1526; border-radius: 4px; overflow: hidden; }
.wc-bar { display: block; height: 100%; background: linear-gradient(90deg, #457b9d, var(--accent)); border-radius: 4px; }

/* Top scorers */
.scorer-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 9px; padding: 9px 14px; margin-bottom: 6px;
}
.scorer-rank { font-size: 1.1rem; font-weight: 700; width: 30px; text-align: center; flex-shrink: 0; }
.scorer-name { font-weight: 700; font-size: 1rem; }
.scorer-picks {
  color: var(--accent); font-size: 0.8rem; background: rgba(255, 209, 102, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.3); border-radius: 6px; padding: 1px 8px; white-space: nowrap;
}
.scorer-goals { margin-left: auto; font-size: 1.25rem; font-weight: 800; color: var(--accent); white-space: nowrap; }
.scorer-goals small { font-size: 0.7rem; color: var(--muted); font-weight: 400; }

/* Matches */
.date-header {
  margin: 22px 0 8px; font-weight: 700; color: var(--muted);
  font-size: 0.95rem; border-bottom: 1px solid #26314f; padding-bottom: 4px;
}
.date-header::first-letter { text-transform: uppercase; }
.match-card { background: var(--card); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.match-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.match-num { color: var(--muted); font-size: 0.75rem; width: 56px; flex-shrink: 0; }
.match-teams { font-weight: 700; font-size: 1rem; flex: 1; min-width: 230px; }
.match-score { font-weight: 800; font-size: 1.05rem; color: var(--accent); }
.match-time { color: var(--muted); font-size: 0.85rem; }
.live-badge {
  background: var(--live); color: white; font-size: 0.7rem; font-weight: 800;
  padding: 1px 7px; border-radius: 9px; animation: pulse 1.4s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
.bets-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.bet-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card2); border-radius: 7px; padding: 3px 8px; font-size: 0.8rem;
}
.bet-chip .bname { color: var(--muted); font-size: 0.72rem; }
.bet-chip .bscore { font-weight: 700; }
.bet-chip .ot-pick { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* Knockout */
.ko-stage { margin: 14px 0 6px; font-weight: 700; color: var(--muted); font-size: 0.9rem; }
.ko-card { background: var(--card); border-radius: 8px; padding: 7px 12px; margin-bottom: 5px; }
.ko-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.ko-card .match-teams { font-size: 0.92rem; min-width: 0; }
.ko-card .bets-row { margin-top: 7px; }
.note { color: var(--muted); font-size: 0.85rem; }

footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 18px; border-top: 1px solid #26314f; }

@media (max-width: 640px) {
  .lb-detail { display: none; }
  .lb-bar-wrap { display: none; }
  .match-num { width: auto; }
}
