/* Saturday to Sunday Football — phone-first PWA styles (phase 1) */
:root {
  --bg: #0d1526;
  --bg2: #111c33;
  --card: #16223c;
  --card2: #1b2a4a;
  --line: #26365c;
  --text: #eef2f7;
  --muted: #8b98ad;
  --accent: #f5b301;
  --green: #3ddc84;
  --red: #ff6b6b;
  --blue: #5aa9ff;
  --tabbar-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  overflow-x: hidden; /* hard guard: page never scrolls horizontally */
  -webkit-text-size-adjust: 100%;
}
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; }

/* ---------- header ---------- */
#topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px calc(8px + env(safe-area-inset-top, 0px));
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
}
.brand { font-weight: 800; letter-spacing: 0.5px; font-size: 15px; }
.brand em { color: var(--accent); font-style: normal; }
.build-tag {
  font-size: 10px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 2px;
}
.league-switch { display: flex; gap: 6px; margin-top: 8px; }
.league-switch button {
  flex: 1 1 0; min-width: 0;
  background: var(--card); color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 0; font-size: 14px; font-weight: 700; cursor: pointer;
}
.league-switch button.active { background: var(--accent); color: #1a1a1a; border-color: var(--accent); }
.season-line { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* ---------- main view ---------- */
#view { padding: 12px 12px calc(var(--tabbar-h) + 24px); }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; margin-bottom: 12px;
  max-width: 100%;
}
.card h3 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.card h3 .gold { color: var(--accent); }

/* ---------- tab bar ---------- */
#tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex;
  background: var(--bg2);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  max-width: 520px; margin: 0 auto;
}
#tabs button {
  flex: 1 1 0; min-width: 0;
  background: none; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: var(--tabbar-h); cursor: pointer;
  font-size: 11px; font-weight: 600;
}
#tabs button b { font-size: 20px; font-weight: 400; }
#tabs button.active { color: var(--accent); }

