/* ── Custom properties ────────────────────────────────────────────────────── */
:root {
  --bg:             #070b0f;
  --surface:        #0d1117;
  --surface-raised: #161b22;
  --border:         #21262d;
  --border-subtle:  #161b22;
  --text:           #e6edf3;
  --text-muted:     #7d8590;
  --text-faint:     #3d444d;
  --accent:         #3fb950;
  --accent-dim:     rgba(63, 185, 80, 0.08);
  --accent-border:  rgba(63, 185, 80, 0.35);
  --gold:           #d29922;
  --gold-dim:       rgba(210, 153, 34, 0.12);
  --blue:           #58a6ff;
  --blue-dim:       rgba(88, 166, 255, 0.08);
  --red:            #f85149;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar        { width: 5px; height: 5px; }
::-webkit-scrollbar-track  { background: var(--bg); }
::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 3px; }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.mono    { font-family: 'JetBrains Mono', monospace; }
.eyebrow {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.wrap    { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ── Header ───────────────────────────────────────────────────────────────── */
#site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 15, 0.85);
  backdrop-filter: blur(14px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 16px;
}
.site-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.season-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 3px;
}
/* Season select — inherits season-tag aesthetic */
#season-select {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%237d8590'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  transition: border-color 0.1s ease, color 0.1s ease;
}
#season-select:hover  { border-color: var(--accent); color: var(--text); }
#season-select option { background: var(--surface); color: var(--text); }
.gh-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.12s ease;
}
.gh-link:hover { color: var(--text); }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--border-subtle);
}
.hero h1 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.18;
  margin-bottom: 16px;
  max-width: 580px;
}
.hero p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.75;
  max-width: 540px;
}


/* ── Stats strip ──────────────────────────────────────────────────────────── */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.stat-cell {
  padding: 22px 24px;
  border-right: 1px solid var(--border);
}
.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
  margin-top: 8px;
}
@media (max-width: 640px) {
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ── Toolbar ──────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0;
  flex-wrap: wrap;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 4px 13px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: border-color 0.1s ease, color 0.1s ease, background 0.1s ease;
  user-select: none;
}
.chip:hover  { border-color: var(--accent); color: var(--text); }
.chip.active { background: var(--accent-dim); border-color: var(--accent-border); color: var(--accent); }
.sort-select {
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  outline: none;
}
.sort-select option { background: var(--surface); color: var(--text); }

/* ── Challenge grid ───────────────────────────────────────────────────────── */
.challenge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.challenge-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface);
  transition: background 0.12s ease;
  outline: none;
}
.challenge-card:hover,
.challenge-card:focus-visible { background: var(--surface-raised); }
.challenge-card:focus-visible  { box-shadow: inset 0 0 0 2px var(--accent); }
.challenge-card:hover .card-num { color: var(--text-muted); }
.challenge-card[data-status="pending"] { cursor: default; }
.challenge-card[data-status="pending"]:hover { background: var(--surface); }
.challenge-card[data-status="pending"]:hover .card-num { color: var(--text-faint); }

.card-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 30px;
  font-weight: 500;
  color: var(--text-faint);
  line-height: 1;
  transition: color 0.12s ease;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.card-body { flex: 1; }
.card-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}
.card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}
.pts-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.pts-pred {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-faint);
}
.pts-arrow { color: var(--text-faint); font-size: 11px; margin: 0 4px; }
.pts-actual {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text);
}
.player-match {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}
.opt-gap {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--gold);
}
.acc-track { height: 2px; background: var(--border); border-radius: 2px; overflow: hidden; }
.acc-fill  { height: 100%; border-radius: 2px; background: var(--blue); transition: width 0.5s cubic-bezier(0.4,0,0.2,1); }
.outcome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-faint);
}

/* Status badges */
.badge {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid;
  flex-shrink: 0;
}
.badge-complete  { color: var(--accent); border-color: var(--accent-border); background: var(--accent-dim); }
.badge-predicted { color: var(--blue);   border-color: rgba(88,166,255,0.35); background: var(--blue-dim); }
.badge-actual    { color: var(--gold);   border-color: rgba(210,153,34,0.35); background: var(--gold-dim); }
.badge-pending   { color: var(--text-muted); border-color: var(--border); }

