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

/* ─── Design Tokens ─────────────────────────────────────────────── */
/* --primary*, --accent, --bg-base and the *-rgb values are overridden
   at runtime by theme.js. */
:root {
  --primary:        #22c55e;
  --primary-light:  #4ade80;
  --primary-dark:   #166534;
  --primary-rgb:    34, 197, 94;
  --accent:         #facc15;
  --accent-rgb:     250, 204, 21;
  --bg-base:        #050914;

  --surface:        rgba(255, 255, 255, 0.04);
  --surface-2:      rgba(255, 255, 255, 0.07);
  --border:         rgba(255, 255, 255, 0.09);
  --border-strong:  rgba(255, 255, 255, 0.16);

  --text:           #f1f5f9;
  --text-muted:     rgba(226, 232, 240, 0.62);
  --text-faint:     rgba(226, 232, 240, 0.38);

  --win:            #4ade80;
  --loss:           #f87171;

  --font-display:   'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body:      'Inter', system-ui, -apple-system, sans-serif;

  --radius:         18px;
  --radius-sm:      10px;
  --gutter:         clamp(16px, 4vw, 32px);
  --max:            1120px;
}

/* ─── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 30rem at 15% -10%, rgba(var(--primary-rgb), 0.16), transparent 70%),
    radial-gradient(50rem 30rem at 100% 110%, rgba(var(--accent-rgb), 0.07), transparent 70%);
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.num { font-variant-numeric: tabular-nums; }

/* ─── Top Bar ───────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg-base) 78%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  color: #04070d;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.35);
}

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

.brand-name small {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tabs a {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.tabs a:hover { color: var(--text); background: var(--surface-2); }

.tabs a[aria-current="page"] {
  color: #04070d;
  background: var(--primary);
}

@media (max-width: 760px) {
  .topbar .wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
  }
  .tabs a { flex: 1 0 auto; text-align: center; padding: 0.5rem 0.7rem; font-size: 0.84rem; }
  .tabs .long { display: none; }
}

/* ─── Page Hero ─────────────────────────────────────────────────── */
.hero {
  padding: clamp(2.5rem, 7vw, 4.5rem) 0 clamp(1.75rem, 4vw, 2.5rem);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--primary-rgb), 0.4);
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary-light);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.hero h1 {
  margin-top: 1rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.2rem, 11vw, 6.5rem);
  line-height: 0.88;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.hero h1 .outline {
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(var(--primary-rgb), 0.85);
}

.hero p {
  margin-top: 1rem;
  max-width: 40rem;
  color: var(--text-muted);
  font-size: clamp(0.98rem, 2vw, 1.08rem);
}

/* ─── Sections & Cards ──────────────────────────────────────────── */
.section { margin-bottom: clamp(2rem, 5vw, 3rem); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.section-head p {
  color: var(--text-faint);
  font-size: 0.82rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 3vw, 1.6rem);
}

.status {
  grid-column: 1 / -1;
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

.status.error { color: var(--loss); }

/* ─── Teams (bento) ─────────────────────────────────────────────── */
.bento {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.team-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  scroll-margin-top: 140px;
  transition: border-color 0.2s, transform 0.2s;
}

.team-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }

.team-card .watermark {
  position: absolute;
  right: 0.6rem;
  bottom: -1.6rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 7.5rem;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.08);
  pointer-events: none;
  user-select: none;
}

.team-card header { position: relative; }

.team-card h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.1rem;
  line-height: 1;
  text-transform: uppercase;
}

.team-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pill.gold {
  background: rgba(var(--accent-rgb), 0.14);
  border-color: rgba(var(--accent-rgb), 0.45);
  color: var(--accent);
}

.roster {
  position: relative;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.roster li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
}

.avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(var(--primary-rgb), 0.14);
  border: 1px solid rgba(var(--primary-rgb), 0.35);
  color: var(--primary-light);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.team-card.leader {
  grid-column: span 2;
  background:
    radial-gradient(40rem 20rem at 100% 0%, rgba(var(--accent-rgb), 0.12), transparent 60%),
    linear-gradient(160deg, rgba(var(--primary-rgb), 0.16), rgba(var(--primary-rgb), 0.03));
  border-color: rgba(var(--primary-rgb), 0.45);
}

.team-card.leader .watermark {
  font-size: 11rem;
  -webkit-text-stroke-color: rgba(var(--primary-rgb), 0.22);
}

.team-card.leader h2 { font-size: clamp(2.8rem, 6vw, 4rem); }

.leader-score {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-top: auto;
}

.leader-score strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(4rem, 10vw, 6rem);
  line-height: 0.8;
  color: var(--primary-light);
}

.leader-score span { color: var(--text-muted); font-weight: 600; }

.team-card.leader .roster { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.team-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.25);
}

@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .glance { grid-column: auto; }
}

@media (max-width: 600px) {
  .bento { grid-template-columns: 1fr; }
  .team-card.leader { grid-column: auto; }
  .team-card.leader .roster { grid-template-columns: 1fr; }
}

.glance {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.4rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
}

.glance h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  text-transform: uppercase;
}

.glance p { margin-top: 0.4rem; color: var(--text-muted); }

.links { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover { background: var(--surface-2); }

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #04070d;
}

.btn.primary:hover { background: var(--primary-light); }

