:root {
  --bg: #0f1419;
  --surface: #1a2129;
  --surface-2: #222c37;
  --border: #2c3742;
  --text: #e7edf3;
  --muted: #93a1b0;
  --primary: #ff7a18;
  --primary-2: #ff9d4d;
  --green: #35c46b;
  --red: #ef4f6b;
  --gold: #ffcf5c;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #1c2a33, var(--bg));
  color: var(--text);
  min-height: 100vh;
}
.hidden { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 800; font-size: 1.2rem; letter-spacing: 0.2px; }
.nav { display: flex; gap: 0.35rem; margin-left: 0.5rem; }
.user-area { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.user-name { color: var(--muted); font-size: 0.9rem; }

.nav-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}
.nav-btn:hover { color: var(--text); background: var(--surface-2); }
.nav-btn.active { color: #1a1206; background: var(--primary); }

main { max-width: 900px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.view { animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.auth-card { max-width: 400px; margin: 3rem auto; }

/* Landing / how-to-play */
.landing {
  display: grid;
  grid-template-columns: 1fr minmax(320px, 380px);
  gap: 2rem;
  align-items: start;
  margin-top: 1.5rem;
}
.landing .auth-card { margin: 0; position: sticky; top: 84px; }
.landing-title { font-size: 2rem; margin: 0.3rem 0 0.6rem; line-height: 1.1; }
.lede { font-size: 1.05rem; line-height: 1.55; color: var(--text); margin: 0 0 1.5rem; max-width: 60ch; }
.lede strong { color: var(--primary-2); }
.how-title { margin: 1.5rem 0 0.7rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.85rem; }
.step { display: flex; gap: 0.8rem; align-items: flex-start; line-height: 1.5; }
.step b { color: var(--text); }
.step-num {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 0.85rem;
  background: linear-gradient(160deg, var(--primary-2), var(--primary)); color: #1a1206;
}
.scoring { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.score-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.4rem 0.85rem; font-size: 0.88rem; color: var(--muted);
}
.score-chip b { color: var(--text); }
.score-chip.streak { border-color: color-mix(in srgb, var(--gold) 40%, var(--border)); }
.score-n { color: var(--gold); font-weight: 800; }
.streak-note { margin: 0.6rem 0 0; max-width: 55ch; }
.spread-explainer { margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.spread-explainer summary { cursor: pointer; color: var(--primary-2); font-weight: 600; font-size: 0.9rem; }
.spread-explainer summary:hover { color: var(--primary); }
.spread-explainer p { margin: 0.7rem 0 0; line-height: 1.55; max-width: 60ch; }
.spread-explainer b { color: var(--text); }

@media (max-width: 760px) {
  .landing { grid-template-columns: 1fr; gap: 1.5rem; }
  .landing .auth-card { position: static; order: -1; max-width: none; }
  .landing-title { font-size: 1.6rem; }
}

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.tab {
  flex: 1;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.tab.active { background: var(--primary); color: #1a1206; border-color: var(--primary); }

.form { display: flex; flex-direction: column; gap: 0.85rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field span { font-size: 0.82rem; color: var(--muted); }
input, .select, .input-sm {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  font-size: 0.95rem;
}
input:focus, .select:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
.input-sm { max-width: 120px; }

.btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.55rem 0.95rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: linear-gradient(180deg, var(--primary-2), var(--primary)); color: #1a1206; border: none; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }

.week-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
h2 { margin: 0.25rem 0 0.75rem; }
.section-title { margin-top: 2rem; color: var(--muted); font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.6px; }

.banner {
  font-size: 0.85rem;
  color: var(--gold);
  background: rgba(255, 207, 92, 0.1);
  border: 1px solid rgba(255, 207, 92, 0.3);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
}
.banner.locked { color: var(--red); background: rgba(239, 79, 107, 0.12); border-color: rgba(239, 79, 107, 0.35); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--red); font-size: 0.85rem; min-height: 1rem; margin: 0; }
.status { color: var(--muted); font-size: 0.85rem; }

/* Games / picks */
.games { display: flex; flex-direction: column; gap: 0.75rem; margin: 1rem 0; }
.game {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.game-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.78rem; margin-bottom: 0.6rem; }
.matchup { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.5rem; align-items: stretch; }
.team-btn {
  display: flex; flex-direction: column; gap: 0.15rem;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  color: var(--text);
  text-align: left;
}
.team-btn:hover { border-color: var(--primary-2); }
.team-btn.selected { border-color: var(--primary); background: rgba(255, 122, 24, 0.14); }
.team-btn.win { border-color: var(--green); }
.team-btn.loss { opacity: 0.6; }
.team-name { font-weight: 700; }
.team-rank { color: var(--gold); font-size: 0.75rem; font-weight: 700; }
.team-spread { color: var(--muted); font-size: 0.82rem; }
.vs { align-self: center; color: var(--muted); font-weight: 700; font-size: 0.8rem; }

.submit-bar { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.pill { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0.35rem 0.8rem; font-size: 0.85rem; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 0.6rem 0.7rem; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; }
.table tbody tr:hover { background: var(--surface-2); }
.rank-1 td:first-child { color: var(--gold); font-weight: 800; }
.table-scroll { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { font-size: 0.72rem; padding: 0.1rem 0.4rem; border-radius: 6px; font-weight: 700; }
.tag.win { background: rgba(53, 196, 107, 0.18); color: var(--green); }
.tag.loss { background: rgba(239, 79, 107, 0.18); color: var(--red); }
.tag.push { background: rgba(147, 161, 176, 0.18); color: var(--muted); }
.tag.pending { background: rgba(255, 207, 92, 0.14); color: var(--gold); }

.result-block { margin-bottom: 1.5rem; }
.result-block h4 { margin: 0.5rem 0; }

@media (max-width: 560px) {
  .nav-btn { padding: 0.4rem 0.6rem; font-size: 0.82rem; }
  .brand { font-size: 1rem; }
  .matchup { grid-template-columns: 1fr; }
  .vs { display: none; }
}
