:root {
  --bg: #070b16;
  --bg2: #0c1220;
  --panel: #111827;
  --panel2: #171e30;
  --text: #f7f8fc;
  --muted: #99a5bb;
  --line: rgba(255,255,255,.13);
  --line2: rgba(255,255,255,.25);
  --orange: #2f7dff;
  --orange2: #60a5fa;
  --purple: #14b8a6;
  --purple2: #22c55e;
  --green: #22c55e;
  --red: #ff4f5e;
  --shadow: 0 28px 70px rgba(0,0,0,.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root.light {
  --bg: #edf2fa;
  --bg2: #e1e8f3;
  --panel: #ffffff;
  --panel2: #f5f7fb;
  --text: #101827;
  --muted: #657084;
  --line: rgba(16,24,39,.14);
  --line2: rgba(16,24,39,.24);
  --shadow: 0 22px 60px rgba(41,54,87,.16);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}
button, select, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.game-shell { min-height: 100vh; }
.topbar {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 96px;
  border-bottom: 1px solid var(--line);
  background: rgba(8,12,23,.88);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.light .topbar { background: rgba(255,255,255,.84); }
.brand-row, .top-actions { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 32px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff3800, #60a5fa);
  color: #fff;
  display: grid;
  place-items: center;
  line-height: .72;
  box-shadow: inset 0 -4px rgba(0,0,0,.2);
  font-weight: 950;
  font-size: 12px;
  letter-spacing: -.04em;
}
.logo-mark small { display:block; font-size: 8px; letter-spacing: .08em; }
.icon-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255,255,255,.04);
}
.icon-btn:hover { color: var(--text); border-color: var(--line2); }

.spin-screen {
  max-width: 1120px;
  margin: 48px auto 0;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 68px;
  align-items: center;
}
.spin-side { min-height: 360px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.tiles-row { display: flex; align-items: center; gap: 32px; }
.spin-tile {
  width: 160px;
  height: 96px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #202638;
  color: #fff;
  position: relative;
  transition: transform .2s ease, filter .2s ease;
}
.light .spin-tile { background: #152034; }
.spin-tile::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 8px;
  z-index: -1;
}
.team-tile::before { background: linear-gradient(135deg, var(--orange2), var(--orange)); }
.era-tile::before { background: linear-gradient(135deg, #5eead4, var(--purple2)); }
.spin-tile small { color: var(--orange); font-size: 12px; font-weight: 950; letter-spacing: .04em; }
.era-tile small { color: #d277ff; }
.spin-tile span { margin-top: 6px; font-size: 28px; font-weight: 950; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.spin-tile.spinning { transform: translateY(-2px) scale(1.03); filter: brightness(1.18); }
.tile-labels {
  display: grid;
  grid-template-columns: 160px 160px;
  gap: 32px;
  margin: 18px 0 18px;
  color: var(--muted);
  text-align: center;
  width: 352px;
}
.spin-btn {
  border: 0;
  border-radius: 7px;
  background: linear-gradient(180deg, #2f7dff, #e75d00);
  color: #fff;
  font-weight: 950;
  padding: 12px 32px;
  min-width: 104px;
  box-shadow: 0 12px 28px rgba(255,122,0,.22);
}
.spin-btn:hover { filter: brightness(1.08); }
.spin-btn:disabled { opacity: .55; cursor: not-allowed; filter: grayscale(.2); }
.prompt-text { margin: 18px 0 0; color: var(--muted); line-height: 1.55; max-width: 390px; }

.court-wrap { display: flex; justify-content: center; flex-direction: column; align-items: center; }
.court {
  position: relative;
  width: min(42vw, 450px);
  min-width: 360px;
  aspect-ratio: 1 / 1;
  border-left: 2px solid rgba(150,166,196,.45);
  border-right: 2px solid rgba(150,166,196,.45);
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px) 0 0/36px 100%,
    radial-gradient(circle at 50% 18%, rgba(255,255,255,.04), transparent 45%),
    #0e1524;
  box-shadow: var(--shadow);
}
.light .court { background: #dfe6f2; }
.court::before {
  content: "";
  position: absolute;
  left: 5%; right: 5%; top: -35%;
  height: 78%;
  border: 2px solid rgba(150,166,196,.42);
  border-bottom-left-radius: 50%;
  border-bottom-right-radius: 50%;
}
.court-lines { position: absolute; border-color: rgba(150,166,196,.42); pointer-events: none; }
.paint { width: 130px; height: 90px; top: 0; left: calc(50% - 65px); border-left: 2px solid; border-right: 2px solid; border-bottom: 2px solid; }
.rim { width: 80px; height: 80px; top: 62px; left: calc(50% - 40px); border: 2px solid; border-radius: 50%; }
.court-slot {
  position: absolute;
  width: 64px; height: 64px;
  border: 2px dashed rgba(174,185,207,.38);
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: rgba(215,222,238,.7);
  font-weight: 950;
  background: rgba(255,255,255,.035);
  text-align: center;
  padding: 6px;
  transition: .18s ease;
  cursor: default;
}
.light .court-slot { color: rgba(16,24,39,.62); background: rgba(255,255,255,.6); }
.court-slot.filled {
  border-style: solid;
  border-color: rgba(255,122,0,.8);
  color: #fff;
  background: linear-gradient(135deg, rgba(255,122,0,.92), rgba(181,60,255,.72));
  box-shadow: 0 12px 28px rgba(0,0,0,.25);
  font-size: 11px;
  line-height: 1.05;
}
.slot-c { top: 36px; left: 28%; }
.slot-pf { top: 36px; right: 28%; }
.slot-sf { top: 56%; left: 6%; }
.slot-sg { top: 56%; right: 6%; }
.slot-pg { bottom: 22%; left: calc(50% - 32px); }

.pick-screen { border-top: 1px solid var(--line); }
.rolled-strip {
  max-width: 1010px;
  margin: 0 auto;
  min-height: 50px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.rolled-pills { display: flex; align-items: center; gap: 10px; }
.rolled-pill {
  min-width: 48px;
  padding: 8px 13px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-weight: 950;
  letter-spacing: -.02em;
}
.team-pill { background: linear-gradient(135deg, #8d50d5, #642aa0); }
.era-pill { background: linear-gradient(135deg, #e06400, #7a3200); }
.respin-left { color: var(--muted); font-size: 12px; font-weight: 800; }
.respin-actions { display: flex; gap: 16px; align-items: center; }
.respin-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.respin-btn:first-child { color: var(--orange2); }
.respin-btn:last-child { color: var(--purple); }
.respin-btn:disabled { opacity: .35; cursor: not-allowed; }

.pick-layout {
  max-width: 1010px;
  margin: 0 auto;
  padding: 16px 12px 32px;
  display: grid;
  grid-template-columns: 450px 1fr;
  gap: 126px;
  align-items: start;
}
.players-column { min-width: 0; }
.filters-row {
  display: grid;
  grid-template-columns: auto 1fr 80px;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}
.tab-row { display: flex; gap: 6px; }
.tab {
  height: 29px;
  min-width: 29px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}
.tab.active { background: var(--orange); color: #fff; }
#searchInput, #sortSelect {
  width: 100%;
  height: 37px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--panel2);
  outline: none;
}
#searchInput { padding: 0 13px; }
#sortSelect { padding: 0 10px; }
#searchInput:focus, #sortSelect:focus { border-color: var(--line2); }
.available-text { color: #a6b4cf; font-size: 12px; margin: 0 0 12px; }
.player-list {
  height: min(63vh, 520px);
  overflow-y: auto;
  padding-right: 5px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.42) transparent;
}
.player-list::-webkit-scrollbar { width: 10px; }
.player-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.45); border-radius: 999px; }
.player-row {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  border-radius: 7px;
  padding: 10px 11px;
  margin-bottom: 6px;
  color: var(--text);
}
.light .player-row { background: rgba(255,255,255,.74); }
.player-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}
.player-nameblock strong {
  display: block;
  font-size: 14px;
  line-height: 1.05;
  color: #fff;
}
.light .player-nameblock strong { color: var(--text); }
.player-nameblock small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.pos-line { display: block; color: #5eead4; font-size: 11px; font-weight: 950; margin-top: 2px; }
.stats-mini {
  display: grid;
  grid-template-columns: repeat(5, 38px);
  gap: 3px;
  text-align: center;
}
.stats-mini b { display: block; font-size: 13px; line-height: 1; }
.stats-mini small { display: block; margin-top: 3px; font-size: 8px; color: var(--muted); font-weight: 950; }
.place-row {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}
.place-row > div { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.pos-pick-btn {
  border: 1px solid rgba(47,125,255,.45);
  background: rgba(47,125,255,.13);
  color: #93c5fd;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 950;
}
.pos-pick-btn:hover { background: var(--orange); color: #fff; }
.empty-list {
  border: 1px dashed var(--line2);
  border-radius: 12px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}
.pick-court-wrap { justify-content: flex-start; }
.pick-court-wrap .court { width: min(44vw, 448px); min-width: 400px; }

.move-panel {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 24px));
  min-width: 0;
  margin: 0;
  border: 1px solid rgba(96,165,250,.38);
  background: rgba(15,23,42,.96);
  backdrop-filter: blur(14px);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 18px 42px rgba(0,0,0,.38);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 85;
}
.light .move-panel { background: rgba(255,255,255,.92); }
.move-copy strong { display:block; font-size: 13px; }
.move-copy span { display:block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.move-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.move-btn {
  border: 1px solid rgba(20,184,166,.45);
  color: #5eead4;
  background: rgba(20,184,166,.12);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 950;
}
.move-btn:hover { background: var(--purple); color: #031513; }
.move-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.05);
  color: var(--muted);
  font-weight: 950;
}
.move-empty { color: var(--muted); font-size: 11px; }
.court-hint {
  width: min(44vw, 448px);
  min-width: 400px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.result-panel {
  max-width: 1120px;
  margin: 34px auto 0;
  padding: 24px 16px 42px;
}
.eyebrow { color: var(--orange); letter-spacing: .16em; font-size: 12px; font-weight: 950; margin: 0 0 4px; }
h1,h2,p { margin-top: 0; }
.result-hero { text-align: center; max-width: 760px; margin: 0 auto 24px; }
.result-hero h1 { font-size: clamp(64px, 12vw, 132px); line-height: .85; margin: 6px 0 12px; letter-spacing: -.08em; }
.result-hero p { color: var(--muted); line-height: 1.6; }
.result-buttons { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.ghost-btn {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.05);
  color: var(--text);
  font-weight: 950;
  padding: 12px 18px;
}
.result-grid { display: grid; grid-template-columns: .8fr 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.result-card, .lineup-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.035));
  border-radius: 18px;
  color: var(--text);
  box-shadow: 0 14px 36px rgba(0,0,0,.15);
}
.result-card { padding: 18px; }
.result-card small { display:block; color: var(--muted); font-weight: 950; letter-spacing: .12em; margin-bottom: 8px; }
.result-card strong { font-size: 54px; letter-spacing: -.06em; }
.result-card ul { padding-left: 19px; margin: 0; color: var(--muted); line-height: 1.7; }
.meter { height: 10px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 10px; }
.meter span { display:block; height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), var(--green)); }
.final-lineup { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.lineup-card { padding: 14px; }
.lineup-card strong { display:block; margin-bottom: 5px; }
.muted { color: var(--muted); }

.settings-drawer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.46);
  display: none;
  justify-content: flex-end;
  z-index: 60;
}
.settings-drawer.open { display: flex; }
.drawer-card {
  width: min(390px, 92vw);
  min-height: 100%;
  padding: 24px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.drawer-card label { display:block; color: var(--muted); font-weight: 800; margin-bottom: 16px; }
.drawer-card select {
  display:block;
  width: 100%;
  margin-top: 8px;
  color: var(--text);
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.check-row { display:flex !important; gap: 10px; align-items:center; }
.check-row input { width:18px; height:18px; accent-color: var(--orange); }
.drawer-note { color: var(--muted); line-height: 1.6; border-top: 1px solid var(--line); padding-top: 16px; }
code { color: #93c5fd; }

@media (max-width: 980px) {
  .topbar { padding: 0 16px; }
  .spin-screen { grid-template-columns: 1fr; gap: 28px; margin-top: 28px; }
  .spin-side { align-items: center; min-height: auto; }
  .prompt-text { text-align: center; }
  .court { width: min(92vw, 445px); min-width: 0; }
  .rolled-strip { max-width: 92vw; }
  .pick-layout { grid-template-columns: 1fr; gap: 26px; max-width: 92vw; }
  .pick-court-wrap { justify-content: center; }
  .pick-court-wrap .court, .court-hint { width: min(92vw, 445px); min-width: 0; }
  .result-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .tiles-row { gap: 20px; }
  .spin-tile { width: 132px; height: 86px; }
  .spin-tile span { font-size: 25px; }
  .tile-labels { width: 284px; grid-template-columns: 132px 132px; gap: 20px; }
  .rolled-strip { align-items: flex-start; flex-direction: column; }
  .filters-row { grid-template-columns: 1fr; }
  .tab-row { justify-content: space-between; }
  .player-main { grid-template-columns: 1fr; }
  .stats-mini { grid-template-columns: repeat(5, 1fr); }
}

.court-slot .court-initials { font-size: 21px; letter-spacing: .04em; }

/* v4 polish: cleaner court badges, bench modes, dramatic respins */
.logo-mark {
  background: linear-gradient(135deg, #0f766e, #2563eb);
}
.spin-btn {
  background: linear-gradient(180deg, #14b8a6, #2563eb);
  box-shadow: 0 16px 34px rgba(20,184,166,.22);
}
.team-tile::before { background: linear-gradient(135deg, #38bdf8, #2563eb); }
.era-tile::before { background: linear-gradient(135deg, #5eead4, #0f766e); }
.spin-tile small { color: #93c5fd; }
.era-tile small { color: #5eead4; }
.spin-tile.spinning {
  animation: spinLift 420ms ease-in-out infinite alternate, glowPulse 900ms ease-in-out infinite;
}
@keyframes spinLift {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-5px) scale(1.045); }
}
@keyframes glowPulse {
  0%,100% { filter: brightness(1); }
  50% { filter: brightness(1.26); }
}

.court-slot,
.bench-slot {
  cursor: pointer;
}
.court-slot.filled,
.bench-slot.filled {
  border-style: solid;
  border-color: rgba(94,234,212,.95);
  color: #ecfeff;
  background:
    radial-gradient(circle at 30% 15%, rgba(94,234,212,.23), transparent 34%),
    linear-gradient(155deg, rgba(15,118,110,.94), rgba(30,64,175,.86));
  box-shadow: 0 12px 28px rgba(20,184,166,.18), inset 0 0 0 1px rgba(255,255,255,.08);
}
.court-slot.filled:hover,
.bench-slot.filled:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}
.court-slot .court-initials,
.bench-slot .court-initials {
  font-size: 21px;
  line-height: 1;
  letter-spacing: .06em;
  text-shadow: none;
}
.bench-label {
  display: block;
  font-size: 9px;
  line-height: 1;
  letter-spacing: .08em;
  opacity: .82;
  margin-bottom: 4px;
}
.bench-zone {
  width: min(44vw, 448px);
  min-width: 400px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  gap: 7px;
  margin-top: 10px;
}
.bench-slot {
  min-height: 42px;
  border: 1px dashed rgba(174,185,207,.38);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: rgba(215,222,238,.72);
  font-weight: 950;
  background: rgba(255,255,255,.035);
  text-align: center;
  padding: 4px;
  transition: .18s ease;
}
.light .bench-slot { color: rgba(16,24,39,.62); background: rgba(255,255,255,.65); }

.team-pill { background: linear-gradient(135deg, #2563eb, #1e3a8a); }
.era-pill { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.rolled-pill.respinning {
  animation: respinShake 180ms linear infinite, respinGlow 700ms ease-in-out infinite;
  box-shadow: 0 0 0 5px rgba(94,234,212,.12), 0 12px 28px rgba(20,184,166,.22);
}
.rolled-pill.dimmed { opacity: .45; transform: scale(.96); }
@keyframes respinShake {
  0% { transform: translateX(-2px) scale(1.02); }
  50% { transform: translateX(2px) scale(1.05); }
  100% { transform: translateX(-1px) scale(1.02); }
}
@keyframes respinGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}
.dramatic-empty {
  animation: emptyPulse 900ms ease-in-out infinite;
}
@keyframes emptyPulse {
  0%,100% { border-color: var(--line2); opacity: .75; }
  50% { border-color: rgba(94,234,212,.65); opacity: 1; }
}
.player-row {
  animation: rowEnter 260ms ease both;
}
.player-row.no-open-slot {
  opacity: .72;
}
@keyframes rowEnter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.pos-pick-btn.taken,
.pos-pick-btn:disabled {
  border-color: rgba(148,163,184,.22);
  color: rgba(148,163,184,.72);
  background: rgba(148,163,184,.08);
  cursor: not-allowed;
}
.pos-pick-btn.bench-pick {
  border-color: rgba(20,184,166,.45);
  background: rgba(20,184,166,.12);
  color: #5eead4;
}
.swap-btn {
  border-color: rgba(96,165,250,.48);
  background: rgba(96,165,250,.12);
  color: #bfdbfe;
}

@media (max-width: 900px) {
  .bench-zone { width: min(92vw, 445px); min-width: 0; }
}

/* v6: team-colour placement + court hover stat cards */
:root {
  --team-primary: #38bdf8;
  --team-secondary: #14b8a6;
  --team-accent: #ffffff;
  --team-primary-rgb: 56, 189, 248;
  --team-secondary-rgb: 20, 184, 166;
  --slot-primary: #0f766e;
  --slot-secondary: #2563eb;
  --slot-accent: #ffffff;
  --slot-primary-rgb: 15, 118, 110;
  --slot-secondary-rgb: 37, 99, 235;
}

.court { overflow: visible; }

.team-pill,
.team-tile::before {
  background: linear-gradient(135deg, var(--team-primary), var(--team-secondary));
}
.era-pill,
.era-tile::before {
  background: linear-gradient(135deg, var(--team-secondary), var(--team-primary));
}
.tab.active {
  background: linear-gradient(135deg, var(--team-primary), var(--team-secondary));
  color: var(--team-accent);
}
#searchInput:focus,
#sortSelect:focus {
  border-color: rgba(var(--team-primary-rgb), .65);
  box-shadow: 0 0 0 3px rgba(var(--team-primary-rgb), .10);
}
.respin-btn:first-child { color: var(--team-primary); }
.respin-btn:last-child { color: var(--team-secondary); }
.rolled-pill.respinning {
  box-shadow: 0 0 0 5px rgba(var(--team-primary-rgb), .12), 0 12px 28px rgba(var(--team-primary-rgb), .22);
}

.player-row {
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease, box-shadow .16s ease;
}
.player-row:hover {
  border-color: rgba(var(--team-primary-rgb), .55);
  background: linear-gradient(90deg, rgba(var(--team-primary-rgb), .14), rgba(255,255,255,.045));
  transform: translateX(2px);
}
.player-row.selected {
  border-color: var(--team-primary);
  background:
    radial-gradient(circle at 0% 50%, rgba(var(--team-primary-rgb), .24), transparent 38%),
    linear-gradient(90deg, rgba(var(--team-primary-rgb), .20), rgba(var(--team-secondary-rgb), .10));
  box-shadow: inset 3px 0 0 var(--team-primary), 0 8px 24px rgba(var(--team-primary-rgb), .12);
}
.player-row.selected .pos-line,
.player-row:hover .pos-line { color: var(--team-secondary); }
.player-row.no-open-slot {
  cursor: not-allowed;
  opacity: .56;
}
.player-row.no-open-slot:hover {
  transform: none;
  border-color: var(--line);
  background: rgba(255,255,255,.045);
}
.row-pick-hint {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(255,255,255,.07);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}
.player-row.selected .row-pick-hint {
  color: var(--team-secondary);
}

.court-slot.place-open,
.bench-slot.place-open {
  border-color: var(--team-primary);
  color: var(--team-primary);
  background:
    radial-gradient(circle at 50% 20%, rgba(var(--team-primary-rgb), .20), transparent 55%),
    rgba(var(--team-primary-rgb), .08);
  box-shadow: 0 0 0 4px rgba(var(--team-primary-rgb), .10), inset 0 0 0 1px rgba(var(--team-primary-rgb), .18);
  animation: placePulse 980ms ease-in-out infinite;
}
.court-slot.place-taken,
.bench-slot.place-taken {
  box-shadow: 0 0 0 3px rgba(var(--team-primary-rgb), .12), inset 0 0 0 1px rgba(var(--team-primary-rgb), .22);
  filter: saturate(.7) brightness(.82);
}
.court-slot.place-disabled,
.bench-slot.place-disabled {
  opacity: .36;
  filter: grayscale(.35);
}
@keyframes placePulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.025); }
}

.court-slot.filled,
.bench-slot.filled {
  border-color: color-mix(in srgb, var(--slot-secondary) 65%, white 35%);
  color: var(--slot-accent);
  background:
    radial-gradient(circle at 25% 15%, rgba(255,255,255,.22), transparent 34%),
    linear-gradient(145deg, var(--slot-primary), var(--slot-secondary));
  box-shadow: 0 12px 28px rgba(var(--slot-primary-rgb), .24), inset 0 0 0 1px rgba(255,255,255,.16);
}
.court-slot.filled:hover,
.bench-slot.filled:hover {
  transform: translateY(-2px) scale(1.015);
  filter: brightness(1.09);
}
.court-slot.filled .court-initials,
.bench-slot.filled .court-initials {
  display: block;
  color: var(--slot-accent);
  text-shadow: 0 2px 8px rgba(0,0,0,.34);
}

.court-tooltip {
  position: absolute;
  z-index: 90;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: 230px;
  min-width: 190px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  text-align: left;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  padding: 9px 10px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(var(--slot-primary-rgb), .22), rgba(0,0,0,.04)),
    rgba(3, 7, 18, .96);
  box-shadow: 0 18px 38px rgba(0,0,0,.42), 0 0 0 3px rgba(var(--slot-primary-rgb), .10);
  transition: opacity .14s ease, visibility .14s ease, transform .14s ease;
}
.court-tooltip strong {
  display: block;
  font-size: 12px;
  line-height: 1.15;
  margin-bottom: 4px;
}
.court-tooltip small,
.court-tooltip span,
.court-tooltip em {
  display: block;
  font-size: 10px;
  line-height: 1.35;
  color: rgba(255,255,255,.78);
  font-style: normal;
}
.court-tooltip span { color: #fff; font-weight: 850; margin-top: 5px; }
.court-tooltip em { color: color-mix(in srgb, var(--slot-secondary) 35%, white 65%); margin-top: 2px; }
.court-slot.filled:hover .court-tooltip,
.bench-slot.filled:hover .court-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.slot-c .court-tooltip,
.slot-pf .court-tooltip {
  bottom: auto;
  top: calc(100% + 10px);
}
.slot-sf .court-tooltip { left: 0; transform: translateX(0) translateY(4px); }
.slot-sf.filled:hover .court-tooltip { transform: translateX(0) translateY(0); }
.slot-sg .court-tooltip { left: auto; right: 0; transform: translateX(0) translateY(4px); }
.slot-sg.filled:hover .court-tooltip { transform: translateX(0) translateY(0); }
.bench-slot .court-tooltip {
  bottom: calc(100% + 8px);
}

.light .court-tooltip {
  background:
    linear-gradient(135deg, rgba(var(--slot-primary-rgb), .16), rgba(255,255,255,.72)),
    rgba(255,255,255,.96);
  color: #0f172a;
  border-color: rgba(15,23,42,.16);
}
.light .court-tooltip small,
.light .court-tooltip em { color: rgba(15,23,42,.68); }
.light .court-tooltip span { color: #0f172a; }


/* v7 respin reliability polish */
.respin-btn.no-candidates:not(:disabled) { opacity: .72; }
.respin-btn:not(:disabled) { cursor: pointer; pointer-events: auto; }

/* v8 respin click fix + better visibility */
.rolled-strip {
  position: relative;
  z-index: 80;
}
.respin-actions {
  position: relative;
  z-index: 90;
  pointer-events: auto;
}
.respin-btn {
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.045);
  pointer-events: auto !important;
  user-select: none;
  touch-action: manipulation;
}
.respin-btn:hover { background: rgba(255,255,255,.085); transform: translateY(-1px); }
.respin-btn.used,
.respin-btn.busy,
.respin-btn[aria-disabled="true"] {
  opacity: .42;
}
.respin-btn.used { cursor: not-allowed; }
.respin-btn.busy { cursor: wait; }
.respin-btn:not(.used):not(.busy) { cursor: pointer !important; }

/* v9 drag-to-swap lineup controls */
.court-slot.filled,
.bench-slot.filled {
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.court-slot.filled:active,
.bench-slot.filled:active {
  cursor: grabbing;
}
body.lineup-dragging,
body.lineup-dragging * {
  cursor: grabbing !important;
}
.court-slot.drag-source,
.bench-slot.drag-source {
  opacity: .46;
  transform: scale(.94);
  filter: saturate(.7) brightness(.82);
}
.court-slot.drag-target-open,
.bench-slot.drag-target-open {
  border-color: var(--team-primary);
  color: var(--team-primary);
  background:
    radial-gradient(circle at 50% 20%, rgba(var(--team-primary-rgb), .22), transparent 55%),
    rgba(var(--team-primary-rgb), .10);
  box-shadow: 0 0 0 4px rgba(var(--team-primary-rgb), .10), inset 0 0 0 1px rgba(var(--team-primary-rgb), .20);
  animation: placePulse 980ms ease-in-out infinite;
}
.court-slot.drag-target-swap,
.bench-slot.drag-target-swap {
  border-color: var(--team-secondary);
  color: var(--team-accent);
  box-shadow: 0 0 0 4px rgba(var(--team-secondary-rgb), .13), inset 0 0 0 2px rgba(var(--team-secondary-rgb), .38);
  filter: brightness(1.07) saturate(1.12);
}
.court-slot.drag-target-blocked,
.bench-slot.drag-target-blocked {
  opacity: .34;
  filter: grayscale(.6) brightness(.72);
}
.court-slot.drag-over,
.bench-slot.drag-over {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 0 0 6px rgba(var(--team-primary-rgb), .18), 0 18px 34px rgba(0,0,0,.30), inset 0 0 0 2px rgba(255,255,255,.26);
}
.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  width: 70px;
  height: 58px;
  border-radius: 14px;
  pointer-events: none;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--slot-accent);
  border: 2px solid color-mix(in srgb, var(--slot-secondary) 65%, white 35%);
  background:
    radial-gradient(circle at 25% 15%, rgba(255,255,255,.24), transparent 34%),
    linear-gradient(145deg, var(--slot-primary), var(--slot-secondary));
  box-shadow: 0 18px 40px rgba(0,0,0,.45), 0 0 0 4px rgba(var(--slot-primary-rgb), .18);
  will-change: transform;
}
.drag-ghost strong {
  display: block;
  font-size: 20px;
  line-height: .95;
  letter-spacing: .02em;
}
.drag-ghost small {
  display: block;
  margin-top: 3px;
  font-size: 8px;
  opacity: .86;
  font-weight: 950;
}
body.lineup-dragging .court-tooltip {
  display: none;
}

/* v13 mobile + responsive web-app polish */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  width: 100%;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  padding-bottom: env(safe-area-inset-bottom);
}
button,
select,
input,
.player-row,
.court-slot,
.bench-slot {
  -webkit-tap-highlight-color: transparent;
}
button,
select,
input {
  font-size: 16px;
}
.icon-btn,
.tab,
.respin-btn,
.pos-pick-btn,
.move-btn,
.move-close,
.spin-btn,
.ghost-btn,
.court-slot,
.bench-slot {
  min-height: 44px;
}
.topbar {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.player-row {
  touch-action: manipulation;
}
.court,
.court * {
  touch-action: none;
}

@media (hover: none) and (pointer: coarse) {
  .court-tooltip { display: none !important; }
  .player-row:hover {
    transform: none;
    border-color: var(--line);
    background: rgba(255,255,255,.045);
  }
  .player-row.selected {
    border-color: var(--team-primary);
    background:
      radial-gradient(circle at 0% 50%, rgba(var(--team-primary-rgb), .24), transparent 38%),
      linear-gradient(90deg, rgba(var(--team-primary-rgb), .20), rgba(var(--team-secondary-rgb), .10));
  }
}

@media (max-width: 820px) {
  .topbar {
    height: 52px;
    position: sticky;
    top: 0;
  }
  .brand-row { gap: 10px; }
  #roundLabel { font-size: 14px; }
  .top-actions { gap: 8px; }
  .icon-btn { width: 38px; height: 38px; }

  .spin-screen {
    margin: 18px auto 0;
    padding: 0 14px 20px;
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .spin-side {
    align-items: center;
    min-height: auto;
  }
  .tiles-row {
    width: min(100%, 370px);
    justify-content: center;
    gap: 22px;
  }
  .spin-tile {
    width: min(42vw, 148px);
    height: 86px;
  }
  .tile-labels {
    width: min(100%, 330px);
    grid-template-columns: 1fr 1fr;
    gap: 22px;
  }
  .spin-btn {
    width: min(100%, 330px);
    padding: 14px 18px;
  }
  .prompt-text {
    max-width: 340px;
    font-size: 13px;
  }
  .court,
  .pick-court-wrap .court {
    width: min(94vw, 385px);
    min-width: 0;
  }
  .court-slot {
    width: 56px;
    height: 56px;
    border-radius: 12px;
  }
  .slot-pg { left: calc(50% - 28px); }
  .bench-zone {
    width: min(94vw, 385px);
    min-width: 0;
    grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
  }
  .court-hint {
    width: min(94vw, 385px);
    min-width: 0;
    font-size: 10px;
  }

  .rolled-strip {
    position: sticky;
    top: 52px;
    z-index: 95;
    width: 100%;
    max-width: none;
    min-height: auto;
    padding: 10px max(12px, env(safe-area-inset-left)) 10px max(12px, env(safe-area-inset-right));
    background: rgba(7, 11, 22, .96);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    align-items: stretch;
  }
  .light .rolled-strip { background: rgba(237,242,250,.96); }
  .rolled-pills {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .rolled-pill {
    min-height: 38px;
    padding: 8px 14px;
  }
  .respin-left {
    flex-basis: 100%;
    font-size: 11px;
  }
  .respin-actions {
    justify-content: flex-end;
    gap: 8px;
  }
  .respin-btn {
    min-height: 40px;
    padding: 9px 12px;
    font-size: 12px;
  }

  .pick-layout {
    max-width: none;
    width: 100%;
    padding: 10px max(10px, env(safe-area-inset-left)) 0 max(10px, env(safe-area-inset-right));
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .players-column {
    order: 1;
    width: 100%;
  }
  .pick-court-wrap {
    order: 2;
    position: sticky;
    bottom: 0;
    z-index: 70;
    padding: 10px 0 max(10px, env(safe-area-inset-bottom));
    margin-left: calc(-1 * max(10px, env(safe-area-inset-left)));
    margin-right: calc(-1 * max(10px, env(safe-area-inset-right)));
    background:
      linear-gradient(180deg, rgba(7,11,22,0), rgba(7,11,22,.96) 14%, rgba(7,11,22,.99));
  }
  .light .pick-court-wrap {
    background:
      linear-gradient(180deg, rgba(237,242,250,0), rgba(237,242,250,.96) 14%, rgba(237,242,250,.99));
  }
  .filters-row {
    grid-template-columns: auto 1fr 96px;
    gap: 8px;
    position: sticky;
    top: 126px;
    z-index: 75;
    padding: 8px 0;
    margin-bottom: 8px;
    background: rgba(7,11,22,.94);
    backdrop-filter: blur(10px);
  }
  .light .filters-row { background: rgba(237,242,250,.94); }
  .tab-row { gap: 5px; }
  .tab {
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
  }
  #searchInput,
  #sortSelect {
    height: 46px;
    border-radius: 10px;
  }
  .available-text {
    margin: 0 0 8px;
    font-size: 12px;
  }
  .player-list {
    height: 48svh;
    max-height: 520px;
    padding-right: 3px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .player-row {
    border-radius: 12px;
    padding: 13px 12px;
    margin-bottom: 9px;
  }
  .player-nameblock strong { font-size: 16px; line-height: 1.1; }
  .player-nameblock small,
  .pos-line { font-size: 12px; }
  .stats-mini {
    grid-template-columns: repeat(5, minmax(34px, 44px));
    gap: 4px;
  }
  .stats-mini b { font-size: 14px; }
  .stats-mini small { font-size: 8px; }
  .row-pick-hint { font-size: 12px; padding-top: 10px; }

  .move-panel {
    width: calc(100vw - 18px);
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 10px;
    flex-direction: column;
    align-items: stretch;
    z-index: 120;
  }
  .move-actions { justify-content: flex-start; }
  .move-btn { min-height: 40px; padding: 8px 11px; }
  .drag-ghost {
    width: 64px;
    height: 52px;
    transform-origin: center;
  }
  .drag-ghost strong { font-size: 18px; }

  .result-panel {
    margin-top: 16px;
    padding: 18px 12px 38px;
  }
  .result-buttons {
    flex-direction: column;
  }
  .result-buttons .spin-btn,
  .result-buttons .ghost-btn {
    width: 100%;
  }
  .settings-drawer { justify-content: center; }
  .drawer-card {
    width: 100vw;
    min-height: 100svh;
    padding: 20px max(16px, env(safe-area-inset-right)) 20px max(16px, env(safe-area-inset-left));
  }
}

@media (max-width: 520px) {
  .logo-mark { width: 30px; height: 28px; }
  .topbar { padding-left: 10px; padding-right: 10px; }
  .top-actions .icon-btn { width: 36px; height: 36px; }

  .rolled-strip {
    top: 52px;
    flex-direction: column;
    gap: 8px;
  }
  .respin-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .respin-btn {
    justify-content: center;
  }
  .filters-row {
    top: 146px;
    grid-template-columns: 1fr 92px;
  }
  .tab-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }
  .player-main {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .stats-mini {
    grid-template-columns: repeat(5, 1fr);
    max-width: 100%;
  }
  .player-list {
    height: 44svh;
  }
  .pick-court-wrap .court,
  .court {
    width: min(92vw, 340px);
  }
  .court-slot {
    width: 50px;
    height: 50px;
    font-size: 12px;
  }
  .court-slot .court-initials,
  .bench-slot .court-initials {
    font-size: 18px;
  }
  .slot-pg { left: calc(50% - 25px); }
  .slot-sf { left: 5%; }
  .slot-sg { right: 5%; }
  .bench-zone {
    width: min(92vw, 340px);
  }
  .court-hint {
    width: min(92vw, 340px);
    line-height: 1.25;
  }
}

@media (max-width: 380px) {
  .player-list { height: 40svh; }
  .pick-court-wrap .court,
  .court { width: min(91vw, 310px); }
  .court-slot { width: 46px; height: 46px; }
  .slot-pg { left: calc(50% - 23px); }
  .bench-zone { width: min(91vw, 310px); }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 900px) {
  .rolled-strip { position: static; }
  .filters-row { position: static; }
  .pick-layout {
    display: grid;
    grid-template-columns: minmax(330px, 1fr) minmax(300px, .9fr);
    gap: 12px;
    align-items: start;
  }
  .pick-court-wrap {
    position: sticky;
    top: 56px;
    order: 2;
    padding-top: 0;
    background: transparent;
  }
  .players-column { order: 1; }
  .player-list { height: calc(100svh - 180px); }
  .pick-court-wrap .court { width: min(42vw, 330px); }
  .bench-zone { width: min(42vw, 330px); }
}


/* v14 logo update */
.logo-home {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  flex: 0 0 auto;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
}
.logo-home:hover {
  border-color: rgba(255,255,255,.28);
  transform: translateY(-1px);
}
.logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
@media (max-width: 520px) {
  .logo-home { width: 34px; height: 34px; border-radius: 9px; }
}

/* v16: better home menu and mode hub */
.home-screen {
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 18px 60px;
}
.home-hero {
  min-height: 330px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 28px;
  background:
    radial-gradient(circle at 14% 15%, rgba(var(--team-primary-rgb,47,125,255),.22), transparent 36%),
    radial-gradient(circle at 83% 25%, rgba(20,184,166,.18), transparent 34%),
    linear-gradient(135deg, rgba(255,255,255,.06), rgba(255,255,255,.015));
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px) 0 0/44px 44px,
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px) 0 0/44px 44px;
  mask-image: radial-gradient(circle at 72% 52%, black, transparent 72%);
  opacity: .55;
  pointer-events: none;
}
.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 700px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--orange2);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .14em;
}
.home-hero h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 72px);
  line-height: .95;
  letter-spacing: -.07em;
  max-width: 730px;
}
.hero-sub {
  margin: 18px 0 0;
  color: var(--muted);
  max-width: 620px;
  font-size: 16px;
  line-height: 1.55;
}
.hero-actions {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.home-primary { min-width: 170px; }
.hero-board {
  position: relative;
  z-index: 1;
  min-height: 250px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  align-content: center;
  background:
    radial-gradient(circle at center, rgba(96,165,250,.28), transparent 62%),
    linear-gradient(160deg, rgba(255,255,255,.12), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.15);
  overflow: hidden;
}
.hero-board::before {
  content: "";
  width: 210px;
  height: 210px;
  border: 2px solid rgba(255,255,255,.18);
  border-radius: 50%;
  position: absolute;
}
.hero-board span,
.hero-board strong {
  position: relative;
  font-weight: 1000;
  font-size: 86px;
  line-height: .82;
  letter-spacing: -.08em;
}
.hero-board strong { color: var(--orange2); }
.hero-board small {
  position: relative;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
}
.home-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  align-items: start;
}
.menu-section,
.franchise-start-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.045);
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
}
.menu-section { padding: 20px; }
.franchise-start-card {
  padding: 22px;
  position: sticky;
  top: 66px;
}
.franchise-start-card h2,
.section-title-row h2 {
  margin: 0;
  letter-spacing: -.035em;
}
.franchise-start-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.5;
  margin: 10px 0 16px;
}
.franchise-start-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 850;
  margin-bottom: 14px;
}
.franchise-start-card select {
  min-height: 44px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
}
.franchise-start-card .spin-btn { width: 100%; }
.quick-start-stack {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 66px;
}
.quick-start-stack .franchise-start-card {
  position: static;
  top: auto;
}
.free-agency-start-card {
  border-color: rgba(20,184,166,.35);
  background:
    radial-gradient(circle at 88% 10%, rgba(20,184,166,.14), transparent 36%),
    rgba(255,255,255,.045);
}
.section-title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}
.mode-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  white-space: nowrap;
}
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.mode-card,
.mini-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.07), rgba(255,255,255,.025));
  color: var(--text);
  text-align: left;
  padding: 16px;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.mode-card:hover,
