:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dde1e7;
  --text: #161a22;
  --muted: #5d6675;
  --accent: #e8620c;
  --accent-soft: #fde8d9;
  --accent-text: #ffffff;
  --good: #15803d;
  --good-soft: #dcf3e3;
  --bad: #c2262e;
  --bad-soft: #fbe1e2;
  --warn: #a15c00;
  --warn-soft: #fdf0d5;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 12px;
  --pos-pg: #bf4b0c; --pos-sg: #bd123d; --pos-g: #e65d0e; --pos-sf: #064a97; --pos-pf: #7d29c5;
  --pos-f: #913ae2; --pos-c: #049466; --pos-flx: #0f7a72; --pos-bn: #0651a6;
  --b2b: #eab308;
  --b2b-ring: #86efac; /* back-to-back nights: a lighter green ring */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218;
    --surface: #171b23;
    --surface-2: #1f2430;
    --border: #2b3240;
    --text: #e8ebf0;
    --muted: #97a0b0;
    --accent: #f97316;
    --accent-soft: #3a2414;
    --accent-text: #161a22;
    --good: #4ade80;
    --good-soft: #15301f;
    --bad: #f87171;
    --bad-soft: #3a1b1d;
    --warn: #fbbf24;
    --warn-soft: #36290f;
    --shadow: none;
    --pos-pg: #f57118; --pos-sg: #eb4664; --pos-g: #e65d0e; --pos-sf: #0b7ff3; --pos-pf: #aa61f9;
    --pos-f: #913ae2; --pos-c: #049466; --pos-flx: #11b4a3; --pos-bn: #0b7ff3;
    --b2b: #facc15;
    --b2b-ring: #15803d;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --pos-pg: #f57118; --pos-sg: #eb4664; --pos-g: #e65d0e; --pos-sf: #0b7ff3; --pos-pf: #aa61f9;
  --pos-f: #913ae2; --pos-c: #049466; --pos-flx: #11b4a3; --pos-bn: #0b7ff3;
  --b2b: #facc15;
  --b2b-ring: #15803d;

  --bg: #0f1218;
  --surface: #171b23;
  --surface-2: #1f2430;
  --border: #2b3240;
  --text: #e8ebf0;
  --muted: #97a0b0;
  --accent: #f97316;
  --accent-soft: #3a2414;
  --accent-text: #161a22;
  --good: #4ade80;
  --good-soft: #15301f;
  --bad: #f87171;
  --bad-soft: #3a1b1d;
  --warn: #fbbf24;
  --warn-soft: #36290f;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