/* ─── Standings ─────────────────────────────────────────────────── */
.spotlight {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.spot-main {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 220px;
  padding: 1.6rem;
  border-radius: var(--radius);
  border: 1px solid rgba(var(--primary-rgb), 0.45);
  background:
    radial-gradient(30rem 16rem at 100% 0%, rgba(var(--accent-rgb), 0.14), transparent 60%),
    linear-gradient(160deg, rgba(var(--primary-rgb), 0.2), rgba(var(--primary-rgb), 0.04));
  text-decoration: none;
}

.spot-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.spot-team {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 7vw, 3.6rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.spot-pts {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.spot-pts strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 4.5rem;
  line-height: 0.85;
  color: var(--primary-light);
}

.spot-pts span { color: var(--text-muted); font-weight: 600; }

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.stat {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

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

.stat strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.2rem;
  line-height: 1;
}

@media (max-width: 760px) {
  .spotlight { grid-template-columns: 1fr; }
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.standings-table th {
  padding: 0.8rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.standings-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.standings-table tr:last-child td { border-bottom: none; }

.standings-table tbody tr { transition: background 0.15s; }
.standings-table tbody tr:hover { background: var(--surface-2); }

.standings-table .c { text-align: center; }

.rank {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--text-faint);
  width: 2.5rem;
}

.is-top .rank { color: var(--accent); }

.team-link {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  text-transform: uppercase;
  text-decoration: none;
}

.team-link:hover { color: var(--primary-light); }

.pts-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 150px;
}

.pts-cell strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  min-width: 2ch;
}

.bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary-light));
}

.form {
  display: inline-flex;
  gap: 4px;
}

.form b {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-muted);
}

.form b.w { background: rgba(74, 222, 128, 0.16); color: var(--win); }
.form b.l { background: rgba(248, 113, 113, 0.14); color: var(--loss); }

@media (max-width: 600px) {
  .standings-table .hide-sm { display: none; }
  .standings-table th, .standings-table td { padding: 0.75rem 0.6rem; }
  .pts-cell { min-width: 0; }
}

.matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  font-variant-numeric: tabular-nums;
}

.matrix th {
  padding: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.matrix tbody th { text-align: left; white-space: nowrap; }

.matrix td {
  min-width: 64px;
  height: 46px;
  border-radius: 8px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--surface);
  color: var(--text-faint);
}

.matrix td.self { background: transparent; }
.matrix td.w { background: rgba(74, 222, 128, 0.13); color: var(--win); }
.matrix td.l { background: rgba(248, 113, 113, 0.11); color: var(--loss); }
.matrix td.t { background: var(--surface-2); color: var(--text-muted); }

.matrix-wrap { overflow-x: auto; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend i { width: 12px; height: 12px; border-radius: 3px; }

/* ─── Schedule ──────────────────────────────────────────────────── */
.weeks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.week {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 0.6rem;
}

.week-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.week-head h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  text-transform: uppercase;
}

.week-head span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.game {
  display: grid;
  grid-template-columns: 3.4rem 1fr auto 1fr;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.game time {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-faint);
}

.game .side {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--text-muted);
}

.game .side.right { flex-direction: row-reverse; }

.game .side em {
  font-style: normal;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--text-faint);
}

.game .side.won { color: var(--text); }
.game .side.won em { color: var(--primary-light); }

.game .vs {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-faint);
}

.game.tbd .side { color: var(--text-faint); font-weight: 500; }

.week.playoffs {
  border-color: rgba(var(--accent-rgb), 0.4);
  background: linear-gradient(160deg, rgba(var(--accent-rgb), 0.08), transparent);
}

.week.playoffs .week-head span { color: var(--accent); }

/* ─── Rules ─────────────────────────────────────────────────────── */
.format-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.format {
  position: relative;
  overflow: hidden;
  padding: 1.3rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.format .big {
  position: absolute;
  right: 0.6rem;
  bottom: -1.4rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 6.5rem;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(var(--primary-rgb), 0.25);
  pointer-events: none;
}

.format span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary-light);
}

.format h3 {
  margin: 0.35rem 0 0.4rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  text-transform: uppercase;
}

.format p {
  position: relative;
  max-width: 85%;
  font-size: 0.92rem;
  color: var(--text-muted);
}

@media (max-width: 760px) {
  .format-grid { grid-template-columns: 1fr; }
}

.rules {
  list-style: none;
  counter-reset: rule;
  display: grid;
  gap: 0.25rem;
}

.rules li {
  counter-increment: rule;
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  gap: 0.75rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

.rules li:first-child { border-top: none; padding-top: 0.2rem; }

.rules li::before {
  content: counter(rule, decimal-leading-zero);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.1;
  color: var(--primary-light);
}

.rules strong { color: var(--text); font-weight: 600; }

/* ─── Feedback ──────────────────────────────────────────────────── */
.form-card {
  max-width: 720px;
  padding: 0.5rem;
  overflow: hidden;
}

.form-card iframe {
  display: block;
  width: 100%;
  min-height: 780px;
  border: 0;
  border-radius: 12px;
  background: #fff;
}

/* ─── Footer ────────────────────────────────────────────────────── */
.site-footer {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  font-size: 0.82rem;
  color: var(--text-faint);
}

.theme-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-bar-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-right: 0.25rem;
}

.theme-bar-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.theme-bar-swatch:hover { transform: scale(1.15); }
.theme-bar-swatch.active { border-color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