.mini-card:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--team-primary-rgb,47,125,255),.55);
  background: linear-gradient(135deg, rgba(var(--team-primary-rgb,47,125,255),.16), rgba(255,255,255,.035));
}
.mode-card.featured {
  border-color: rgba(96,165,250,.55);
  background:
    radial-gradient(circle at 88% 18%, rgba(20,184,166,.23), transparent 36%),
    linear-gradient(135deg, rgba(47,125,255,.24), rgba(255,255,255,.035));
}
.mode-card.locked { opacity: .88; }
.mode-tag {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: white;
  background: linear-gradient(135deg, var(--orange), var(--purple));
}
.mode-tag.soon { background: rgba(255,255,255,.16); color: var(--muted); }
.mode-card strong,
.mini-card strong {
  font-size: 18px;
  letter-spacing: -.025em;
}
.mode-card small,
.mini-card small {
  color: var(--muted);
  line-height: 1.38;
}
.mini-games { margin-top: 22px; }
.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.mini-card { min-height: 110px; }
.mode-info-drawer {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(10px);
}
.mode-info-drawer.open { display: grid; }
.mode-info-card {
  width: min(520px, 100%);
  border: 1px solid var(--line2);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
  position: relative;
}
.mode-info-card h2 { margin: 0 0 10px; letter-spacing: -.035em; }
.mode-info-card p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.mode-info-close { position: absolute; right: 14px; top: 14px; }
.mode-info-actions { margin-top: 18px; display: flex; justify-content: flex-end; }
.result-subhead {
  grid-column: 1 / -1;
  margin: 16px 0 0;
  color: var(--text);
  letter-spacing: -.025em;
}
.playoff-bracket {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.bracket-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,.045);
}
.bracket-card.won { border-color: rgba(34,197,94,.45); }
.bracket-card.lost { border-color: rgba(255,79,94,.45); }
.bracket-card small,
.bracket-card span { display: block; color: var(--muted); font-size: 12px; }
.bracket-card strong { display: block; font-size: 26px; margin: 4px 0; }
.cpu-card { border-color: rgba(96,165,250,.22); }

