:root {
  --bg: #0b1220;
  --card: #131c2e;
  --card2: #1a2742;
  --line: #25324d;
  --text: #e8eef9;
  --muted: #9fb0cc;
  --accent: #38e07b;
  --accent2: #4aa3ff;
  --warn: #ffd166;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -200px, #16233d 0%, var(--bg) 60%);
  color: var(--text);
  line-height: 1.55;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1040px; margin: 0 auto; padding: 0 18px; }

header.site {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(8px);
  background: rgba(11,18,32,.78);
  border-bottom: 1px solid var(--line);
}
header.site .container { display: flex; align-items: center; gap: 18px; height: 58px; }
.brand { font-weight: 800; letter-spacing: .3px; color: var(--text); }
.brand span { color: var(--accent); }
nav.main { display: flex; gap: 16px; margin-left: auto; flex-wrap: wrap; }
nav.main a { color: var(--muted); font-size: 14px; font-weight: 600; }
nav.main a:hover { color: var(--text); text-decoration: none; }

.hero { padding: 46px 0 18px; }
.hero h1 { font-size: clamp(26px, 4vw, 40px); margin: 0 0 10px; line-height: 1.15; }
.hero p { color: var(--muted); max-width: 680px; margin: 0; }

.section { padding: 26px 0; }
.section h2 { font-size: 22px; margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; overflow-x: auto; }
.grid { display: grid; gap: 14px; }
.grid.groups { grid-template-columns: 1fr; }
.grid.matches { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
tr:hover td { background: rgba(255,255,255,.02); }
.rank { color: var(--muted); width: 36px; }
.rating { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }
.flag { font-size: 18px; margin-right: 7px; }

.qual { color: var(--accent); margin-right: 5px; font-size: 10px; vertical-align: middle; }
.tag.ft { color: var(--accent); border-color: var(--accent); }
table.mini { font-size: 13px; }
table.mini th, table.mini td { padding: 6px 6px; }
table.mini td:first-child { white-space: nowrap; }
/* one group per row: header band on the left, standings table on the right */
.group-card { display: flex; align-items: center; gap: 18px; }
.group-head { display: flex; align-items: center; gap: 10px; flex: 0 0 168px; }
.group-badge { display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: var(--accent); color: #0b0f1a; font-weight: 800; font-size: 17px; }
.group-card h3 { margin: 0; font-size: 15px; color: var(--text); }
.group-card table.mini { flex: 1; margin: 0; }
.group-card table.mini th:not(:first-child),
.group-card table.mini td:not(:first-child) { text-align: center; width: 72px; }
@media (max-width: 640px) {
  .group-card { flex-direction: column; align-items: stretch; gap: 10px; }
  .group-head { flex-basis: auto; }
}

.match-card { display: block; color: var(--text); }
.match-card:hover { text-decoration: none; border-color: var(--accent2); }
.match-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.match-teams { font-weight: 700; }
.score { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.score .x { color: var(--muted); margin: 0 6px; font-size: 18px; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }

.bars { margin-top: 12px; }
.bar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.bar .w { background: var(--accent); }
.bar .d { background: #41507a; }
.bar .l { background: var(--accent2); }
.bar div { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #06140b; }
.bar .d { color: #fff; }
.bar .l { color: #04121f; }
.legend { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

.bigmatch { text-align: center; padding: 30px 16px; }
.bigmatch .vs { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.bigmatch .team { font-size: 20px; font-weight: 800; }
.bigmatch .pred-score { font-size: 56px; font-weight: 900; font-variant-numeric: tabular-nums; margin: 8px 0; }
.bigmatch .pred-score .x { color: var(--muted); font-size: 34px; margin: 0 10px; }

.compare-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
select {
  background: var(--card2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-size: 15px; min-width: 200px;
}
#compareResult { margin-top: 22px; }

.ad { margin: 22px 0; padding: 10px; border: 1px dashed var(--line); border-radius: 10px;
  text-align: center; color: var(--muted); font-size: 12px; min-height: 90px;
  display: flex; align-items: center; justify-content: center; }

.notice { background: rgba(255,209,102,.08); border: 1px solid rgba(255,209,102,.3);
  color: var(--warn); border-radius: 10px; padding: 12px 14px; font-size: 13px; }

footer.site { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 0; color: var(--muted); font-size: 13px; }
footer.site a { color: var(--muted); }
footer.site .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.breadcrumb { font-size: 13px; color: var(--muted); padding: 14px 0 0; }

/* ---------- Prose (team descriptions) ---------- */
.prose { max-width: 72ch; }
.prose p { margin: 0 0 12px; color: var(--text); }
.prose p:last-child { margin-bottom: 0; }

/* ---------- Match evidence ---------- */
.grid.case-grid { grid-template-columns: 1fr 1fr; }
.case-head { font-size: 16px; margin-bottom: 4px; }
.case-col p { color: var(--muted); }

/* ---------- Knockout bracket ---------- */
.champ { text-align: center; }
.champ-name { font-size: 28px; font-weight: 900; margin-top: 4px; }
.bracket { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: stretch; }
.ko-round { min-width: 210px; display: flex; flex-direction: column; gap: 10px; justify-content: space-around; }
.ko-round h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); position: sticky; top: 0; }
.ko-tie { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.ko-team { font-size: 13px; padding: 3px 0; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.ko-team.win { color: var(--text); font-weight: 700; }
.ko-foot { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Mobile optimization ---------- */
@media (max-width: 640px) {
  header.site .container {
    height: auto; min-height: 56px; flex-wrap: wrap;
    padding-top: 8px; padding-bottom: 8px; gap: 6px 14px;
  }
  .brand { width: 100%; }
  nav.main { margin-left: 0; gap: 14px; }
  nav.main a { font-size: 13px; }

  .hero { padding: 26px 0 10px; }
  .hero h1 { font-size: 24px; }
  .section { padding: 18px 0; }
  .section h2 { font-size: 19px; }

  /* match cards: let the teams/score row wrap and breathe */
  .grid.matches { grid-template-columns: 1fr; }
  .grid.case-grid { grid-template-columns: 1fr; }
  .match-head { flex-wrap: wrap; gap: 6px; }
  .match-teams { font-size: 14px; }
  .score { font-size: 22px; }

  /* big match header on match pages */
  .bigmatch { padding: 22px 12px; }
  .bigmatch .team { font-size: 17px; }
  .bigmatch .pred-score { font-size: 42px; }
  .bigmatch .pred-score .x { font-size: 26px; margin: 0 6px; }

  /* compare controls stack full-width */
  .compare-controls { flex-direction: column; align-items: stretch; gap: 10px; }
  .field { width: 100%; }
  select { width: 100%; min-width: 0; }

  /* denser tables; .card already scrolls horizontally if needed */
  th, td { padding: 8px 8px; font-size: 13px; }
  .legend { flex-wrap: wrap; gap: 8px 14px; }
}

@media (max-width: 380px) {
  .score { font-size: 20px; }
  .bigmatch .pred-score { font-size: 36px; }
  nav.main { gap: 10px; }
}
