/* Franchise HQ - dark by design. Sports apps live at night, and a fixed dark
   palette keeps the team-colour chips readable and consistent. */

:root {
  --bg: #0b1220;
  --bg-elev: #131c2e;
  --bg-elev-2: #1b263c;
  --line: #24314c;
  --text: #e8eefc;
  --muted: #8fa0c0;
  --accent: #2f81f7;
  --pos: #46d18a;
  --neg: #f8737f;
  --warn: #f5b955;
  --radius: 14px;
  --tabbar-h: 56px;
  --header-h: 54px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.left { text-align: left; }

/* --------------------------------------------------------------- chrome */

#progress {
  position: fixed; top: var(--safe-top); left: 0; height: 2px; width: 0;
  background: var(--accent); z-index: 60; transition: width .2s ease, opacity .3s;
  opacity: 0;
}
#progress.on { opacity: 1; }

#pull { height: 0; transition: height .18s ease; }

#header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--header-h) + var(--safe-top));
  padding: var(--safe-top) 12px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: rgba(11, 18, 32, .82);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.hdr-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hdr-title { font-weight: 680; font-size: 16px; letter-spacing: -0.01em; }
.hdr-sub { font-size: 11.5px; color: var(--muted); margin-top: -1px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 0;
  background: transparent; color: var(--text); font-size: 20px; line-height: 1;
  display: grid; place-items: center;
}
.icon-btn:active { background: var(--bg-elev-2); }
.icon-btn.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#view {
  position: absolute; inset: 0;
  padding: calc(var(--header-h) + var(--safe-top) + 12px) 12px
           calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(11, 18, 32, .9);
  backdrop-filter: blur(18px) saturate(160%);
  border-top: 1px solid var(--line);
}
#tabbar button {
  border: 0; background: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