@media (max-width: 980px) {
  .home-hero { grid-template-columns: 1fr; }
  .hero-board { min-height: 210px; }
  .home-grid { grid-template-columns: 1fr; }
  .franchise-start-card { position: static; }
  .mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .playoff-bracket { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .home-screen { padding: 18px 12px 42px; }
  .home-hero { border-radius: 22px; padding: 20px; }
  .hero-actions .spin-btn,
  .hero-actions .ghost-btn { width: 100%; }
  .mode-grid,
  .mini-grid { grid-template-columns: 1fr; }
  .section-title-row { align-items: flex-start; flex-direction: column; }
  .hero-board span,
  .hero-board strong { font-size: 64px; }
  .playoff-bracket { grid-template-columns: 1fr; }
}

/* v17 mini-game pack */
.mini-game-screen {
  display: grid;
  gap: 1rem;
  padding: 1rem 0 2rem;
}

.mini-game-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(2, 6, 23, 0.72));
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.28);
}

.mini-title-block h1 {
  margin: .15rem 0 .25rem;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
}

.mini-title-block p:last-child {
  margin: 0;
  color: var(--muted);
}

.mini-score-pill {
  justify-self: end;
  padding: .7rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.34);
  background: rgba(56, 189, 248, 0.11);
  color: var(--text);
  font-weight: 900;
  white-space: nowrap;
}

.mini-game-body {
  min-height: 420px;
  display: grid;
  align-content: start;
  gap: 1rem;
}

.mini-question-card,
.mini-summary-card {
  padding: clamp(1rem, 3vw, 2rem);
  border-radius: 28px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.7));
  box-shadow: 0 22px 80px rgba(0,0,0,.28);
}

.mini-question-card h2,
.mini-summary-card h2 {
  margin: .25rem 0 1rem;
  font-size: clamp(1.6rem, 4vw, 3rem);
}

.mini-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(72px, 1fr));
  gap: .7rem;
  margin-top: 1rem;
}

.mini-stat-grid.small {
  grid-template-columns: repeat(4, minmax(52px, 1fr));
  gap: .45rem;
}

.mini-stat-grid b {
  display: grid;
  gap: .15rem;
  place-items: center;
  padding: .85rem .5rem;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, .18);
  background: rgba(255, 255, 255, .06);
  font-size: 1.15rem;
}

.mini-stat-grid.small b {
  padding: .55rem .35rem;
  font-size: .95rem;
}

.mini-stat-grid em {
  font-style: normal;
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .08em;
}

.mini-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
}

.mini-choice-btn,
.mini-duel-btn {
  min-height: 64px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 20px;
  background: rgba(15, 23, 42, .72);
  color: var(--text);
  font-weight: 900;
  font-size: 1rem;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.mini-choice-btn:hover,
.mini-duel-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, .75);
  background: rgba(56, 189, 248, .12);
}

.mini-choice-btn.correct,
.mini-duel-btn.correct {
  border-color: rgba(34, 197, 94, .85);
  background: rgba(34, 197, 94, .18);
}

.mini-choice-btn.wrong,
.mini-duel-btn.wrong {
  border-color: rgba(248, 113, 113, .85);
  background: rgba(248, 113, 113, .17);
}

.mini-choice-btn:disabled,
.mini-duel-btn:disabled {
  cursor: default;
  transform: none;
}

.mini-versus-head {
  text-align: center;
  padding: .5rem;
}

.mini-versus-head h2 {
  margin: .2rem 0 .8rem;
}

.mini-versus-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.mini-duel-btn {
  padding: 0;
  text-align: left;
  overflow: hidden;
}

.mini-player-card {
  min-height: 100%;
  padding: 1rem;
  background:
    linear-gradient(135deg, rgba(var(--slot-primary-rgb), .27), rgba(var(--slot-secondary-rgb), .14)),
    rgba(15, 23, 42, .72);
  border-left: 5px solid var(--slot-primary);
}

.mini-player-card small {
  display: block;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .35rem;
}

.mini-player-card strong {
  display: block;
  font-size: 1.25rem;
  margin-bottom: .3rem;
}

.mini-player-card span {
  display: block;
  color: var(--muted);
  font-size: .92rem;
}

.mini-player-card.stat-hidden {
  min-height: 168px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.mini-player-card.stat-hidden.compact {
  min-height: 150px;
}

.mini-hidden-hint {
  margin: .8rem 0 0;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 750;
}


.mini-name-stack {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .65rem;
}

.mini-name-stack span,
.path-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: .75rem .7rem;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, .2);
  background: rgba(255,255,255,.06);
  font-weight: 850;
}

.path-pill {
  min-width: 118px;
  max-width: 220px;
  padding: .65rem .85rem;
  border-color: rgba(var(--slot-primary-rgb), .62);
  background:
    linear-gradient(135deg, rgba(var(--slot-primary-rgb), .30), rgba(var(--slot-secondary-rgb), .16)),
    rgba(15, 23, 42, .78);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
  font-size: clamp(1.05rem, 2.4vw, 1.9rem);
  letter-spacing: -.035em;
}

.career-path-card h2 {
  margin: 0;
}

.career-path-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem;
  margin: .6rem 0 1rem;
}

.path-arrow {
  color: var(--muted);
  margin: 0 .1rem;
  font-size: clamp(1.2rem, 2.8vw, 2.4rem);
  font-weight: 900;
}

.mini-clue-line {
  color: var(--muted);
  margin: -.4rem 0 .8rem;
}

.mini-reveal {
  display: grid;
  gap: .2rem;
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, .2);
  background: rgba(15,23,42,.72);
}

.mini-reveal.correct { border-color: rgba(34,197,94,.55); }
.mini-reveal.wrong { border-color: rgba(248,113,113,.55); }
.mini-reveal span { font-weight: 900; }
.mini-reveal small { color: var(--muted); }

.mini-game-actions {
  display: flex;
  justify-content: center;
  gap: .8rem;
}

.mini-result-meter {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, .18);
  margin-top: 1rem;
}

.mini-result-meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #14b8a6);
}

.light .mini-game-head,
.light .mini-question-card,
.light .mini-summary-card,
.light .mini-choice-btn,
.light .mini-duel-btn,
.light .mini-reveal {
  background: rgba(255,255,255,.86);
}

@media (max-width: 760px) {
  .mini-game-head {
    grid-template-columns: 1fr;
  }
  .mini-score-pill {
    justify-self: start;
  }
  .mini-choice-grid,
  .mini-versus-grid,
  .mini-name-stack {
    grid-template-columns: 1fr;
  }
  .career-path-row {
    align-items: stretch;
  }
  .path-pill {
    min-width: 0;
    max-width: none;
    flex: 1 1 140px;
    font-size: 1.15rem;
  }
  .mini-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mini-game-body {
    min-height: 360px;
  }
}

