:root {
  --primary: #37003c;
  --primary-2: #4a0050;
  --primary-dark: #240028;
  --accent: #00ff87;
  --accent-dark: #00d672;
  --bg: #f5f5f8;
  --card: #ffffff;
  --text: #14101a;
  --text-muted: #5e5a6e;
  --border: #ececf2;
  --green: #00b86b;
  --red: #e74c3c;
  --shadow: 0 6px 28px rgba(55, 0, 60, 0.08);
  --shadow-sm: 0 2px 10px rgba(55, 0, 60, 0.05);
  --radius: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== HEADER ========== */
.site-header {
  background: var(--primary);
  color: white;
  padding: 18px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: white;
}
.brand-logo {
  width: 46px;
  height: 46px;
  background: var(--accent);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  border-radius: 12px;
  letter-spacing: -0.5px;
}
.brand h1 {
  font-size: 19px;
  font-weight: 800;
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.3px;
}
.subtitle {
  font-size: 12px;
  opacity: 0.7;
  margin: 2px 0 0;
  font-weight: 500;
}
.main-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.main-nav a {
  color: white;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease;
}
.main-nav a:hover {
  background: rgba(255,255,255,0.12);
}

/* ========== HERO ========== */
.hero {
  background:
    radial-gradient(circle at 90% 20%, rgba(0,255,135,0.12), transparent 50%),
    linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: white;
  padding: 80px 0 100px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 10% 90%, rgba(0,255,135,0.08), transparent 40%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 820px;
}
.hero-tag {
  display: inline-block;
  background: var(--accent);
  color: var(--primary);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.hero h2 {
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 18px;
  letter-spacing: -1px;
}
.hero p {
  font-size: clamp(15px, 2vw, 18px);
  opacity: 0.88;
  margin: 0 0 28px;
  max-width: 680px;
  line-height: 1.55;
}
.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: var(--primary);
  padding: 14px 26px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

/* ========== HERO LEAGUE SWITCHER ========== */
.hero-switcher {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  max-width: 640px;
}
.hero-switcher-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 10px;
}
.league-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.league-form input {
  flex: 1;
  min-width: 240px;
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.league-form input::placeholder { color: rgba(255, 255, 255, 0.45); }
.league-form input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.12);
}
.league-form button {
  padding: 12px 22px;
  border: none;
  background: var(--accent);
  color: var(--primary);
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: background 0.15s ease, transform 0.15s ease;
}
.league-form button:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
}
.league-form button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.league-status {
  margin-top: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  min-height: 18px;
  font-family: inherit;
}
.league-status.loading::before { content: "⏳  "; }
.league-status.success { color: var(--accent); }
.league-status.success::before { content: "✓  "; }
.league-status.error { color: #ff9b8c; }
.league-status.error::before { content: "!  "; }

/* ========== STATS ROW ========== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin: 8px 0 24px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 700;
}
.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 6px;
  letter-spacing: -1px;
  line-height: 1.1;
}
.stat-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 500;
}

/* ========== CARDS ========== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}
.card h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.2px;
}
.card-sub {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

/* ========== TABLE ========== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead th {
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 16px;
  text-align: left;
}
thead th:first-child { border-top-left-radius: var(--radius-sm); }
thead th:last-child { border-top-right-radius: var(--radius-sm); }
.col-num { width: 50px; text-align: center; }
.col-points, .col-total, .col-move { text-align: right; }
tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr.is-you {
  background: rgba(0, 255, 135, 0.08);
}
tbody tr.is-you td:first-child {
  border-left: 3px solid var(--accent);
}
.rank-cell {
  font-weight: 800;
  color: var(--primary);
  font-size: 16px;
  text-align: center;
}
.team-cell {
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.manager-cell {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
  font-weight: 500;
}
.points-cell, .total-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.total-cell { font-weight: 700; color: var(--primary); font-size: 15px; }
.you-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--primary);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.bench-cell { color: var(--text-muted); font-weight: 500; }
.move-cell { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.move-up { color: var(--green); }
.move-down { color: var(--red); }
.move-same { color: var(--text-muted); }

/* ========== POSITION HEATMAP ========== */
.heatmap-table { font-variant-numeric: tabular-nums; }
.heatmap-table thead th {
  text-align: center;
  padding: 12px 8px;
  font-size: 11px;
}
.heatmap-table thead th:first-child {
  text-align: left;
  padding-left: 16px;
  min-width: 160px;
}
.heatmap-table tbody td {
  padding: 12px 8px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.heatmap-table tbody td.team-col {
  text-align: left;
  padding-left: 16px;
  font-weight: 700;
  background: var(--card);
  border-left: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.heatmap-table tbody tr:last-child td { border-bottom: none; }
.heatmap-table tbody tr.is-you td.team-col {
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}
.heatmap-cell-zero { color: var(--text-muted); opacity: 0.35; font-weight: 500; }
.heatmap-cell-light { color: var(--primary); }
.heatmap-cell-dark { color: white; }

/* ========== CHIPS OVERVIEW ========== */
.chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.chips-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 18px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.chips-card.is-you {
  border-left: 3px solid var(--accent);
  background: rgba(0, 255, 135, 0.06);
}
.chips-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  gap: 8px;
  flex-wrap: wrap;
}
.chips-team {
  font-weight: 800;
  color: var(--primary);
  font-size: 15px;
  letter-spacing: -0.2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chips-summary {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.chips-summary strong {
  color: var(--primary);
  font-weight: 800;
}
.chips-rows {
  display: grid;
  gap: 8px;
}
.chips-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.chips-row-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.chips-pills {
  display: flex;
  gap: 6px;
}
.chip-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}
.chip-pill.used {
  background: var(--primary);
  color: white;
}
.chip-pill.free {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  opacity: 0.7;
}

/* ========== CAPTAINS — THIS GW STRIP ========== */
.captains-now-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.cap-now {
  background: #f7f5fa;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
}
.cap-now-team {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  margin-bottom: 4px;
}
.cap-now-player {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.1;
}
.cap-now-pts {
  font-size: 22px;
  font-weight: 900;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.cap-now.cap-now-tc {
  background: rgba(255, 204, 0, 0.18);
  border-color: #e6b800;
}
.cap-now.cap-now-tc .cap-now-pts { color: #b8860b; }
.cap-now.cap-now-blank .cap-now-pts { color: var(--red); opacity: 0.85; }

/* ========== CAPTAINS PER GAMEWEEK ========== */
.captains-wrap {
  max-height: 520px;
  overflow: auto;
}
.captains-table { font-variant-numeric: tabular-nums; font-size: 12px; }
.captains-table thead th {
  text-align: center;
  padding: 10px 6px;
  font-size: 10px;
  position: sticky;
  top: 0;
  z-index: 2;
}
.captains-table thead th.cap-gw-col {
  text-align: center;
  min-width: 56px;
  left: 0;
  z-index: 3;
}
.captains-table tbody td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  vertical-align: middle;
  min-width: 88px;
}
.captains-table tbody td.cap-gw-col {
  font-weight: 800;
  color: var(--primary);
  background: var(--card);
  border-left: none;
  position: sticky;
  left: 0;
  z-index: 1;
}
.captains-table tbody tr:last-child td { border-bottom: none; }
.cap-cell .cap-name {
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.cap-cell .cap-pts {
  margin-top: 2px;
  font-weight: 800;
  color: var(--primary);
  font-size: 13px;
}
.cap-cell.cap-tc {
  background: rgba(255, 204, 0, 0.18);
}
.cap-cell.cap-tc .cap-pts { color: #b8860b; }
.cap-cell.cap-blank .cap-pts { color: var(--red); opacity: 0.75; }
.cap-star { color: #d4a200; }
.cap-empty {
  color: var(--text-muted);
  opacity: 0.5;
  font-weight: 500;
}

/* ========== CHARTS ========== */
.chart-wrap {
  height: 360px;
  position: relative;
}
.chart-wrap-tall { height: 440px; }

/* ========== ROW OF 2 ========== */
.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
.row-2-overlap {
  margin-top: -56px;
  margin-bottom: 28px;
  position: relative;
  z-index: 5;
}

.highlight-card {
  position: relative;
  overflow: hidden;
}
.highlight-card .tag {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
}
.motw .tag { background: var(--accent); color: var(--primary); }
.flop .tag { background: #ffe5e8; color: #c0392b; }
.highlight-card h3 {
  font-size: 24px;
  margin: 0 0 4px;
  letter-spacing: -0.5px;
}
.muted-team {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}
.big-number {
  font-size: 56px;
  font-weight: 900;
  color: var(--primary);
  margin: 16px 0 4px;
  letter-spacing: -2px;
  line-height: 1;
}
.flop .big-number { color: #c0392b; }
.muted {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ========== SECTION HEADING ========== */
.section-heading {
  font-size: 26px;
  font-weight: 800;
  margin: 36px 0 20px;
  color: var(--primary);
  letter-spacing: -0.5px;
}

/* ========== TALKING POINTS ========== */
.talking-points {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 12px;
}
.tp-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
  display: flex;
  flex-direction: column;
}
.tp-card h4 {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--primary);
  letter-spacing: -0.2px;
}
.tp-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
  line-height: 1.55;
}

/* ========== BANTER ========== */
.banter-feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 48px;
}
.banter-post {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--primary);
}
.banter-post.placeholder {
  border-left-color: var(--accent);
  border: 2px dashed var(--border);
  border-left: 4px solid var(--accent);
  background: transparent;
  box-shadow: none;
}
.banter-author {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.banter-team {
  font-size: 11px;
  background: var(--bg);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.banter-text {
  color: var(--text);
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.5;
}
.banter-text code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}
.banter-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ========== COMMENTS (CUSDIS) ========== */
.comments-card {
  margin-bottom: 48px;
  min-height: 200px;
}
#cusdis_thread {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#cusdis_thread iframe {
  width: 100% !important;
  border: none;
}

/* ========== HISTORY / HALL OF FAME ========== */
.section-lede {
  color: var(--text-muted);
  font-size: 15px;
  margin: -8px 0 24px;
  max-width: 720px;
  line-height: 1.55;
}
.hof-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.hof-card {
  text-align: left;
  position: relative;
  overflow: hidden;
}
.hof-card .tag {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
  background: var(--bg);
  color: var(--text-muted);
}
.hof-card.hof-champ .tag,
.hof-card.hof-cup .tag {
  background: var(--accent);
  color: var(--primary);
}
.hof-card h4 {
  font-size: 26px;
  margin: 0 0 6px;
  color: var(--primary);
  letter-spacing: -0.5px;
}
.hof-meta {
  font-size: 14px;
  color: var(--text);
  margin: 0 0 4px;
  font-weight: 600;
}
.hof-big {
  font-size: 38px;
  font-weight: 900;
  color: var(--primary);
  margin: 8px 0 4px;
  letter-spacing: -1px;
  line-height: 1;
}
.history-table th {
  background: var(--primary);
}
.history-table tbody tr.is-current {
  background: rgba(0, 255, 135, 0.12);
}
.history-table tbody tr.is-current td:first-child {
  border-left: 3px solid var(--accent);
}
.history-table tbody tr.is-you-history {
  background: rgba(0, 255, 135, 0.08);
}
.history-table tbody tr.is-you-history td:first-child {
  border-left: 3px solid var(--accent);
}
.trophy-cell { font-size: 14px; }
.history-table tbody tr.era-divider td {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 10px 16px;
  text-align: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ========== FOOTER ========== */
.site-footer {
  background: var(--primary-dark);
  color: white;
  padding: 28px 0;
  margin-top: 48px;
  text-align: center;
  font-size: 14px;
  opacity: 0.95;
}
.site-footer p { margin: 0; }

/* ========== MOBILE ========== */
@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .site-header { padding: 14px 0; }
  .brand h1 { font-size: 17px; }
  .subtitle { font-size: 11px; }
  .main-nav a { padding: 6px 10px; font-size: 13px; }
  .hero { padding: 56px 0 80px; }
  .stats-row { gap: 12px; }
  .stat-value { font-size: 26px; }
  .row-2 { grid-template-columns: 1fr; gap: 16px; }
  .row-2-overlap { margin-top: -48px; }
  .card { padding: 20px; }
  .big-number { font-size: 44px; }
  thead th, tbody td { padding: 10px 12px; font-size: 13px; }
  .chart-wrap { height: 320px; }
  .chart-wrap-tall { height: 380px; }
}
