:root {
  --bg: #0b0e17;
  --panel: #151a28;
  --panel-2: #1d2438;
  --line: #2a3350;
  --text: #e9edf6;
  --muted: #8b96b2;
  --accent: #f7531f;     /* NBA orange */
  --accent-2: #1d8fff;
  --gold: #ffce4d;
  --good: #34d399;
  --bad: #f3576b;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #1a2138 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.screen { min-height: 100vh; }

/* ---------- Menu ---------- */
#screen-menu { display: grid; place-items: center; padding: 24px; }
.menu-card { text-align: center; max-width: 640px; }
.logo {
  font-size: clamp(40px, 8vw, 86px); font-weight: 900; letter-spacing: 2px;
  margin: 0 0 8px; line-height: 0.95;
}
.logo span { color: var(--accent); }
.logo-beta { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 7px;
  vertical-align: super; margin-left: 8px; top: 0; }
.tagline { color: var(--muted); font-size: 17px; line-height: 1.6; margin: 18px 0 34px; }

.big-btn {
  background: linear-gradient(180deg, var(--accent), #d8410f);
  color: #fff; border: none; border-radius: 12px;
  font-size: 19px; font-weight: 800; letter-spacing: 0.4px;
  padding: 16px 34px; cursor: pointer;
  box-shadow: 0 10px 30px rgba(247, 83, 31, 0.35);
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.big-btn:hover { transform: translateY(-2px); filter: brightness(1.07); }
.big-btn:active { transform: translateY(0); }
.big-btn:disabled { filter: grayscale(0.6) brightness(0.7); cursor: default; box-shadow: none; }

/* ---------- Account bar + Google button ---------- */
.account-bar { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0 0 26px; }
.acc-in {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 8px 8px 12px;
}
.acc-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.acc-avatar.ph { display: grid; place-items: center; background: var(--accent-2); color: #fff; font-weight: 800; }
.acc-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.25; }
.acc-meta b { font-size: 15px; }
.acc-meta small { color: var(--muted); font-size: 12px; }
.acc-note { color: var(--muted); font-size: 12px; }
.gbtn {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff; color: #1f2330; border: 1px solid #dadce0; border-radius: 8px;
  font-size: 15px; font-weight: 600; padding: 10px 18px; cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.08s ease;
}
.gbtn:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.35); transform: translateY(-1px); }
.gicon { width: 18px; height: 18px; }
.email-btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; font-weight: 600; padding: 9px 16px; cursor: pointer;
  transition: border-color 0.15s ease, transform 0.08s ease;
}
.email-btn:hover { border-color: var(--accent-2); transform: translateY(-1px); }