/* v18 GM Trade + Dynasty modes */
.trade-screen {
  max-width: 1180px;
  margin: 28px auto 0;
  padding: 18px 16px 46px;
}
.trade-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  background:
    radial-gradient(circle at 88% 18%, rgba(var(--team-primary-rgb, 56, 189, 248), .18), transparent 34%),
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.035));
  box-shadow: var(--shadow);
}
.trade-head h1 { margin: 0 0 4px; letter-spacing: -.045em; }
.trade-head p:not(.eyebrow) { margin: 0; color: var(--muted); line-height: 1.45; }
.trade-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, .75fr);
  gap: 16px;
  margin-top: 18px;
}
.trade-layout h2 { margin: 0 0 12px; letter-spacing: -.035em; }
.trade-offers { display: grid; gap: 12px; }
.trade-offer-card,
.trade-roster-card,
.dynasty-summary-card,
.dynasty-year {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.035));
  box-shadow: 0 14px 36px rgba(0,0,0,.13);
}
.trade-offer-card { padding: 16px; }
.trade-offer-card.accepted { border-color: rgba(34,197,94,.48); opacity: .82; }
.trade-offer-card.declined,
.trade-offer-card.expired { opacity: .58; }
.trade-offer-top { display:flex; align-items:center; justify-content:space-between; gap: 12px; margin-bottom: 12px; }
.trade-offer-top strong { letter-spacing: -.025em; }
.trade-sides {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
}
.trade-sides > div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,.035);
}
.trade-sides small,
.trade-sides em,
.trade-roster-row span,
.dynasty-summary-card span,
.dynasty-year small,
.dynasty-year span,
.dynasty-year em {
  display: block;
  color: var(--muted);
  font-style: normal;
  line-height: 1.35;
}
.trade-sides b { display:block; margin: 4px 0; }
.trade-arrow { align-self: center; font-weight: 1000; color: var(--green); }
.trade-stats { display:flex; flex-wrap:wrap; gap:8px; margin: 12px 0; }
.trade-stats span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.trade-card-actions { display:flex; gap: 10px; flex-wrap: wrap; }
.trade-card-actions button[disabled] { opacity: .5; cursor: not-allowed; }
.trade-roster-card { padding: 16px; align-self: start; position: sticky; top: 92px; }
.trade-roster-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px;
  background: rgba(255,255,255,.035);
  margin-bottom: 8px;
}
.trade-roster-row strong { display:block; margin-bottom: 3px; }
.trade-history { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.trade-history h3 { margin: 0 0 8px; font-size: 14px; }
.trade-history ul { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.55; }
.dynasty-summary-card {
  grid-column: 1 / -1;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dynasty-summary-card strong { font-size: 22px; }
.dynasty-timeline {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.dynasty-year { padding: 14px; }
.dynasty-year.champion { border-color: rgba(250,204,21,.6); background: linear-gradient(180deg, rgba(250,204,21,.12), rgba(255,255,255,.035)); }
.dynasty-year strong { display:block; font-size: 30px; margin: 4px 0; letter-spacing: -.05em; }
.dynasty-year em { font-size: 12px; margin-top: 6px; }

@media (max-width: 900px) {
  .trade-head { grid-template-columns: 1fr; }
  .trade-layout { grid-template-columns: 1fr; }
  .trade-roster-card { position: static; }
  .dynasty-timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dynasty-summary-card { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  .trade-screen { padding: 14px 12px 40px; }
  .trade-sides { grid-template-columns: 1fr; }
  .trade-arrow { text-align:center; transform: rotate(90deg); }
  .dynasty-timeline { grid-template-columns: 1fr; }
}

/* v19: compact one-frame polish, records drawer, and smarter trade presentation */
@media (min-width: 901px) {
  body { overflow: hidden; }
  .topbar { height: 42px; }
  .home-screen,
  .spin-screen,
  .pick-screen,
  .trade-screen,
  .mini-game-screen,
  .result-panel {
    height: calc(100svh - 42px);
    overflow: hidden;
  }

  .home-screen {
    padding: 18px 18px 20px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 14px;
  }
  .home-hero {
    min-height: 190px;
    padding: 20px 22px;
    grid-template-columns: minmax(0, 1fr) 280px;
    border-radius: 22px;
  }
  .home-hero h1 { font-size: clamp(34px, 4.8vw, 58px); }
  .hero-sub { margin-top: 12px; font-size: 14px; max-width: 760px; }
  .hero-actions { margin-top: 16px; }
  .hero-board { min-height: 170px; }
  .home-grid { margin-top: 0; min-height: 0; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; }
  .menu-section { padding: 14px; }
  .franchise-start-card { padding: 16px; top: 54px; }
  .section-title-row { margin-bottom: 10px; }
  .mode-grid { gap: 9px; }
  .mode-card { min-height: 102px; padding: 12px; border-radius: 15px; gap: 6px; }
  .mode-card strong, .mini-card strong { font-size: 15px; }
  .mode-card small, .mini-card small { font-size: 12px; line-height: 1.25; }
  .mini-games { margin-top: 0; }
  .mini-grid { gap: 9px; }
  .mini-card { min-height: 76px; padding: 12px; border-radius: 15px; gap: 5px; }

  .spin-screen { margin-top: 0; padding: 24px 16px; align-items: center; }
  .pick-screen { display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .pick-layout {
    height: 100%;
    min-height: 0;
    padding: 10px 12px 12px;
    gap: clamp(30px, 7vw, 96px);
    overflow: hidden;
  }
  .players-column { display: flex; min-height: 0; flex-direction: column; }
  .player-list { flex: 1; height: auto; max-height: none; min-height: 0; }
  .pick-court-wrap { min-height: 0; }
  .pick-court-wrap .court { width: min(40vw, 430px); min-width: 360px; }
  .court-hint { width: min(40vw, 430px); min-width: 360px; }

  .trade-screen { margin-top: 0; padding: 12px 16px; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
  .trade-head { padding: 14px 16px; border-radius: 18px; }
  .trade-head h1 { font-size: 28px; }
  .trade-layout { margin-top: 0; min-height: 0; overflow: hidden; }
  .trade-offers,
  .trade-roster-card { max-height: 100%; overflow: auto; padding-right: 4px; }
  .trade-roster-card { position: static; align-self: stretch; }
  .trade-offer-card { padding: 13px; border-radius: 15px; }

  .mini-game-screen {
    max-width: 1120px;
    margin: 0 auto;
    padding: 12px 16px;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
  }
  .mini-game-body { min-height: 0; overflow: auto; align-content: start; }

  .result-panel {
    margin-top: 0;
    padding: 14px 16px;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 10px;
  }
  .result-hero { margin-bottom: 0; }
  .result-hero h1 { font-size: clamp(46px, 7.5vw, 86px); letter-spacing: -.06em; }
  .result-buttons { margin-top: 10px; }
  .result-grid { margin-bottom: 0; gap: 10px; }
  .result-card { padding: 13px; border-radius: 15px; }
  .result-card strong { font-size: 38px; }
  .final-lineup { overflow: auto; min-height: 0; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; padding-right: 4px; }
  .lineup-card { padding: 10px; border-radius: 14px; }
}

.hero-board {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  align-items: baseline;
  gap: 0 10px;
  background:
    radial-gradient(circle at 48% 42%, rgba(96,165,250,.22), transparent 54%),
    linear-gradient(160deg, rgba(255,255,255,.10), rgba(255,255,255,.025));
}
.hero-board::before {
  width: min(72%, 230px);
  height: auto;
  aspect-ratio: 1;
  opacity: .55;
}
.hero-board span,
.hero-board strong {
  font-size: clamp(66px, 8vw, 104px);
  line-height: .82;
  letter-spacing: -.07em;
}
.hero-board small {
  width: 100%;
  text-align: center;
  margin-top: 12px;
}

.record-compact-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.trade-offer-card.positive { border-color: rgba(34,197,94,.42); }
.trade-offer-card.negative { border-color: rgba(248,113,113,.42); }
.trade-offer-card.neutral { border-color: rgba(250,204,21,.32); }
.trade-impact { font-weight: 1000 !important; }
.trade-impact.positive { color: #86efac !important; border-color: rgba(34,197,94,.38); background: rgba(34,197,94,.10); }
.trade-impact.negative { color: #fca5a5 !important; border-color: rgba(248,113,113,.38); background: rgba(248,113,113,.10); }
.trade-impact.neutral { color: #fde68a !important; border-color: rgba(250,204,21,.32); background: rgba(250,204,21,.10); }
.trade-note { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.35; }

.records-drawer {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  justify-content: flex-end;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(10px);
}
.records-drawer.open { display: flex; }
.records-card {
  width: min(520px, 96vw);
  height: 100%;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
}
.records-head { display:flex; align-items:center; justify-content:space-between; gap: 16px; }
.records-head h2 { margin: 0; letter-spacing: -.035em; }
.records-tabs { display:flex; gap: 8px; flex-wrap: wrap; }
.record-tab {
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255,255,255,.045);
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 950;
}
.record-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--team-primary), var(--team-secondary));
  border-color: transparent;
}
.records-list { min-height: 0; overflow: auto; display: grid; align-content: start; gap: 10px; padding-right: 4px; }
.record-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px;
  background: linear-gradient(135deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
}
.record-row.mini { border-color: rgba(20,184,166,.24); }
.record-topline { display:flex; justify-content:space-between; align-items:center; gap: 10px; margin-bottom: 8px; }
.record-topline em { color: var(--muted); font-size: 12px; font-style: normal; }
.record-row strong { display:block; font-size: 28px; letter-spacing: -.04em; margin-bottom: 3px; }
.record-row small { display:block; color: var(--muted); line-height: 1.4; }
.record-lineup { display:flex; flex-wrap:wrap; gap: 6px; margin-top: 10px; }
.record-lineup span { border: 1px solid var(--line); border-radius: 999px; color: var(--muted); padding: 4px 7px; font-size: 11px; font-weight: 800; }
.records-actions { border-top: 1px solid var(--line); padding-top: 12px; display:flex; justify-content:flex-end; }

@media (max-width: 560px) {
  .records-drawer { justify-content: center; }
  .records-card { width: 100vw; padding: 18px max(14px, env(safe-area-inset-right)) 18px max(14px, env(safe-area-inset-left)); }
}

/* v20: menu may scroll, gameplay screens stay locked to one frame when possible */
@media (min-width: 901px) {
  body {
    overflow: hidden;
  }

  /* The home/menu is allowed to scroll if the mode tiles need more room. */
  .home-screen {
    height: calc(100svh - 42px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
  }

  /* Game screens themselves should not create page scrolling. */
  .spin-screen,
  .pick-screen,
  .trade-screen,
  .mini-game-screen,
  .result-panel {
    height: calc(100svh - 42px);
    overflow: hidden;
  }

  /* Only long content areas scroll internally when they actually need to. */
  .player-list,
  .trade-offers,
  .trade-roster-card,
  .records-list,
  .final-lineup {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .mini-game-body {
    overflow: hidden;
  }

  .mini-game-options,
  .comparison-grid,
  .guess-options,
  .path-options {
    max-height: 100%;
    overflow-y: auto;
  }
}

@media (max-width: 900px) {
  /* Phones/tablets can scroll naturally because the screen is smaller. */
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }
}

/* v21: proper home/menu layout fix
   Home is allowed to be a spacious scrollable landing page.
   Gameplay screens keep the compact one-frame behavior from v20. */
@media (min-width: 901px) {
  .home-screen {
    display: block !important;
    height: calc(100svh - 42px) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 22px clamp(18px, 4vw, 56px) 64px !important;
    max-width: 1760px;
    margin: 0 auto;
    scrollbar-gutter: stable;
  }

  .home-hero {
    min-height: clamp(220px, 28vh, 330px) !important;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 420px) !important;
    gap: 28px !important;
    padding: clamp(22px, 3vw, 34px) !important;
    border-radius: 28px !important;
    margin: 0 0 22px !important;
  }

  .home-hero h1 {
    font-size: clamp(48px, 5.8vw, 86px) !important;
    line-height: .92 !important;
    max-width: 980px;
  }

  .hero-sub {
    font-size: 16px !important;
    line-height: 1.5 !important;
    max-width: 880px !important;
    margin-top: 16px !important;
  }

  .hero-actions { margin-top: 22px !important; }

  .hero-board {
    min-height: clamp(210px, 27vh, 320px) !important;
  }

  .home-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 430px) !important;
    gap: 22px !important;
    align-items: start !important;
    margin-top: 0 !important;
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
  }

  .menu-section,
  .franchise-start-card {
    overflow: visible !important;
    border-radius: 26px !important;
  }

  .menu-section { padding: 22px !important; }
  .franchise-start-card {
    padding: 24px !important;
    position: sticky !important;
    top: 58px !important;
    align-self: start !important;
  }

  .section-title-row {
    margin-bottom: 18px !important;
    align-items: end !important;
  }

  .mode-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  .mode-card {
    min-height: 134px !important;
    padding: 16px !important;
    border-radius: 18px !important;
    gap: 9px !important;
  }

  .mode-card strong,
  .mini-card strong {
    font-size: 18px !important;
    line-height: 1.08 !important;
  }

  .mode-card small,
  .mini-card small {
    font-size: 13px !important;
    line-height: 1.36 !important;
  }

  .mini-games {
    margin-top: 22px !important;
    margin-bottom: 22px !important;
  }

  .mini-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  .mini-card {
    min-height: 112px !important;
    padding: 16px !important;
    border-radius: 18px !important;
    gap: 8px !important;
  }
}

@media (min-width: 901px) and (max-width: 1220px) {
  .home-grid {
    grid-template-columns: 1fr !important;
  }
  .franchise-start-card {
    position: static !important;
  }
  .mini-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* v22: visibility bug fix
   The v21 home-specific display rule was overriding the global .hidden class.
   Keep the home page spacious, but allow JS navigation to actually hide it. */
.home-screen.hidden,
.spin-screen.hidden,
.pick-screen.hidden,
.trade-screen.hidden,
.mini-game-screen.hidden,
.result-panel.hidden,
.settings-drawer.hidden,
.records-drawer.hidden,
.mode-info-drawer.hidden {
  display: none !important;
}

#homeView.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}


/* v23: cleaner home landing page proportions
   The home page should scroll, but the hero should not eat the whole screen. */
@media (min-width: 901px) {
  .home-screen:not(.hidden) {
    height: calc(100svh - 52px) !important;
    overflow-y: auto !important;
    padding: 18px clamp(18px, 4vw, 64px) 54px !important;
    max-width: 1780px !important;
  }

  .home-hero {
    min-height: 0 !important;
    height: clamp(250px, 34vh, 330px) !important;
    grid-template-columns: minmax(0, 1.12fr) minmax(280px, .72fr) !important;
    gap: clamp(18px, 2.6vw, 38px) !important;
    padding: clamp(22px, 2.6vw, 34px) !important;
    margin: 0 0 18px !important;
    align-items: center !important;
  }

  .hero-copy {
    justify-content: center !important;
    min-width: 0 !important;
  }

  .home-hero h1 {
    font-size: clamp(44px, 5.1vw, 72px) !important;
    line-height: .93 !important;
    letter-spacing: -.065em !important;
    max-width: 780px !important;
  }

  .hero-sub {
    font-size: clamp(14px, 1.15vw, 17px) !important;
    line-height: 1.45 !important;
    max-width: 720px !important;
    margin-top: 14px !important;
  }

  .hero-actions {
    margin-top: 18px !important;
    gap: 10px !important;
  }

  .hero-actions .spin-btn,
  .hero-actions .ghost-btn {
    min-height: 46px !important;
    padding: 0 22px !important;
  }

  .hero-board {
    min-height: 0 !important;
    height: min(100%, 260px) !important;
    align-self: center !important;
    border-radius: 24px !important;
  }

  .hero-board::before {
    width: min(70%, 180px) !important;
  }

  .hero-board span,
  .hero-board strong {
    font-size: clamp(58px, 6vw, 92px) !important;
    line-height: .82 !important;
  }

  .hero-board small {
    font-size: 10px !important;
    margin-top: 8px !important;
  }

  .home-grid {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 420px) !important;
    gap: 18px !important;
  }

  .menu-section,
  .franchise-start-card {
    border-radius: 22px !important;
  }

  .menu-section { padding: 18px !important; }
  .franchise-start-card { padding: 20px !important; top: 58px !important; }

  .section-title-row {
    margin-bottom: 14px !important;
  }

  .mode-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .mode-card {
    min-height: 112px !important;
    padding: 14px !important;
    border-radius: 16px !important;
    gap: 7px !important;
  }

  .mode-card strong,
  .mini-card strong {
    font-size: 16px !important;
    line-height: 1.06 !important;
  }

  .mode-card small,
  .mini-card small {
    font-size: 12px !important;
    line-height: 1.3 !important;
  }

  .mini-games {
    margin-top: 18px !important;
  }

  .mini-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .mini-card {
    min-height: 92px !important;
    padding: 14px !important;
    border-radius: 16px !important;
  }
}

@media (min-width: 901px) and (max-width: 1320px) {
  .home-hero {
    height: auto !important;
    grid-template-columns: 1fr !important;
  }
  .hero-board {
    display: none !important;
  }
  .home-grid {
    grid-template-columns: 1fr !important;
  }
  .franchise-start-card {
    position: static !important;
  }
  .mode-grid,
  .mini-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 900px) {
  .home-hero h1 {
    font-size: clamp(38px, 12vw, 64px) !important;
  }
  .hero-board {
    min-height: 190px !important;
  }
}

/* v24: fixed pick/player list scrolling
   Keep gameplay screens in one frame, but make the player list its own scroll area.
   This prevents long team-era lists from running under the viewport with no usable scroll. */
.pick-screen:not(.hidden) {
  overflow: hidden !important;
}

.pick-screen:not(.hidden) .pick-layout {
  min-height: 0 !important;
  overflow: hidden !important;
}

.pick-screen:not(.hidden) .players-column {
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

.pick-screen:not(.hidden) .player-list {
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  scrollbar-gutter: stable !important;
  touch-action: pan-y !important;
}

@media (min-width: 901px) {
  .pick-screen:not(.hidden) {
    height: calc(100svh - 42px) !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
  }

  .pick-screen:not(.hidden) .pick-layout {
    height: 100% !important;
    max-height: 100% !important;
  }

  .pick-screen:not(.hidden) .player-list {
    flex: 1 1 auto !important;
    height: auto !important;
    max-height: none !important;
  }
}

@media (max-width: 900px) {
  .pick-screen:not(.hidden) {
    height: calc(100svh - 52px) !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
  }

  .pick-screen:not(.hidden) .pick-layout {
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .pick-screen:not(.hidden) .players-column {
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }

  .pick-screen:not(.hidden) .pick-court-wrap {
    flex: 0 0 auto !important;
  }

  .pick-screen:not(.hidden) .player-list {
    flex: 1 1 auto !important;
    height: auto !important;
    max-height: none !important;
    padding-bottom: 12px !important;
  }
}

@media (max-width: 520px) {
  .pick-screen:not(.hidden) .filters-row {
    flex: 0 0 auto !important;
  }

  .pick-screen:not(.hidden) .available-text {
    flex: 0 0 auto !important;
  }

  .pick-screen:not(.hidden) .player-row {
    padding: 12px 10px !important;
    margin-bottom: 8px !important;
  }
}

/* v25: hard player-list scroll fix
   The previous flex-only fix could fail when browser viewport math/grid rows changed.
   This gives the player list a real viewport-based scroll height and keeps the filters visible. */
.pick-screen:not(.hidden) .players-column {
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.pick-screen:not(.hidden) .player-list {
  display: block !important;
  height: calc(100dvh - 210px) !important;
  max-height: calc(100dvh - 210px) !important;
  min-height: 180px !important;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  overscroll-behavior: contain !important;
  padding-right: 8px !important;
  padding-bottom: 18px !important;
}

@supports not (height: 100dvh) {
  .pick-screen:not(.hidden) .player-list {
    height: calc(100vh - 210px) !important;
    max-height: calc(100vh - 210px) !important;
  }
}

@media (min-width: 901px) {
  .pick-screen:not(.hidden) .pick-layout {
    align-items: stretch !important;
  }

  .pick-screen:not(.hidden) .player-list {
    height: calc(100dvh - 205px) !important;
    max-height: calc(100dvh - 205px) !important;
  }
}

@media (max-width: 900px) {
  .pick-screen:not(.hidden) {
    height: auto !important;
    min-height: calc(100dvh - 52px) !important;
    overflow-y: auto !important;
  }

  .pick-screen:not(.hidden) .pick-layout {
    height: auto !important;
    overflow: visible !important;
  }

  .pick-screen:not(.hidden) .player-list {
    height: 46dvh !important;
    max-height: 46dvh !important;
    min-height: 260px !important;
  }
}

/* v26: 82-style scrollable result screen + help drawer */
#helpBtn { font-weight: 950; }
.help-drawer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.58);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 85;
  padding: 18px;
}
.help-drawer.open { display: flex; }
.help-card {
  width: min(760px, 96vw);
  max-height: min(760px, 88svh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(19,26,43,.98), rgba(9,14,27,.98));
  box-shadow: 0 34px 110px rgba(0,0,0,.55);
  padding: 22px;
}
.help-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.help-head h2 { margin: 0; font-size: clamp(28px, 4vw, 46px); letter-spacing: -.05em; }
.help-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.help-body section {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 15px;
  background: rgba(255,255,255,.045);
}
.help-body h3 { margin: 0 0 8px; font-size: 18px; }
.help-body p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 14px; }

.result-panel:not(.hidden) {
  max-width: none !important;
  margin: 0 !important;
  height: calc(100svh - 42px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 0 !important;
  scrollbar-gutter: stable;
}
.end-screen {
  width: min(860px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0 56px;
  text-align: center;
  min-height: calc(100svh - 42px);
  position: relative;
}
.end-top-actions {
  position: sticky;
  top: 10px;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  height: 0;
  pointer-events: none;
}
.end-top-actions .icon-btn { pointer-events: auto; }
.end-logo {
  width: 92px;
  height: 92px;
  object-fit: contain;
  margin: 0 auto 14px;
  display: block;
  filter: drop-shadow(0 12px 30px rgba(0,0,0,.36));
}
.end-title {
  font-size: clamp(26px, 4.2vw, 38px);
  letter-spacing: -.04em;
  margin: 0 0 22px;
}
.result-mode-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(96,165,250,.14);
  color: #60a5fa;
  border: 1px solid rgba(96,165,250,.24);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.result-label {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .22em;
  font-weight: 900;
  margin: 0 0 8px;
}
.end-record {
  font-size: clamp(62px, 11vw, 104px);
  line-height: .88;
  font-weight: 1000;
  letter-spacing: -.08em;
  margin: 0 0 12px;
  color: var(--text);
  text-wrap: balance;
}
.end-record::first-letter { letter-spacing: -.08em; }
.end-grade {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 9px;
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 900;
}
.end-grade span {
  color: #f59e0b;
  font-size: 22px;
  font-weight: 1000;
  letter-spacing: -.04em;
}
.end-grade strong { color: #fbbf24; font-size: 14px; letter-spacing: .02em; }
.end-grade small { color: var(--muted); font-size: 13px; }
.end-summary {
  max-width: 620px;
  margin: 0 auto 22px;
  color: var(--muted);
  line-height: 1.5;
}
.end-buttons {
  width: min(100%, 620px);
  margin: 0 auto 16px !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 10px !important;
}
.end-buttons .spin-btn,
.end-buttons .ghost-btn {
  min-height: 44px;
  border-radius: 8px;
}
.result-breakdown {
  width: min(100%, 620px);
  margin: 0 auto 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: left;
}
.compact-result-card {
  padding: 13px !important;
  border-radius: 14px !important;
}
.compact-result-card ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.45;
  font-size: 13px;
}
.end-lineup {
  width: min(100%, 680px);
  margin: 0 auto;
  display: flex !important;
  flex-direction: column;
  gap: 10px !important;
  overflow: visible !important;
  padding: 0 !important;
}
.end-player-card {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 14px;
  text-align: left;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--card-accent) 24%, transparent), transparent 46%),
    rgba(23, 31, 52, .92);
  border: 1px solid rgba(255,255,255,.07);
  box-shadow: 0 12px 34px rgba(0,0,0,.15);
  overflow: hidden;
}
.end-player-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20px;
  bottom: 20px;
  width: 3px;
  background: var(--card-accent);
  border-radius: 99px;
}
.end-player-badge {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--card-accent), var(--card-secondary));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.end-player-badge strong { font-size: 14px; line-height: 1; }
.end-player-badge small { font-size: 8px; line-height: 1; font-weight: 950; margin-top: -10px; }
.end-player-info { min-width: 0; }
.end-player-info strong {
  display: block;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.end-player-info span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.end-player-stats {
  display: grid;
  grid-template-columns: repeat(6, 43px);
  gap: 5px;
  text-align: center;
}
.end-player-stats b { display: block; font-size: 14px; }
.end-player-stats small { display: block; color: var(--muted); font-size: 8px; font-weight: 950; }
.end-player-rating {
  border-radius: 10px;
  padding: 3px 2px;
  background: color-mix(in srgb, var(--card-accent) 24%, rgba(255,255,255,.04));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.end-player-rating b { color: #fff; }
@media (max-width: 560px) {
  .end-player-card {
    grid-template-columns: 46px minmax(0, 1fr);
  }
  .end-player-stats {
    grid-column: 1 / -1;
    width: 100%;
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.end-totals {
  width: min(100%, 680px);
  margin: 16px auto 0;
  padding: 16px 0 4px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.end-totals span { text-align: center; }
.end-totals b { display: block; font-size: 16px; }
.end-totals small { display: block; color: var(--muted); font-size: 10px; font-weight: 950; }
.result-subhead {
  text-align: left;
  width: min(100%, 680px);
  margin: 18px auto 8px !important;
  color: var(--muted);
}
.result-footer {
  width: min(100%, 680px);
  margin: 26px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.result-footer p {
  margin: 14px 0 0;
  font-size: 11px;
  color: color-mix(in srgb, var(--muted) 75%, transparent);
}
.text-link {
  border: 0;
  background: none;
  color: #facc15;
  text-decoration: underline;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  padding: 0 2px;
}
.dot-sep { opacity: .55; padding: 0 4px; }

@media (max-width: 760px) {
  .help-body { grid-template-columns: 1fr; }
  .end-screen { width: min(100% - 20px, 680px); padding-top: 18px; }
  .end-logo { width: 74px; height: 74px; }
  .end-buttons, .result-breakdown { grid-template-columns: 1fr; }
  .end-player-card {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
    padding: 13px;
  }
  .end-player-stats {
    grid-column: 1 / -1;
    grid-template-columns: repeat(5, 1fr);
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,.06);
  }
  .end-totals { grid-template-columns: repeat(5, 1fr); font-size: 12px; }
}


.help-list {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.help-list li {
  margin: 8px 0;
}

.help-list strong {
  color: var(--text);
}

/* v28: universal overflow safety
   Every page can scroll if its content does not fit the frame.
   Internal scrollers still work, but the whole visible view is no longer trapped. */
html,
body {
  overflow-x: hidden !important;
}

body {
  overflow-y: auto !important;
  min-height: 100dvh;
}

@media (min-width: 901px) {
  body {
    overflow-y: auto !important;
  }

  .home-screen:not(.hidden),
  .spin-screen:not(.hidden),
  .pick-screen:not(.hidden),
  .trade-screen:not(.hidden),
  .mini-game-screen:not(.hidden),
  .result-panel:not(.hidden) {
    height: auto !important;
    min-height: calc(100dvh - 42px) !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-gutter: stable;
  }

  .pick-screen:not(.hidden) {
    display: block !important;
  }

  .pick-screen:not(.hidden) .pick-layout {
    height: auto !important;
    min-height: calc(100dvh - 96px) !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .pick-screen:not(.hidden) .players-column {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .pick-screen:not(.hidden) .player-list {
    height: clamp(360px, calc(100dvh - 225px), 620px) !important;
    max-height: clamp(360px, calc(100dvh - 225px), 620px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .pick-court-wrap {
    overflow: visible !important;
  }

  .trade-screen:not(.hidden) {
    display: block !important;
  }

  .trade-layout {
    overflow: visible !important;
    max-height: none !important;
  }

  .trade-offers,
  .trade-roster-card {
    max-height: calc(100dvh - 220px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .mini-game-screen:not(.hidden) {
    display: grid !important;
  }

  .mini-game-body {
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .result-panel:not(.hidden) {
    height: auto !important;
    min-height: calc(100dvh - 42px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .final-lineup,
  .end-lineup {
    overflow: visible !important;
    max-height: none !important;
  }
}

@media (max-width: 900px) {
  .home-screen:not(.hidden),
  .spin-screen:not(.hidden),
  .pick-screen:not(.hidden),
  .trade-screen:not(.hidden),
  .mini-game-screen:not(.hidden),
  .result-panel:not(.hidden) {
    height: auto !important;
    min-height: calc(100dvh - 52px) !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .pick-screen:not(.hidden) .pick-layout {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .pick-screen:not(.hidden) .player-list {
    height: 48dvh !important;
    max-height: 48dvh !important;
    min-height: 260px !important;
    overflow-y: auto !important;
  }

  .mini-game-body,
  .trade-layout,
  .final-lineup,
  .end-lineup {
    overflow: visible !important;
    max-height: none !important;
  }
}

/* v29: mouse-wheel scroll fix
   Keep pages scrollable with a mouse wheel, not only by dragging the scrollbar. */
html,
body,
.game-shell {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: auto !important;
}

.home-screen:not(.hidden),
.spin-screen:not(.hidden),
.pick-screen:not(.hidden),
.trade-screen:not(.hidden),
.mini-game-screen:not(.hidden),
.result-panel:not(.hidden),
.drawer-card {
  overscroll-behavior-y: auto !important;
}

.player-list,
.trade-offers,
.trade-roster-card,
.mini-game-body,
.records-list,
.final-lineup,
.end-lineup,
.help-content {
  overscroll-behavior-y: auto !important;
}

body.lineup-dragging {
  overflow: hidden !important;
}

/* v33: Local 5v5 play-by-play mode */
.local-switch-screen,
.live-sim-screen {
  min-height: calc(100vh - 86px);
  padding: clamp(18px, 3vw, 40px);
  overflow-y: auto;
}

.local-switch-card,
.live-sim-screen {
  max-width: 1180px;
  margin: 0 auto;
}

.local-switch-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, .96), rgba(8, 13, 28, .98));
  border: 1px solid rgba(148, 163, 184, .25);
  border-radius: 28px;
  padding: clamp(24px, 4vw, 46px);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .28);
}

.local-switch-card h1,
.live-sim-head h1 {
  margin: 6px 0 10px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: .95;
}

.local-switch-card p,
.live-sim-head p {
  color: var(--muted);
  max-width: 760px;
}

.local-switch-roster {
  margin: 24px 0;
}

.local-switch-actions,
.live-result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.local-team-card,
.live-team-panel,
.live-result-hero,
.box-score-card {
  border: 1px solid rgba(148, 163, 184, .20);
  border-radius: 24px;
  background: rgba(15, 23, 42, .72);
  padding: 20px;
}

.local-team-head,
.live-sim-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.local-team-roster,
.live-mini-roster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.local-roster-chip,
.live-player-chip {
  min-height: 78px;
  border-radius: 18px;
  padding: 12px;
  display: grid;
  gap: 4px;
  background: linear-gradient(135deg, rgba(var(--team-primary-rgb, 56,189,248), .30), rgba(var(--team-secondary-rgb, 20,184,166), .17));
  border: 1px solid rgba(var(--team-primary-rgb, 56,189,248), .45);
}

.local-roster-chip b,
.live-player-chip b {
  font-size: 22px;
  color: var(--team-accent, #fff);
}

.local-roster-chip span,
.live-player-chip em {
  color: var(--team-secondary, #22d3ee);
  font-weight: 900;
  font-style: normal;
  font-size: 12px;
}

.local-roster-chip small,
.live-player-chip small {
  color: var(--muted);
  font-weight: 800;
}

.live-sim-head {
  margin-bottom: 22px;
}

.live-matchup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 20px;
}

.live-team-panel h2 {
  margin: 6px 0 12px;
}

.versus-orb {
  align-self: center;
  width: 76px;
  height: 76px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 1000;
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  box-shadow: 0 16px 44px rgba(37, 99, 235, .25);
}

.speed-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 24px;
}

.speed-card {
  text-align: left;
  border: 1px solid rgba(148, 163, 184, .20);
  background: rgba(15, 23, 42, .78);
  color: var(--text);
  border-radius: 20px;
  padding: 18px;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.speed-card:hover,
.speed-card.featured {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, .55);
  background: linear-gradient(135deg, rgba(37, 99, 235, .28), rgba(20, 184, 166, .16));
}

.speed-card strong {
  display: block;
  font-size: 20px;
  margin-bottom: 8px;
}

.speed-card span {
  color: var(--muted);
  font-weight: 800;
}

.live-result-hero {
  text-align: center;
  margin-bottom: 16px;
}

.live-result-hero h2 {
  font-size: clamp(36px, 6vw, 72px);
  margin: 8px 0;
}

.live-scoreboard {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  border-radius: 24px;
  background: rgba(2, 6, 23, .50);
  border: 1px solid rgba(148, 163, 184, .22);
  margin: 10px auto 12px;
}

.live-scoreboard span {
  display: grid;
  gap: 2px;
}

.live-scoreboard small {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.live-scoreboard b {
  font-size: clamp(42px, 7vw, 86px);
  line-height: .9;
}

.live-scoreboard em {
  color: var(--muted);
  font-size: 40px;
  font-style: normal;
}

.quarter-score-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.quarter-score-grid article {
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 16px;
  padding: 14px;
  background: rgba(15, 23, 42, .65);
  text-align: center;
}

.quarter-score-grid small {
  color: var(--muted);
  font-weight: 900;
}

.quarter-score-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.live-sim-columns {
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(360px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.live-sim-columns h3 {
  margin: 8px 0 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 14px;
}

.box-score-card {
  margin-bottom: 12px;
  padding: 14px;
}

.box-score-card h4 {
  margin: 0 0 10px;
  font-size: 18px;
}

.box-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) repeat(5, minmax(48px, .35fr));
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid rgba(148, 163, 184, .12);
}

.box-row span {
  display: grid;
  gap: 2px;
}

.box-row small {
  color: var(--muted);
}

.box-row em {
  font-style: normal;
  font-weight: 900;
  color: var(--text);
  text-align: right;
}

.play-feed {
  max-height: min(62vh, 620px);
  overflow-y: auto;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 20px;
  background: rgba(2, 6, 23, .42);
  padding: 10px;
}

.play-feed p {
  margin: 0;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, .09);
  color: var(--muted);
}

.play-feed p.important {
  color: var(--text);
  background: rgba(56, 189, 248, .08);
  border-radius: 12px;
}

.play-feed span {
  font-weight: 1000;
  color: #60a5fa;
}

@media (max-width: 900px) {
  .live-matchup,
  .live-sim-columns,
  .speed-picker {
    grid-template-columns: 1fr;
  }

  .versus-orb {
    justify-self: center;
  }

  .box-row {
    grid-template-columns: 1fr repeat(2, minmax(48px, auto));
  }

  .box-row em:nth-of-type(n+3) {
    display: none;
  }
}

/* v34 true live sim controls */
.live-result-hero.is-live {
  border-color: rgba(34, 211, 238, .34);
  box-shadow: 0 18px 70px rgba(14, 165, 233, .12);
}

.live-progress {
  margin: 12px auto 0;
  max-width: 620px;
  border: 1px solid rgba(148, 163, 184, .20);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(2, 6, 23, .42);
  color: var(--muted);
  font-weight: 900;
}

.live-box-locked {
  text-align: center;
  min-height: 150px;
  display: grid;
  place-items: center;
  gap: 8px;
}

.live-box-locked p {
  color: var(--muted);
  font-weight: 800;
  margin: 0;
}

.live-result-actions [data-live-action] {
  min-width: 118px;
}

.play-feed:empty::before {
  content: "Press START LIVE to begin the possession feed.";
  display: block;
  padding: 18px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.play-feed p:last-child {
  outline: 1px solid rgba(34, 211, 238, .26);
  background: rgba(34, 211, 238, .08);
  border-radius: 12px;
}

/* v36: compact BasketballGM-style GameCast layout */
.local-switch-card {
  max-width: 1180px;
}
.local-switch-actions .ai-opponent-btn,
#startAiOpponentBtn {
  background: linear-gradient(135deg, #22c55e, #2563eb) !important;
  border-color: rgba(34, 197, 94, .48) !important;
  color: #fff !important;
}
.live-sim-screen {
  max-width: 1480px;
  padding: 18px clamp(12px, 2vw, 28px) 34px !important;
}
.live-sim-head {
  margin-bottom: 12px !important;
  padding: 0 2px;
}
.live-sim-head h1 {
  font-size: clamp(24px, 3.2vw, 42px) !important;
  line-height: 1.02 !important;
}
.live-sim-head p {
  margin: 4px 0 0;
}
.live-matchup {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  margin-bottom: 12px !important;
}
.live-team-panel {
  padding: 14px !important;
  border-radius: 18px !important;
}
.live-team-panel h2 {
  font-size: 20px;
}
.live-mini-roster {
  grid-template-columns: repeat(5, minmax(88px, 1fr)) !important;
  gap: 8px !important;
}
.live-player-chip {
  min-height: 62px !important;
  border-radius: 14px !important;
  padding: 8px !important;
}
.live-player-chip b {
  font-size: 18px !important;
}
.live-player-chip small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.versus-orb {
  width: 54px !important;
  height: 54px !important;
}
.speed-picker {
  margin-top: 12px !important;
}
.speed-card {
  padding: 14px !important;
  border-radius: 16px !important;
}
.speed-card strong {
  font-size: 17px !important;
}
.gamecast-shell {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(15, 23, 42, .84), rgba(2, 6, 23, .66));
  box-shadow: 0 18px 55px rgba(0,0,0,.18);
  padding: 14px;
}
.gamecast-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.gamecast-team {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 16px;
  background: rgba(2, 6, 23, .38);
}
.gamecast-team.team-b {
  justify-content: flex-end;
  text-align: right;
}
.gamecast-team div {
  min-width: 0;
}
.gamecast-team small {
  display: block;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
}
.gamecast-team strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(16px, 2vw, 24px);
}
.gamecast-team b {
  font-size: clamp(34px, 4.4vw, 56px);
  line-height: .9;
  color: #fff;
  text-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.gamecast-logo {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 1000;
  color: #fff;
  background: linear-gradient(135deg, #0ea5e9, #1d4ed8);
  border: 1px solid rgba(255,255,255,.20);
}
.gamecast-center {
  min-width: 170px;
  text-align: center;
  padding: 8px 12px;
  border-radius: 18px;
  background: rgba(15, 23, 42, .60);
  border: 1px solid rgba(148, 163, 184, .14);
}
.gamecast-center h2 {
  margin: 2px 0 4px;
  font-size: clamp(20px, 3vw, 32px);
}
#liveClock {
  display: inline-block;
  font-weight: 1000;
  color: #bfdbfe;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(96, 165, 250, .12);
}
.gamecast-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 16px;
  background: rgba(2, 6, 23, .30);
}
.gamecast-controls .spin-btn,
.gamecast-controls .ghost-btn {
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 13px;
}
.gamecast-jump-select {
  min-height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, .22);
  background: rgba(15, 23, 42, .92);
  color: var(--text);
  padding: 0 12px;
  font-weight: 900;
}
.gamecast-score-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.gamecast-score-strip article {
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 14px;
  padding: 8px;
  background: rgba(15, 23, 42, .50);
  text-align: center;
}
.gamecast-score-strip small {
  color: var(--muted);
  font-weight: 1000;
}
.gamecast-score-strip strong {
  display: block;
  font-size: 18px;
}
.gamecast-body {
  display: grid;
  grid-template-columns: minmax(540px, 1.2fr) minmax(360px, .8fr);
  gap: 12px;
  align-items: start;
}
.gamecast-table-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 8px;
}
.gamecast-table-head h3,
.gamecast-right h3 {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 13px;
}
#liveProgressText {
  color: #93c5fd;
  font-weight: 900;
  font-size: 12px;
}
.gamecast-box-wrap {
  display: grid;
  gap: 10px;
}
.gamecast-box-card {
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(2, 6, 23, .34);
}
.gamecast-box-card h4 {
  margin: 0;
  padding: 10px 12px;
  color: var(--team-secondary, #f97316);
  border-bottom: 1px solid rgba(148, 163, 184, .12);
}
.gamecast-box-header,
.gamecast-box-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.4fr) 54px repeat(5, minmax(42px, .32fr));
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
}
.gamecast-box-header {
  color: var(--muted);
  font-weight: 1000;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: rgba(15, 23, 42, .48);
}
.gamecast-box-row {
  border-top: 1px solid rgba(148, 163, 184, .08);
  min-height: 38px;
}
.gamecast-box-row span {
  font-weight: 900;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gamecast-box-row em,
.gamecast-box-row b,
.gamecast-box-header em {
  text-align: center;
  font-style: normal;
}
.gamecast-right {
  min-width: 0;
}
.gamecast-feed {
  height: min(60vh, 520px) !important;
  max-height: none !important;
  margin-top: 8px;
}
.gamecast-feed p {
  grid-template-columns: 76px 1fr !important;
  padding: 9px 10px !important;
}
.gamecast-pog {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 800;
}
@media (max-width: 1050px) {
  .gamecast-top,
  .gamecast-body,
  .live-matchup,
  .speed-picker {
    grid-template-columns: 1fr !important;
  }
  .gamecast-team.team-b {
    justify-content: flex-start;
    text-align: left;
  }
  .gamecast-team.team-b b {
    order: 3;
    margin-left: auto;
  }
  .gamecast-feed {
    height: 360px !important;
  }
  .live-mini-roster {
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)) !important;
  }
}
@media (max-width: 700px) {
  .gamecast-box-header,
  .gamecast-box-row {
    grid-template-columns: minmax(130px, 1fr) 42px 42px 42px 42px;
  }
  .gamecast-box-header em:nth-of-type(n+5),
  .gamecast-box-row b:nth-of-type(n+4) {
    display: none;
  }
  .gamecast-score-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* v37: compact BasketballGM-style live sim + current-franchise logo badges */
.team-logo-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-weight: 1000;
  font-size: 11px;
  letter-spacing: -0.04em;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.32), transparent 32%),
    linear-gradient(135deg, var(--logo-primary, #2563eb), var(--logo-secondary, #14b8a6));
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 8px 18px rgba(0,0,0,.18);
  flex: 0 0 auto;
}
.team-logo-badge span { transform: translateY(.5px); }
.team-logo-badge.score-logo { width: 38px; height: 38px; font-size: 12px; }
.team-logo-badge.box-logo { width: 24px; height: 24px; font-size: 8px; margin-right: 8px; }
.team-logo-badge.mini-logo { width: 22px; height: 22px; font-size: 7px; }

.live-sim-screen.gamecast-mode {
  gap: 8px !important;
  padding-top: 12px !important;
}
.live-sim-screen.gamecast-mode .live-sim-head {
  display: none !important;
}
.live-sim-screen.gamecast-mode .live-matchup,
.live-sim-screen.gamecast-mode .speed-picker {
  display: none !important;
}

.live-team-panel.compact-preview {
  padding: 14px !important;
}
.live-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.live-preview-head strong {
  font-size: 18px;
}
.compact-vs {
  width: 48px !important;
  height: 48px !important;
  font-size: 16px !important;
}

.gamecast-shell.compact-gamecast {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 12px 12px;
  border-radius: 14px;
  background: #161b22;
  border: 1px solid rgba(148, 163, 184, .14);
  box-shadow: none;
}
.gamecast-scorebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.gamecast-score-team {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(2, 6, 23, .36);
  border: 1px solid rgba(148, 163, 184, .16);
  border-left: 3px solid var(--logo-primary, #60a5fa);
}
.gamecast-score-team.team-b {
  justify-content: flex-end;
  text-align: right;
  border-left: 1px solid rgba(148, 163, 184, .16);
  border-right: 3px solid var(--logo-primary, #60a5fa);
}
.gamecast-score-team div { min-width: 0; }
.gamecast-score-team strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 18px;
  line-height: 1.05;
}
.gamecast-score-team small {
  display: block;
  color: var(--muted);
  font-weight: 900;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.gamecast-score-team b {
  margin-left: auto;
  font-size: 38px;
  line-height: .9;
  color: #fff;
}
.gamecast-score-team.team-b b {
  margin: 0 auto 0 0;
}
.gamecast-status {
  text-align: center;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, .16);
  background: rgba(2, 6, 23, .42);
  padding: 7px 10px;
}
.gamecast-status span {
  display: inline-block;
  color: #bfdbfe;
  font-weight: 1000;
  font-size: 13px;
}
.gamecast-status strong {
  display: block;
  color: #fff;
  font-size: 16px;
  line-height: 1.1;
  margin: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gamecast-status small {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 900;
  font-size: 10px;
}
.compact-controls.gamecast-controls {
  margin: 6px 0;
  padding: 6px;
  border-radius: 10px;
  justify-content: center;
  gap: 6px;
}
.compact-controls .spin-btn,
.compact-controls .ghost-btn,
.compact-controls .gamecast-jump-select {
  min-height: 30px !important;
  height: 30px;
  padding: 4px 10px !important;
  font-size: 11px !important;
  border-radius: 8px !important;
}
.compact-strip.gamecast-score-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 6px 0 8px;
}
.compact-strip.gamecast-score-strip article {
  padding: 5px 6px;
  border-radius: 9px;
}
.compact-strip.gamecast-score-strip small { font-size: 10px; }
.compact-strip.gamecast-score-strip strong { font-size: 14px; }
.compact-body.gamecast-body {
  grid-template-columns: minmax(620px, 1.35fr) minmax(320px, .65fr);
  gap: 10px;
}
.gamecast-table-head {
  margin-bottom: 5px !important;
}
.gamecast-table-head h3,
.gamecast-right h3 {
  font-size: 11px !important;
}
#liveProgressText {
  font-size: 11px !important;
}
.gamecast-box-wrap {
  gap: 8px !important;
}
.gamecast-box-card.compact-box {
  border-radius: 8px;
  background: rgba(5, 8, 16, .40);
}
.gamecast-box-card.compact-box h4 {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 6px 8px;
  font-size: 14px;
  color: #fff;
  background: rgba(15, 23, 42, .54);
}
.gamecast-box-card.compact-box .gamecast-box-header,
.gamecast-box-card.compact-box .gamecast-box-row {
  grid-template-columns: minmax(150px, 1.2fr) 44px repeat(5, minmax(34px, .28fr));
  gap: 5px;
  padding: 5px 8px;
}
.gamecast-box-card.compact-box .gamecast-box-header {
  font-size: 10px;
  letter-spacing: .06em;
}
.gamecast-box-card.compact-box .gamecast-box-row {
  min-height: 28px;
  font-size: 12px;
}
.gamecast-box-card.compact-box .gamecast-box-row span {
  font-size: 12px;
}
.gamecast-box-card.compact-box .gamecast-box-row em,
.gamecast-box-card.compact-box .gamecast-box-row b {
  font-size: 12px;
}
.gamecast-feed {
  height: min(50vh, 440px) !important;
  border-radius: 8px !important;
  margin-top: 6px !important;
}
.gamecast-feed p {
  grid-template-columns: 64px 1fr !important;
  padding: 7px 8px !important;
  font-size: 12px !important;
}
.gamecast-pog {
  font-size: 12px;
  margin-top: 7px !important;
}
.live-player-chip .mini-logo {
  display: none;
}

@media (max-width: 1100px) {
  .gamecast-scorebar,
  .compact-body.gamecast-body {
    grid-template-columns: 1fr !important;
  }
  .gamecast-score-team.team-b {
    justify-content: flex-start;
    text-align: left;
    border-right: 1px solid rgba(148, 163, 184, .16);
    border-left: 3px solid var(--logo-primary, #60a5fa);
  }
  .gamecast-score-team.team-b b {
    margin-left: auto;
    margin-right: 0;
    order: 3;
  }
  .gamecast-feed { height: 320px !important; }
}
@media (max-width: 700px) {
  .gamecast-shell.compact-gamecast { padding: 8px; border-radius: 10px; }
  .gamecast-score-team b { font-size: 30px; }
  .gamecast-score-team strong { font-size: 15px; }
  .gamecast-box-card.compact-box .gamecast-box-header,
  .gamecast-box-card.compact-box .gamecast-box-row {
    grid-template-columns: minmax(120px, 1fr) 38px 36px 36px 36px;
  }
  .gamecast-box-card.compact-box .gamecast-box-header em:nth-of-type(n+5),
  .gamecast-box-card.compact-box .gamecast-box-row b:nth-of-type(n+4) {
    display: none;
  }
}

/* v38: expanded compact GameCast box score */
.gamecast-box-card.compact-box.v38-box {
  overflow: hidden;
}
.gamecast-box-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.gamecast-box-card.compact-box.v38-box .v38-box-row {
  grid-template-columns: minmax(180px, 1.35fr) 42px 48px 46px 46px 46px 44px 44px 46px 46px 48px 46px 46px 48px 46px 46px 48px 48px 42px !important;
  min-width: 1120px;
  gap: 5px;
}
.gamecast-box-card.compact-box.v38-box .gamecast-box-header.v38-box-row {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(15, 23, 42, .92) !important;
}
.gamecast-box-card.compact-box.v38-box .gamecast-box-row.v38-box-row {
  min-height: 27px;
}
.gamecast-box-card.compact-box.v38-box .gamecast-box-row span {
  white-space: nowrap;
}
.gamecast-box-card.compact-box.v38-box .gamecast-box-row em,
.gamecast-box-card.compact-box.v38-box .gamecast-box-row b,
.gamecast-box-card.compact-box.v38-box .gamecast-box-header em {
  font-variant-numeric: tabular-nums;
}
@media (max-width: 700px) {
  .gamecast-box-card.compact-box.v38-box .v38-box-row {
    grid-template-columns: minmax(155px, 1.2fr) 38px 44px 42px 42px 42px 40px 40px 42px 42px 46px 42px 42px 46px 42px 42px 46px 44px 40px !important;
    min-width: 980px;
  }
  .gamecast-box-card.compact-box.v38-box .gamecast-box-header em:nth-of-type(n+5),
  .gamecast-box-card.compact-box.v38-box .gamecast-box-row b:nth-of-type(n+4) {
    display: block !important;
  }
}

/* v39: custom current-franchise SVG badges + stricter 5v5 roster display */
.team-logo-badge.has-team-svg {
  overflow: hidden;
  background: transparent;
  border: 0;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}
.team-logo-badge.has-team-svg img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.team-logo-badge.has-team-svg span {
  display: none;
  width: 100%;
  height: 100%;
  place-items: center;
  border-radius: inherit;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.32), transparent 32%),
    linear-gradient(135deg, var(--logo-primary, #2563eb), var(--logo-secondary, #14b8a6));
  border: 1px solid rgba(255,255,255,.28);
}
.live-player-chip .team-logo-badge.mini-logo {
  margin-right: 3px;
}

/* v40/v41: team-logo display with local PNG and SVG fallback */
.team-logo-badge.official-logo {
  background: rgba(255,255,255,.03);
  border: 0;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}
.team-logo-badge.official-logo img {
  padding: 1px;
}
.team-logo-badge.official-logo.score-logo img { padding: 0; }
.team-logo-badge.official-logo.box-logo img,
.team-logo-badge.official-logo.mini-logo img { padding: 0; }


/* v41: local transparent PNG team logos */
.team-logo-badge.local-logo img {
  object-fit: contain;
  max-width: 100%;
  max-height: 100%;
}
.team-logo-badge.local-logo.score-logo img {
  width: 100%;
  height: 100%;
}
.team-logo-badge.local-logo.box-logo img,
.team-logo-badge.local-logo.mini-logo img {
  width: 100%;
  height: 100%;
}

/* v43: full mobile usability pass
   - Every page can scroll naturally on phones.
   - Mobile layouts stack instead of overflowing.
   - GameCast becomes compact and BasketballGM-like on small screens.
   - Tables scroll horizontally inside their own containers.
*/
html,
body {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: auto;
}
body {
  touch-action: pan-y;
}
.game-shell,
#homeView,
#spinView,
#pickView,
#tradeView,
#miniGameView,
#localSwitchView,
#liveSimView,
#resultView {
  max-width: 100%;
  overflow-x: hidden;
}
img, svg, canvas, video { max-width: 100%; }
button, input, select { max-width: 100%; }

@media (max-width: 900px) {
  body {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
  }
  .topbar {
    height: auto !important;
    min-height: 52px;
    padding: 7px 10px !important;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 500;
  }
  .brand-row {
    min-width: 0;
    gap: 8px;
  }
  .logo-home {
    flex: 0 0 auto;
  }
  #roundLabel {
    min-width: 0;
    max-width: 46vw;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 15px !important;
  }
  .top-actions {
    flex: 0 0 auto;
    gap: 5px !important;
  }
  .icon-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px;
    border-radius: 10px !important;
  }

  /* Home/menu */
  .home-screen:not(.hidden) {
    display: block !important;
    width: 100%;
    max-width: none !important;
    padding: 12px 10px max(34px, env(safe-area-inset-bottom)) !important;
    overflow: visible !important;
  }
  .home-hero {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 18px !important;
    min-height: 0 !important;
    border-radius: 20px !important;
  }
  .home-hero h1 {
    max-width: none !important;
    font-size: clamp(34px, 12vw, 54px) !important;
    line-height: .95 !important;
    letter-spacing: -.06em !important;
  }
  .hero-sub {
    max-width: none !important;
    font-size: 14px !important;
    line-height: 1.45 !important;
  }
  .hero-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
  }
  .hero-actions .spin-btn,
  .hero-actions .ghost-btn {
    width: 100%;
    min-width: 0 !important;
    min-height: 44px;
    padding: 10px 8px !important;
    font-size: 13px !important;
    border-radius: 12px !important;
  }
  .hero-board {
    min-height: 130px !important;
    padding: 18px !important;
    border-radius: 18px !important;
  }
  .hero-board span,
  .hero-board strong {
    font-size: clamp(48px, 18vw, 82px) !important;
  }
  .home-grid,
  .mode-grid,
  .mini-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .home-grid {
    margin-top: 12px !important;
  }
  .menu-section,
  .franchise-start-card {
    padding: 16px !important;
    border-radius: 18px !important;
    min-height: 0 !important;
  }
  .section-title-row {
    gap: 10px;
    align-items: flex-start !important;
    flex-direction: column;
  }
  .section-title-row h2,
  .franchise-start-card h2 {
    font-size: 24px !important;
    line-height: 1.05 !important;
  }
  .mode-card,
  .mini-card {
    min-height: 104px !important;
    padding: 14px !important;
    border-radius: 14px !important;
    text-align: left;
  }
  .mode-card strong,
  .mini-card strong {
    font-size: 18px !important;
  }
  .franchise-start-card select,
  .franchise-start-card .spin-btn {
    width: 100%;
    min-height: 46px;
  }

  /* Spin and draft screens */
  .spin-screen:not(.hidden),
  .pick-screen:not(.hidden),
  .trade-screen:not(.hidden),
  .mini-game-screen:not(.hidden),
  .local-switch-screen:not(.hidden),
  .live-sim-screen:not(.hidden),
  .result-panel:not(.hidden) {
    display: block !important;
    width: 100%;
    overflow: visible !important;
  }
  .spin-screen:not(.hidden) {
    padding: 14px 10px 34px !important;
    margin: 0 !important;
  }
  .spin-side {
    align-items: center !important;
    padding-top: 8px;
  }
  .tiles-row {
    width: 100% !important;
    gap: 14px !important;
  }
  .spin-tile {
    width: calc(50vw - 28px) !important;
    max-width: 160px !important;
    height: 82px !important;
  }
  .tile-labels {
    width: min(100%, 334px) !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 14px !important;
  }
  .prompt-text {
    max-width: 94vw !important;
  }
  .court,
  .pick-court-wrap .court {
    width: min(94vw, 380px) !important;
    min-width: 0 !important;
  }
  .court-wrap {
    width: 100%;
    max-width: 100%;
  }

  .rolled-strip {
    position: sticky !important;
    top: 52px !important;
    width: 100% !important;
    max-width: none !important;
    padding: 8px 10px !important;
    z-index: 350 !important;
  }
  .rolled-pills {
    min-width: 0;
  }
  .rolled-pill {
    min-width: 0 !important;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .respin-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .respin-btn {
    min-height: 40px !important;
    justify-content: center;
  }
  .pick-layout {
    width: 100% !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    padding: 10px 10px 28px !important;
  }
  .players-column,
  .pick-court-wrap {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }
  .players-column { order: 1 !important; }
  .pick-court-wrap {
    order: 2 !important;
    position: static !important;
    background: transparent !important;
    padding: 4px 0 18px !important;
    margin: 0 !important;
  }
  .filters-row {
    position: sticky !important;
    top: 108px !important;
    z-index: 320 !important;
    display: grid !important;
    grid-template-columns: 1fr 92px !important;
    gap: 8px !important;
    padding: 8px 0 !important;
  }
  .tab-row {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
  }
  .tab,
  #searchInput,
  #sortSelect {
    min-height: 44px !important;
  }
  .available-text {
    margin: 4px 0 8px !important;
  }
  .player-list {
    height: min(58svh, 560px) !important;
    max-height: none !important;
    min-height: 280px !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px !important;
    padding-bottom: 14px !important;
  }
  .player-row {
    padding: 12px !important;
    margin-bottom: 9px !important;
    border-radius: 13px !important;
  }
  .player-main {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  .stats-mini {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 4px !important;
  }
  .stats-mini b { font-size: 14px !important; }

  /* On mobile, allow page panning on empty court space. Drag still works from filled slots. */
  .court,
  .court * {
    touch-action: pan-y !important;
  }
  .court-slot.filled,
  .bench-slot.filled,
  .court-slot.filled *,
  .bench-slot.filled * {
    touch-action: none !important;
  }
  .bench-zone {
    width: min(94vw, 380px) !important;
    min-width: 0 !important;
  }

  /* Trade / mini-game / local switch */
  .trade-screen,
  .mini-game-screen,
  .local-switch-screen,
  .live-sim-screen {
    padding: 12px 10px 34px !important;
  }
  .trade-head,
  .mini-game-head,
  .live-sim-head {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    text-align: left !important;
  }
  .trade-head h1,
  .mini-game-head h1,
  .live-sim-head h1,
  .local-switch-card h1 {
    font-size: clamp(32px, 10vw, 48px) !important;
    line-height: 1 !important;
  }
  .trade-layout,
  .mini-answer-grid,
  .comparison-grid,
  .live-matchup,
  .speed-picker {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .trade-offers,
  .trade-roster-card,
  .mini-game-body {
    max-width: 100% !important;
    overflow-x: hidden;
  }
  .mini-card-choice,
  .comparison-card,
  .stat-card,
  .answer-card,
  .speed-card {
    min-width: 0 !important;
    padding: 14px !important;
    border-radius: 16px !important;
  }
  .career-path-row {
    display: flex !important;
    overflow-x: auto !important;
    gap: 8px !important;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .career-team-pill {
    flex: 0 0 auto !important;
    font-size: clamp(24px, 9vw, 42px) !important;
    padding: 12px 16px !important;
  }
  .local-switch-card {
    padding: 16px !important;
    border-radius: 18px !important;
  }
  .local-switch-roster {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
    gap: 8px !important;
  }
  .local-switch-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  .local-switch-actions .spin-btn,
  .local-switch-actions .ghost-btn {
    width: 100%;
  }

  /* Results / records / help */
  .result-panel {
    padding: 12px 10px 34px !important;
  }
  .end-screen {
    width: 100% !important;
    padding: 18px 12px 28px !important;
    border-radius: 18px !important;
  }
  .end-title { font-size: 24px !important; }
  .end-record { font-size: clamp(54px, 18vw, 88px) !important; }
  .result-buttons,
  .end-buttons,
  .result-breakdown {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .final-lineup.end-lineup {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }
  .lineup-card,
  .end-player-card {
    min-width: 0 !important;
  }
  .end-totals {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .records-drawer,
  .help-drawer,
  .settings-drawer,
  .mode-info-drawer {
    align-items: stretch !important;
    justify-content: stretch !important;
  }
  .records-card,
  .help-card,
  .drawer-card,
  .mode-info-card {
    width: 100vw !important;
    max-width: none !important;
    height: 100svh !important;
    max-height: 100svh !important;
    border-radius: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .help-body {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 700px) {
  /* Compact mobile GameCast */
  .live-sim-screen.gamecast-mode {
    padding: 8px 6px max(24px, env(safe-area-inset-bottom)) !important;
  }
  .gamecast-shell.compact-gamecast,
  .gamecast-shell {
    width: 100% !important;
    max-width: none !important;
    padding: 8px !important;
    border-radius: 10px !important;
    overflow: visible !important;
  }
  .gamecast-scorebar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }
  .gamecast-score-team,
  .gamecast-score-team.team-b {
    min-height: 54px !important;
    padding: 7px 8px !important;
    gap: 7px !important;
    border-radius: 9px !important;
    justify-content: flex-start !important;
    text-align: left !important;
    border-left: 3px solid var(--logo-primary, #60a5fa) !important;
    border-right: 1px solid rgba(148, 163, 184, .16) !important;
  }
  .gamecast-score-team strong {
    font-size: 15px !important;
  }
  .gamecast-score-team small {
    font-size: 9px !important;
  }
  .gamecast-score-team b,
  .gamecast-score-team.team-b b {
    margin-left: auto !important;
    margin-right: 0 !important;
    order: 3 !important;
    font-size: 30px !important;
  }
  .team-logo-badge.score-logo {
    width: 30px !important;
    height: 30px !important;
  }
  .gamecast-status {
    order: -1;
    padding: 7px 8px !important;
  }
  .gamecast-status strong {
    font-size: 14px !important;
  }
  .compact-controls.gamecast-controls,
  .gamecast-controls {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    gap: 6px !important;
    padding: 6px !important;
    -webkit-overflow-scrolling: touch;
  }
  .compact-controls .spin-btn,
  .compact-controls .ghost-btn,
  .compact-controls .gamecast-jump-select,
  .gamecast-controls .spin-btn,
  .gamecast-controls .ghost-btn,
  .gamecast-jump-select {
    flex: 0 0 auto !important;
    min-width: max-content !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
  }
  .compact-strip.gamecast-score-strip,
  .gamecast-score-strip {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }
  .compact-body.gamecast-body,
  .gamecast-body {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .gamecast-box-wrap,
  .gamecast-box-card,
  .gamecast-box-scroll {
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .gamecast-box-scroll {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .gamecast-box-card.compact-box.v38-box .v38-box-row {
    min-width: 960px !important;
  }
  .gamecast-feed {
    height: 300px !important;
    max-height: 45svh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .gamecast-feed p {
    grid-template-columns: 58px 1fr !important;
    font-size: 12px !important;
  }
}

@media (max-width: 430px) {
  .topbar {
    padding: 6px 8px !important;
  }
  #roundLabel { max-width: 38vw; font-size: 13px !important; }
  .top-actions { gap: 4px !important; }
  .icon-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    font-size: 13px;
  }
  .logo-home { width: 34px !important; height: 34px !important; }
  .hero-actions {
    grid-template-columns: 1fr !important;
  }
  .home-hero h1 {
    font-size: clamp(31px, 13vw, 46px) !important;
  }
  .filters-row {
    top: 98px !important;
  }
  .rolled-strip {
    top: 46px !important;
  }
  .player-list {
    height: min(55svh, 520px) !important;
    min-height: 260px !important;
  }
  .court,
  .pick-court-wrap .court {
    width: min(94vw, 330px) !important;
  }
  .court-slot { width: 48px !important; height: 48px !important; }
  .slot-pg { left: calc(50% - 24px) !important; }
  .end-record { font-size: clamp(46px, 20vw, 70px) !important; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .topbar { position: sticky !important; }
  .home-hero {
    grid-template-columns: 1.2fr .8fr !important;
  }
  .hero-board { min-height: 110px !important; }
  .pick-layout {
    display: grid !important;
    grid-template-columns: minmax(330px, 1fr) minmax(300px, .8fr) !important;
    align-items: start !important;
  }
  .pick-court-wrap {
    position: sticky !important;
    top: 58px !important;
  }
  .player-list {
    height: calc(100svh - 190px) !important;
    min-height: 220px !important;
  }
  .filters-row,
  .rolled-strip { position: static !important; }
}

/* v46 - Global update log footer + page */
.update-log-screen.hidden { display: none !important; }
.update-log-screen:not(.hidden) {
  display: block;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 24px;
}
.update-log-page {
  display: grid;
  gap: 18px;
}
.update-log-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    radial-gradient(circle at top left, rgba(96,165,250,.18), transparent 40%),
    linear-gradient(135deg, rgba(20,184,166,.12), rgba(17,24,39,.96));
  box-shadow: var(--shadow);
}
.update-log-hero h1 {
  margin: 4px 0 12px;
  font-size: clamp(38px, 7vw, 78px);
  line-height: .92;
  letter-spacing: -.07em;
}
.update-log-hero p:last-child {
  max-width: 820px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
  margin: 0;
}
.update-log-list {
  display: grid;
  gap: 12px;
}
.update-entry {
  position: relative;
  padding: 20px 22px 20px 98px;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,.045), rgba(255,255,255,.018));
  overflow: hidden;
}
.update-entry.latest {
  border-color: rgba(20,184,166,.45);
  background: linear-gradient(135deg, rgba(20,184,166,.16), rgba(47,125,255,.08));
}
.version-pill {
  position: absolute;
  left: 18px;
  top: 20px;
  width: 56px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--purple));
  font-weight: 950;
  font-size: 14px;
  letter-spacing: .02em;
  box-shadow: inset 0 -5px rgba(0,0,0,.22);
}
.update-entry h2 {
  margin: 0 0 8px;
  font-size: 23px;
  letter-spacing: -.025em;
}
.update-entry ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.48;
}
.global-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 12px auto 24px;
  padding: 16px 0 max(16px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
}
.update-log-button {
  border: 1px solid rgba(96,165,250,.35);
  border-radius: 999px;
  color: var(--text);
  background: linear-gradient(135deg, rgba(47,125,255,.22), rgba(20,184,166,.18));
  padding: 12px 18px;
  font-weight: 900;
  letter-spacing: .02em;
  box-shadow: 0 14px 36px rgba(0,0,0,.22);
}
.update-log-button:hover {
  border-color: rgba(96,165,250,.7);
  transform: translateY(-1px);
}
.light .update-entry,
.light .update-log-hero {
  background: rgba(255,255,255,.92);
}
@media (max-width: 760px) {
  .update-log-screen:not(.hidden) {
    width: min(100% - 18px, 1180px);
    padding-top: 18px;
  }
  .update-log-hero {
    display: grid;
    padding: 22px;
    border-radius: 20px;
  }
  .update-log-hero h1 {
    font-size: clamp(38px, 12vw, 56px);
  }
  .update-entry {
    padding: 18px;
  }
  .version-pill {
    position: static;
    margin-bottom: 10px;
  }
  .global-footer {
    width: min(100% - 18px, 1180px);
  }
  .update-log-button {
    width: 100%;
  }
}

/* v51 Free Agency quick-start rail */
.quick-start-stack {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 66px;
}
.quick-start-stack .franchise-start-card {
  position: static !important;
  top: auto !important;
}
.free-agency-start-card {
  border-color: rgba(20,184,166,.35);
  background:
    radial-gradient(circle at 88% 10%, rgba(20,184,166,.14), transparent 36%),
    rgba(255,255,255,.045);
}
@media (max-width: 900px) {
  .quick-start-stack {
    position: static !important;
    top: auto !important;
  }
}

/* v52 - Mobile gameplay layout patch
   Keeps every game mode playable on phone widths, especially Free Agency, Classic, Pick, results, trade, and 5v5 screens. */
html, body { max-width: 100%; overflow-x: hidden !important; }
body { min-width: 0; }
.game-shell { width: 100%; max-width: 100%; overflow-x: clip !important; }

@media (max-width: 760px) {
  .topbar {
    height: 48px !important;
    min-height: 48px !important;
    padding: 5px 7px !important;
    gap: 7px !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
  }
  .brand-row {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    gap: 7px !important;
  }
  .logo-home {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    border-radius: 9px !important;
  }
  #roundLabel {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    font-size: 13px !important;
    line-height: 1.05 !important;
  }
  .top-actions {
    flex: 0 0 auto !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 3px !important;
    max-width: 58vw !important;
    overflow-x: auto !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .top-actions::-webkit-scrollbar { display: none; }
  .top-actions .icon-btn,
  .icon-btn {
    width: 31px !important;
    height: 31px !important;
    min-width: 31px !important;
    min-height: 31px !important;
    border-radius: 9px !important;
    font-size: 13px !important;
    padding: 0 !important;
  }

  .home-screen:not(.hidden),
  .spin-screen:not(.hidden),
  .pick-screen:not(.hidden),
  .trade-screen:not(.hidden),
  .mini-game-screen:not(.hidden),
  .local-switch-screen:not(.hidden),
  .live-sim-screen:not(.hidden),
  .result-panel:not(.hidden),
  .update-log-screen:not(.hidden) {
    width: 100% !important;
    max-width: 100% !important;
    min-height: calc(100dvh - 48px) !important;
    overflow-x: hidden !important;
  }

  .spin-screen:not(.hidden) {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    padding: 12px 10px max(24px, env(safe-area-inset-bottom)) !important;
    margin: 0 auto !important;
    align-items: start !important;
  }
  .spin-side {
    width: 100% !important;
    min-height: 0 !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding-top: 4px !important;
  }
  .tiles-row {
    width: min(100%, 430px) !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }
  .spin-tile {
    width: 100% !important;
    max-width: none !important;
    height: clamp(72px, 21vw, 88px) !important;
    border-radius: 12px !important;
  }
  .spin-tile::before { inset: -8px !important; border-radius: 13px !important; }
  .spin-tile span { font-size: clamp(27px, 10vw, 40px) !important; }
  .tile-labels {
    width: min(100%, 430px) !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
    margin: 14px 0 12px !important;
  }
  .spin-btn {
    width: min(100%, 430px) !important;
    min-height: 50px !important;
    padding: 12px 16px !important;
    border-radius: 12px !important;
  }
  .prompt-text {
    width: min(100%, 430px) !important;
    max-width: 430px !important;
    margin: 12px auto 0 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    text-align: center !important;
  }
  .court-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }
  .court,
  .pick-court-wrap .court {
    width: min(90vw, 330px) !important;
    min-width: 0 !important;
    max-width: 330px !important;
    border-radius: 16px 16px 0 0 !important;
  }
  .court-slot {
    width: clamp(46px, 13vw, 54px) !important;
    height: clamp(46px, 13vw, 54px) !important;
    border-radius: 12px !important;
    font-size: 12px !important;
  }
  .slot-pg { left: calc(50% - clamp(23px, 6.5vw, 27px)) !important; }
  .slot-c { left: 28% !important; }
  .slot-pf { right: 28% !important; }
  .slot-sf { left: 5.5% !important; }
  .slot-sg { right: 5.5% !important; }
  .court-hint {
    width: min(90vw, 330px) !important;
    max-width: 330px !important;
    margin-top: 10px !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  .rolled-strip {
    top: 48px !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 8px 10px !important;
    gap: 8px !important;
    overflow: hidden !important;
  }
  .rolled-pills { width: 100% !important; min-width: 0 !important; }
  .rolled-pill { max-width: 40vw !important; min-height: 34px !important; padding: 7px 10px !important; }
  .respin-actions { width: 100% !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 7px !important; }
  .respin-btn { min-width: 0 !important; min-height: 36px !important; padding: 7px 8px !important; }
  .pick-layout {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 10px max(28px, env(safe-area-inset-bottom)) !important;
    gap: 12px !important;
    overflow: visible !important;
  }
  .filters-row {
    top: 104px !important;
    grid-template-columns: 1fr 88px !important;
    width: 100% !important;
  }
  .player-list {
    height: min(55dvh, 520px) !important;
    min-height: 260px !important;
    max-height: none !important;
  }
  .stats-mini { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  .bench-zone { width: min(90vw, 330px) !important; max-width: 330px !important; }

  .trade-head,
  .trade-layout,
  .mini-game-head,
  .live-sim-head,
  .live-matchup,
  .speed-picker,
  .result-breakdown,
  .final-lineup.end-lineup,
  .end-buttons,
  .result-buttons {
    grid-template-columns: 1fr !important;
  }
  .trade-screen,
  .mini-game-screen,
  .local-switch-screen,
  .live-sim-screen,
  .result-panel {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  .end-screen,
  .trade-head,
  .trade-roster-card,
  .local-switch-card,
  .live-sim-head {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 18px !important;
  }
  .mini-game-body,
  .trade-offers,
  .trade-roster-card,
  .final-lineup,
  .end-lineup {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  .lineup-card,
  .end-player-card,
  .trade-offer-card,
  .mini-card-choice,
  .answer-card,
  .comparison-card,
  .speed-card {
    min-width: 0 !important;
  }
}

@media (max-width: 390px) {
  .top-actions { max-width: 55vw !important; }
  #roundLabel { font-size: 12px !important; }
  .top-actions .icon-btn,
  .icon-btn { width: 30px !important; height: 30px !important; min-width: 30px !important; min-height: 30px !important; }
  .court,
  .pick-court-wrap .court { width: min(88vw, 310px) !important; }
  .bench-zone,
  .court-hint { width: min(88vw, 310px) !important; }
}


/* v54 - Create Your Player mode + stronger mobile layout pass */
.create-player-start-card {
  border-color: rgba(96,165,250,.38);
  background:
    radial-gradient(circle at 88% 10%, rgba(96,165,250,.16), transparent 36%),
    rgba(255,255,255,.045);
}
.create-player-screen {
  width: min(1180px, calc(100% - 32px));
  margin: 26px auto 0;
  padding-bottom: 36px;
}
.create-player-shell {
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(circle at 12% 0%, rgba(47,125,255,.18), transparent 34%),
    radial-gradient(circle at 90% 8%, rgba(20,184,166,.15), transparent 34%),
    rgba(255,255,255,.045);
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  padding: 22px;
}
.create-player-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}
.create-player-head h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 62px);
  letter-spacing: -.06em;
}
.create-player-head p:not(.eyebrow) {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}
.create-player-grid {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.create-player-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(7,11,22,.54);
  padding: 18px;
  min-width: 0;
}
.light .create-player-card { background: rgba(255,255,255,.72); }
.create-player-card h2 { margin: 0 0 14px; letter-spacing: -.035em; }
.create-player-card label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: var(--muted);
  font-weight: 850;
}
.create-player-card input,
.create-player-card select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
}
.create-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.created-player-preview {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(96,165,250,.28);
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(47,125,255,.15), rgba(20,184,166,.10));
  min-height: 92px;
}
.created-player-preview strong { display:block; font-size: 18px; }
.created-player-preview span,
.created-player-preview small { display:block; color: var(--muted); line-height: 1.35; }
.created-preview-rating {
  width: 70px;
  height: 70px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  align-content: center;
  background: linear-gradient(180deg, #2f7dff, #14b8a6);
  color: white;
  box-shadow: 0 14px 34px rgba(47,125,255,.24);
}
.created-preview-rating b { font-size: 30px; line-height: .9; }
.created-preview-rating small { color: rgba(255,255,255,.86); font-size: 10px; font-weight: 950; letter-spacing: .12em; }
.create-budget {
  margin: 12px 0;
  color: var(--green);
  font-weight: 900;
}
.create-budget.over-budget { color: var(--red); }
.create-player-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.create-player-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.stats-builder-card > p {
  color: var(--muted);
  line-height: 1.5;
  margin-top: -4px;
}
.create-stat-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,.035);
  margin: 0 !important;
  grid-template-columns: 1fr auto;
  align-items: center;
}
.create-stat-row span { color: var(--text); }
.create-stat-row b { color: var(--orange2); }
.create-stat-row input[type="range"] {
  grid-column: 1 / -1;
  min-height: 30px;
  padding: 0;
  accent-color: #38bdf8;
}

@media (max-width: 820px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  .game-shell { width: 100%; max-width: 100%; overflow-x: hidden; }
  .topbar {
    min-height: 54px !important;
    height: auto !important;
    padding: 7px 8px !important;
    gap: 8px !important;
    align-items: center !important;
  }
  .brand-row { min-width: 0 !important; flex: 1 1 auto !important; gap: 8px !important; }
  .logo-home { width: 40px !important; height: 40px !important; min-width: 40px !important; }
  #roundLabel {
    min-width: 0 !important;
    max-width: 38vw !important;
    font-size: 14px !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .top-actions {
    flex: 0 0 auto !important;
    max-width: 50vw !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 5px !important;
    overflow-x: auto !important;
    padding-bottom: 1px !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .top-actions::-webkit-scrollbar { display: none; }
  .top-actions .icon-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 10px !important;
  }
  .home-screen:not(.hidden),
  .create-player-screen:not(.hidden),
  .spin-screen:not(.hidden),
  .pick-screen:not(.hidden),
  .trade-screen:not(.hidden),
  .mini-game-screen:not(.hidden),
  .local-switch-screen:not(.hidden),
  .live-sim-screen:not(.hidden),
  .result-panel:not(.hidden),
  .update-log-screen:not(.hidden) {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    overflow-x: hidden !important;
  }
  .home-screen { padding-left: 10px !important; padding-right: 10px !important; }
  .home-grid,
  .mode-grid,
  .mini-grid,
  .quick-start-stack { grid-template-columns: 1fr !important; }
  .mode-card, .mini-card, .franchise-start-card { min-width: 0 !important; width: 100% !important; }
  .section-title-row { align-items: flex-start !important; flex-direction: column !important; gap: 8px !important; }
  .create-player-screen { padding: 10px 10px max(26px, env(safe-area-inset-bottom)) !important; }
  .create-player-shell { padding: 14px !important; border-radius: 20px !important; }
  .create-player-head { display: grid !important; grid-template-columns: 1fr !important; }
  .create-player-head .ghost-btn { width: 100% !important; }
  .create-player-grid { grid-template-columns: 1fr !important; gap: 14px !important; }
  .create-form-row, .create-player-stats, .create-player-actions { grid-template-columns: 1fr !important; }
  .created-player-preview { grid-template-columns: 64px 1fr !important; padding: 12px !important; }
  .created-preview-rating { width: 60px !important; height: 60px !important; border-radius: 15px !important; }
  .created-preview-rating b { font-size: 25px !important; }
  .spin-screen:not(.hidden) {
    min-height: auto !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 12px 10px max(24px, env(safe-area-inset-bottom)) !important;
    align-items: start !important;
  }
  .spin-side { min-height: 0 !important; width: 100% !important; align-items: center !important; }
  .tiles-row, .tile-labels { width: 100% !important; max-width: 440px !important; gap: 10px !important; }
  .spin-tile { height: clamp(78px, 24vw, 102px) !important; border-radius: 13px !important; }
  .spin-tile span { font-size: clamp(28px, 10vw, 44px) !important; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .spin-btn { width: min(100%, 440px) !important; min-height: 52px !important; }
  .prompt-text { width: min(100%, 440px) !important; max-width: 440px !important; }
  .court-wrap { min-width: 0 !important; width: 100% !important; }
  .court, .pick-court-wrap .court {
    width: min(86vw, 340px) !important;
    max-width: 340px !important;
    min-width: 0 !important;
    height: min(86vw, 520px) !important;
    max-height: 520px !important;
  }
  .bench-zone, .court-hint { width: min(86vw, 340px) !important; max-width: 340px !important; }
  .pick-screen:not(.hidden) .pick-layout {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  .players-column, .player-list, .rolled-strip, .filters-row { max-width: 100% !important; min-width: 0 !important; }
  .rolled-strip { top: 54px !important; }
  .player-row { min-width: 0 !important; }
  .player-main { grid-template-columns: 1fr !important; }
  .stats-mini { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .end-player-card { grid-template-columns: auto 1fr !important; }
  .end-player-stats { grid-column: 1 / -1 !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

@media (max-width: 430px) {
  #roundLabel { max-width: 34vw !important; font-size: 13px !important; }
  .top-actions { max-width: 52vw !important; gap: 4px !important; }
  .top-actions .icon-btn { width: 34px !important; height: 34px !important; min-width: 34px !important; min-height: 34px !important; }
  .logo-home { width: 38px !important; height: 38px !important; min-width: 38px !important; }
  .court, .pick-court-wrap .court { width: min(84vw, 318px) !important; }
  .bench-zone, .court-hint { width: min(84vw, 318px) !important; }
  .court-slot { width: 46px !important; height: 46px !important; }
}
