@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #08090d;
  --surface: #11141b;
  --surface-2: #171b24;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);

  --fg: #eef1f6;
  --muted: #8b93a5;
  --faint: #5b6273;

  --accent: #3ddc84;
  --accent-glow: rgba(61, 220, 132, 0.18);

  --gold: #f5c451;
  --silver: #c3ccdb;
  --bronze: #cd7f45;

  --display: 'Barlow Condensed', 'Oswald', 'Arial Narrow', sans-serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(900px 400px at 15% -10%, rgba(61, 220, 132, 0.10), transparent 70%),
    radial-gradient(700px 350px at 90% -5%, rgba(80, 130, 255, 0.08), transparent 70%);
  background-repeat: no-repeat;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(8, 9, 13, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--fg);
}

.wordmark .mark {
  display: grid;
  place-items: center;
  color: var(--accent);
  filter: drop-shadow(0 3px 10px var(--accent-glow));
}

.crown {
  width: 34px;
  height: 29px;
  display: block;
}

.crown.lead {
  width: 15px;
  height: 13px;
  color: var(--gold);
  flex-shrink: 0;
  filter: drop-shadow(0 1px 5px rgba(245, 196, 81, 0.45));
}

.wordmark .name {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}

.wordmark .sub {
  display: block;
  font-family: var(--body);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 2px;
}

nav.pills {
  display: flex;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
}

nav.pills a {
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

nav.pills a:hover { color: var(--fg); }

nav.pills a.active {
  background: var(--accent);
  color: #06180e;
}

/* ---------- page intro ---------- */

main { padding: 2rem 0 3rem; min-height: 60vh; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.page-head h2 {
  font-family: var(--display);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0;
  line-height: 1;
}

.page-head .lede {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.45rem 0 0;
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  white-space: nowrap;
}

.live-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(61, 220, 132, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); }
}

/* ---------- stat cards ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem;
}

.stat .label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.stat .value {
  font-family: var(--display);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.15;
  margin-top: 0.3rem;
  letter-spacing: 0.01em;
}

.stat .value.accent { color: var(--accent); }

.stat .note {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

/* ---------- tables ---------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.table-scroll { overflow-x: auto; }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.93rem;
}

thead th {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--line-strong);
  color: var(--faint);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.8rem 1rem;
  text-align: left;
  white-space: nowrap;
}

tbody td {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 1rem;
  white-space: nowrap;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr { transition: background 0.14s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.035); }

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* rank badges */

