*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #fafaf8;
  --bg-card:     #ffffff;
  --bg-hover:    #f5f5f3;
  --border:      #e5e5e3;
  --nav-bg:      #0f172a;
  --nav-border:  rgba(255,255,255,0.08);
  --blue:        #0284c7;
  --green:       #16a34a;
  --red:         #dc2626;
  --gold:        #d97706;
  --gold-dim:    #b45309;
  --purple:      #7c3aed;
  --text:        #111827;
  --text-dim:    #4b5563;
  --text-muted:  #9ca3af;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.05);
  --shadow:      0 2px 6px rgba(0,0,0,0.06), 0 10px 24px rgba(0,0,0,0.08);
  --radius:      14px;
  --radius-sm:   8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── NAV ─────────────────────────────────────────────── */
nav.main-nav {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  height: 52px;
  gap: 1rem;
}

.nav-logo {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 0.1rem;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  margin-left: auto;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  white-space: nowrap;
  display: block;
}
.nav-links a:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.08); }
.nav-links a.active { color: #ffffff; background: rgba(255,255,255,0.12); }

/* Mobile: nav links wrap to second row */
@media (max-width: 700px) {
  nav.main-nav {
    height: auto;
    flex-wrap: wrap;
    padding: 0.6rem 1rem 0;
    gap: 0;
  }
  .nav-logo {
    flex: 1;
    padding: 0.1rem 0 0.5rem;
  }
  .nav-links {
    width: 100%;
    margin-left: 0;
    border-top: 1px solid var(--nav-border);
    padding: 0.3rem 0 0.4rem;
  }
}

/* ── LAYOUT ──────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }
.section { margin-bottom: 2.5rem; }

.page-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
}
.league-name-header {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.3rem;
  min-height: 1em;
}
.page-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-transform: none;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 0.75rem;
  padding-left: 0.25rem;
  display: block;
}
.section-title::after { display: none; }

/* ── LANDING ─────────────────────────────────────────── */
.landing-hero {
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 5rem 1.5rem 4rem;
  text-align: center;
}
.landing-logo {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  margin-bottom: 1.5rem;
}
.landing-title {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}
.landing-sub {
  color: rgba(255,255,255,0.55);
  font-size: 1rem;
  max-width: 520px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}
.league-input-wrap { max-width: 560px; margin: 0 auto; }
.league-input-row { display: flex; gap: .5rem; margin-bottom: .75rem; }
.league-input {
  flex: 1;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  color: #ffffff;
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.league-input::placeholder { color: rgba(255,255,255,0.35); }
.league-input:focus {
  border-color: rgba(255,255,255,0.4);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
}
.season-select {
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  padding: .75rem .75rem;
  color: #ffffff;
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
}
.analyze-btn {
  width: 100%;
  background: #ffffff;
  color: var(--nav-bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: .85rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity .15s;
}
.analyze-btn:hover { opacity: 0.88; }
.league-input-help { font-size: .78rem; color: rgba(255,255,255,0.35); margin-top: .6rem; }
.last-league-card {
  max-width: 380px;
  margin: 1.5rem auto 0;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: rgba(255,255,255,0.7);
}
.last-league-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,0.35); }
.last-league-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  padding: .35rem .85rem;
  color: rgba(255,255,255,0.8);
  font-size: .82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s;
}
.last-league-btn:hover { border-color: rgba(255,255,255,0.5); }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.feature-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s;
}
.feature-card:hover { box-shadow: var(--shadow); }
.feature-icon { font-size: 1.5rem; margin-bottom: .5rem; }
.feature-name { font-weight: 600; font-size: .95rem; margin-bottom: .25rem; }
.feature-desc { font-size: .78rem; color: var(--text-dim); line-height: 1.5; }
.bmc-btn {
  display: inline-block;
  background: #ffdd00;
  color: #000;
  font-weight: 700;
  font-family: inherit;
  padding: .7rem 1.75rem;
  border-radius: 20px;
  text-decoration: none;
  font-size: .9rem;
  transition: opacity .15s;
}
.bmc-btn:hover { opacity: .85; }