/* ---------- score / game rows ---------- */
.game-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 4px; border-bottom: 1px solid var(--line);
  max-width: 100%;
}
.game-row:last-child { border-bottom: none; }
.team-side { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 7px; }
.team-side.right { flex-direction: row-reverse; text-align: right; }
.team-side .nm {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; font-size: 14px;
}
.team-side .nm small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.badge {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.score-mid { flex: 0 0 auto; text-align: center; min-width: 64px; }
.score-mid .sc { font-size: 17px; font-weight: 800; }
.score-mid .sc .w { color: var(--green); }
.score-mid .meta { font-size: 10px; color: var(--muted); }
.ot-tag { color: var(--accent); font-weight: 700; }

/* ---------- stories ---------- */
.story {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 14px;
  max-width: 100%;
}
.story:last-child { border-bottom: none; }
.story .ic { flex: 0 0 auto; font-size: 17px; }
.story .tx { min-width: 0; }
.empty-note { color: var(--muted); font-size: 13px; padding: 6px 2px; }

/* ---------- teams list ---------- */
.search {
  width: 100%; max-width: 100%;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 15px; margin-bottom: 10px;
}
.team-row {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: 100%;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
  cursor: pointer; text-align: left; font-size: 15px;
}
.team-row .info { flex: 1 1 0; min-width: 0; }
.team-row .info .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-row .info .s { font-size: 12px; color: var(--muted); }
.team-row .rec { flex: 0 0 auto; font-weight: 800; font-size: 14px; }
.stars { color: var(--accent); font-size: 12px; letter-spacing: 1px; }
.back-btn {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 8px 14px; font-size: 14px; font-weight: 700;
  margin-bottom: 10px; cursor: pointer;
}

/* ---------- roster ---------- */
.sort-toggle { display: flex; gap: 6px; margin-bottom: 8px; }
.sort-toggle button {
  flex: 1 1 0; background: var(--card2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; padding: 7px 0; font-size: 13px; font-weight: 700; cursor: pointer;
}
.sort-toggle button.active { color: var(--accent); border-color: var(--accent); }
.prow {
  display: flex; align-items: center; gap: 9px; width: 100%; max-width: 100%;
  background: none; border: none; border-bottom: 1px solid var(--line);
  color: var(--text); padding: 8px 2px; cursor: pointer; text-align: left; font-size: 14px;
}
.prow:last-child { border-bottom: none; }
.pos {
  flex: 0 0 auto; width: 38px; text-align: center;
  font-size: 11px; font-weight: 800; color: var(--blue);
  background: rgba(90,169,255,0.12); border-radius: 6px; padding: 3px 0;
}
.prow .pn { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.prow .pn small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.prow .ov { flex: 0 0 auto; font-weight: 800; font-size: 14px; }
.prow .ov.good { color: var(--green); }
.inj { color: var(--red); font-size: 11px; font-weight: 700; }

/* ---------- standings ---------- */
.stand-card { margin-bottom: 12px; }
.stand-card h4 { margin: 0 0 4px; font-size: 13px; color: var(--accent); }
.srow {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 14px;
  max-width: 100%;
}
.srow:last-child { border-bottom: none; }
.srow .rk { flex: 0 0 auto; width: 20px; color: var(--muted); font-size: 12px; }
.srow .tn { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.srow .wl { flex: 0 0 auto; font-weight: 800; min-width: 44px; text-align: right; }
.srow .pf { flex: 0 0 auto; color: var(--muted); font-size: 12px; min-width: 76px; text-align: right; }

/* ---------- sim tab ---------- */
.big-btn {
  display: block; width: 100%; max-width: 100%;
  border: none; border-radius: 12px; padding: 14px;
  font-size: 16px; font-weight: 800; cursor: pointer; margin-bottom: 10px;
}
.big-btn.primary { background: var(--green); color: #06281a; }
.big-btn.secondary { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.big-btn.warn { background: none; color: var(--red); border: 1px solid var(--red); font-size: 14px; }
.big-btn:disabled { opacity: 0.45; cursor: default; }
.week-chips {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; margin-bottom: 6px;
  max-width: 100%; -webkit-overflow-scrolling: touch;
}
.week-chips button {
  flex: 0 0 auto; background: var(--card2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; padding: 7px 11px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.week-chips button.active { color: #1a1a1a; background: var(--accent); border-color: var(--accent); }
.week-chips button.done { color: var(--green); }

/* ---------- player detail ---------- */
.attr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.attr { font-size: 12px; }
.attr .lbl { display: flex; justify-content: space-between; color: var(--muted); margin-bottom: 2px; }
.attr .lbl b { color: var(--text); }
.bar { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.stat-table { width: 100%; max-width: 100%; border-collapse: collapse; font-size: 13px; }
.stat-table td { padding: 5px 2px; border-bottom: 1px solid var(--line); }
.stat-table td:last-child { text-align: right; font-weight: 700; }
.stat-table tr:last-child td { border-bottom: none; }
.phead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.phead .pn2 { font-size: 18px; font-weight: 800; min-width: 0; }
.phead .sub { font-size: 12px; color: var(--muted); }

/* ---------- toast / misc ---------- */
#toast-root { position: fixed; bottom: calc(var(--tabbar-h) + 16px); left: 0; right: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: #0a0f1e; border: 1px solid var(--accent); color: var(--text);
  border-radius: 10px; padding: 10px 16px; font-size: 14px; font-weight: 600;
  max-width: calc(100% - 32px);
}
.error-card { border-color: var(--red); }
.kv { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-weight: 700; }

/* ---------- phase 2: rankings ---------- */
.mv { flex: 0 0 auto; font-size: 12px; font-weight: 800; min-width: 40px; text-align: right; }
.mv.up { color: var(--green); }
.mv.dn { color: var(--red); }
.mv.same { color: var(--muted); }
.mv.new { color: var(--accent); font-size: 10px; }
.rank-row { cursor: pointer; width: 100%; background: none; border: none; border-bottom: 1px solid var(--line); color: var(--text); text-align: left; }
.rank-row:last-child { border-bottom: none; }

/* ---------- phase 2: recruiting ---------- */
.team-select {
  width: 100%; max-width: 100%;
  background: var(--card2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 12px; font-size: 16px; font-weight: 700;
  margin-bottom: 8px; cursor: pointer;
}
.filter-row { display: flex; gap: 8px; }
.filter-row select {
  flex: 1 1 0; min-width: 0;
  background: var(--card2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 6px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.prospect {
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; margin-bottom: 10px;
  max-width: 100%;
}
.prospect h4 { margin: 10px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.prospect .bar.big { height: 8px; margin: 4px 0 6px; }
.stars-q { color: var(--muted); font-size: 14px; letter-spacing: 2px; }
.tag {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 0.5px;
  border-radius: 6px; padding: 3px 8px; text-transform: uppercase;
}
.tag.signed { background: rgba(61,220,132,0.15); color: var(--green); border: 1px solid var(--green); }
.tag.committed { background: rgba(245,179,1,0.12); color: var(--accent); border: 1px solid var(--accent); }
.tag.committed-me { background: var(--green); color: #06281a; }
.int-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; }
.int-row span { flex: 0 0 44px; font-weight: 700; }
.int-row .bar { flex: 1 1 0; }
.int-row b { flex: 0 0 30px; text-align: right; }
.int-row.me span { color: var(--accent); }
.recruit-acts { display: flex; gap: 8px; margin-top: 10px; }
.recruit-acts button {
  flex: 1 1 0; min-width: 0;
  background: var(--card); border: 1px solid var(--accent); color: var(--text);
  border-radius: 10px; padding: 10px 4px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.recruit-acts button b { font-size: 15px; }
.recruit-acts button small { color: var(--muted); font-size: 11px; }
.recruit-acts button:disabled { opacity: 0.4; border-color: var(--line); cursor: default; }
.recruit-acts button:not(:disabled):active { background: var(--accent); }
.recruit-acts button:not(:disabled):active b,
.recruit-acts button:not(:disabled):active small { color: #1a1a1a; }

/* ---------- phase 2: playoffs ---------- */
.champ-card { border-color: var(--accent); }
.wtag {
  display: inline-block; background: var(--green); color: #06281a;
  font-size: 10px; font-weight: 800; border-radius: 4px; padding: 1px 5px; margin-left: 4px;
}
.bowl-block { margin-bottom: 12px; }
.bowl-block:last-child { margin-bottom: 0; }
.bowl-block h4 { margin: 0 0 4px; font-size: 13px; color: var(--accent); }

/* ---------- phase 2: offseason hub ---------- */
.ostep { display: flex; align-items: center; gap: 8px; padding: 8px 2px; font-size: 14px; }
.ostep-ic { flex: 0 0 auto; font-size: 16px; }

/* ---------- phase 3: pro shell ---------- */
/* Steppers: big thumb-friendly -/+ controls, no free-text entry. */
.step-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 5px 0;
}
.step-lbl { font-size: 13px; color: var(--muted); flex: 0 0 auto; }
.stepper { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.stepper button {
  width: 44px; height: 44px; border-radius: 12px; flex: 0 0 auto;
  background: var(--card); border: 1px solid var(--accent); color: var(--text);
  font-size: 22px; font-weight: 800; line-height: 1; cursor: pointer;
}
.stepper button:active { background: var(--accent); color: #1a1a1a; }
.step-val { font-size: 15px; font-weight: 800; min-width: 76px; text-align: center; }
/* Cut rows: player + dead-money preview + cut button. */
.cut-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px; border-bottom: 1px solid var(--line);
}
.cut-row:last-child { border-bottom: none; }
.cut-row .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cut-btn {
  flex: 0 0 auto; background: none; color: var(--red);
  border: 1px solid var(--red); border-radius: 10px;
  font-size: 14px; font-weight: 800; padding: 12px 16px; cursor: pointer;
}
.cut-btn:active { background: var(--red); color: #fff; }