.badge {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

.badge.g1 { background: linear-gradient(150deg, #f7d27a, var(--gold)); color: #241a02; border-color: transparent; }
.badge.g2 { background: linear-gradient(150deg, #e2e8f2, var(--silver)); color: #1c222c; border-color: transparent; }
.badge.g3 { background: linear-gradient(150deg, #e0a06a, var(--bronze)); color: #241204; border-color: transparent; }

.team-cell {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.team-cell a {
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.14s;
}

.team-cell a:hover { color: var(--accent); }

.standings tbody tr.podium td { background: rgba(245, 196, 81, 0.035); }
.standings tbody tr.podium:hover td { background: rgba(245, 196, 81, 0.07); }
.standings tbody tr.leader td { background: rgba(61, 220, 132, 0.055); }
.standings tbody tr.leader:hover td { background: rgba(61, 220, 132, 0.09); }

td.pts {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

td.secondary { color: var(--muted); }

.wins-pill {
  display: inline-block;
  min-width: 26px;
  text-align: center;
  padding: 0.15rem 0.45rem;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

.wins-pill.has {
  background: rgba(245, 196, 81, 0.14);
  border-color: rgba(245, 196, 81, 0.35);
  color: var(--gold);
}

/* ---------- history matrix ---------- */

.history th:first-child,
.history td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 2;
  border-right: 1px solid var(--line);
}

.history thead th:first-child { background: #14181f; z-index: 3; }
.history tbody tr:hover td:first-child { background: #171b23; }

.cell-score {
  display: block;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.1;
}

.cell-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--faint);
  margin-top: 0.15rem;
}

.finish {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
}

.finish.f1 { background: rgba(245, 196, 81, 0.16); border-color: rgba(245, 196, 81, 0.4); color: var(--gold); }
.finish.f2 { background: rgba(195, 204, 219, 0.14); border-color: rgba(195, 204, 219, 0.3); color: var(--silver); }
.finish.f3 { background: rgba(205, 127, 69, 0.16); border-color: rgba(205, 127, 69, 0.35); color: var(--bronze); }

.bye { color: var(--faint); font-size: 1.1rem; }

td.total {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
}

/* ---------- team page ---------- */

.team-hero {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  background: linear-gradient(150deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.25rem;
}

.team-hero .badge {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  font-size: 2rem;
  flex-shrink: 0;
}

.team-hero h2 {
  font-family: var(--display);
  font-size: 2.4rem;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin: 0;
  line-height: 1;
}

.team-hero .rank-line {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

.back {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.back:hover { color: var(--accent); }

/* ---------- misc ---------- */

.empty {
  color: var(--muted);
  text-align: center;
  padding: 2.5rem 1rem;
}

.points-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1.1rem;
  align-items: center;
}

.points-legend .lg-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-right: 0.3rem;
}

.points-legend .slot {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.2rem 0.5rem;
}

.points-legend .slot b {
  color: var(--fg);
  font-family: var(--display);
  font-size: 0.95rem;
}

.points-legend .lg-link {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  margin-left: 0.35rem;
}

.points-legend .lg-link:hover { text-decoration: underline; }

/* ---------- rules page ---------- */

.rules-section { margin-bottom: 2.5rem; }

.rules-section h3 {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 0.8rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}

.sec-num {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: rgba(61, 220, 132, 0.1);
  border: 1px solid rgba(61, 220, 132, 0.28);
  border-radius: 7px;
  padding: 0.15rem 0.45rem;
  font-family: var(--body);
}

.prose {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 68ch;
  margin: 0 0 1.1rem;
}

.prose strong { color: var(--fg); }

.fine {
  color: var(--faint);
  font-size: 0.82rem;
  max-width: 68ch;
  margin: 0.9rem 0 0;
}

.rule-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.55rem;
  max-width: 72ch;
}

.rule-list li {
  position: relative;
  padding: 0.75rem 1rem 0.75rem 2.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  font-size: 0.9rem;
}

.rule-list li::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 1.15rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.rule-list strong { color: var(--fg); }

.points-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 0.6rem;
}

.pt-card {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.5rem;
  text-align: center;
}

.pt-card.p1 { border-color: rgba(245, 196, 81, 0.45); background: linear-gradient(160deg, rgba(245, 196, 81, 0.14), var(--surface)); }
.pt-card.p2 { border-color: rgba(195, 204, 219, 0.35); background: linear-gradient(160deg, rgba(195, 204, 219, 0.1), var(--surface)); }
.pt-card.p3 { border-color: rgba(205, 127, 69, 0.4); background: linear-gradient(160deg, rgba(205, 127, 69, 0.12), var(--surface)); }

.pt-place {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.pt-card.p1 .pt-place { color: var(--gold); }
.pt-card.p2 .pt-place { color: var(--silver); }
.pt-card.p3 .pt-place { color: var(--bronze); }

.pt-value {
  font-family: var(--display);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.05;
  margin-top: 0.15rem;
}

.pt-unit {
  font-size: 0.65rem;
  color: var(--faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.payouts td.pts { font-size: 1.6rem; }

footer {
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.78rem;
  padding: 1.25rem 0 2.5rem;
}

footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--accent); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1rem;
  border-radius: 10px;
  overflow-x: auto;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 620px) {
  .page-head h2 { font-size: 2rem; }
  .wordmark .name { font-size: 1.25rem; }
  thead th, tbody td { padding: 0.65rem 0.7rem; }
  td.pts { font-size: 1.25rem; }
  .hide-sm { display: none; }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .stat { padding: 0.75rem 0.85rem; }
  .stat .value { font-size: 1.5rem; }
  .stat .note { font-size: 0.72rem; }
  .stats .stat:first-child { grid-column: 1 / -1; }
}
