:root {
  --bg: #07110d;
  --panel: rgba(13, 27, 22, 0.84);
  --panel-strong: #10251d;
  --line: rgba(214, 255, 225, 0.14);
  --text: #f5fff8;
  --muted: #aac1b3;
  --accent: #37d66b;
  --accent-2: #f6c85f;
  --danger: #ff6b6b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Inter Tight", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(55, 214, 107, 0.24), transparent 28rem),
    radial-gradient(circle at 88% 2%, rgba(246, 200, 95, 0.16), transparent 24rem),
    linear-gradient(135deg, #07110d 0%, #0b1b15 48%, #07110d 100%);
  color: var(--text);
  font-family: var(--sans);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.auth-screen {
  min-height: 100vh;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 28px 0;
}
.auth-screen.hidden { display: none; }
.auth-card {
  width: min(720px, 100%);
  border: 1px solid var(--line);
  border-radius: 38px;
  padding: clamp(24px, 5vw, 48px);
  background: linear-gradient(155deg, rgba(255,255,255,.11), rgba(255,255,255,.035));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute;
  inset: -100px -80px auto auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(55, 214, 107, .16);
  pointer-events: none;
}
.auth-brand { margin-bottom: 22px; }
.auth-card h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1; letter-spacing: -.05em; }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0,0,0,.18);
  margin: 28px 0 18px;
}
.auth-tab {
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  padding: 13px 16px;
  cursor: pointer;
  font-weight: 800;
}
.auth-tab.active { background: var(--accent); color: #06120b; }
.auth-form { display: grid; gap: 14px; }
.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  outline: 0;
  border-radius: 18px;
  padding: 15px 16px;
  color: var(--text);
  background: rgba(255,255,255,.07);
}
.auth-form input:focus { border-color: rgba(55,214,107,.7); }
.auth-submit { margin-top: 6px; justify-content: center; }
.auth-message { min-height: 22px; color: var(--accent); margin: 0; }
.auth-message.error { color: var(--danger); }
.auth-note {
  display: grid;
  gap: 5px;
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  background: rgba(0,0,0,.16);
}
.auth-note strong { color: var(--accent-2); }
.app-shell.locked { display: none; }

.site-header {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 14px 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(18px);
}

.brand-mark {
  color: var(--text);
  font-weight: 900;
  letter-spacing: -.03em;
  font-size: 20px;
}

.main-nav {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0,0,0,.2);
}
.main-nav a {
  color: var(--muted);
  font-weight: 800;
  padding: 9px 13px;
  border-radius: 999px;
}
.main-nav a:hover { color: var(--text); background: rgba(255,255,255,.07); }

.back {
  color: var(--muted);
  font-weight: 700;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}
.user-box strong { color: var(--text); }

.user-box button,
.btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
}

main {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
}

.dashboard-summary {
  padding: 14px 0 10px;
}

.compact-score {
  display: grid;
  grid-template-columns: minmax(150px, auto) auto 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 0;
}

.compact-score strong {
  margin: 0;
  font-size: clamp(34px, 5vw, 54px);
}

.compact-score p {
  margin: 0;
  font-size: 16px;
}

.hero {
  min-height: 360px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 360px);
  gap: 24px;
  align-items: center;
  padding: 34px 0 24px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .14em;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 760px;
  margin-bottom: 22px;
  font-size: clamp(30px, 4.6vw, 54px);
  line-height: .98;
  letter-spacing: -.07em;
}

.lead {
  max-width: 690px;
  color: var(--muted);
  font-size: clamp(16px, 1.7vw, 20px);
  line-height: 1.45;
}

.hero-actions { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.btn.primary { background: var(--accent); color: #06120b; border-color: transparent; }

.score-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 34px;
  padding: 24px;
  background: linear-gradient(155deg, rgba(255,255,255,.09), rgba(255,255,255,.03));
  box-shadow: var(--shadow);
}

.score-card::before {
  content: "";
  position: absolute;
  inset: -60px -60px auto auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(55, 214, 107, .22);
}

.score-card span:first-child,
.score-card small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.score-card strong {
  display: block;
  margin: 22px 0 8px;
  font-size: 72px;
  line-height: 1;
  letter-spacing: -.08em;
}

.score-card p { color: var(--muted); font-size: 20px; }

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 50px rgba(0, 0, 0, .18);
}


.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 14px;
  align-items: start;
  padding: 12px 0 38px;
}

.panel { padding: 16px; }
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.section-head h2 { margin: 0; font-size: 34px; letter-spacing: -.04em; }
.hint { color: var(--muted); margin: 0; }

.games-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
  gap: 8px;
}
.loading { color: var(--muted); padding: 20px; }