a { color: var(--accent); }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
/* one slim bar: tabs on the left (scroll sideways if needed), theme toggle on the right */
.topbar-inner {
  max-width: 1200px; margin: 0 auto;
  padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px));
  display: flex; align-items: center; gap: 8px;
}
.tabs {
  flex: 1; min-width: 0;
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 13px 12px 11px; white-space: nowrap; text-decoration: none;
  color: var(--muted); font-weight: 600; font-size: .92rem;
  border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.nav-btn { display: none; }

.container {
  max-width: 1200px; margin: 0 auto; padding-block: 20px 64px; outline: none;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.top-right { display: flex; align-items: center; gap: 10px; flex: none; }
.top-right .icon-btn { width: 30px; height: 30px; }
/* settings gear */
#gearMenu { position: relative; }
.gear summary { list-style: none; display: grid; place-items: center; font-size: 1rem; color: var(--muted); }
.gear summary::-webkit-details-marker { display: none; }
.gear[open] summary { background: var(--surface-2); color: var(--text); }
.gear-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 270px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(16, 24, 40, .18); padding: 6px; }
.gear-row { padding: 6px 10px 8px; font-size: .88rem; color: var(--muted); display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.gear-sub { display: block; font-size: .76rem; color: var(--muted); font-weight: 400; margin-top: 1px; }
.gear-toggle { display: flex !important; align-items: center; justify-content: space-between; }
.gear-switch { width: 34px; height: 20px; border-radius: 10px; background: var(--border); position: relative; flex: none; transition: background .15s; }
.gear-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: left .15s; }
.gear-switch.on { background: var(--accent); }
.gear-switch.on::after { left: 16px; }
.ctx-meta[hidden] { display: none; }
.sync { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.modal-sm { width: min(420px, calc(100vw - 24px)); }
.modal-sm h2 { margin-bottom: 6px; }
.modal-sm p { margin: 0; }
#backupText { font: 12px/1.4 ui-monospace, Consolas, monospace; word-break: break-all; }

/* ---------- Generic ---------- */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-sub { margin: 0 0 14px; color: var(--muted); font-size: .9rem; }
.page-sub-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 14px; }
.page-sub-row .page-sub { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; min-width: 0;
}
.card + .card { margin-top: 16px; }
/* side-by-side cards line up: grids space them with gap instead */
.kpis > .card + .card, .grid-2 > .card + .card, .trade-grid > .card + .card, .awards > .card + .card { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Dashboard: things to act on first (side by side when there's room), then Performances at full width for its columns */
.dash-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.dash-side { order: -1; display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.dash-side > .card + .card { margin-top: 0; }
@media (max-width: 900px) { .dash-side { grid-template-columns: minmax(0, 1fr); } }
/* top performances */
/* Performances tables: 5 rows show, the rest scroll (fitPerfLists); the header, player and value columns stay put */
.perf-when { margin: -6px 0 10px; }
.perf-table .pf-emo { margin-right: 2px; font-size: .9em; }
.pf-legend { margin: 8px 0 0; }
.perf-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.pill { font: inherit; font-size: .8rem; font-weight: 600; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.pill:hover { background: var(--surface-2); }
.pill.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.pf-sep { width: 1px; align-self: stretch; margin: 2px 4px; background: var(--border); }
.badge.active { background: transparent; color: var(--good); box-shadow: inset 0 0 0 1px var(--good); }
.badge.bench { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.perf-wrap { overflow: auto; margin: 0 0 14px; } /* no padding: pinned columns stick to its edges */
.perf-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.perf-table th, .perf-table td { padding: 6px 4px; }
.perf-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); font-size: .7rem; }
.perf-table th.sc { text-align: center; }
.perf-table td.sc { text-align: center; font-size: .82rem; font-variant-numeric: tabular-nums; min-width: 36px; white-space: nowrap; border-bottom: 2px solid var(--surface); }
.perf-table .pf-name { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 190px; max-width: 230px; padding-left: 0; }
.perf-table thead th.pf-name { z-index: 3; }
.perf-table .pf-name .bname { flex-wrap: nowrap; }
.perf-table .pf-name .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.perf-table .pf-name .pmeta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perf-table .pf-v { position: sticky; right: 0; z-index: 1; background: var(--surface); padding-left: 8px; } /* the value stays in view too */
.perf-table thead th.pf-v { z-index: 3; }
.perf-table td.pf-v { font-weight: 800; font-variant-numeric: tabular-nums; }
/* your players' rows are tinted orange, the opponent's red: the player and value cells (the stats keep their shading) */
.perf-table { --pf-me: color-mix(in srgb, var(--accent) 14%, var(--surface)); --pf-opp: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
.perf-table tr.pf-me td.pf-name, .perf-table tr.pf-me td.pf-v { background: var(--pf-me); }
.perf-table tr.pf-opp td.pf-name, .perf-table tr.pf-opp td.pf-v { background: var(--pf-opp); }
.perf-table tr.pf-me td.pf-name { box-shadow: inset 3px 0 0 var(--accent); }
.perf-table tr.pf-opp td.pf-name { box-shadow: inset 3px 0 0 var(--bad); }
.perf-table td.pf-name { padding-left: 6px; }
.pf-swatch { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }
.pf-swatch.pf-me { background: var(--accent); }
.pf-swatch.pf-opp { background: var(--bad); }
/* a game still on: a pulsing dot by the clock */
.lv-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); margin-right: 4px; vertical-align: 1px; animation: lv-pulse 1.6s ease-in-out infinite; }
@keyframes lv-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .lv-dot { animation: none; } }
.perf-rank { flex: none; min-width: 1.5em; color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.perf-owner { color: var(--muted); }
@media (max-width: 640px) { .perf-table .pf-name { min-width: 150px; max-width: 160px; } .perf-table .pf-name .pmeta { white-space: normal; } } /* phones: badges wrap instead of hiding */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.kpi { padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .hint { color: var(--muted); font-size: .82rem; }

.btn {
  font: inherit; font-weight: 600; font-size: .9rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn {
  font: inherit; background: transparent; border: 1px solid var(--border); color: var(--text);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; font-weight: 600; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 8px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sorted { color: var(--accent); }
tbody tr:hover { background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.player { min-width: 170px; }
.pname { font-weight: 600; }
.pmeta { color: var(--muted); font-size: .8rem; }
.row-actions { white-space: nowrap; text-align: right; }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: .75rem; font-weight: 700; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.pos-good { color: var(--good); }
.pos-bad { color: var(--bad); }

/* ---------- Category bars ---------- */
.catbars { display: grid; gap: 8px; }
.catbar { display: grid; grid-template-columns: 44px 1fr 48px; align-items: center; gap: 10px; font-size: .85rem; }
.catbar .lbl { font-weight: 700; color: var(--muted); }
.catbar .track { position: relative; height: 14px; background: var(--surface-2); border-radius: 4px; }
.catbar .track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--muted); opacity: .5; }
.catbar .fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.catbar .fill.up { left: 50%; background: var(--good); }
.catbar .fill.down { right: 50%; background: var(--bad); }
.catbar .v { text-align: right; font-variant-numeric: tabular-nums; }
.legend-row { display: flex; justify-content: space-between; color: var(--muted); font-size: .75rem; margin: 4px 0 0 54px; padding-right: 58px; }

/* ---------- Alerts ---------- */
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; font-size: .9rem; background: var(--surface-2); }
.alert.bad { background: var(--bad-soft); }
.alert.warn { background: var(--warn-soft); }
.alert.good { background: var(--good-soft); }
.alert .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--muted); }
.alert.bad .dot { background: var(--bad); }
.alert.warn .dot { background: var(--warn); }
.alert.good .dot { background: var(--good); }
.alert .grow { flex: 1; }

/* ---------- Lineup ---------- */
.slot-label {
  --pc: var(--accent);
  display: inline-grid; place-items: center; min-width: 46px; padding: 3px 6px;
  border-radius: 6px; background: color-mix(in srgb, var(--pc) 13%, var(--surface)); color: var(--pc);
  font-weight: 800; font-size: .78rem; text-transform: none; letter-spacing: 0;
}
.slot-PG { --pc: var(--pos-pg); } .slot-SG { --pc: var(--pos-sg); } .slot-G { --pc: var(--pos-g); }
.slot-SF { --pc: var(--pos-sf); } .slot-PF { --pc: var(--pos-pf); } .slot-F { --pc: var(--pos-f); }
.slot-C { --pc: var(--pos-c); } .slot-FLX { --pc: var(--pos-flx); } .slot-BN { --pc: var(--pos-bn); }
.pt { font-weight: 700; }
.pt-PG { color: var(--pos-pg); } .pt-SG { color: var(--pos-sg); } .pt-SF { color: var(--pos-sf); }
.pt-PF { color: var(--pos-pf); } .pt-C { color: var(--pos-c); }
.slot-label.il { background: var(--bad-soft); color: var(--bad); }
select, input, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
textarea { resize: vertical; width: 100%; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.proj { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.proj .k { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.proj .v { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.05rem; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--muted); margin: 0 0 12px; min-width: 0; }
.field input, .field select, .field textarea { color: var(--text); font-weight: 400; font-size: .95rem; width: 100%; }
fieldset.field { border: 0; padding: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input, .field .chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  font-weight: 700; color: var(--text); cursor: pointer; font-size: .85rem;
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px 10px; margin-bottom: 12px; }
.stat-grid .field { margin: 0; }
.sub { margin: 4px 0 8px; font-size: .9rem; }
.form-error { color: var(--bad); margin: 0; min-height: 1.2em; font-size: .9rem; }
.inline-form { display: grid; gap: 10px; grid-template-columns: 90px 1fr 110px 110px 90px auto; align-items: end; }
.inline-form .field { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg label { cursor: pointer; position: relative; }
.seg input, .field .seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 14px; font-weight: 600; font-size: .9rem; }
.seg input:checked + span { background: var(--accent); color: var(--accent-text); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.settings-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.count-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.count-grid .field { margin: 0; }
.score-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.score-grid .field { margin: 0; }

/* ---------- Trade ---------- */
.trade-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.trade-team { flex: 1; min-width: 0; max-width: 220px; margin: 0 auto 0 10px; }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 360px; overflow-y: auto; }
.pick-list label {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
.pick-list label:hover { background: var(--surface-2); }
.pick-list input { accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.pick-list .grow { flex: 1; min-width: 0; }
.pick-list .val { font-variant-numeric: tabular-nums; font-weight: 700; }
.verdict { font-size: 1.15rem; font-weight: 700; }
.delta-table td.num { font-weight: 600; }

/* ---------- Lineup editor (Roster tab) ---------- */

/* ---------- Matchups ---------- */
.margin-bar { height: 8px; border-radius: 4px; min-width: 2px; }
.margin-bar.win { background: var(--good); }
.margin-bar.loss { background: var(--bad); }
.margin-bar.tie { background: var(--muted); }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; font-size: 1rem; }

/* ---------- Modal ---------- */
.modal {
  border: 1px solid var(--border); border-radius: 14px; padding: 0;
  background: var(--surface); color: var(--text);
  width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px); /* the visible screen, not counting phone browser toolbars */
}
.modal::backdrop { background: rgba(10, 12, 16, .55); }
.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.modal-head, .modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; }
.modal-head { border-bottom: 1px solid var(--border); }
.modal-foot { border-top: 1px solid var(--border); justify-content: flex-end; }
.modal-body { padding: 16px; overflow-y: auto; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-weight: 600; font-size: .9rem; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.sample-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--accent-soft); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: .9rem;
}

/* ---------- Players tab ---------- */
.filters { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(4, minmax(110px, 1fr)); gap: 10px; margin-bottom: 8px; }
.filters .field { margin: 0; }
.list-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 12px; }
.pmeta.inj { color: var(--bad); }
button.link-btn.pname { color: var(--text); text-align: left; }
button.link-btn.pname:hover { color: var(--accent); text-decoration: underline; }
.modal-lg { width: min(860px, calc(100vw - 24px)); }
.modal-lg[open] { display: flex; flex-direction: column; }
/* flex-basis auto, not 0: older iPhone Safari sizes the card from the basis, so 0 collapsed it to a sliver */
.modal-lg .modal-body { flex: 1 1 auto; min-height: 0; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
/* player card on phones: averages with seasons across, recent games as short blocks */
.show-sm { display: none; }
.pc-avg { width: 100%; font-size: .86rem; font-variant-numeric: tabular-nums; }
.pc-avg th, .pc-avg td { padding: 3px 6px; }
.pc-games { list-style: none; margin: 0; padding: 0; gap: 6px; font-size: .86rem; font-variant-numeric: tabular-nums; }
.pc-games li { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.pc-games li span { white-space: nowrap; }
.pc-g-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 2px; }
.pc-g-min { margin-left: auto; font-weight: 700; }
@media (max-width: 640px) {
  .show-sm { display: block; }
  table.show-sm { display: table; }
  ul.pc-games { display: grid; }
  .modal-lg { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .modal-lg .modal-body { padding: 14px; }
  .detail-id h2 { font-size: 1.15rem; }
}
code { font-family: ui-monospace, Consolas, monospace; font-size: .85em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
@media (max-width: 900px) { .filters { grid-template-columns: 1fr 1fr; } .filters .field.grow { grid-column: 1 / -1; } }

/* ---------- Matchups ---------- */
.week-nav { display: flex; min-width: 0; }
.week-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.week-main > .card + .card, .week-side > .card + .card { margin-top: 16px; }
.scoreboard { padding: 18px 20px; }
.sb-main { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 12px; }
.sb-side.right { text-align: right; }
.sb-label { font-weight: 700; color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-score { font-size: 2.6rem; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.sb-vs { text-align: center; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; padding-bottom: 8px; }
.odds { height: 12px; border-radius: 999px; background: var(--bad); opacity: .9; overflow: hidden; margin-top: 14px; }
.odds-you { display: block; height: 100%; background: var(--good); }
.odds-legend { display: flex; justify-content: space-between; font-size: .85rem; margin-top: 6px; }
.sb-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: .9rem; }
.pbar-cell { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.pbar { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.pbar span { display: block; height: 100%; border-radius: 4px; }
.pbar .good { background: var(--good); }
.pbar .bad { background: var(--bad); }
.pbar .mid { background: var(--muted); }
.day-grid td.num, .day-grid th.num { text-align: center; min-width: 44px; }
.day-grid th { line-height: 1.2; }
.cell-on { color: var(--good); font-size: 1.1rem; }
.cell-sit { color: var(--warn); font-size: 1.1rem; }
.cell-out { color: var(--bad); font-size: .75rem; font-weight: 700; text-transform: uppercase; }
.day-grid .past { opacity: .5; }
.icon-btn.xs { width: 26px; height: 26px; font-size: .75rem; color: var(--muted); }
.icon-btn.xs:hover { color: var(--bad); }
.start-box { accent-color: var(--accent); width: 16px; height: 16px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; margin-bottom: 8px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
@media (max-width: 900px) { .week-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .sb-score { font-size: 2rem; } .sb-foot { grid-template-columns: 1fr; } }

/* ---------- Matchup board + lineup analysis ---------- */
.fx-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; font-size: .9rem; }
.fx-vs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.fx-lock { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }
.fx-vs .stepper .ctx-team { max-width: 300px; }
.week-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.week-stack > .card + .card { margin-top: 0; }
.pw-final { margin: 0 0 10px; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.pw-table .pw-total td { border-top: 2px solid var(--border); font-weight: 700; }
.pw-table tr.bench td.sc, .pw-table tr.bench td.st-g { color: var(--muted); }
.board { table-layout: fixed; min-width: 340px; }
.board col.c-slot { width: 58px; }
.board thead th { font-size: .8rem; color: var(--text); text-transform: none; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; }
.board th[scope="row"] { padding-right: 4px; }
.bcell { vertical-align: top; }
.bcell.bench { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.bname { font-weight: 600; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.bname .pname { font-size: .9rem; }
.n-short { display: none; }
.bctrl { margin-left: auto; display: inline-flex; gap: 4px; }
.bctrl .icon-btn.xs { width: 24px; height: 24px; }
/* team · pos on the left; day dots and the games count pinned right so they line up row to row */
.bmeta { display: grid; grid-template-columns: minmax(0, 1fr) auto 2.2em; align-items: center; gap: 8px; color: var(--muted); font-size: .75rem; margin-top: 2px; }
.bmeta-info { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bmeta-g { text-align: right; }
.bmeta b { color: var(--text); font-variant-numeric: tabular-nums; }
.dots { display: inline-flex; gap: 2px; vertical-align: middle; }
.dots i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
/* filled: played; ring: still to come; grey: bench; red: missed or ruled out */
.dots i.done { background: var(--good); }
.dots i.done.bench { background: var(--muted); opacity: .55; }
.dots i.up { box-shadow: inset 0 0 0 1.5px var(--good); }
.dots i.up.bench { box-shadow: inset 0 0 0 1.5px var(--muted); opacity: .7; }
.dots i.done.short { background: var(--b2b); opacity: 1; }
.dots i.up.b2b { box-shadow: inset 0 0 0 1.5px var(--b2b-ring); }
.dots i.dnp { background: var(--bad); opacity: .75; }
.dots i.out { box-shadow: inset 0 0 0 1.5px var(--bad); }
.dots i.none { background: var(--border); }
/* tooltips (data-tip) */
.tip {
  position: fixed; z-index: 60; pointer-events: none; max-width: 260px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, .22); padding: 9px 11px; font-size: .82rem; line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
.tip[hidden] { display: none; }
.tip-head { font-weight: 800; }
.tip-tag { font-weight: 600; color: var(--muted); font-size: .76rem; margin-left: 4px; }
.tip-dim { color: var(--muted); }
.tip-warn { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--border); color: var(--text); }
.tip-warn::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--b2b); margin-right: 6px; vertical-align: 0; }
.dots i[data-tip] { cursor: default; }
.bmeta-g[data-tip] { cursor: default; }
.dots-legend { display: inline-flex; align-items: center; gap: 4px; }
.tag { font-size: .7rem; font-weight: 800; padding: 1px 6px; border-radius: 999px; white-space: nowrap; }
.tag.up { background: var(--good-soft); color: var(--good); }
.tag.down { background: var(--bad-soft); color: var(--bad); }
.board-sep td { background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 4px 8px; }
.board-tot td, .board-tot th { font-size: .85rem; }
.sb-foot.one { grid-template-columns: 1fr; }
.swap { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.swap + .swap { margin-top: 10px; }
.swap.suggested { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); background: color-mix(in srgb, var(--good-soft) 40%, transparent); }
.swap-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.swap-in { color: var(--text); }
.swap-out { color: var(--muted); }
.swap-net { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cchip { display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); font-size: .78rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.cchip b { color: var(--text); }
.cchip.good { background: var(--good-soft); color: var(--good); }
.cchip.bad { background: var(--bad-soft); color: var(--bad); }
.cchip-p { font-weight: 700; }
.swap-why { margin: 8px 0 0; }
.cat-table .pbar-cell { min-width: 230px; }
.pbars { flex: 1; display: grid; gap: 3px; }
.pbar-row { display: grid; grid-template-columns: 30px 1fr 36px; align-items: center; gap: 6px; }
.pbar-k { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pbar.thin { height: 6px; }
.pbar .asset { background: var(--muted); opacity: .55; }
.cat-table tr.moved td:first-child b { color: var(--accent); }
@media (max-width: 640px) {
    .board { min-width: 0; }
  .board col.c-slot { width: 46px; }
  .board td, .board th { padding-left: 5px; padding-right: 5px; }
  .bname .pname { font-size: .82rem; }
  .board:not(.stats) .bmeta-info { display: none; }
  .board:not(.stats) .bmeta { grid-template-columns: auto 2.2em; justify-content: space-between; }
  .cat-table .pbar-cell { min-width: 190px; }
  .swap-net { margin-left: 0; }
}

/* ---------- Headshots, logos, board stats ---------- */
.hs { display: inline-grid; place-items: center; flex: none; border-radius: 50%; background-color: var(--surface-2); background-image: url(data/headshots.webp); background-repeat: no-repeat; box-shadow: inset 0 0 0 1px var(--border); }
/* team colors: a light tint of the secondary color behind the photo, and a thin, soft ring over its edge
   (two thirds primary, the bottom third secondary), blended toward white so it shows on dark cards too.
   Browsers without color-mix get the full colors. */
.hs.tm { position: relative; background-color: color-mix(in srgb, var(--t2) 30%, var(--surface-2)); }
.hs.tm::after { content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 240deg, var(--t1) 0 66.67%, var(--t2) 0);
  background: conic-gradient(from 240deg, color-mix(in srgb, var(--t1) 60%, #fff) 0 66.67%, color-mix(in srgb, var(--t2) 60%, #fff) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--rw)), #000 calc(100% - var(--rw) + .5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - var(--rw)), #000 calc(100% - var(--rw) + .5px)); }
.hs-none { background-image: none; font-size: .62rem; font-weight: 800; color: var(--muted); }
.tlogo { display: inline-block; vertical-align: -3px; object-fit: contain; }
.bplayer { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bmain { flex: 1; min-width: 0; }
.recs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rec { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 6px 16px; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: .9rem; }
@media (max-width: 640px) { .rec { grid-template-columns: minmax(0, 1fr); } }
.inl-p { display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; }
.alert > .hs { margin-top: 1px; }
.detail-id { display: flex; align-items: center; gap: 12px; }
.seg-sm { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-sm button { font: inherit; font-size: .8rem; font-weight: 600; padding: 5px 10px; border: 0; background: var(--surface); color: var(--muted); cursor: pointer; }
.seg-sm button + button { border-left: 1px solid var(--border); }
.seg-sm button.on { background: var(--accent); color: var(--accent-text); }
.board-legend { margin: -4px 0 10px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; }
.stat-boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; min-width: 920px; }
.stab { table-layout: fixed; width: 100%; }
.bench-boards { margin-top: 20px; }
.bench-boards .stab tbody td.st-name, .bench-boards .stab tbody td.st-g { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.stab th, .stab td { padding: 6px 3px; }
.stab th.st-name, .stab td.st-name { width: 31%; padding-left: 6px; }
.stab .st-g { width: 6%; }
.stab th.sc { text-align: center; }
.stab thead th { font-size: .7rem; }
.stab thead th.st-name { font-size: .82rem; color: var(--text); text-transform: none; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; }
.stab td.sc { text-align: center; font-size: .82rem; font-variant-numeric: tabular-nums; color: var(--text); border-bottom: 2px solid var(--surface); }
.stab tbody tr.bench td.st-name, .stab tbody tr.bench td.st-g { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.stab .bname { flex-wrap: nowrap; }
.stab .bname .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.st-sep td { background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 4px 8px; }
.stab tfoot td { border-top: 2px solid var(--border); border-bottom: 0; font-weight: 700; }
.zp1, .sw.zp1 { background: color-mix(in srgb, var(--good) 14%, transparent); }
.zp2, .sw.zp2 { background: color-mix(in srgb, var(--good) 28%, transparent); }
.zp3, .sw.zp3 { background: color-mix(in srgb, var(--good) 45%, transparent); font-weight: 700; }
.zn1, .sw.zn1 { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.zn2, .sw.zn2 { background: color-mix(in srgb, var(--bad) 28%, transparent); }
.zn3, .sw.zn3 { background: color-mix(in srgb, var(--bad) 45%, transparent); font-weight: 700; }

/* ---------- Info popups ---------- */
/* info: a small round button, same border and hover as the other buttons */
.info-btn { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; margin-left: 6px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--muted) 45%, transparent); background: var(--surface); color: var(--muted); font-family: inherit; font-size: 12px; font-weight: 700; font-style: normal; line-height: 1; cursor: pointer; vertical-align: middle; text-transform: none; letter-spacing: 0; box-shadow: 0 1px 0 rgba(0, 0, 0, .04); }
.info-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--muted); }
.info-btn:active { transform: translateY(1px); }
.info-modal { width: min(560px, calc(100vw - 24px)); }
/* the header (and its close button) stays put; only the explanation scrolls */
.info-modal[open] { display: flex; flex-direction: column; }
.info-modal .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
@media (max-width: 640px) {
  .modal, .info-modal { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .info-modal .modal-head { padding: 10px 12px 10px 14px; }
  .info-modal .modal-head h2 { font-size: 1.05rem; }
  .info-modal .modal-body { padding: 12px 14px 16px; font-size: .92rem; }
}
.prose { font-size: .92rem; line-height: 1.55; }
.prose p { margin: 0 0 10px; }
.prose ul { margin: 0 0 10px; padding-left: 20px; }
.prose li { margin-bottom: 4px; }

/* ---------- Category strengths ---------- */
.cs-table { min-width: 620px; }
.cs-table th.cs-bar, .cs-table td.cs-bar { width: 18%; }
.cs-bar .track { display: block; position: relative; height: 12px; background: var(--surface-2); border-radius: 4px; }
.cs-bar .track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--muted); opacity: .5; }
.cs-bar .fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.cs-bar .fill.up { left: 50%; background: var(--good); }
.cs-bar .fill.down { right: 50%; background: var(--bad); }
.cs-table td.cs-strip, .cs-table th.cs-strip { width: 40%; }
.strip { position: relative; height: 18px; }
.strip::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.strip::after { content: ""; position: absolute; left: 50%; top: 2px; bottom: 2px; width: 1px; background: var(--muted); opacity: .45; }
.sdot { position: absolute; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--muted); opacity: .55; }
.sdot.me { width: 12px; height: 12px; margin: -6px 0 0 -6px; background: var(--accent); opacity: 1; z-index: 1; box-shadow: 0 0 0 2px var(--surface); }
.cs-row { cursor: pointer; }
.cs-row td:first-child { white-space: nowrap; }
.cs-chev { display: inline-block; width: 1em; color: var(--muted); font-size: .75rem; transition: transform .15s; }
.cs-row[aria-expanded="true"] .cs-chev { transform: rotate(90deg); }
.cs-row[aria-expanded="true"] td { border-bottom-color: transparent; }
.cs-detail td { padding-top: 0; }
.cs-who { font-size: .85rem; display: flex; flex-wrap: wrap; gap: 6px 28px; padding-left: 1em; }
.cs-rank { white-space: nowrap; }
.cs-avg, .show-sm-inline { display: none; }
.cs-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: .9rem; }
/* phones: the league average goes under your number and the rank drops "/ 10", so the every-team strip gets the room */
@media (max-width: 640px) {
  .cs-table .cs-lavg { display: none; }
  .cs-avg { display: block; font-size: .7rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
  .show-sm-inline { display: inline; }
  .cs-table thead th { white-space: nowrap; }
  .cs-table td.cs-strip, .cs-table th.cs-strip { width: 50%; }
}
.roster-table td.rc { font-variant-numeric: tabular-nums; }
.roster-table tr.muted-row td { opacity: .55; }
.fx-connect { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.fx-connect .field { margin: 0; }
@media (max-width: 640px) { .cs-summary { grid-template-columns: 1fr; } .fx-connect { grid-template-columns: 1fr; } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .dash-grid, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inline-form { grid-template-columns: 1fr 1fr; }
  .inline-form .field.wide { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .sync { display: none; }
  .trade-grid, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .count-grid { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 1.3rem; }
  .kpi .value { font-size: 1.35rem; }
  .hide-sm { display: none; }
}

[hidden] { display: none !important; }

/* ---------- Draft ---------- */
.dr-table { min-width: 460px; }
.dr-table td.st-name { min-width: 170px; }
tr.dr-mine td { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.dr-teams { min-width: 560px; }
.dr-board { table-layout: fixed; min-width: 1100px; }
.dr-board thead th { font-size: .72rem; text-transform: none; letter-spacing: 0; color: var(--text); white-space: normal; line-height: 1.2; vertical-align: bottom; }
.dr-board th.dr-mine-col { color: var(--accent); }
.dr-board th[scope="row"] { width: 38px; }
.dr-cell { font-size: .78rem; line-height: 1.25; vertical-align: top; border: 2px solid var(--surface); border-radius: 6px; padding: 5px 6px; }
.dr-cell .link-btn { color: var(--text); font-weight: 600; text-align: left; }
.dr-pick { display: block; font-size: .66rem; color: var(--muted); }
.dr-gain { display: block; font-size: .7rem; font-weight: 700; }
.dr-board .n-short { display: none; }
.dr-keeper { background: var(--surface-2); }
.dr-board tr.dr-krow + tr:not(.dr-krow) th, .dr-board tr.dr-krow + tr:not(.dr-krow) td { border-top: 2px solid var(--border); }
.dr-via { display: block; font-size: .64rem; color: var(--muted); font-style: italic; }

/* ---------- Landing ---------- */
body.landing .tabs { visibility: hidden; }
.landing-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; padding-block: 24px; }
.landing-card { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 28px; }
.landing-card h1 { font-size: 1.7rem; letter-spacing: -.02em; text-wrap: balance; margin-bottom: 8px; }
.landing-card > p { margin: 0 0 16px; max-width: 60ch; }
.land-step { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 0 0 8px !important; }
.land-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; margin-top: 4px; }
.land-form .field { margin: 0; }
.land-form input { font-size: 1rem; padding: 10px 12px; }
.land-form .btn { padding: 11px 16px; }
.land-help { margin: 4px 0 14px; font-size: .9rem; }
.land-help summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.land-help p { margin: 8px 0 0; color: var(--muted); }
.land-url { display: inline-block; margin-top: 4px; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; color: var(--text); background: var(--surface-2); padding: 3px 8px; border-radius: 6px; word-break: break-all; }
.land-foot { margin: 0 !important; padding-top: 14px; border-top: 1px solid var(--border); }
.land-note { font-size: .88rem; background: var(--surface-2); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px !important; }
.land-teams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.land-team { font: inherit; font-weight: 600; text-align: left; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.land-team:hover, .land-team:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 640px) {
  .landing-card { padding: 20px; }
  .land-form { grid-template-columns: minmax(0, 1fr); }
  .land-teams { grid-template-columns: minmax(0, 1fr); }
}

tr.me-row td { background: var(--accent-soft); }

/* ---------- Awards ---------- */
.awards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.award { display: flex; flex-direction: column; gap: 4px; }
.aw-title { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); }
.aw-win { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.aw-name { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }
.aw-val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.aw-blurb { margin: 6px 0 8px; }
.aw-list { margin: 0; padding: 8px 0 0 22px; border-top: 1px solid var(--border); font-size: .88rem; }
.aw-list li { padding: 2px 0; }
.aw-list li > span:first-child { display: inline-block; min-width: 0; }
.aw-list li { display: list-item; }
.aw-list li span + span { float: right; font-variant-numeric: tabular-nums; }
.aw-list li.me, .aw-win.me .aw-name { color: var(--accent); }

/* ---------- League and team bar ---------- */
/* above the tabs: league / team on the left, week and data freshness on the right */
.ctx { background: var(--surface); }
.ctx[hidden] { display: none; }
.ctx-inner {
  max-width: 1200px; margin: 0 auto; padding: 10px max(14px, env(safe-area-inset-right, 0px)) 2px max(14px, env(safe-area-inset-left, 0px));
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 16px;
}
.ctx-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ctx-sep { display: none; }
.ctx-team-wrap { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
/* league, season and team pickers share one look: a bordered box with a caret (also inside a stepper) */
.ctx-team, .lm summary {
  font: inherit; font-size: .95rem; font-weight: 600; color: var(--text); line-height: 1.2;
  background-color: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 30px 7px 11px; max-width: 100%; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a94a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; background-size: 10px 6px;
}
.ctx-team:hover, .ctx-team:focus-visible, .lm summary:hover, .lm[open] summary { background-color: var(--surface-2); border-color: var(--muted); }
/* ‹ [dropdown] ›: the buttons join the picker into one bordered control */
.stepper { display: inline-flex; align-items: stretch; min-width: 0; max-width: 100%; }
.stepper .ctx-team { border-radius: 0; margin: 0 -1px; min-width: 0; text-overflow: ellipsis; }
.step-btn {
  position: relative; display: inline-grid; place-items: center; width: 36px; flex: none; padding: 0;
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); cursor: pointer;
}
.step-btn:first-child { border-radius: 8px 0 0 8px; }
.step-btn:last-child { border-radius: 0 8px 8px 0; }
.step-btn:hover:not(:disabled), .stepper .ctx-team:hover { z-index: 1; background-color: var(--surface-2); border-color: var(--muted); }
.step-btn:focus-visible, .stepper .ctx-team:focus-visible { z-index: 2; }
.step-btn:disabled { color: var(--muted); opacity: .45; cursor: default; }
.ctx-meta { color: var(--muted); font-size: .82rem; padding-left: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.ctx-meta .btn.sm { padding: 2px 10px; font-size: .78rem; }
.ctx-season { font-weight: 600; }
body.past .ctx-season { color: var(--accent); }
.ctx-add { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ctx-add input { font: inherit; font-size: .9rem; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); width: 210px; max-width: 100%; }
#leagueMenu { position: relative; }
.lm summary { list-style: none; display: flex; align-items: center; max-width: 320px; }
.lm summary::-webkit-details-marker { display: none; }
.lm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-caret { display: none; }
.lm-pop { position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: 270px; max-height: calc(100vh - 80px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(16, 24, 40, .18); padding: 6px; }
.lm-sec { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 10px 4px; }
.lm-row { display: flex; align-items: center; gap: 4px; }
.lm-item { display: block; width: 100%; text-align: left; font: inherit; font-size: .9rem; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); cursor: pointer; }
.lm-item:hover, .lm-item:focus-visible { background: var(--surface-2); }
.lm-item.on { font-weight: 700; color: var(--accent); }
.lm-item.danger { color: var(--bad); }
@media (max-width: 640px) {
  .ctx-inner { padding-top: 8px; }
  .ctx-sep { display: none; }
  .ctx-row { gap: 0 4px; }
  .ctx-team, .lm summary { font-size: 1rem; }
  .lm summary { max-width: 200px; }
  .lm-pop { width: min(270px, calc(100vw - 32px)); }
}

/* ---------- Phone tidy-up ---------- */
@media (max-width: 640px) {
  .page-head { margin-bottom: 12px; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .card { padding: 14px; }
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
  /* Fantrax bar: team pickers fill the width */
  .fx-strip { padding: 10px 12px; }
  .fx-vs { width: 100%; }
  .fx-vs .stepper, .week-nav, .week-nav .stepper { flex: 1 1 100%; }
  .stepper .ctx-team, .fx-vs .stepper .ctx-team { flex: 1; width: auto; max-width: none; }
  .fx-strip .actions { width: 100%; }
  .fx-strip .actions .btn { flex: 1 1 auto; }
  /* scoreboard */
  .sb-vs { font-size: .62rem; padding-bottom: 6px; }
  .sb-vs-extra { display: none; }
  /* schedule board: short names on one line, compact opponent controls */
  .board .n-full, .stab .n-full { display: none; }
  .board .n-short, .stab .n-short { display: inline; }
  .board .bname { flex-wrap: nowrap; }
  .board .bname .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; }
  .board .bname .badge, .board .bname .tag { font-size: .62rem; padding: 0 5px; flex: none; }
  .board .bctrl { gap: 2px; }
  .board .bctrl .icon-btn.xs { width: 22px; height: 22px; }
  .board .opp-x { display: none; }
  /* category strengths: number, rank and league strip fit without scrolling */
  .cs-table { min-width: 0; }
  .cs-table th { white-space: normal; }
  .cs-table th, .cs-table td { padding-left: 4px; padding-right: 4px; }
  .cs-table td.cs-strip { min-width: 80px; }
  .cs-table .cs-bar { display: none; }
  /* settings */
  .count-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .count-grid input { padding: 6px 8px; }
  .seg span { padding: 7px 10px; }
  /* draft lists: keep player, slot, now and +/− on screen */
  .dr-table { min-width: 0; }
  .dr-table td.st-name { min-width: 0; }
  .dr-table .pmeta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
}

/* ---------- Phones: menu button instead of tabs, pickers stacked ---------- */
@media (max-width: 640px) {
  .topbar-inner { position: relative; padding-top: 6px; padding-bottom: 6px; padding-left: max(12px, env(safe-area-inset-left, 0px)); }
  .nav-btn {
    display: inline-flex; align-items: center; gap: 10px; flex: 1; min-width: 0; height: 40px; padding: 0 12px;
    font: inherit; font-weight: 700; font-size: 1rem; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 8px; cursor: pointer; text-align: left;
  }
  .nav-btn .nav-icon { font-size: 1.1rem; color: var(--muted); }
  .nav-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--muted); }
  .tabs {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 2px;
    padding: 6px max(12px, env(safe-area-inset-left, 0px)) 12px; background: var(--surface);
    border-bottom: 1px solid var(--border); box-shadow: 0 14px 28px rgba(16, 24, 40, .16); overflow: visible;
  }
  body.nav-open .tabs { display: flex; }
  .tabs a { padding: 12px; border-bottom: 0; border-radius: 8px; font-size: 1rem; color: var(--text); }
  .tabs a.active { background: var(--accent-soft); color: var(--accent); }
  .top-right .icon-btn { width: 40px; height: 40px; }

  .ctx-inner { padding: 10px max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)); gap: 8px; }
  .ctx-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; width: 100%; }
  .ctx-row > #leagueMenu, .ctx-team-wrap > .ctx-add, .ctx-team-wrap > .badge, .ctx-team-wrap > .link-btn { grid-column: 1 / -1; }
  .ctx-team-wrap { display: contents; }
  .lm summary { max-width: none; width: 100%; }
  .lm-pop { width: 100%; }
  .ctx-team, .lm summary { font-size: .95rem; width: 100%; }
  .ctx-meta { padding-left: 0; }
}