/* ── CARDS ───────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card-sm { padding: 1rem; }
.card-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

/* ── GRIDS ───────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; }
.grid-5 { display: grid; grid-template-columns: repeat(5,1fr); gap: 1rem; }
@media (max-width: 900px) { .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; } }

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .6rem;
}

/* ── TABLES ──────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  background: #f9f9f7;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.7rem 1rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
thead th:hover { color: var(--text-dim); }
thead th.sorted { color: var(--blue); }
thead th.sorted::after { content: ' ↓'; }
thead th.sorted.asc::after { content: ' ↑'; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
td { padding: 0.8rem 1rem; vertical-align: middle; }

/* ── BADGES ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-gold   { background: rgba(217,119,6,0.1);   color: var(--gold); }
.badge-green  { background: rgba(22,163,74,0.1);   color: var(--green); }
.badge-red    { background: rgba(220,38,38,0.1);   color: var(--red); }
.badge-blue   { background: rgba(2,132,199,0.1);   color: var(--blue); }
.badge-purple { background: rgba(124,58,237,0.1);  color: var(--purple); }
.badge-gray   { background: rgba(0,0,0,0.05);      color: var(--text-dim); }

/* ── STATS ───────────────────────────────────────────── */
.stat-num {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.25rem;
}

/* ── RECORD ──────────────────────────────────────────── */
.record { font-weight: 600; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.record .w   { color: var(--green); }
.record .sep { color: var(--text-muted); margin: 0 1px; }
.record .l   { color: var(--text-muted); }

/* ── MATCHUP CARD ────────────────────────────────────── */
.matchup-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}
.matchup-card:hover { box-shadow: var(--shadow); }
.matchup-card.playoff-game { outline: 1px solid rgba(124,58,237,0.2); }
.matchup-team-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.45rem 0; }
.matchup-team-info { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.matchup-team-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.matchup-score {
  font-size: 1.6rem;
  font-weight: 700;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.matchup-score.win  { color: var(--text); }
.matchup-score.lose { color: var(--text-muted); font-weight: 400; }
.matchup-divider { border: none; border-top: 1px solid var(--border); margin: 0.25rem 0; }
.matchup-label { font-size: 0.68rem; text-align: center; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.5rem; }

/* ── WEEK SELECTOR ───────────────────────────────────── */
.week-selector { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.week-btn {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.week-btn:hover { border-color: var(--blue); color: var(--text); }
.week-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); font-weight: 600; box-shadow: none; }
.week-btn.playoff-week { border-color: rgba(124,58,237,0.3); color: var(--purple); }
.week-btn.playoff-week.active { background: var(--purple); color: #fff; border-color: var(--purple); }

/* ── TRANSACTION ITEM ────────────────────────────────── */
.txn-item { display: flex; gap: 1rem; padding: 1rem; border-bottom: 1px solid var(--border); align-items: flex-start; }
.txn-item:last-child { border-bottom: none; }
.txn-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; margin-top: 2px; }
.txn-icon.trade  { background: rgba(2,132,199,0.1); }
.txn-icon.add    { background: rgba(22,163,74,0.1); }
.txn-icon.drop   { background: rgba(220,38,38,0.1); }
.txn-icon.waiver { background: rgba(124,58,237,0.1); }
.txn-body { flex: 1; min-width: 0; }
.txn-main { font-size: 0.875rem; line-height: 1.4; }
.txn-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── DRAFT BOARD ─────────────────────────────────────── */
.draft-board-wrap { overflow-x: auto; }
.draft-board { border-collapse: collapse; white-space: nowrap; }
.draft-board th {
  background: #f9f9f7;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.6rem 0.75rem;
  text-align: center;
  border: 1px solid var(--border);
  min-width: 130px;
  max-width: 130px;
}
.draft-board th.round-col { min-width: 50px; max-width: 50px; color: var(--blue); }
.draft-board td { border: 1px solid var(--border); padding: 0.3rem; vertical-align: top; min-width: 130px; max-width: 130px; }
.draft-board td.round-num {
  background: rgba(2,132,199,0.04);
  color: var(--blue);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  min-width: 50px;
  max-width: 50px;
}
.pick-card { background: var(--bg-hover); border-radius: var(--radius-sm); padding: 0.45rem 0.6rem; height: 62px; overflow: hidden; }
.pick-card:hover { background: #ebebea; }
.pick-num    { font-size: 0.65rem; color: var(--text-muted); margin-bottom: 0.15rem; }
.pick-player { font-weight: 600; font-size: 0.8rem; line-height: 1.2; color: var(--text); }
.pick-pos    { font-size: 0.68rem; margin-top: 0.2rem; font-weight: 600; }

/* ── POSITION COLORS ─────────────────────────────────── */
.pos-qb  { color: #ea580c; }
.pos-rb  { color: var(--green); }
.pos-wr  { color: var(--blue); }
.pos-te  { color: var(--purple); }
.pos-k   { color: var(--text-muted); }
.pos-def { color: var(--red); }

/* ── LOADING ─────────────────────────────────────────── */
.loading { display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 4rem 2rem; color: var(--text-dim); }
.spinner { width: 22px; height: 22px; border: 2px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.65s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg { background: rgba(220,38,38,0.06); border: 1px solid rgba(220,38,38,0.15); border-radius: var(--radius); padding: 1rem 1.25rem; color: var(--red); font-size: 0.875rem; }

/* ── SEASON TABS ─────────────────────────────────────── */
.season-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.season-tab {
  padding: 0.45rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
.season-tab:hover { color: var(--text); border-color: var(--blue); }
.season-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: none; }

/* ── LUCK INDEX ──────────────────────────────────────── */
.luck-bar { flex: 1; height: 8px; background: var(--border); border-radius: 4px; position: relative; overflow: visible; }
.luck-bar::before { content: ''; position: absolute; left: 50%; top: -2px; width: 1px; height: 12px; background: var(--text-muted); opacity: 0.4; }
.luck-fill { position: absolute; top: 0; height: 100%; border-radius: 4px; }

/* ── PROGRESS ────────────────────────────────────────── */
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.progress-gold   { background: var(--blue); }
.progress-purple { background: var(--purple); }
.progress-green  { background: var(--green); }
.progress-blue   { background: var(--blue); }

/* ── TEAM ROW ────────────────────────────────────────── */
.team-cell { display: flex; align-items: center; gap: 0.65rem; }
.team-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-hover); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; flex-shrink: 0; overflow: hidden;
}
.team-avatar img { width: 100%; height: 100%; object-fit: cover; }
.team-name-main { font-weight: 600; font-size: 0.9rem; line-height: 1.2; }
.team-name-sub  { font-size: 0.75rem; color: var(--text-dim); }

/* ── WL BAR ──────────────────────────────────────────── */
.wl-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; gap: 1px; }
.wl-bar .w-seg { background: var(--green); }
.wl-bar .l-seg { background: var(--border); }

/* ── FOOTER ──────────────────────────────────────────── */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 1200px;
  margin: 3rem auto 0;
  padding: 1.25rem 1.5rem 2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.footer-coffee { color: var(--text-muted); text-decoration: none; transition: color 0.15s; }
.footer-coffee:hover { color: var(--text-dim); }

/* ── UTIL ────────────────────────────────────────────── */
.text-purple { color: var(--purple); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-gold   { color: var(--gold); }
.text-dim    { color: var(--text-dim); }
.text-muted  { color: var(--text-muted); }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.font-cond   { font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.font-bold   { font-weight: 600; }
.d-flex      { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 640px) {
  .container { padding: 1rem; }
  .page-header { padding: 1.25rem 1rem 0; }
  .landing-hero { padding: 3.5rem 1rem 3rem; }
  .site-footer { padding: 1rem 1rem 1.5rem; }
}