/* ---------- Auth + username modals ---------- */
.auth-input {
  width: 100%; box-sizing: border-box; margin: 0 0 10px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; padding: 12px 14px; outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-input::placeholder { color: var(--muted); }
.auth-input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(29,143,255,0.18); }
.field-hint { min-height: 18px; margin: 2px 0 12px; font-size: 13px; color: var(--muted); text-align: left; }
.field-hint.ok { color: var(--good); }
.field-hint.bad { color: var(--bad); }
#username-modal .big-btn, #auth-modal .big-btn { display: block; width: 100%; margin: 4px 0 6px; }
#username-modal .text-btn, #auth-modal .text-btn { display: block; margin: 2px auto 0; }
.auth-tabs { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px; margin: 0 0 16px; }
.auth-tab {
  flex: 1; background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 14px; font-weight: 700; padding: 9px 10px; border-radius: 7px;
  transition: background 0.15s ease, color 0.15s ease;
}
.auth-tab.active { background: var(--panel-2); color: var(--text); }
.auth-google { width: 100%; justify-content: center; margin: 0 0 12px; font-size: 19px; padding: 16px 34px; border-radius: 12px; }   /* match the email button's size */
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 0 0 12px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Mode select ---------- */
.mode-select { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.mode-card {
  display: flex; flex-direction: column; gap: 8px; text-align: left;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 16px; padding: 22px 20px; cursor: pointer; color: var(--text);
  transition: transform 0.08s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.mode-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 12px 26px rgba(0,0,0,0.4); }
.mode-card.rated:hover { border-color: var(--gold); box-shadow: 0 12px 26px rgba(255,206,77,0.18); }
.mode-card.daily { border-color: var(--accent-2); background: linear-gradient(180deg, #18233b, var(--panel)); grid-column: 1 / -1; position: relative; }
.mode-card.daily:hover { border-color: var(--accent-2); box-shadow: 0 12px 26px rgba(29,143,255,0.20); }
.mode-card.daily .mc-title { color: var(--accent-2); }
/* Optional challenge "face" headshot, pinned to the right of the daily card (empty for most challenges). */
.mc-face { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); pointer-events: none; line-height: 0; }
.mc-face .headshot.hs-daily { --hs-size: 60px; border-color: var(--accent-2); }
.mc-title { font-size: 24px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.mode-card.rated .mc-title { color: var(--gold); }
.mc-desc { color: var(--muted); font-size: 13px; line-height: 1.5; }
.mc-lock { font-size: 14px; }
@media (max-width: 560px) { .mode-select { grid-template-columns: 1fr; } }

/* ---------- Daily challenge scouting screen (compact, mobile-first) ---------- */
#screen-challenge { display: grid; place-items: center; padding: 16px; }
.cl-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 18px 20px; width: 100%; max-width: 560px; text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.cl-title { margin: 0 0 2px; font-size: 23px; font-weight: 900; }
.cl-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.cl-team-ovr { margin: 0 0 14px; }
.cl-ovr-val { font-size: 34px; font-weight: 900; color: var(--gold); line-height: 1; }
.cl-team-ovr label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-top: 3px; }
.cl-ratings { max-width: 360px; margin: 0 auto 16px; text-align: left; }
.cl-roster { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 4px; }
.cl-prow {
  display: flex; align-items: center; gap: 9px; text-align: left;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px 7px 9px;
}
.cl-pos { font-size: 11px; font-weight: 800; color: var(--accent-2); width: 30px; flex: 0 0 auto; line-height: 1.15; }
.cl-pname { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; gap: 1px; }
.cl-pname b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-pname small { font-size: 10.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cl-ovr {
  margin-left: auto; flex: 0 0 auto; font-weight: 900; font-size: 14px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 0; min-width: 38px; text-align: center; font-variant-numeric: tabular-nums;
}
.challenge-tagline { font-size: 18px; font-weight: 800; margin: 16px 0 12px; color: var(--text); }
.cl-btns .big-btn { display: block; width: 100%; max-width: 320px; margin: 0 auto 8px; }
.cl-back { display: block; margin: 0 auto; }
@media (max-width: 540px) {
  .cl-roster { grid-template-columns: 1fr; }
  .cl-ratings { max-width: 100%; margin-left: 0; margin-right: 0; }   /* fill width (no auto-centering) so tiles align with the roster edges */
  .cl-title { font-size: 21px; }
  /* Lift the OVR + Start Draft button above the long roster/ratings so the CTA needs no scrolling */
  .cl-card { display: flex; flex-direction: column; }
  .cl-card > * { order: 7; }
  .cl-card > .cl-title { order: 0; }
  .cl-card > .cl-sub { order: 1; }
  .cl-card > .cl-team-ovr { order: 2; margin-bottom: 10px; }
  .cl-card > .challenge-tagline { order: 3; margin: 2px 0 12px; }
  .cl-card > .cl-btns { order: 4; }
  .cl-card > .cl-stats { order: 5; margin: 0 0 8px; }   /* sit right above the lineup (matches desktop) */
  .cl-card > .cl-roster { order: 5; margin-top: 12px; }
  .cl-card > .cl-ratings { order: 6; margin-top: 33px; }   /* even spacing above (matches the ~37px below the tiles) */
  .cl-card > .cl-back { order: 8; margin-top: 16px; }      /* "Back to menu" at the very bottom on mobile */
  /* Matchup + Team Construction: two matching tiles spanning the full width, so their outer
     edges line up with the player panels above (left of Matchup ↔ left of roster, etc.) */
  .cl-ratings .rp-single { display: flex; gap: 12px; align-items: stretch; }
  .cl-ratings .rp-single > .rp-grp {
    flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column;   /* title pinned at top; rows centered in the space below (see auto margins) */
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 11px 11px;
  }
  /* Title stays top-aligned; the subhead+rows block is centered beneath it (auto margins are a
     no-op in the taller Team Construction tile, which fills its height). */
  .cl-ratings .rp-grp > .rp-shead { margin-top: auto; }
  .cl-ratings .rp-grp > .rp-srow:last-child { margin-bottom: auto; }
  .cl-ratings .rp { --rp-cell: 30px; }                /* shrink cells so both tiles fit narrow phones */
  .cl-ratings .rp-lab { font-size: 12px; line-height: 1.2; white-space: nowrap; }   /* never wrap → rows stay aligned */
  /* Tile title: centered, no side rules; matched margins so both titles align */
  #screen-challenge .cl-ratings .rp-grp > .rp-sec { justify-content: center; margin: 0 0 8px; letter-spacing: 0.4px; }
  .cl-ratings .rp-grp > .rp-sec::before, .cl-ratings .rp-grp > .rp-sec::after { display: none; }
  /* Construction: one value column, right-aligned to mirror Matchup's DEF column, with its
     "Rating" subhead revealed so every value row lines up across both tiles. */
  .cl-ratings .rp-srow1 { grid-template-columns: 1fr var(--rp-cell); }
  .cl-ratings .rp-1cell { justify-content: flex-end; }
  .cl-ratings .rp-shead1 { display: grid; }
  .cl-ratings .rp-shead1 span:last-child { text-align: right; }
}

/* ---------- Rating bits (battle + result) ---------- */
.mode-badge {
  display: inline-block; font-size: 13px; font-weight: 900; letter-spacing: 1px; color: var(--muted);
}
.mode-badge.rated { color: var(--gold); }
.rtg-chip {
  font-size: 13px; font-weight: 800; color: var(--gold);
  background: rgba(255,206,77,0.12); border: 1px solid rgba(255,206,77,0.4);
  border-radius: 999px; padding: 1px 9px; vertical-align: middle;
}
.sr-rating {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 0 auto 16px; max-width: 460px; padding: 12px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
}
.sr-rating.up { border-color: var(--good); }
.sr-rating.down { border-color: var(--bad); }
.rtg-delta { font-size: 30px; font-weight: 900; }
.sr-rating.up .rtg-delta { color: var(--good); }
.sr-rating.down .rtg-delta { color: var(--bad); }
.rtg-line { font-size: 14px; color: var(--text); text-align: left; }
.rtg-line small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------- Leaderboards ---------- */
.lb-link { display: inline-block; margin-top: 8px; }

/* Menu links row: "View Leaderboards →" (left) and "What's new" (right) share a line */
.menu-links { display: flex; gap: 22px; justify-content: center; align-items: baseline; flex-wrap: wrap; margin-top: 8px; }
.menu-links .lb-link { margin-top: 0; }

/* "What's new" changelog modal */
.changelog { text-align: left; display: flex; flex-direction: column; gap: 18px; margin: 2px 0 18px; }
.cl-rel { display: flex; flex-direction: column; gap: 10px; }
.cl-head { display: flex; align-items: baseline; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.cl-ver { font-size: 16px; font-weight: 800; color: var(--gold); }
.cl-date { font-size: 12px; color: var(--muted); }
.cl-item { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; line-height: 1.5; }
.cl-item b { color: var(--text); font-size: 14px; }
.cl-item span { color: var(--muted); }

/* Support / donation button (Ko-fi) — subtle pill, doesn't compete with the play CTAs */
.menu-footer { margin-top: 28px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.support-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 18px; color: var(--muted); font-size: 14px; font-weight: 700;
  text-decoration: none; transition: transform 0.08s ease, border-color 0.15s ease, color 0.15s ease;
}
.support-btn:hover { transform: translateY(-2px); border-color: var(--gold); color: var(--text); }
.discord-btn:hover { border-color: #5865F2; color: var(--text); }
.discord-ico { display: block; flex: 0 0 auto; }
.support-ico { font-size: 16px; }

/* Dev-only daily-challenge switcher (rendered only for the dev account) */
.dev-menu { margin-top: 22px; padding: 12px 14px 14px; border: 1px dashed var(--line); border-radius: 12px; background: rgba(255,255,255,0.02); }
.dev-title { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 9px; }
.dev-chs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.dev-ch { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer; transition: border-color 0.15s ease, color 0.15s ease; }
.dev-ch:hover { border-color: var(--accent-2); }
.dev-ch.active { border-color: var(--gold); color: var(--gold); }

/* Report a bug / suggestion modal */
.report-type { display: flex; gap: 8px; margin-bottom: 12px; }
.report-type-btn {
  flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; color: var(--muted); font-size: 14px; font-weight: 700; cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.report-type-btn:hover { color: var(--text); }
.report-type-btn.active { border-color: var(--accent-2); color: var(--text); }
.report-text { resize: vertical; min-height: 110px; font-family: inherit; line-height: 1.5; }
#report-modal .big-btn { display: block; width: 100%; margin: 4px 0 6px; }

/* Admin bug-report list (dev account only) */
.bugs-list { text-align: left; display: flex; flex-direction: column; gap: 12px; max-height: 56vh; overflow-y: auto; margin: 4px 0 16px; }
.bug-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: rgba(255,255,255,0.02); }
.bug-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.bug-kind { text-transform: uppercase; letter-spacing: 1px; font-weight: 800; font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.bug-kind.bug { color: var(--bad); border-color: var(--bad); }
.bug-kind.suggestion { color: var(--accent-2); border-color: var(--accent-2); }
.bug-email { color: var(--accent-2); word-break: break-all; }
.bug-text { color: var(--text); font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.bug-del { margin-top: 8px; font-size: 12px; }

/* Non-affiliation disclaimer (footer of the menu) */
.legal { max-width: 460px; margin: 22px auto 0; font-size: 11px; line-height: 1.5; color: var(--muted); opacity: 0.7; }
/* Flat single-colour background: the leaderboard list grows tall, and the body's radial gradient
   (#1a2138 glow → --bg) would otherwise show a visible band behind the lower rows. */
#screen-leaders { display: grid; place-items: start center; padding: 36px 20px; background: var(--bg); }
.lb-card { width: 100%; max-width: 660px; text-align: center; }
.lb-card h1 { font-size: 34px; margin: 0 0 18px; }
.lb-tabs { display: flex; gap: 6px; width: fit-content; margin: 0 auto 20px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px; }
.lb-tabs.lb-era { margin-bottom: 10px; }
.lb-tab { background: transparent; border: none; color: var(--muted); font-weight: 700; font-size: 14px;
  padding: 9px 20px; border-radius: 999px; cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.lb-tab.active { background: var(--accent); color: #fff; }
.lb-body { min-height: 140px; margin-bottom: 18px; }
.lb-loading, .lb-empty { color: var(--muted); padding: 36px 12px; line-height: 1.6; }
.lb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lb-table th, .lb-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.lb-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.lb-table th.num, .lb-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.lb-table td.lb-rank { color: var(--muted); font-weight: 800; width: 40px; }
.lb-table tr:first-child td.lb-rank { color: var(--gold); }
.lb-who small { display: block; color: var(--muted); font-size: 12px; }
.lb-rtg { font-weight: 800; color: var(--gold); }
.lb-pct { font-weight: 800; }
.lb-table tr.me td { background: rgba(29,143,255,0.10); }
.lb-table tr.clickable { cursor: pointer; }
.lb-table tr.clickable:hover td { background: rgba(247,83,31,0.10); }
.lb-hint { color: var(--muted); font-size: 12px; margin: 12px 0 0; }
.lb-pager { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 14px 0 2px; }
.lb-pg { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--text);
  font-size: 13px; font-weight: 700; padding: 7px 14px; cursor: pointer; }
.lb-pg:hover:not(:disabled) { border-color: var(--accent); }
.lb-pg:disabled { opacity: 0.4; cursor: default; }
.lb-pg.lb-jump { color: var(--accent-2); border-color: var(--accent-2); }
.lb-pg-info { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.lb-you { font-size: 10px; background: var(--accent-2); color: #fff; padding: 1px 7px;
  border-radius: 999px; margin-left: 6px; vertical-align: middle; text-transform: uppercase; letter-spacing: 0.5px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--line);
  background: rgba(13, 17, 28, 0.6); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px);
}
.brand { font-weight: 900; letter-spacing: 1px; font-size: 20px; }
.brand span { color: var(--accent); }
.meters { display: flex; gap: 14px; }
.meter {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 16px; text-align: center; min-width: 96px;
}
.meter-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.meter-val { font-size: 22px; font-weight: 800; }
.meter-val.low { color: var(--gold); }
.meter-val.crit { color: var(--bad); }

/* ---------- Draft layout ---------- */
.draft-body {
  display: grid; grid-template-columns: 1fr 380px; gap: 24px;
  max-width: 1180px; margin: 0 auto; padding: 26px;
}
.left { min-height: 60vh; }
.hint { color: var(--muted); font-size: 14px; margin: 14px 2px; min-height: 18px; }

/* Budget summary, sits above the draft offers */
.budget-bar { display: flex; gap: 14px; margin: 0 0 18px; }
.bb-item {
  flex: 1; background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; text-align: center;
}
.bb-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 4px; }
.bb-val { font-size: 30px; font-weight: 900; line-height: 1; color: var(--text); }
.bb-val.low { color: var(--gold); }
.bb-val.crit { color: var(--bad); }

.offer-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px; margin-top: 6px;
}
.player-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 14px; padding: 16px 14px 14px;
  text-align: left; color: var(--text); cursor: pointer; position: relative;
  transition: transform 0.08s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.player-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 10px 24px rgba(0,0,0,0.4); }
.pc-pos {
  position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 800;
  color: var(--accent-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px;
  background: rgba(29,143,255,0.08);
}
.pc-name { font-size: 18px; font-weight: 800; margin: 2px 38px 4px 0; line-height: 1.15; }
.pc-meta { color: var(--muted); font-size: 13px; }
.pc-price { margin-top: 12px; font-size: 22px; font-weight: 900; color: var(--gold); }
/* God mode (admin-only optimal-draft helper) overlays on the offer cards */
.gm-rank { position: absolute; top: 10px; left: 10px; z-index: 2; font-size: 10.5px; font-weight: 800; letter-spacing: 0.3px; padding: 2px 7px; border-radius: 6px; background: var(--panel); color: var(--muted); border: 1px solid var(--line); }
.gm-rank.best { background: #1f7a3a; color: #fff; border-color: #38b35f; }
.player-card.gm-best { border-color: #38b35f; box-shadow: 0 0 0 1px #38b35f, 0 10px 24px rgba(56,179,95,0.28); }
.gm-hint { margin-top: 10px; font-size: 11.5px; color: var(--accent-2); font-weight: 700; }
.gm-hint b { color: var(--text); }
.gm-bar { display: block; height: 4px; margin-top: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.gm-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #38b35f, #2ea05a); }
.gm-optimal { display: block; margin: 0 auto 12px; padding: 11px 26px; border-radius: 10px; cursor: pointer;
  border: 1px solid #38b35f; background: rgba(56,179,95,0.14); color: #7ee0a0; font-size: 14px; font-weight: 800; letter-spacing: 0.2px; }
.gm-optimal:hover { background: rgba(56,179,95,0.22); }

/* ---------- Roster ---------- */
.right h2 { margin: 0 0 12px; font-size: 18px; }
.roster-group-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted);
  margin: 14px 4px 8px;
}
.roster-group-title:first-child { margin-top: 0; }
.slot {
  display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; min-height: 50px;
}
.slot.filled { border-color: #34406a; }
.slot-tag {
  font-size: 12px; font-weight: 800; color: var(--accent); text-align: center;
  background: rgba(247,83,31,0.1); border-radius: 6px; padding: 4px 0;
}
.slot-player { display: flex; flex-direction: column; line-height: 1.2; }
.slot-player b { font-size: 15px; }
.slot-player small { color: var(--muted); font-size: 12px; }
.slot-empty { color: #586181; font-style: italic; font-size: 14px; }
.slot-price { font-weight: 800; color: var(--gold); }
@keyframes flash { 0% { background: rgba(247,83,31,0.35); } 100% { background: var(--panel); } }
.slot.flash { animation: flash 0.8s ease; }

/* ---------- Done screen ---------- */
#screen-done { display: grid; place-items: start center; padding: 36px 20px; }
.done-card { width: 100%; max-width: 820px; text-align: center; }
.done-card h1 { font-size: 40px; margin: 4px 0 18px; }
.done-card h1 span.grade { color: var(--gold); }
.done-summary { display: flex; justify-content: center; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.done-summary > div {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 22px; min-width: 110px;
}
.done-summary span { display: block; font-size: 28px; font-weight: 900; }
.done-summary label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.reveal { width: 100%; border-collapse: collapse; margin: 8px 0 22px; font-size: 14px; }
.reveal th, .reveal td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.reveal th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.reveal td small { color: var(--muted); margin-left: 6px; }
.reveal td.ovr { font-weight: 800; }
.deal-STEAL { color: var(--good); font-weight: 800; }
.deal-good { color: #8fe3bf; }
.deal-fair { color: var(--muted); }
.deal-overpaid { color: var(--bad); }

/* Draft-complete: team ratings panel */
.done-rp { max-width: 340px; margin: 0 auto 8px; text-align: left; }
.done-sub { color: var(--muted); font-size: 13px; margin: 4px 0 18px; text-align: center; }

/* Stat tooltips (hover desktop / tap mobile) */
.has-tip { cursor: help; }
.tip {
  position: absolute; z-index: 60; max-width: 270px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 13px; font-size: 12.5px; line-height: 1.45; color: var(--text); text-align: left;
  box-shadow: 0 10px 28px rgba(0,0,0,0.55); pointer-events: none;
}
.tip.hidden { display: none; }
.tip b { color: var(--accent); }
.done-note { color: var(--muted); margin: 18px 0 22px; }

/* projected stats screen */
.done-card.wide { max-width: 940px; }
.banner-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; margin: 0 0 14px; }
.team-total { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 8px; }
.pill { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; min-width: 78px; }
.pill span { display: block; font-size: 24px; font-weight: 900; color: var(--gold); }
.pill label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.tbl-title { font-size: 16px; text-align: left; margin: 26px 0 8px; }
.tbl-wrap { overflow-x: auto; }
table.box { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
table.box th, table.box td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.box th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
table.box th:nth-child(n+3), table.box td.num { text-align: right; }
table.box td.slot-c { color: var(--accent); font-weight: 800; font-size: 12px; }
table.box td small { color: var(--muted); margin-left: 6px; }
table.box tr.grp td {
  color: var(--accent-2); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px;
  background: rgba(29,143,255,0.05); border-bottom: none; padding-top: 12px;
}
table.box tr.total-row td {
  font-weight: 900; font-size: 14px; color: var(--text);
  border-top: 2px solid var(--line); border-bottom: none;
}

/* ---------- Set minutes screen ---------- */
#screen-minutes { display: grid; place-items: start center; padding: 30px 18px; }
.min-card { width: 100%; max-width: 720px; }
.min-card h1 { text-align: center; margin: 0 0 6px; font-size: 32px; }
/* (i) badge revealing the "how it works" explainer (hover desktop / tap mobile via [data-tip]) */
.min-info {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  width: 22px; height: 22px; margin-left: 9px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--panel-2); color: var(--accent-2);
  font: italic 800 13px/1 Georgia, "Times New Roman", serif; cursor: help; -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.min-info:hover, .min-info:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.min-sub { color: var(--muted); text-align: center; font-size: 14px; line-height: 1.6; margin: 0 0 14px; }
.min-sub #min-left { display: inline-block; color: var(--gold); font-weight: 700; }
.min-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.min-row {
  display: grid; grid-template-columns: 44px 1fr 30px 130px 30px 34px 56px; align-items: center; gap: 9px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px;
}
/* ± minute steppers (easier than the slider, esp. on mobile) */
.mr-btn {
  width: 30px; height: 30px; padding: 0; flex: 0 0 auto; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); border-radius: 8px; font-size: 19px; font-weight: 800;
  line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; user-select: none; transition: border-color 0.12s ease, transform 0.06s ease;
}
.mr-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.mr-btn:active:not(:disabled) { transform: scale(0.92); }
.mr-btn:disabled { opacity: 0.28; cursor: default; }
.min-row.over { border-color: #6b3a2a; background: rgba(247,83,31,0.06); }
.mr-slot { color: var(--accent); font-weight: 800; font-size: 12px; }
.mr-name { font-size: 14px; }
.mr-name small { display: block; color: var(--muted); font-size: 12px; }
/* Custom slider so the minutes PAST a player's MPG can be painted red (--mr-fill set inline per row) */
.mr-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; cursor: pointer; margin: 0; --mr-fill: var(--line); }
.mr-slider:focus { outline: none; }
.mr-slider::-webkit-slider-runnable-track { height: 8px; border-radius: 6px; background: var(--mr-fill); }
.mr-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; margin-top: -5px; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.mr-slider::-moz-range-track { height: 8px; border-radius: 6px; background: var(--mr-fill); }
.mr-slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
/* Red "value flag" floating over the red zone — makes it crystal clear those minutes count at X% */
.mr-track { position: relative; display: flex; align-items: center; min-width: 0; }
.mr-track .mr-slider { width: 100%; }
.mr-flag {
  position: absolute; bottom: calc(100% + 4px); transform: translateX(-50%); z-index: 2;
  background: var(--bad); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.2px;
  padding: 1.5px 6px; border-radius: 6px; white-space: nowrap; pointer-events: none;
  box-shadow: 0 2px 7px rgba(0,0,0,0.45); opacity: 0; transition: opacity 0.1s ease;
}
.mr-flag::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 4px solid transparent; border-top-color: var(--bad); }
.mr-flag.show { opacity: 1; }
.mr-min { font-weight: 800; font-size: 16px; text-align: center; font-variant-numeric: tabular-nums; }
.mr-fat { font-size: 11px; font-weight: 800; text-align: right; }
.mr-fat.ok { color: var(--good); }
.mr-fat.warn { color: var(--bad); }
.mr-fat.dnp { color: #586181; }
.min-card .big-btn { display: block; margin: 0 auto; }

/* ---------- Battle screen ---------- */
.tr-min.dnp { color: #586181; }
/* One uniform column width for every section of the battle screen (scoreboard,
   live reveal, box score, head-to-head, rosters, series log) so the desktop
   layout reads as a single clean stack rather than three different widths. */
.battle-body { max-width: 700px; margin: 0 auto; padding: 22px; }
.done-btns { display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; }

.scoreboard {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 26px; margin-bottom: 18px;
}
.sb-side { display: flex; align-items: center; justify-content: center; gap: 18px; }
.sb-side:last-child { flex-direction: row-reverse; }
.sb-name { font-size: 20px; font-weight: 800; }
.sb-name.you { color: var(--accent-2); }
.sb-wins { font-size: 44px; font-weight: 900; min-width: 44px; text-align: center; }
.sb-mid { text-align: center; }
.sb-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
.sb-dash { font-size: 28px; color: var(--muted); }

.matchup { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.team-col { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.team-name { margin: 0 0 12px; font-size: 18px; }
.team-name.you { color: var(--accent-2); }
.team-roster { display: flex; flex-direction: column; gap: 4px; }
.tr-row { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.tr-slot { color: var(--accent); font-weight: 800; font-size: 11px; }
.tr-name small { color: var(--muted); margin-left: 6px; }
.tr-min { color: var(--muted); font-size: 12px; }

/* ============================================================================
   Team-ratings panel — "Matchup" (per-group OFF/DEF) + "Team Construction"
   (spacing / rebounding / ball security / FT rate). Shared by the live draft
   sidebar, the draft-complete card, the daily scouting screen (single-team),
   and the battle screen (head-to-head "tale of the tape").
   ============================================================================ */
.rp { --rp-cell: 34px; }
#draft-ratings { margin-bottom: 14px; }

/* Section divider label */
.rp-sec {
  display: flex; align-items: center; gap: 10px;
  font-size: 10px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--accent-2); margin: 13px 0 8px;
}
.rp-sec::before, .rp-sec::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.rp-single > .rp-grp:first-child > .rp-sec { margin-top: 2px; }

/* Color-graded value cell (red=weak .. green=strong); gold ring = beats the opponent */
.rp-cell {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--rp-cell); height: 26px; border-radius: 7px;
  font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.rp-empty { background: var(--panel-2); color: var(--muted); box-shadow: none; }
/* Win highlight intensity scales with --rpw (0..1, set inline from the gap size): a small edge glows
   faintly, a blowout rings bright with a big halo. Same gold hue throughout — only alpha + glow grow. */
.rp-win {
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 206, 77, calc(0.42 + 0.55 * var(--rpw, 1))),
    0 0 calc(2px + 16px * var(--rpw, 1)) rgba(255, 206, 77, calc(0.05 + 0.35 * var(--rpw, 1)));
  font-weight: 900;
}

/* Team-OVR header (single-team panels) */
.rp-ovr1 { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.rp-ovr-val { font-size: 26px; font-weight: 900; color: var(--gold); line-height: 1; }
.rp-ovr1 label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }

/* ----- Single-team layout: label · OFF · DEF (one centred value for factors) ----- */
.rp-srow { display: grid; grid-template-columns: 1fr var(--rp-cell) var(--rp-cell); align-items: center; gap: 6px; margin-bottom: 5px; }
.rp-srow1 { grid-template-columns: 1fr calc(var(--rp-cell) * 2 + 6px); }
.rp-shead { margin-bottom: 4px; }
.rp-shead span { font-size: 9px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); text-align: center; }
.rp-shead1 { display: none; }   /* Construction "Rating" subhead — only shown in the side-by-side tiles */
.rp-lab { font-weight: 700; color: var(--text); font-size: 12.5px; }
.rp-1cell { display: flex; justify-content: center; }

/* ----- Head-to-head "tale of the tape" (your numbers vs theirs, mirrored) ----- */
.h2h-wrap { margin: 0 0 18px; }
.rp-h2h { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 15px 18px 16px; box-shadow: 0 14px 36px rgba(0,0,0,0.32); }
.rp-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding-bottom: 13px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.rp-team { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rp-team.you { align-items: flex-end; text-align: right; }
.rp-team.opp { align-items: flex-start; text-align: left; }
.rp-team .rp-ovr-val { font-size: 32px; }
.rp-team.you .rp-ovr-val { color: var(--accent-2); }
.rp-team.opp .rp-ovr-val { color: var(--text); }
.rp-ovr-val.rp-lead { text-shadow: 0 0 16px currentColor; }   /* leader glows in its own team colour */
.rp-tline { display: flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }
.rp-team.you .rp-tline { justify-content: flex-end; }
.rp-team.opp .rp-tline { justify-content: flex-start; }
.rp-tname { font-size: 13px; font-weight: 700; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-tline .rtg-chip { flex: 0 0 auto; }
.rp-vs { text-align: center; flex: 0 0 auto; }
.rp-vs b { display: block; font-size: 13px; font-weight: 900; letter-spacing: 1.5px; color: var(--muted); }
.rp-vs label { font-size: 9px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }

.rp-row { display: grid; grid-template-columns: 1fr 104px 1fr; align-items: center; margin-bottom: 6px; }
.rp-you { display: flex; gap: 5px; justify-self: end; }
.rp-opp { display: flex; gap: 5px; justify-self: start; }
/* Matchup: render the OFF+DEF pair as one connected pill (no inner gap) so the win highlight wraps a
   single solid unit instead of outlining two cells with an awkward gap between them. */
.rp-row .rp-pair { gap: 0; }
.rp-pair .rp-cell { border-radius: 0; box-shadow: none; }
.rp-pair .rp-cell:first-child { border-radius: 8px 0 0 8px; }
.rp-pair .rp-cell:last-child { border-radius: 0 8px 8px 0; }
.rp-pair .rp-cell + .rp-cell { box-shadow: inset 1.5px 0 0 rgba(11, 14, 23, 0.55); }   /* hairline divider */

/* Winning side: ring + glow on the whole pill, intensity (--rpw) scaling with the combined-rating gap. */
.rp-sidewin {
  border-radius: 8px;
  box-shadow:
    0 0 0 1.6px rgba(255, 206, 77, calc(0.45 + 0.55 * var(--rpw, 1))),
    0 0 calc(3px + 15px * var(--rpw, 1)) rgba(255, 206, 77, calc(0.07 + 0.33 * var(--rpw, 1)));
}
.rp-mid { text-align: center; font-size: 12px; font-weight: 700; color: var(--text); padding: 0 6px; }
.rp-colh { margin-bottom: 4px; }
.rp-colh i { display: inline-flex; justify-content: center; width: var(--rp-cell); font-style: normal; font-size: 9px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }

.battle-controls { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 16px 0; }
.battle-controls .min-info { margin-left: 0; }                              /* flex gap handles spacing */
.battle-controls:has(#play-game.hidden) .min-info { display: none; }        /* badge follows the button's visibility */

.game-log { margin: 0; }
.log-title { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin: 6px 0 10px; }
.log-row {
  display: grid; grid-template-columns: 70px 90px 60px 1fr; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px; margin-bottom: 7px; font-size: 14px;
  background: var(--panel); border: 1px solid var(--line); border-left-width: 4px;
}
.log-row.win { border-left-color: var(--good); }
.log-row.loss { border-left-color: var(--bad); }
.lg-game { color: var(--muted); font-size: 12px; }
.lg-score b { font-size: 16px; }
.lg-res { font-weight: 800; font-size: 12px; }
.log-row.win .lg-res { color: var(--good); }
.log-row.loss .lg-res { color: var(--bad); }
.lg-top { color: var(--muted); font-size: 12px; text-align: right; }

/* per-game box scores */
.game-box { margin: 16px 0; }   /* top matches team-life's bottom so the Start button sits with equal gap above/below (incl. when the box is empty) */
/* Last Game / Series segmented toggle above the box score */
.box-toggle { display: flex; width: fit-content; margin: 0 auto 14px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.box-toggle button { border: none; background: none; color: var(--muted); font-weight: 700;
  font-size: 13px; padding: 6px 18px; border-radius: 999px; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease; }
.box-toggle button.active { background: var(--accent); color: #fff; }
.box-toggle button:not(.active):hover { color: var(--text); }
.gb-title { font-size: 15px; text-align: center; color: var(--text); margin: 0 0 12px; }
.gb-tables { display: grid; grid-template-columns: 1fr; gap: 14px; }
.gb-team { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.gb-team.won { border-color: var(--good); }
.gb-team-name { font-weight: 800; margin-bottom: 8px; font-size: 15px; }
.gb-team.won .gb-team-name { color: var(--good); }
table.bx { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
table.bx th, table.bx td { padding: 4px 5px; border-bottom: 1px solid var(--line); text-align: right; }
table.bx th { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.3px; }
table.bx th:first-child, table.bx td.bx-name { text-align: left; }
table.bx td.bx-name { font-size: 12px; }
table.bx td.bx-name small { color: var(--muted); margin-left: 5px; font-size: 10px; }
table.bx td.bx-pts { font-weight: 800; color: var(--gold); }
table.bx tr.dnp td { color: #586181; font-style: italic; }
table.bx tr.bx-tot td { font-weight: 800; border-top: 2px solid var(--line); border-bottom: none; color: var(--text); }

/* ---------- Live game reveal ---------- */
.team-life { text-align: center; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: 1.5px; margin: -8px 0 16px; }
.live {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 16px; padding: 26px 20px; text-align: center;
  margin: 6px 0 22px; transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.live.win { border-color: var(--good); box-shadow: 0 0 44px rgba(52,211,153,0.22); }
.live.loss { border-color: var(--bad); box-shadow: 0 0 44px rgba(243,87,107,0.18); }
.live.clutch { border-color: var(--gold); box-shadow: 0 0 50px rgba(255,206,77,0.22); }
.live-q { font-size: 13px; font-weight: 900; letter-spacing: 3px; color: var(--gold);
  text-transform: uppercase; min-height: 16px; }
.live-q.flash { animation: qflash 0.4s ease; }
.live-score { display: flex; align-items: center; justify-content: center; gap: clamp(10px, 4vw, 28px); margin: 14px 0 4px; }
.ls-team { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 96px; }
.ls-ball { position: absolute; top: -19px; left: 50%; font-size: 17px; line-height: 1; pointer-events: none;
  opacity: 0; transform: translateX(-50%) scale(0.6); transition: opacity 0.18s ease, transform 0.18s ease;
  filter: drop-shadow(0 1px 4px rgba(255,176,32,0.55)); }
.ls-ball.has { opacity: 1; transform: translateX(-50%) scale(1); animation: ballBounce 0.5s ease; }
@keyframes ballBounce {
  0% { transform: translateX(-50%) translateY(-5px) scale(0.7); }
  60% { transform: translateX(-50%) translateY(2px) scale(1.12); }
  100% { transform: translateX(-50%) translateY(0) scale(1); }
}
.ls-pts { font-size: clamp(48px, 12vw, 72px); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums;
  transition: color 0.2s ease; }
.ls-team.you .ls-pts { color: var(--accent-2); }
.live.win .ls-team.you .ls-pts { color: var(--good); }
.live.loss .ls-team:not(.you) .ls-pts { color: var(--bad); }
.ls-name { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px;
  max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Centered scoreboard clock between the two scores */
.ls-mid { display: flex; align-items: center; justify-content: center; min-width: 64px; }
.live-clock { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 24px; line-height: 1;
  color: var(--muted); letter-spacing: 1px; }
.live.clutch .live-clock { color: var(--gold); animation: clockPulse 1s ease-in-out infinite; }
.live-qs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; min-height: 24px; }
.q-chip { font-size: 12px; color: var(--muted); background: var(--panel);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; opacity: 0; font-variant-numeric: tabular-nums; }
.q-chip.in { animation: chipIn 0.3s ease forwards; }
.reveal-rows tbody tr { opacity: 0; animation: rowIn 0.35s ease forwards; }
.sb-wins.bump { animation: pop 0.4s ease; }

/* Sim-speed toggle (Fast / Medium / Slow) */
.sim-speed { display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 8px; margin: 2px 0 14px; }
.sim-speed.busy { opacity: 0.55; }
.ss-label { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); margin-right: 2px; }
.ss-btn { background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease; }
.ss-btn:hover:not(:disabled) { border-color: var(--accent-2); color: var(--text); }
.ss-btn.active { border-color: var(--accent-2); color: var(--text); background: rgba(29,143,255,0.12); }
.ss-btn:disabled { cursor: default; }

/* Clutch possession-by-possession cards (your plays under your score, theirs under theirs) */
.ls-pts.pop { animation: scorePop 0.45s cubic-bezier(.2,1.6,.4,1); }
.live-poss-row { position: relative; display: flex; gap: clamp(10px, 4vw, 28px); margin: 12px 0 2px; min-height: 52px; }
/* collapse when nothing's showing — but keep height while a hype banner is animating */
.live-poss-row:not(:has(.poss-row)):not(:has(.live-flash.show)) { min-height: 0; margin: 6px 0 0; }
.ls-poss { flex: 1 1 0; min-width: 0; display: flex; }
#poss-a { justify-content: flex-start; }
#poss-b { justify-content: flex-end; }
.poss-row { display: inline-flex; align-items: center; gap: 9px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  max-width: 100%; opacity: 0; }
#poss-b .poss-row { flex-direction: row-reverse; }
.poss-row.in { animation: possIn 0.3s cubic-bezier(.2,1.4,.4,1) forwards; }
.poss-row .poss-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; text-align: left; }
#poss-b .poss-row .poss-txt { text-align: right; }
.poss-row .poss-txt b { font-weight: 800; font-size: 13.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
.poss-row .poss-txt small { font-size: 11px; color: var(--muted); }
.poss-badge { font-weight: 900; font-size: 15px; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.poss-row.made .poss-badge { color: var(--good); }
.poss-row.made.opp .poss-badge { color: var(--accent); }
.poss-row.k-3pt.made { border-color: var(--gold); }
.poss-row.k-3pt.made .poss-badge { color: var(--gold); }
.poss-row.made.mine { border-color: var(--good); }
.poss-row.made.opp { border-color: var(--accent); }
.poss-row.and1 { border-color: var(--gold); box-shadow: 0 0 14px rgba(255,206,77,0.25); }
.poss-row.and1 .poss-txt small { color: var(--gold); font-weight: 700; }
.poss-row.foul { border-style: dashed; border-color: var(--muted); }
.poss-row.foul .poss-txt small { font-style: italic; }
.poss-row.foul .poss-badge { color: var(--accent-2); font-size: 11px; font-weight: 800; }
/* possession-flow cards: offensive rebound, turnover, steal */
.poss-row.reb { border-color: var(--accent-2); }
.poss-row.reb .poss-badge { color: var(--accent-2); font-size: 11px; font-weight: 800; }
.poss-row.tov { border-style: dashed; border-color: var(--bad); opacity: 0.92; }
.poss-row.tov .poss-txt small { color: var(--muted); }
.poss-row.tov .poss-badge { color: var(--bad); font-size: 11px; font-weight: 800; }
.poss-row.stl { border-color: var(--good); }
.poss-row.stl .poss-badge { color: var(--good); font-size: 11px; font-weight: 800; }
.poss-row.miss { opacity: 0.85; }
.poss-row.miss .poss-badge { color: var(--muted); }

/* Hype banner — centered in the empty space between the two team possession cards */
.live-flash { position: absolute; inset: 0; z-index: 3; pointer-events: none;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-weight: 900; letter-spacing: 2px; text-transform: uppercase;
  font-size: clamp(20px, 6vw, 34px); color: var(--gold); opacity: 0;
  text-shadow: 0 1px 2px rgba(6,9,16,0.95), 0 2px 18px rgba(6,9,16,0.85); }
.live-flash.show { animation: hypeFlash 1.15s ease forwards; }
.live-flash.tie { color: var(--accent-2); }
.live-flash.lead { color: var(--good); }
.live-flash.lead-opp { color: var(--bad); }
.live-flash.three { color: var(--gold); }
.live-flash.win { color: var(--good); }
@keyframes scorePop { 0% { transform: scale(1); } 35% { transform: scale(1.42); } 100% { transform: scale(1); } }
@keyframes possIn { from { opacity: 0; transform: translateY(10px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes clockPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.12); opacity: 0.85; } }
@keyframes hypeFlash {
  0% { opacity: 0; transform: scale(0.6); }
  18% { opacity: 1; transform: scale(1.12); }
  32% { transform: scale(1); }
  72% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.05); }
}

/* Slow-mode quarter break: show the running box INLINE (#live-break) and compress the rest of the view
   (qbreak-on) so both teams' box scores fit on screen without scrolling. */
.live-break { margin-top: 6px; }
.big-btn.qb-continue-btn { background: linear-gradient(180deg, #f3c75a, #e0a72b); color: #20160a;
  box-shadow: 0 10px 30px rgba(224, 167, 43, 0.34); }
#screen-battle.qbreak-on #team-life,
#screen-battle.qbreak-on #sim-speed,
#screen-battle.qbreak-on .live-poss-row,
#screen-battle.qbreak-on #live-qs { display: none; }   /* drop possession cards + quarter chips, keep the score */
#screen-battle.qbreak-on #live { margin: 0; padding: 4px 0 0; background: none; border: none; box-shadow: none; }
/* keep the live game score on screen, just compact */
#screen-battle.qbreak-on .live-q { font-size: 11px; min-height: 0; }
#screen-battle.qbreak-on .live-score { margin: 4px 0 10px; }
#screen-battle.qbreak-on .ls-pts { font-size: clamp(30px, 9vw, 42px); }
#screen-battle.qbreak-on .ls-name { font-size: 10px; }
#screen-battle.qbreak-on .ls-ball { display: none; }
#screen-battle.qbreak-on .live-clock { font-size: 16px; }
#screen-battle.qbreak-on .gb-title { font-size: 14px; margin: 0 0 8px; }
/* trim the top series scoreboard a touch so everything clears the fold */
#screen-battle.qbreak-on .scoreboard { padding: 8px 12px; margin-bottom: 6px; }
#screen-battle.qbreak-on .sb-wins { font-size: 28px; min-width: 28px; }
#screen-battle.qbreak-on .sb-name { font-size: 14px; }
/* tighten the break box so two 8-man teams fit in a phone viewport */
#screen-battle.qbreak-on #live-break .bx { font-size: 12px; }
#screen-battle.qbreak-on #live-break .bx th,
#screen-battle.qbreak-on #live-break .bx td { padding: 3px 6px; }
#screen-battle.qbreak-on #live-break .gb-team-name { font-size: 13px; margin-bottom: 4px; }
#screen-battle.qbreak-on #live-break .gb-tables { gap: 12px; }
.sr-cap { color: var(--muted); font-size: 13px; margin: 4px 0 16px; }
.sr-cap.done { color: var(--gold); font-weight: 700; }
/* Daily-challenge tracker lines */
.sr-rank { font-size: 16px; font-weight: 800; color: var(--gold); margin: 8px 0 2px; }
.sr-rank small { font-weight: 600; color: var(--muted); }
.sr-stats { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.sr-stats b { color: var(--text); }
.cl-stats { font-size: 13px; color: var(--muted); margin: 0 0 14px; min-height: 1em; }
.cl-stats b { color: var(--gold); }
@keyframes qflash { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }
@keyframes chipIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.55); } 100% { transform: scale(1); } }

.series-result {
  text-align: center; border-radius: 16px; padding: 22px; margin-bottom: 18px;
  border: 1px solid var(--line);
}
.series-result.win { background: linear-gradient(180deg, rgba(52,211,153,0.16), transparent); border-color: var(--good); }
.series-result.loss { background: linear-gradient(180deg, rgba(243,87,107,0.14), transparent); border-color: var(--bad); }
.series-result h2 { margin: 0 0 6px; font-size: 28px; }
.sr-score { font-size: 40px; font-weight: 900; margin-bottom: 16px; }
.sr-btns { display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; }
.sr-mvp {
  max-width: 560px; margin: 0 auto 18px; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--gold); border-radius: 12px;
}
.mvp-tag { color: var(--gold); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 6px; }
.mvp-name { font-size: 20px; font-weight: 900; }
.mvp-name small { display: block; color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 2px; }
.mvp-line { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 10px; }
.mvp-line span { font-size: 13px; color: var(--muted); }
.mvp-line b { color: var(--text); font-size: 16px; font-weight: 800; margin-right: 3px; }

@media (max-width: 720px) {
  .matchup { grid-template-columns: 1fr; }
}

/* ---------- Placement modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(6, 9, 16, 0.72); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
}
.modal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px 26px; width: 100%; max-width: 460px; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}
.modal-card.wide { max-width: 580px; }
.modal-card h3 { margin: 0 0 4px; font-size: 22px; }
.modal-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.modal-slots { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 16px; }
.slot-btn {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; min-width: 120px;
  color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 3px; align-items: center;
  transition: transform 0.08s ease, border-color 0.15s ease;
}
.slot-btn b { font-size: 16px; }
.slot-btn small { font-size: 11px; color: var(--muted); }
.slot-btn:hover:not(.disabled) { transform: translateY(-2px); border-color: var(--accent); }
.slot-btn .kind { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent-2); }
.slot-btn.disabled { opacity: 0.4; cursor: not-allowed; }
.slot-btn.disabled small { color: var(--bad); }
.text-btn {
  background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px;
  text-decoration: underline; padding: 6px;
}
.text-btn:hover { color: var(--text); }

/* share-result card modal */
.share-card { max-width: 440px; }
.share-preview { margin: 6px 0 16px; display: flex; justify-content: center; }
#share-canvas {
  display: block; width: auto; height: auto; max-width: 100%; max-height: 56vh;
  border-radius: 14px; border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); background: var(--bg);
}
.share-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.share-actions .big-btn { width: 100%; margin: 0; }
.share-actions .text-btn { text-decoration: none; }
.share-close { display: block; margin: 12px auto 0; }
/* the "Share Result" button on the series-result screen */
.share-btn {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; border: 1px solid var(--accent); border-radius: 10px;
  color: var(--accent); padding: 10px 16px; font-weight: 700; font-size: 14px;
  transition: background 0.15s ease;
}
.share-btn svg { display: block; flex: 0 0 auto; }
.share-btn:hover { background: rgba(247, 83, 31, 0.12); color: var(--accent); }

@media (max-width: 820px) {
  .draft-body { grid-template-columns: 1fr; }
}

/* ---------- Player headshots ---------- */
.headshot {
  --hs-size: 36px;
  width: var(--hs-size); height: var(--hs-size); flex: 0 0 auto;
  border-radius: 50%; object-fit: cover; object-position: center 12%;
  background: #141b29; border: 1px solid var(--line);
  display: inline-block; vertical-align: middle;
}
.headshot.hs-lg { --hs-size: 52px; }
.headshot.hs-xs { --hs-size: 26px; }
/* fallback badge (span swapped in when a photo 404s) */
.hs-badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; letter-spacing: .02em; font-size: calc(var(--hs-size) * 0.36);
  color: hsl(var(--hs-hue, 210) 70% 85%);
  background: hsl(var(--hs-hue, 210) 42% 30%);
  border-color: hsl(var(--hs-hue, 210) 40% 42%);
}

/* offer card: headshot + name/meta header row (pos badge stays absolute top-right) */
.pc-top { display: flex; align-items: center; gap: 12px; margin-right: 32px; }
.pc-id { min-width: 0; }
.pc-id .pc-name { margin: 0 0 2px; }

/* roster slot: photo left of the stacked name/meta */
.slot-player { flex-direction: row; align-items: center; gap: 9px; }
.sp-id { display: flex; flex-direction: column; min-width: 0; }

/* minutes row + battle team column: photo left of name */
.mr-name { display: flex; align-items: center; gap: 9px; }
.mrn-txt { min-width: 0; }
.tr-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.trn-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* team-detail modal table: small photo in the Player cell */
.td-player { display: flex; align-items: center; gap: 8px; }
.td-player small { display: block; color: var(--muted); }

/* series MVP: photo beside the name */
.mvp-head { display: flex; align-items: center; justify-content: center; gap: 14px; }
.mvp-head .mvp-name { text-align: left; }

/* ============================================================================
   MOBILE UI OVERHAUL  ·  additive, scoped, desktop untouched
   ----------------------------------------------------------------------------
   Everything below lives inside media queries so the desktop layout (all rules
   above) is byte-for-byte unchanged. No HTML/JS markup or features are altered.
     · @media (hover: none)   — touch-device feel: kill sticky :hover, add press
     · @media (max-width:768px) — phones + portrait tablets: spacing/sizing/flow
     · @media (max-width:380px) — small-phone fine-tuning
   ============================================================================ */

@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---- Touch devices: sticky :hover looks broken, so neutralize the lift/glow
        and give a quick scale press instead, so taps feel native. ------------ */
@media (hover: none) {
  .mode-card:hover        { transform: none; border-color: var(--line); box-shadow: none; }
  .mode-card.rated:hover  { border-color: var(--line); box-shadow: none; }
  .player-card:hover      { transform: none; border-color: var(--line); box-shadow: none; }
  .slot-btn:hover:not(.disabled) { transform: none; border-color: var(--line); }
  .gbtn:hover             { transform: none; box-shadow: none; }
  .big-btn:hover          { transform: none; filter: none; }

  .mode-card:active, .player-card:active, .slot-btn:active:not(.disabled),
  .gbtn:active, .big-btn:active:not(:disabled), .lb-tab:active, .text-btn:active {
    transform: scale(0.97);
    transition: transform 0.05s ease;
  }
}

/* ---- Phones + portrait tablets --------------------------------------------- */
@media (max-width: 768px) {
  html { -webkit-text-size-adjust: 100%; }   /* stop iOS bumping font sizes on rotate */
  .screen { min-height: 100dvh; }            /* dynamic vh: no content hidden under mobile toolbars */

  /* primary CTAs go full-width & a touch smaller for thumb reach */
  .big-btn, .auth-google { font-size: 17px; padding: 15px 22px; border-radius: 11px; }
  #draft-next, #play-game, #min-start { width: 100%; }
  .done-btns, .sr-btns { flex-direction: column; gap: 10px; }
  .done-btns .big-btn, .sr-btns .big-btn { width: 100%; }
  .text-btn { padding: 10px 8px; font-size: 13px; }

  /* ----- Menu ----- */
  #screen-menu { padding: 28px 16px; }
  .logo { letter-spacing: 1px; }
  .tagline { font-size: 14.5px; line-height: 1.55; margin: 14px 0 24px; }
  .account-bar { margin-bottom: 18px; }
  .acc-in { flex-wrap: wrap; justify-content: center; max-width: 100%; border-radius: 14px; }
  .acc-meta { min-width: 0; }
  .acc-meta small { font-size: 11px; }
  .mode-select { grid-template-columns: 1fr; gap: 12px; }
  .mode-card { padding: 16px; border-radius: 14px; }
  .mc-title { font-size: 19px; }
  .mc-desc { font-size: 12.5px; }
  /* Lift the footer (Support button) up so it clears the bottom radial glow's fade line above:
     tighter top margin + a little padding below (the card is vertically centered, so padding below
     nudges the whole footer up). */
  .menu-footer { margin-top: 20px; padding-bottom: 16px; }

  /* ----- Top bar (draft + battle) ----- */
  .topbar { padding: 10px 14px; flex-wrap: wrap; gap: 8px 10px; }
  .brand { font-size: 14px; letter-spacing: 0.3px; }
  .meters { gap: 8px; }
  .meter { padding: 5px 8px; min-width: 60px; border-radius: 9px; }
  .meter-label { font-size: 9px; letter-spacing: 0.5px; }
  .meter-val { font-size: 16px; }
  .mode-badge { font-size: 10px; letter-spacing: 0.5px; }

  /* ----- Draft ----- */
  /* Flat single-colour background on the draft screen (mobile): the body's radial gradient
     (#1a2138 glow → --bg) leaves a visible gray-blue band partway down the tall draft page. */
  #screen-draft { background: var(--bg); }
  .draft-body { padding: 14px 12px 32px; gap: 16px; }
  .left { min-height: 0; }
  .budget-bar { gap: 10px; margin-bottom: 14px; }
  .bb-item { padding: 9px 8px; border-radius: 12px; }
  .bb-label { font-size: 9.5px; letter-spacing: 0.5px; margin-bottom: 2px; }
  .bb-val { font-size: 23px; }
  .hint { font-size: 13px; margin: 10px 2px; }
  /* Offered draft picks: 3-up grid on mobile so all 9 show at once (3x3). ONLY the offer grid
     (#offer) changes here — the picked-team list (#roster) stays the normal stacked rows. */
  .offer-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .player-card { padding: 12px 7px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
  .player-card .pc-top { flex-direction: column; align-items: center; gap: 8px; margin-right: 0; }
  .player-card .pc-id { width: 100%; min-width: 0; text-align: center; }
  .player-card .headshot.hs-lg { --hs-size: 44px; }
  .pc-name { font-size: 13px; line-height: 1.2; }
  .pc-meta { font-size: 10px; }
  .pc-pos { top: 8px; right: 8px; font-size: 9px; padding: 1px 5px; }
  .pc-price { font-size: 16px; margin-top: auto; padding-top: 10px; }  /* pin price -> aligns across the row */

  .right h2 { font-size: 16px; margin-bottom: 10px; }
  .roster-group-title { margin: 12px 4px 6px; }
  .slot { grid-template-columns: 46px 1fr auto; gap: 8px; padding: 8px 10px; min-height: 44px; }
  .slot-player b { font-size: 14px; }
  .slot-player small { font-size: 11px; }
  .slot-price { font-size: 14px; }

  /* ----- Draft ratings: Matchup + Team Construction side by side (mirrors the daily-challenge
     tiles). Team OVR header spans the full width above two equal tiles. Pure CSS — to revert,
     drop this block. ----- */
  #draft-ratings .rp-single { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
  #draft-ratings .rp-single > .rp-ovr1 { grid-column: 1 / -1; }   /* Team OVR header full width */
  #draft-ratings .rp-single > .rp-grp {
    min-width: 0;
    display: flex; flex-direction: column;   /* title pinned at top; rows centered in the space below (see auto margins) */
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 11px 11px;
  }
  #draft-ratings .rp-grp > .rp-shead { margin-top: auto; }
  #draft-ratings .rp-grp > .rp-srow:last-child { margin-bottom: auto; }
  #draft-ratings .rp { --rp-cell: 30px; }
  #draft-ratings .rp-lab { font-size: 12px; line-height: 1.2; white-space: nowrap; }   /* never wrap → rows stay aligned */
  /* Tile title: centered, no side rules; matched margins so both titles align */
  #draft-ratings .rp-grp > .rp-sec { justify-content: center; margin: 0 0 8px; letter-spacing: 0.4px; }
  #draft-ratings .rp-grp > .rp-sec::before, #draft-ratings .rp-grp > .rp-sec::after { display: none; }
  /* Construction: one right-aligned value column mirroring Matchup's DEF column, with its
     "Rating" subhead revealed so every value row lines up across both tiles. */
  #draft-ratings .rp-srow1 { grid-template-columns: 1fr var(--rp-cell); }
  #draft-ratings .rp-1cell { justify-content: flex-end; }
  #draft-ratings .rp-shead1 { display: grid; }
  #draft-ratings .rp-shead1 span:last-child { text-align: right; }

  /* ----- Draft complete page: same side-by-side ratings tiles as the draft view ----- */
  .done-rp { max-width: 100%; margin-left: 0; margin-right: 0; }   /* override 340px cap → tiles span full width */
  .done-rp .rp-single { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
  .done-rp .rp-single > .rp-ovr1 { grid-column: 1 / -1; }   /* Team OVR header full width */
  .done-rp .rp-single > .rp-grp {
    min-width: 0;
    display: flex; flex-direction: column;   /* title pinned at top; rows centered below */
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 11px 11px;
  }
  .done-rp .rp-grp > .rp-shead { margin-top: auto; }
  .done-rp .rp-grp > .rp-srow:last-child { margin-bottom: auto; }
  .done-rp .rp { --rp-cell: 30px; }
  .done-rp .rp-lab { font-size: 12px; line-height: 1.2; white-space: nowrap; }
  .done-rp .rp-grp > .rp-sec { justify-content: center; margin: 0 0 8px; letter-spacing: 0.4px; }
  .done-rp .rp-grp > .rp-sec::before, .done-rp .rp-grp > .rp-sec::after { display: none; }
  .done-rp .rp-srow1 { grid-template-columns: 1fr var(--rp-cell); }
  .done-rp .rp-1cell { justify-content: flex-end; }
  .done-rp .rp-shead1 { display: grid; }
  .done-rp .rp-shead1 span:last-child { text-align: right; }

  /* ----- Draft complete: continue button up top, tables below for review -----
     Reorder the card with flexbox `order` (specificity climbs so the rest stay
     in source order) so you can proceed without scrolling past three tables. */
  #screen-done { padding: 22px 12px 36px; }
  .done-card { display: flex; flex-direction: column; }
  .done-card > * { order: 3; }                            /* tables + the rest, in source order */
  .done-card > h1 { order: 0; }
  .done-card > .done-rp { order: 1; }                     /* ratings panel above the CTA on mobile */
  .done-card > .done-sub { order: 1; }
  .done-card > .done-btns { order: 2; margin-bottom: 6px; }
  .done-card h1 { font-size: 26px; margin-bottom: 12px; }
  .done-sub { margin: 2px 0 10px; }
  .tbl-title { font-size: 15px; margin: 18px 0 8px; }
  .banner-label { margin: 14px 0 10px; }
  .team-total { gap: 7px; }
  .pill { min-width: 0; flex: 1 1 calc(33.333% - 7px); padding: 8px 6px; text-align: center; }  /* 3-up stat grid */
  .pill span { font-size: 18px; }
  .pill label { font-size: 10px; }
  .done-note { font-size: 13px; }

  /* ----- Stat tables on mobile -----
     The battle box score (.bx) stays a contained, swipeable table with a frozen
     player column. iOS keeps grid/flex items at content width (min-width:auto),
     so min-width:0 lets the wide table scroll *inside* its wrapper. */
  .gb-tables, .gb-team, .matchup, .team-col, .tbl-wrap { min-width: 0; }
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl-wrap::-webkit-scrollbar { height: 5px; }
  .tbl-wrap::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
  #tm-body .tbl-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
  table.box { font-size: 12px; }
  table.box th, table.box td { padding: 6px 8px; }
  table.bx { font-size: 11px; }
  table.bx th, table.bx td { padding: 5px 6px; }
  table.bx th:first-child, table.bx td:first-child {
    position: sticky; left: 0; z-index: 1; background: var(--panel);
    max-width: 118px; overflow: hidden; text-overflow: ellipsis;
    box-shadow: 6px 0 8px -6px rgba(0,0,0,0.45);
  }

  /* ----- Draft-complete tables -> per-player cards -----
     A 12-column box score can't fit a phone, so a wide table forced the browser to
     shrink the whole page (everything tiny + pinch-zoom). Reflow each row into a
     card: name on top, stats as labeled chips that wrap. The data-label attributes
     come from app.js and are simply ignored by the desktop table. */
  #screen-done { display: block; }                       /* definite width: nothing can blow out the page */
  #screen-done .tbl-wrap { overflow: visible; background: none; border: none; padding: 0; }
  #screen-done table.box, #screen-done table.box > tbody { display: block; }
  #screen-done table.box > thead { display: none; }
  #screen-done table.box > tbody > tr {
    display: block; position: relative; white-space: normal;   /* base table sets nowrap; let chips wrap */
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
    padding: 9px 12px; margin-bottom: 8px;
  }
  #screen-done table.box > tbody > tr.grp {              /* "Starters" / "Bench" divider */
    background: none; border: none; padding: 12px 2px 2px; margin: 0;
  }
  #screen-done table.box > tbody > tr.grp td {
    color: var(--accent-2); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px;
  }
  #screen-done table.box > tbody > tr.total-row { border-color: var(--gold); }
  #screen-done table.box > tbody > tr > td { display: inline-block; border: none; padding: 0; text-align: left; }
  #screen-done table.box td.slot-c {                     /* slot badge, pinned top-right */
    position: absolute; top: 9px; right: 10px;
    font-size: 10px; font-weight: 800; color: var(--accent);
    background: rgba(247,83,31,0.12); border-radius: 6px; padding: 2px 7px;
  }
  #screen-done table.box > tbody > tr > td:nth-child(2) {  /* player name = card title */
    display: block; font-weight: 700; font-size: 14px; margin: 0 60px 7px 0;
  }
  #screen-done table.box td small { color: var(--muted); margin-left: 6px; font-weight: 400; }
  #screen-done table.box td.num {                        /* stat -> labeled chip */
    min-width: 46px; margin: 0 13px 3px 0; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums;
  }
  #screen-done table.box td.num::before {
    content: attr(data-label); display: block;
    font-size: 9px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--muted); margin-bottom: 1px;
  }
  #screen-done table.box > tbody > tr.total-row > td:first-child:empty { display: none; }

  /* ----- Set rotation (minutes) — was overflowing badly; go 2-row per player ----- */
  #screen-minutes { padding: 18px 12px 32px; }
  .min-card h1 { font-size: 24px; }
  .min-sub { font-size: 12.5px; line-height: 1.5; }
  .min-list { gap: 8px; }
  .min-row {
    grid-template-columns: 40px 1fr 40px 46px;
    grid-template-areas:
      "slot  name   name fat"
      "minus slider plus min";
    gap: 18px 8px; padding: 10px 12px 11px; align-items: center;   /* extra row-gap leaves room for the value flag */
  }
  .mr-slot   { grid-area: slot; align-self: end; }
  .mr-name   { grid-area: name; align-self: end; }
  .mr-fat    { grid-area: fat; align-self: end; }
  .mr-minus  { grid-area: minus; }
  .mr-plus   { grid-area: plus; }
  .mr-min    { grid-area: min; }
  .mr-track  { grid-area: slider; }
  .mr-slider { width: 100%; height: 28px; }                       /* full-width, taller tap target */
  .mr-btn { width: 40px; height: 36px; font-size: 23px; }         /* bigger ± tap targets on mobile */

  /* Find Opponent up top so you don't scroll past all 8 rows to continue
     (a default rotation is set on load, so the button is usable immediately). */
  .min-card { display: flex; flex-direction: column; }
  .min-card > * { order: 3; }
  .min-card > h1 { order: 0; }
  .min-card > .min-sub { order: 1; }
  .min-card > #min-start { order: 2; margin-bottom: 12px; }
  .min-card > #min-optimal { order: 2; }   /* god-mode optimal-lineup button rides with the CTA on mobile */

  /* ----- Battle ----- */
  .battle-body { padding: 14px 12px 30px; }
  .scoreboard { padding: 14px 12px; gap: 10px; border-radius: 14px; }
  .sb-side { gap: 10px; }
  .sb-name { font-size: 14px; }
  .sb-wins { font-size: 32px; min-width: 32px; }
  .sb-dash { font-size: 22px; }
  .sb-label { font-size: 10px; }
  .matchup { grid-template-columns: 1fr; gap: 12px; }
  .team-col { padding: 12px; border-radius: 12px; }
  .team-name { font-size: 16px; }

  /* Keep the head-to-head card readable on a phone: tighter cells + centre column */
  .rp { --rp-cell: 31px; }
  .rp-h2h { padding: 13px 12px 14px; border-radius: 14px; }
  .rp-head { gap: 8px; }
  .rp-team .rp-ovr-val { font-size: 27px; }
  .rp-tname { font-size: 12px; }
  .rp-row { grid-template-columns: 1fr 86px 1fr; }
  .rp-mid { font-size: 11px; padding: 0 3px; }
  .rp-you, .rp-opp { gap: 4px; }
  .rp-colh i { width: var(--rp-cell); }
  .battle-controls { margin: 14px 0; }
  .battle-controls #play-game { width: auto; flex: 1 1 auto; }   /* fill the row but leave room for the (i) */
  .live { padding: 20px 14px; border-radius: 14px; }
  .live-clock { font-size: 21px; }
  .ls-mid { min-width: 48px; }
  .live-poss-row { gap: 8px; min-height: 50px; }
  .poss-row { gap: 7px; padding: 5px 7px; }
  .poss-row .poss-txt b { font-size: 12.5px; max-width: 30vw; }
  .poss-row .poss-txt small { font-size: 10px; }
  .poss-badge { font-size: 14px; }
  .live-qs { gap: 6px; }
  .sim-speed { gap: 6px; margin-bottom: 12px; }
  .sim-speed .ss-label { width: 100%; text-align: center; margin: 0 0 2px; }
  .ss-btn { padding: 6px 16px; }
  /* Quarter break on phones: compress hard so both 8-man box scores fit without scrolling */
  #screen-battle.qbreak-on #live-break .bx { font-size: 11px; }
  #screen-battle.qbreak-on #live-break .bx th,
  #screen-battle.qbreak-on #live-break .bx td { padding: 2px 5px; }
  #screen-battle.qbreak-on #live-break .gb-tables { gap: 8px; }
  #screen-battle.qbreak-on .gb-title { font-size: 13px; margin-bottom: 6px; }
  #screen-battle.qbreak-on .battle-controls { margin: 8px 0; }
  .series-result { padding: 18px 14px; border-radius: 14px; }
  .series-result h2 { font-size: 21px; }
  .sr-score { font-size: 30px; margin-bottom: 12px; }
  .sr-mvp { padding: 12px; }
  .mvp-name { font-size: 18px; }
  .sr-rating { gap: 12px; padding: 12px; }
  .rtg-delta { font-size: 26px; }
  /* series log: two-line rows so the top-scorer line never gets crushed */
  .log-row {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "game score res"
      "top  top   top";
    gap: 3px 10px; padding: 9px 12px;
  }
  .lg-game  { grid-area: game; }
  .lg-score { grid-area: score; text-align: center; }
  .lg-res   { grid-area: res; }
  .lg-top   { grid-area: top; text-align: left; }

  /* ----- Leaderboards ----- */
  #screen-leaders { padding: 22px 12px 32px; }
  .lb-card h1 { font-size: 24px; margin-bottom: 14px; }
  .lb-tabs { margin-bottom: 12px; padding: 4px; }
  .lb-tabs.lb-era { margin-bottom: 8px; }
  .lb-tab { padding: 8px 14px; font-size: 13px; }
  .lb-table { font-size: 13px; }
  .lb-table th, .lb-table td { padding: 8px; }
  .lb-table td.lb-rank { width: 28px; }
  .lb-who small { font-size: 11px; }

  /* ----- Modals (placement + team detail) ----- */
  .modal { padding: 14px; }
  .modal-card { padding: 20px 16px; max-height: 88vh; overflow-y: auto;
    -webkit-overflow-scrolling: touch; animation: modalIn 0.2s ease; }
  .modal-card h3 { font-size: 19px; }
  .modal-slots { gap: 10px; }
  .slot-btn { min-width: 0; flex: 1 1 calc(50% - 10px); padding: 13px 12px; }  /* 2-up */
}

/* ---- Small phones ---------------------------------------------------------- */
@media (max-width: 380px) {
  .logo { font-size: 32px; }
  .brand { font-size: 13px; }
  .meter { min-width: 54px; }
  .offer-grid { gap: 6px; }
  .player-card { padding: 10px 4px; }
  .player-card .headshot.hs-lg { --hs-size: 40px; }
  .pc-name { font-size: 12px; }
  .pc-meta { font-size: 9.5px; }
  .pc-price { font-size: 15px; }
  .sb-wins { font-size: 28px; }
}