/* ── Modal overlay ────────────────────────────────────────────────────────── */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px 48px;
  overflow-y: auto;
}
#modal-overlay.open { display: flex; }

#modal-box {
  width: 100%;
  max-width: 820px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  animation: modal-in 0.18s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.modal-close {
  flex-shrink: 0;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
  transition: color 0.1s ease;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* Modal totals + lineups — grid split by a 1px divider */
.modal-split { display: grid; }
.modal-split--two-col   { grid-template-columns: 1fr 1px 1fr; }
.modal-split--three-col  { grid-template-columns: 1fr 1px 1fr 1px 1fr; }
.split-divider { background: var(--border); }
.split-col { min-width: 0; }

.total-cell { padding: 18px 24px; }
.total-label { margin-bottom: 6px; }
.total-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
}
.total-sub { font-size: 11px; color: var(--text-faint); margin-top: 4px; }

.col-header-row {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

/* Player rows */
.player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s ease;
}
.player-row:last-child    { border-bottom: none; }
.player-row:hover         { background: var(--surface-raised); }
.player-row.shared        { background: var(--accent-dim); }
.player-row.shared:hover  { background: rgba(63,185,80,0.12); }
.player-row.is-captain    { background: var(--gold-dim); }

.pos-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 2px 5px;
  border-radius: 3px;
  min-width: 30px;
  text-align: center;
  flex-shrink: 0;
}
.pos-gk  { background: rgba(251,146,60,0.12);  color: #fb923c; }
.pos-def { background: rgba(96,165,250,0.12);   color: #60a5fa; }
.pos-mid { background: rgba(74,222,128,0.12);   color: #4ade80; }
.pos-fwd { background: rgba(248,113,113,0.12);  color: #f87171; }

.captain-c {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--gold);
  color: #000;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}
.shared-tick { font-size: 11px; color: var(--accent); }
.player-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-meta { font-size: 11px; color: var(--text-muted); }
.player-pts-col { text-align: right; flex-shrink: 0; }
.player-pts  { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 500; }
.pts-kind    { font-size: 10px; color: var(--text-faint); }

.modal-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--border);
}
.comparison-grid {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.comp-stat { flex-shrink: 0; }
.comp-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 500;
}
.comp-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.note-text { font-size: 11px; color: var(--text-faint); margin-top: 10px; }

/* ── Hero row (summary + learn-more) ──────────────────────────────────────── */
.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.hero-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.hero-summary:hover { border-color: var(--accent-border); color: var(--text); }

/* ── About modal ─────────────────────────────────────────────────────────── */
#about-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px;
  overflow-y: auto;
}
#about-overlay.open { display: flex; }
#about-box {
  width: 100%;
  max-width: 680px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  animation: modal-in 0.18s ease;
}
.about-header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.about-body { padding: 24px; }
.about-section { margin-bottom: 28px; }
.about-section:last-child { margin-bottom: 0; }
.about-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.about-section p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 8px;
}
.about-section p:last-child { margin-bottom: 0; }
.about-list {
  margin: 8px 0 8px 4px;
  padding: 0;
  list-style: none;
}
.about-list li {
  position: relative;
  padding: 6px 0 6px 14px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  border-bottom: 1px solid var(--border-subtle);
}
.about-list li:last-child { border-bottom: none; }
.about-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 13px;
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
}
.about-list li strong { color: var(--text); font-weight: 500; }
.about-callout {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-top: 10px;
}
.about-callout strong { color: var(--text); font-weight: 500; }
.about-example {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: 3px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-top: 10px;
}
.about-example strong { color: var(--text); font-weight: 500; }
.about-example p { font-size: 12px; line-height: 1.65; color: var(--text-muted); margin-bottom: 6px; }
.about-example p:last-child { margin-bottom: 0; }
.about-pipeline {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 14px 0 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.pipeline-step {
  flex: 1;
  padding: 12px 14px;
  background: var(--surface-raised);
  border-right: 1px solid var(--border);
  font-size: 12px;
}
.pipeline-step:last-child { border-right: none; }
.pipeline-step-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.pipeline-step-name { color: var(--text); font-weight: 500; font-size: 12px; }
.pipeline-step-desc { color: var(--text-muted); font-size: 11px; margin-top: 3px; line-height: 1.5; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
#site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Season standing bar ─────────────────────────────────────────────────── */
.standing-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  gap: 16px;
  flex-wrap: wrap;
  cursor: pointer;
  transition: background 0.12s ease;
}
.standing-bar:hover { background: var(--surface-raised); }
.standing-view-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-faint);
  transition: color 0.12s ease;
  margin-top: 2px;
}
.standing-bar:hover .standing-view-hint { color: var(--text-muted); }