.board-controls { align-items: center; }
.week-picker {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.week-picker select {
  min-width: 140px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--text);
  background: #0d1b16;
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
}

.ad-slot {
  display: grid;
  place-items: center;
  gap: 4px;
  margin: 0 0 12px;
  border: 1px dashed rgba(246, 200, 95, .45);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(246, 200, 95, .07);
  text-align: center;
}
.ad-slot span { color: var(--accent-2); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.ad-slot strong { color: var(--text); font-size: 18px; }
.ad-slot small { font-size: 12px; }
.ad-slot-wide { min-height: 78px; }
.ad-slot-sidebar { min-height: 210px; margin-top: 18px; margin-bottom: 0; }

.game-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 9px;
  background: rgba(255,255,255,.045);
}

.game-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  margin-bottom: 7px;
}
.game-meta b { color: var(--accent-2); }

.matchup {
  display: grid;
  grid-template-columns: 1fr 18px 1fr;
  gap: 6px;
  align-items: center;
}

.at { color: var(--muted); font-family: var(--mono); }
.team {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 7px;
  color: var(--text);
  background: rgba(255,255,255,.045);
  cursor: pointer;
  text-align: left;
}
.team:hover { border-color: rgba(55,214,107,.58); }
.team.selected { background: rgba(55, 214, 107, .18); border-color: var(--accent); }
.team:disabled { cursor: not-allowed; opacity: .65; }
.team img,
.logo-fallback {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255,255,255,.09);
  object-fit: contain;
  color: var(--accent-2);
  font-family: var(--mono);
  font-weight: 800;
}
.team strong { display: block; font-size: 16px; }
.team small { display: block; color: var(--muted); line-height: 1.1; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }

.leaderboard {
  display: grid;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.leader-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.045);
}
.leader-row.me { border-color: rgba(55, 214, 107, .6); background: rgba(55, 214, 107, .12); }
.rank, .pct { color: var(--muted); font-family: var(--mono); }
.record { font-family: var(--mono); font-size: 20px; font-weight: 800; color: var(--accent-2); }
.leader-row em { display: block; color: var(--accent); font-style: normal; font-size: 12px; }

.rules {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  color: var(--muted);
}
.rules h3 { color: var(--text); }
.rules ul { padding-left: 18px; margin-bottom: 0; }

footer {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 34px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .site-header, .hero, .app-grid, .compact-score { grid-template-columns: 1fr; }
  .games-list { grid-template-columns: 1fr; }
  .site-header { position: static; align-items: stretch; }
  .main-nav { justify-self: stretch; justify-content: space-between; }
  .user-box { border-radius: 22px; flex-wrap: wrap; justify-content: space-between; }
  .hero { min-height: auto; padding-top: 24px; }
  .score-card strong { font-size: 58px; }
  .section-head { align-items: start; flex-direction: column; }
  .matchup { grid-template-columns: 1fr; }
  .at { text-align: center; }
}


/* Release polish */
.board-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.save-strip {
  position: sticky;
  top: 76px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(55, 214, 107, .35);
  border-radius: 16px;
  background: rgba(8, 25, 17, .94);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .24);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.save-strip strong { color: var(--accent); }

.rules-card {
  border: 1px solid rgba(214, 255, 225, .14);
  border-radius: 18px;
  background: rgba(255, 255, 255, .04);
}
.mobile-rules {
  display: none;
  gap: 8px;
  margin: 0 0 12px;
  padding: 12px;
  color: var(--muted);
}
.mobile-rules strong { color: var(--text); }
.mobile-rules span { line-height: 1.35; }

.ad-slot.ad-cta {
  border-style: solid;
  border-color: rgba(246, 200, 95, .34);
  background:
    radial-gradient(circle at 15% 15%, rgba(246, 200, 95, .20), transparent 9rem),
    linear-gradient(135deg, rgba(246, 200, 95, .13), rgba(55, 214, 107, .07));
}
.ad-slot.ad-cta strong { font-size: 21px; letter-spacing: -.02em; }
.ad-slot.ad-cta small { max-width: 420px; line-height: 1.35; }

