/* Gridiron Throne web client — self-contained, no external assets. */
:root {
  --bg: #0f1216;
  --surface: #171c22;
  --surface-2: #1f262e;
  --border: #2a333d;
  --text: #e7ecf1;
  --muted: #9aa7b4;
  /* Brand / primary — regal gold. */
  --accent: #e8b84b;
  --accent-2: #f2c94e; /* brighter gold for hovers */
  --accent-ink: #1a1204; /* dark text on gold */
  /* Positive survival status stays green so it never blurs with amber danger. */
  --good: #46c97b;
  --danger: #ff6b6b;
  --warn: #ffb454;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #241d12 0%, var(--bg) 55%) fixed;
  color: var(--text);
  min-height: 100vh;
}

/* ── Top bar ─────────────────────────────────────────────── */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: rgba(15, 18, 22, 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: 20px; letter-spacing: 0.3px; cursor: pointer; display: inline-flex; align-items: center; gap: 9px; }
.brand:hover { color: var(--accent); }
.brand-mark { color: var(--accent); display: inline-flex; flex: none; }
.brand-mark svg { height: 24px; width: auto; display: block; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
#who { color: var(--muted); font-size: 14px; }
.week-picker { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }

/* ── Layout ──────────────────────────────────────────────── */
#app { max-width: 940px; margin: 0 auto; padding: 26px 20px 80px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; }
h1 { font-size: 26px; margin: 4px 0 2px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.subtitle { color: var(--muted); margin: 0 0 18px; }
.muted { color: var(--muted); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }

/* ── Buttons & inputs ────────────────────────────────────── */
.btn {
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, opacity 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-small { padding: 6px 12px; font-size: 13px; }

input, select {
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
label.field { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
select { width: auto; }

/* ── Auth screen ─────────────────────────────────────────── */
.auth-wrap { max-width: 400px; margin: 8vh auto 0; }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 13px; font-size: 30px; font-weight: 800; margin-bottom: 6px; letter-spacing: 0.3px; }
.auth-logo .brand-mark svg { height: 46px; }
.auth-tag { text-align: center; color: var(--muted); margin-bottom: 24px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab {
  flex: 1; text-align: center; padding: 9px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border); color: var(--muted); background: transparent; font-weight: 600;
}
.tab.active { background: var(--surface-2); color: var(--text); border-color: var(--accent); }

/* ── Pools list ──────────────────────────────────────────── */
.pool-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2);
}
.pool-item + .pool-item { margin-top: 10px; }
.pill {
  font-size: 12px; padding: 3px 9px; border-radius: 999px; font-weight: 600;
  background: #23303a; color: var(--muted); border: 1px solid var(--border);
}
.pill.alive { background: rgba(70,201,123,0.14); color: var(--good); border-color: rgba(70,201,123,0.4); }
.pill.eliminated { background: rgba(255,107,107,0.14); color: var(--danger); border-color: rgba(255,107,107,0.4); }
.pill.winner { background: rgba(232,184,75,0.18); color: var(--accent); border-color: rgba(232,184,75,0.55); }
.pill.safe { background: rgba(70,201,123,0.18); color: var(--good); border-color: rgba(70,201,123,0.55); font-weight: 700; }
.pill.danger { background: rgba(255,180,84,0.16); color: var(--warn); border-color: rgba(255,180,84,0.55); font-weight: 700; }

/* ── Injury / availability flags ─────────────────────────── */
.inj {
  display: inline-flex; align-items: center; gap: 3px; font-weight: 700;
  font-size: 11px; padding: 1px 7px; border-radius: 999px; white-space: nowrap;
}
.inj-warn { background: rgba(255,180,84,0.16); color: var(--warn); border: 1px solid rgba(255,180,84,0.5); }
.inj-out  { background: rgba(255,107,107,0.14); color: var(--danger); border: 1px solid rgba(255,107,107,0.45); }
.inj-note {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: rgba(255,180,84,0.10); border: 1px solid rgba(255,180,84,0.35); color: var(--text);
}

/* ── Live scoreboard strip ───────────────────────────────── */
.sb-head { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 2px 0 8px; }
.sb-strip {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 14px;
  scrollbar-width: thin;
}
.sb-card {
  flex: 0 0 auto; min-width: 118px; padding: 9px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.sb-team { display: flex; align-items: center; justify-content: space-between; gap: 12px; line-height: 1.5; }
.sb-abbr { font-weight: 600; color: var(--muted); font-size: 13px; }
.sb-score { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.sb-win .sb-abbr, .sb-win .sb-score { color: var(--text); }
.sb-status { margin-top: 6px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 5px; }
.sb-live { color: var(--danger); font-weight: 700; }
.dome { font-size: 11px; opacity: 0.9; }
.sb-wx { margin-top: 5px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 5px; white-space: nowrap; }
.sb-clickable { cursor: pointer; transition: border-color .12s ease, background .12s ease, transform .12s ease; }
.sb-clickable:hover { border-color: var(--accent); background: #212a33; transform: translateY(-1px); }

/* Matchup pick panel (opened by clicking a scoreboard game) */
.game-sec + .game-sec { margin-top: 6px; }
.game-sec-h {
  margin: 14px 0 4px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--accent);
}

/* How it works / FAQ */
.faq { max-width: 760px; margin: 0 auto; }
.faq-item { display: flex; gap: 14px; padding: 14px 0; }
.faq-item + .faq-item { border-top: 1px solid var(--border); }
.faq-icon { font-size: 22px; line-height: 1.3; flex: 0 0 28px; text-align: center; }
.faq-q { margin: 0 0 4px; font-size: 16px; }
.faq-a { color: var(--muted); font-size: 14px; line-height: 1.6; }
.faq-a b { color: var(--text); font-weight: 600; }
.faq-a ul { margin: 8px 0 0; padding-left: 18px; }
.faq-a li { margin: 4px 0; }
.faq-a .pill, .faq-a .inj { vertical-align: middle; }
.faq-score { width: 100%; border-collapse: collapse; }
.faq-score td { padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
.faq-score td:nth-child(2), .faq-score td:nth-child(4) { font-weight: 700; color: var(--accent); white-space: nowrap; }
.faq-score td:nth-child(3) { padding-left: 22px; }
.faq-tips { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.faq-tips li { margin: 4px 0; }

/* ── Live game center ────────────────────────────────────── */
.live-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; transition: border-color .12s ease; }
.live-cta:hover { border-color: var(--accent); }
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 10px; }
.lg-card { padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.lg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; line-height: 1.55; }
.lg-row > span:first-child { font-weight: 600; color: var(--muted); font-size: 13px; }
.lg-win > span { color: var(--text); }
.lg-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.lg-status { margin-top: 6px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 5px; }
.feed-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.feed-row:last-child { border-bottom: none; }
.feed-rank { color: var(--muted); font-weight: 700; font-size: 12px; margin-right: 6px; }
.lg-clickable { cursor: pointer; transition: border-color .12s ease, background .12s ease; }
.lg-clickable:hover { border-color: var(--accent); background: #212a33; }
.box-h { margin: 14px 0 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.box-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.box-row:last-child { border-bottom: none; }
.box-stat { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ── Tabs (pool view) ────────────────────────────────────── */
.viewtabs { display: flex; gap: 8px; margin: 6px 0 18px; }
.viewtab {
  padding: 8px 16px; border-radius: 9px; cursor: pointer; font-weight: 600;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
}
.viewtab.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* ── Compact lineup (combined pool view) ─────────────────── */
.lineup { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 12px 0 4px; }
.lineup-slot {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text); font: inherit; text-align: left;
  transition: border-color .12s ease;
}
.lineup-slot:disabled { opacity: 1; cursor: default; }
.lineup-slot.editable { cursor: pointer; }
.lineup-slot.editable:hover { border-color: var(--accent); }
.ls-pos { font-size: 11px; font-weight: 800; color: var(--accent); letter-spacing: .05em; }
.ls-name { font-weight: 700; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-name.empty { color: var(--muted); font-weight: 600; }
.ls-meta { display: flex; align-items: center; gap: 8px; min-height: 15px; }
.ls-pts { color: var(--accent); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.ls-flag { font-size: 11px; color: var(--muted); }

/* ── Pick slots ──────────────────────────────────────────── */
.slot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
}
.slot + .slot { margin-top: 10px; }
.slot-pos {
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; background: #23303a; color: var(--accent); border: 1px solid var(--border);
}
.slot-main { display: flex; align-items: center; gap: 14px; }
.slot-name { font-weight: 700; }
.slot-sub { color: var(--muted); font-size: 13px; }
.slot-score { font-weight: 800; font-size: 18px; }
.locked-tag { font-size: 11px; color: var(--warn); border: 1px solid var(--border); padding: 2px 7px; border-radius: 999px; }

/* ── Search results ──────────────────────────────────────── */
.results { margin-top: 12px; max-height: 320px; overflow-y: auto; }
.result {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.result:last-child { border-bottom: none; }
.result.ineligible { opacity: 0.55; }
.reason { font-size: 12px; color: var(--warn); }

/* ── Leaderboard table ───────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
td.rank { font-weight: 800; color: var(--accent); width: 44px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.breakdown { color: var(--muted); font-size: 13px; }
.breakdown b { color: var(--text); font-weight: 600; }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 50; max-width: 90vw;
}
.toast.error { border-color: var(--danger); }
.toast.ok { border-color: var(--accent); }

/* ── Status banners ──────────────────────────────────────── */
.banner {
  padding: 14px 18px; border-radius: 10px; font-weight: 700;
  margin: 4px 0 16px; border: 1px solid; box-shadow: var(--shadow);
}
.banner-eliminated { background: rgba(255, 107, 107, 0.14); color: var(--danger); border-color: rgba(255, 107, 107, 0.55); }
.banner-winner { background: rgba(232, 184, 75, 0.16); color: var(--accent); border-color: rgba(232, 184, 75, 0.55); }

/* Highlighted per-player points on the leaderboard */
.pts { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.pill.you { background: rgba(232, 184, 75, 0.16); color: var(--accent); border-color: rgba(232, 184, 75, 0.45); }
tr.me-row td { background: rgba(232, 184, 75, 0.07); }

/* Hidden-pick ninja + player detail modal */
.ninja { font-size: 15px; cursor: default; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto;
}
.pickable-badge {
  margin-top: 14px; padding: 10px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 14px;
}
.pickable-badge b { color: var(--accent); }
.invite-box { margin-top: 10px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); overflow-x: auto; }
.invite-box code { color: var(--accent); font-size: 13px; white-space: nowrap; }
.own-badge {
  margin-top: 8px; padding: 10px 14px; border-radius: 10px; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.own-badge b { color: var(--accent); }

/* Fantasy form (avg PPG + positional rank) on player rows */
.form { color: var(--warn); font-weight: 600; white-space: nowrap; }

/* Pick-search sort control */
.sortbar { display: flex; align-items: center; gap: 8px; margin: 12px 0 2px; font-size: 13px; color: var(--muted); }
.sortbtn {
  padding: 4px 12px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13px;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
}
.sortbtn.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.empty { text-align: center; color: var(--muted); padding: 30px 0; }
.error-text { color: var(--danger); font-size: 14px; min-height: 18px; }
.spinner { color: var(--muted); padding: 20px 0; text-align: center; }
a.link { color: var(--accent); cursor: pointer; }

/* Responsive label swaps (e.g. "How it works" → "Rules" on phones). */
.show-mobile { display: none; }

/* ── Mobile (most traffic) ───────────────────────────────── */
@media (max-width: 640px) {
  .hide-mobile { display: none; }
  .show-mobile { display: inline; }

  /* Top bar: compact, and allowed to wrap on very narrow phones so it can
     never force the page to scroll sideways. */
  #topbar { padding: 10px 13px; flex-wrap: wrap; gap: 8px; }
  .brand { font-size: 16px; }
  .topbar-right { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
  #who { display: none; }                 /* free up room; name is on the pool anyway */
  .week-picker { font-size: 12px; gap: 5px; }
  #topbar .btn { padding: 7px 11px; font-size: 13px; }

  #app { padding: 18px 13px 72px; }
  .card { padding: 15px; }
  h1 { font-size: 22px; }
  h2 { font-size: 17px; }

  /* Pools list: let the meta and actions wrap instead of overflowing. */
  .pool-item { flex-wrap: wrap; gap: 10px; }
  .pool-item > div:last-child { width: 100%; justify-content: flex-start; }

  /* Leaderboard → stacked rows: rank + name + total on top, lineup beneath. */
  .lb-table thead { display: none; }
  .lb-table tbody, .lb-table tr, .lb-table td { display: block; }
  .lb-table tr {
    display: grid; grid-template-columns: auto 1fr auto;
    grid-template-areas: "rank name total" "bd bd bd";
    column-gap: 8px; row-gap: 4px; padding: 12px 6px; align-items: baseline;
    border-bottom: 1px solid var(--border);
  }
  .lb-table td { border: none; padding: 0; }
  .lb-table td.rank { grid-area: rank; }
  .lb-table td.entrant { grid-area: name; }
  .lb-table td.breakdown { grid-area: bd; line-height: 1.7; }
  .lb-table td.num { grid-area: total; font-size: 16px; }
  .lb-table tr.me-row { background: rgba(232, 184, 75, 0.07); border-radius: 8px; }
  .lb-table tr.me-row td { background: none; }

  /* FAQ scoring table: tighten so it fits a phone. */
  .faq-score td { padding: 7px 5px; font-size: 12.5px; }
  .faq-score td:nth-child(3) { padding-left: 10px; }
  .faq-item { gap: 11px; padding: 12px 0; }
  .faq-icon { font-size: 20px; flex-basis: 24px; }

  /* Scoreboard: a touch smaller so more games peek in. */
  .sb-card { min-width: 104px; }

  /* Search / matchup rows: keep the Pick button from being squeezed off. */
  .result { gap: 10px; }
}