/* ── Season standing chart modal ───────────────────────────────────────────── */
#standing-chart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px;
  overflow-y: auto;
}
#standing-chart-overlay.open { display: flex; }
#standing-chart-box {
  width: 100%;
  max-width: 760px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  animation: modal-in 0.18s ease;
}
.chart-canvas-wrap {
  padding: 24px 24px 12px;
  position: relative;
}
.chart-canvas-wrap canvas {
  height: 280px !important;
}
.chart-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
}
.chart-stat-cell {
  padding: 16px 20px;
  border-right: 1px solid var(--border);
}
.chart-stat-cell:last-child { border-right: none; }
.chart-stat-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 500;
  margin-top: 6px;
  line-height: 1;
}
.standing-rank-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 8px;
}
.standing-rank {
  font-family: 'JetBrains Mono', monospace;
  font-size: 30px;
  font-weight: 500;
  color: var(--accent);
  line-height: 1;
}
.standing-of {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--text-muted);
}
.standing-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.standing-pct-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  padding: 3px 10px;
  border-radius: 3px;
}
.standing-gw-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .challenge-grid { grid-template-columns: 1fr; }
  .hide-sm        { display: none; }
  .hero           { padding: 36px 0 28px; }

  /* Bottom-sheet modal */
  #modal-overlay {
    align-items: flex-end;
    padding: 0;
    overflow-y: hidden;
  }
  @keyframes modal-in-mobile {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  #modal-box {
    max-height: 92svh;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 12px 12px 0 0;
    will-change: transform;
    animation: modal-in-mobile 0.24s cubic-bezier(0.32, 0.72, 0, 1);
  }
  /* Drag handle hint */
  #modal-box::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 10px auto 0;
  }

  /* Collapse two-col splits to single column */
  .modal-split--two-col { grid-template-columns: 1fr; }
  .modal-split--two-col .split-divider { display: none; }
  .modal-split--two-col .split-col + .split-col { border-top: 1px solid var(--border); }

  /* Tighter padding throughout */
  .modal-header   { padding: 14px 16px 16px; }
  .total-cell     { padding: 12px 16px; }
  .total-val      { font-size: 22px; }
  .col-header-row { padding: 6px 10px; }
  .player-row     { padding: 8px 10px; }
  .modal-footer   { padding: 14px 16px; }
  .comparison-grid { gap: 16px 24px; }
  .comp-val       { font-size: 17px; }

  /* Standing bar */
  .standing-bar   { padding: 14px 16px; }
  .standing-rank  { font-size: 24px; }
  .standing-right { align-items: flex-start; flex-direction: row; flex-wrap: wrap; gap: 8px; }

  /* Standing chart modal — bottom sheet on mobile */
  #standing-chart-overlay {
    align-items: flex-end;
    padding: 0;
    overflow-y: hidden;
  }
  #standing-chart-box {
    max-height: 92svh;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 12px 12px 0 0;
    will-change: transform;
    animation: modal-in-mobile 0.24s cubic-bezier(0.32, 0.72, 0, 1);
  }
  #standing-chart-box::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 10px auto 0;
  }
  .chart-canvas-wrap canvas { height: 200px !important; }
  .chart-stats-row { grid-template-columns: repeat(2, 1fr); }
  .chart-stat-cell:nth-child(2) { border-right: none; }
  .chart-stat-cell:nth-child(3) { border-top: 1px solid var(--border); border-right: 1px solid var(--border); }
  .chart-stat-cell:nth-child(4) { border-top: 1px solid var(--border); }
}