#tabbar button.on { color: var(--accent); }
.tab-icon { font-size: 18px; line-height: 1; }
.tab-label { font-size: 10.5px; letter-spacing: .01em; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
  background: var(--bg-elev-2); border: 1px solid var(--line);
  padding: 9px 15px; border-radius: 999px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: all .22s ease; z-index: 70;
  max-width: 88vw; text-align: center;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------------------------------------------------------- blocks */

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h2 { margin-bottom: 0; }
.card.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.card.error { border-color: color-mix(in srgb, var(--neg) 45%, var(--line)); }

.hero {
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 34%, var(--bg-elev)), var(--bg-elev) 62%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
.hero.compact { padding: 14px; }
.hero-top { display: flex; align-items: center; gap: 12px; }
.hero-top h1 { font-size: 21px; line-height: 1.15; }
.hero-record { display: flex; align-items: baseline; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.hero-record .big { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.hero-stats { display: flex; gap: 12px; font-size: 13px; color: var(--muted); }
.hero-stats b { color: var(--text); }
.hero-seed { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; }

.empty { text-align: center; padding: 44px 18px; color: var(--muted); }
.empty h2 { color: var(--text); margin-bottom: 8px; font-size: 17px; }

.skeleton {
  height: 160px; border-radius: var(--radius);
  background: linear-gradient(90deg, var(--bg-elev), var(--bg-elev-2), var(--bg-elev));
  background-size: 200% 100%; animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.footnote { text-align: center; color: var(--muted); font-size: 11.5px; padding: 10px 0 4px; }

/* ----------------------------------------------------------------- chips */

.chip {
  display: inline-grid; place-items: center; flex: none;
  background: var(--chip, #33415c); color: #fff;
  border-radius: 8px; font-weight: 700; letter-spacing: .02em;
  width: 32px; height: 24px; font-size: 10.5px;
}
.chip-lg { width: 52px; height: 42px; font-size: 15px; border-radius: 12px; }

.badge {
  display: inline-block; padding: 1px 6px; border-radius: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em; vertical-align: middle;
}
.badge-user { background: color-mix(in srgb, var(--accent) 26%, transparent); color: #9dc4ff; }
/* Dense tables use a dot instead of the username - same signal, no width. */
.user-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: var(--accent); display: inline-block; margin-left: 5px;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}
.badge-div { background: color-mix(in srgb, var(--pos) 20%, transparent); color: var(--pos); }

/* --------------------------------------------------------------- controls */

.segmented {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 12px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 11px;
}
.segmented.wrap { flex-wrap: wrap; }
.segmented button {
  flex: 1; min-width: 78px; border: 0; border-radius: 8px; padding: 7px 8px;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 600;
}
.segmented button.on { background: var(--bg-elev-2); color: var(--text); }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.row-actions button, button.primary {
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text);
  padding: 9px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:active { filter: brightness(.9); }

.field { display: block; margin-bottom: 10px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
input[type=url], input[type=text], select {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }

/* --------------------------------------------------------------- tables */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.tbl th {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600; text-align: right; padding: 0 0 7px 10px;
}
.tbl th.left { text-align: left; padding-left: 0; }
.tbl td { text-align: right; padding: 7px 0 7px 10px; border-top: 1px solid var(--line); }
.tbl td.left { text-align: left; padding-left: 0; display: flex; align-items: center; gap: 7px; }
.tbl tr.me td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tbl tr.me td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.tname { overflow: hidden; text-overflow: ellipsis; max-width: 128px; }
.small-tbl { font-size: 11.5px; }
.roster tr.injured td { opacity: .62; }
.inj { color: var(--neg); font-size: 10px; font-weight: 700; }
.dev-1 { color: #6fb4ff; } .dev-2 { color: #c99bff; } .dev-3 { color: var(--warn); font-weight: 700; }

.roster-controls { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.roster-controls select { width: auto; flex: 1; min-width: 118px; }

/* ---------------------------------------------------------------- games */

.game { padding: 10px 0; border-top: 1px solid var(--line); }
.game:first-of-type { border-top: 0; padding-top: 0; }
.game-week { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.game-teams { display: grid; gap: 5px; }
.game-team { display: flex; align-items: center; gap: 8px; }
.game-team span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-team b { font-variant-numeric: tabular-nums; font-size: 15px; }
.game-team.hi { font-weight: 650; }
.game-status { font-size: 11px; color: var(--muted); margin-top: 5px; }

.form-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.form-pill {
  display: grid; place-items: center; min-width: 52px; padding: 6px 8px;
  border-radius: 9px; background: var(--bg-elev-2); border: 1px solid var(--line);
}
.form-pill b { font-size: 12px; }
.form-pill span { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.form-pill.w { border-color: color-mix(in srgb, var(--pos) 50%, var(--line)); }
.form-pill.w b { color: var(--pos); }
.form-pill.l { border-color: color-mix(in srgb, var(--neg) 45%, var(--line)); }
.form-pill.l b { color: var(--neg); }
.stat-line { font-size: 15px; }

.week-picker {
  display: flex; gap: 5px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: 0 -12px 12px; padding: 0 12px 4px;
}
.week-picker button {
  flex: none; min-width: 38px; padding: 7px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--muted);
  font-size: 12.5px; font-weight: 600;
}
.week-picker button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* -------------------------------------------------------------- playoffs */

.seeds { list-style: none; margin: 0; padding: 0; }
.seed-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 0; border-top: 1px solid var(--line);
}
.seed-row:first-child { border-top: 0; }
.seed-row.me { box-shadow: inset 2px 0 0 var(--accent); padding-left: 8px; margin-left: -8px; }
.seed-row.out { opacity: .6; }
.seed-num {
  width: 20px; height: 20px; flex: none; display: grid; place-items: center;
  border-radius: 6px; background: var(--bg-elev-2); font-size: 11px; font-weight: 700; color: var(--muted);
}
.seed-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seed-rec { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.seed-why {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  padding: 1px 5px; border-radius: 5px;
}
.outside { margin-top: 10px; }
.outside summary { color: var(--muted); font-size: 12.5px; cursor: pointer; padding: 6px 0; }
.note { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--warn); }

.matchup {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px;
}
.matchup:first-of-type { border-top: 0; }
.matchup.mine { box-shadow: inset 2px 0 0 var(--accent); padding-left: 8px; margin-left: -8px; }
.mu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 92px; }
.at { color: var(--muted); font-size: 11px; margin: 0 2px; }
.bye { display: flex; align-items: center; gap: 8px; font-size: 13px; padding-bottom: 10px; }

/* ------------------------------------------------------------- scenarios */

.scenario-list { display: grid; gap: 10px; }
.scenario { padding: 9px 0; border-top: 1px solid var(--line); }
.scenario:first-child { border-top: 0; padding-top: 0; }
.scenario.mine { box-shadow: inset 2px 0 0 var(--accent); padding-left: 8px; margin-left: -8px; }
.scenario-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.scenario-pick { display: grid; grid-template-columns: 1fr auto 1fr; gap: 5px; }
.scenario-pick button {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--muted);
  border-radius: 9px; padding: 7px 6px; font-size: 12px; font-weight: 600;
  overflow: hidden; white-space: nowrap;
}
.scenario-pick button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.odds {
  position: relative; display: inline-block; min-width: 52px; padding: 3px 7px;
  border-radius: 6px; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px;
  background: linear-gradient(to right,
    color-mix(in srgb, var(--accent) 34%, transparent) var(--fill), transparent var(--fill));
}
.odds.lock { color: var(--pos); }
.odds.dead { color: var(--muted); background: none; }

.dist { display: grid; gap: 7px; }
.dist-row { display: grid; grid-template-columns: 30px 1fr 48px; align-items: center; gap: 8px; }
.dist-seed { font-size: 12px; color: var(--muted); font-weight: 600; }
.dist-bar { height: 9px; background: var(--bg-elev-2); border-radius: 5px; overflow: hidden; }
.dist-bar i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.dist-val { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ lists */

.team-list, .menu { list-style: none; margin: 0; padding: 0; }
.team-list li {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.team-list li:first-child { border-top: 0; }
.team-list li.me { box-shadow: inset 2px 0 0 var(--accent); padding-left: 8px; margin-left: -8px; }
.tl-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-rec { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; }
.tl-ovr { font-size: 11.5px; color: var(--muted); min-width: 52px; text-align: right; }

.menu li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 0; border-top: 1px solid var(--line); font-size: 15px;
}
.menu li:first-child { border-top: 0; }
.menu li span { color: var(--muted); }

.howto { margin: 0; padding-left: 20px; font-size: 13.5px; }
.howto li { margin-bottom: 6px; }

/* -------------------------------------------------------------- onboarding */

.onboard { padding: 22px 2px 8px; }
.onboard h1 { font-size: 25px; letter-spacing: -0.02em; margin-bottom: 6px; }
.onboard > .muted { margin-bottom: 18px; }

.onboard-form { display: flex; gap: 8px; margin-bottom: 6px; }
.onboard-form input { flex: 1; }
.onboard-form button { flex: none; padding: 10px 20px; }

.onboard-msg { margin: 12px 0 4px; font-size: 13.5px; }
.warn-text { color: var(--warn); }

.onboard-sep {
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0 12px; color: var(--muted); font-size: 12px;
}
.onboard-sep::before, .onboard-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

.pick-list { display: grid; gap: 8px; }
.pick-team {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent, transparent);
}
.pick-team:active { background: var(--bg-elev-2); }
.pick-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-user { font-size: 11.5px; color: var(--muted); max-width: 108px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.all-teams { margin-top: 18px; }
.all-teams summary { color: var(--muted); font-size: 13px; padding: 8px 0; cursor: pointer; }
.all-teams .pick-list { margin-top: 10px; }

/* Marks a figure reconstructed from Madden's rounded per-game averages. */
.approx { opacity: .75; font-weight: 400; }

/* ------------------------------------------------------------------ seasons */

.season-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.season-head h2 { margin-bottom: 0; font-size: 17px; text-transform: none; letter-spacing: -0.01em; color: var(--text); }
.badge-live { background: color-mix(in srgb, var(--pos) 20%, transparent); color: var(--pos); }

.season-mine {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 10px 11px; border-radius: 10px; background: var(--bg-elev-2);
  box-shadow: inset 3px 0 0 var(--accent); margin-bottom: 10px;
}
.season-rec { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.season-best { display: flex; align-items: center; gap: 8px; font-size: 13px; padding-bottom: 4px; }
.season-table summary { color: var(--muted); font-size: 12.5px; cursor: pointer; padding: 8px 0 0; }