.leaderboard-panel {
  position: sticky;
  top: 82px;
}
.leader-head {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 0 14px 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.player-name { min-width: 0; }
.player-name strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rules.rules-card {
  border-top: 1px solid var(--line);
  padding: 16px;
}
.rules small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.game-card.picked-game {
  border-color: rgba(55, 214, 107, .32);
  background: rgba(55, 214, 107, .065);
}
.game-card.locked-game { opacity: .86; }
.team {
  position: relative;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.team:hover { transform: translateY(-1px); }
.team:focus-visible {
  outline: 3px solid rgba(55, 214, 107, .36);
  outline-offset: 2px;
}
.team.selected {
  box-shadow: inset 0 0 0 1px rgba(55, 214, 107, .45), 0 10px 24px rgba(55, 214, 107, .12);
}
.pick-check {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #06120b;
  font-weight: 900;
}

footer nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 12px;
}
footer a {
  color: var(--accent);
  font-weight: 800;
}
footer p {
  max-width: 820px;
  margin: 0 auto;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .leaderboard-panel,
  .save-strip { position: static; }
  .mobile-rules { display: grid; }
  .ad-slot-wide { min-height: 68px; }
  .ad-slot-sidebar { min-height: 150px; }
  .compact-score { gap: 8px; }
  .compact-score strong { font-size: 44px; }
  .save-strip { align-items: flex-start; flex-direction: column; }
  .team { min-height: 58px; }
  .team small { max-width: none; }
}

/* Compact desktop layout: one app screen, inner game-board scrolling only */
@media (min-width: 901px) {
  body { overflow: hidden; }

  .app-shell {
    height: 100svh;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .site-header {
    padding: 8px 0;
  }

  main {
    min-height: 0;
    display: block;
  }

  .app-grid {
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 10px;
    padding: 4px 0 10px;
    align-items: stretch;
  }

  .app-grid > * { min-height: 0; }

  .panel {
    border-radius: 22px;
    padding: 10px;
  }

  .games-panel {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    overflow: hidden;
  }

  .board-controls {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
  }

  .board-copy .eyebrow { margin-bottom: 4px; }
  .section-head h2 { font-size: clamp(24px, 2.2vw, 32px); }
  .board-hint { font-size: 13px; }

  .compact-score {
    grid-template-columns: auto auto;
    gap: 3px 10px;
    min-width: 230px;
    padding: 10px 12px;
    border-radius: 18px;
  }

  .compact-score::before { display: none; }
  .compact-score span:first-child,
  .compact-score small { font-size: 10px; }
  .compact-score strong {
    grid-row: span 2;
    order: -1;
    font-size: 34px;
  }
  .compact-score p { font-size: 13px; }

  .week-picker select { padding: 8px 10px; }

  .save-strip {
    position: static;
    margin-bottom: 8px;
    padding: 8px 10px;
    border-radius: 13px;
    font-size: 11px;
  }

  .ad-slot-wide {
    min-height: 38px;
    grid-template-columns: auto auto 1fr;
    justify-content: center;
    column-gap: 10px;
    margin-bottom: 8px;
    padding: 6px 10px;
  }
  .games-panel > .ad-slot-wide:last-child { display: none; }
  .ad-slot-wide strong { font-size: 15px; }
  .ad-slot-wide small { max-width: none; }

  .games-list {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    align-content: start;
    gap: 6px;
    padding-right: 4px;
    scrollbar-color: rgba(55,214,107,.55) rgba(255,255,255,.05);
  }

  .game-card { padding: 7px; border-radius: 14px; }
  .game-meta { font-size: 9px; margin-bottom: 5px; }
  .team { min-height: 40px; padding: 6px; border-radius: 11px; }
  .team img,
  .logo-fallback { width: 26px; height: 26px; }
  .team strong { font-size: 14px; }
  .team small { font-size: 10px; max-width: 110px; }
  .pick-check { width: 18px; height: 18px; font-size: 12px; }

  .leaderboard-panel {
    top: auto;
    position: static;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
  }
  .leaderboard { gap: 7px; }
  .leader-row {
    grid-template-columns: 42px minmax(0, 1fr) auto auto;
    gap: 7px;
    padding: 10px;
    border-radius: 14px;
  }
  .leader-head { grid-template-columns: 42px minmax(0, 1fr) auto auto; gap: 7px; padding: 0 10px 2px; }
  .record { font-size: 17px; }

  .rules.rules-card {
    margin-top: 8px;
    padding: 9px;
  }
  .rules h3 { margin-bottom: 6px; font-size: 15px; }
  .rules ul { margin: 0; font-size: 12px; line-height: 1.2; }
  .rules small { margin-top: 6px; font-size: 10px; }
  .ad-slot-sidebar { min-height: 84px; margin-top: 8px; padding: 8px; }
  .ad-slot.ad-cta strong { font-size: 16px; }

  footer { display: none; }
}

@media (max-width: 560px) {
  .site-header, main, footer, .auth-screen { width: min(100% - 20px, 1440px); }
  .main-nav a { padding: 8px 10px; }
  .section-head h2 { font-size: 28px; }
  .leader-row,
  .leader-head { grid-template-columns: 42px minmax(0, 1fr) auto auto; gap: 7px; padding-left: 10px; padding-right: 10px; }
  .record { font-size: 17px; }
}
