:root {
  --bg: #ffffff; --surface: #f6f7f9; --text: #1b1f24; --muted: #5d6673; --border: #dde1e7;
  --accent: #1f5fbf; --accent-soft: #e6eefb; --radius: 8px; --tip-bg: #ffffff;
  --strong: #e3eefc; --weak: #fdeee3; --up: #1a7f37; --down: #b42318; --warn: #9a6700;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111418; --surface: #191d23; --text: #e6e9ee; --muted: #9aa4b2; --border: #2c333d;
    --accent: #7fb0ff; --accent-soft: #1c2a40; --tip-bg: #222831; --strong: #1b2c44; --weak: #3a2618;
    --up: #4ac26b; --down: #f47067; --warn: #d4a72c;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, sans-serif; }
.site-header { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; padding: 12px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; font-size: 18px; }
.home { color: var(--accent); text-decoration: none; font-size: 14px; }
.home:hover { text-decoration: underline; }
main { max-width: 1280px; margin: 0 auto; padding: 8px 16px 48px; }
h2 { margin: 28px 0 8px; }
h2 .muted { font-size: 15px; font-weight: 400; }
.muted, .note { color: var(--muted); }
.note { font-size: 14px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 12px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.controls label { display: flex; gap: 6px; align-items: center; }
.controls label[hidden] { display: none; }
select, button, input { font: inherit; color: inherit; }
select { max-width: 280px; padding: 4px 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
select:disabled { opacity: 0.5; }
button#go, button#ev-go { padding: 6px 14px; background: var(--accent); color: var(--bg); border: 0; border-radius: 6px; font-weight: 600; cursor: pointer; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 600; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
.grid th, .grid td { padding: 5px 8px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.grid thead th { background: var(--surface); position: sticky; top: 0; }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.strong { background: var(--strong); }
.grid td.weak { background: var(--weak); }
.cell-name { display: block; white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.cell-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.roster tr.surplus td { background: var(--accent-soft); }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.status { font-size: 11px; font-weight: 700; color: var(--warn); }
.trade { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.trade-head { padding: 4px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--surface); }
.trade.three .trade-head { color: var(--accent); }
.sides { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.side { padding: 8px 12px; border-top: 1px solid var(--border); }
.sides .side + .side { border-left: 1px solid var(--border); }
.gain { font-variant-numeric: tabular-nums; }
.gain.up { color: var(--up); }
.gain.down { color: var(--down); }
.pos { font-size: 11px; color: var(--muted); }
.val { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.why { font-size: 12px; color: var(--muted); }
.why b { font-weight: 600; color: var(--text); }
.grid td.differs { color: var(--accent); font-weight: 600; }
.luck { font-size: 11px; padding: 0 6px; border-radius: 10px; white-space: nowrap; }
.luck.buy { background: var(--strong); color: var(--accent); }
.luck.sell { background: var(--weak); color: var(--warn); }
.up { color: var(--up); }
.down { color: var(--down); }
.about { margin: -4px 0 8px; }
.about summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.bye { font-size: 11px; color: var(--muted); }
.tabs { display: flex; gap: 4px; margin: 20px 0 14px; border-bottom: 1px solid var(--border); }
.tabs button { padding: 8px 14px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--muted); font-weight: 600; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--text); }
section[hidden] { display: none; }
.roster tr.picked td { background: var(--strong); font-weight: 600; }
/* league tab */
.grid.strength td, .grid.strength th { text-align: center; white-space: nowrap; }
.grid.strength th:first-child { text-align: left; }
.rank { font-variant-numeric: tabular-nums; font-weight: 600; }
.spare, .need { font-size: 11px; padding: 0 6px; border-radius: 10px; white-space: nowrap; }
.spare { background: var(--accent-soft); color: var(--accent); }
.need { background: var(--weak); color: var(--down); }
.pos-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); gap: 12px; }
.pos-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.pos-card h3 { margin: 0 0 6px; font-size: 16px; }
.pos-card h3 .muted { font-size: 12px; font-weight: 400; }
.pos-card h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.fit-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fit-cols ul { margin: 0; padding: 0; list-style: none; }
.fit-cols li { margin: 0 0 8px; font-size: 13px; line-height: 1.35; }
.fit-cols .bench { color: var(--muted); }
.fit-cols .starter { font-weight: 600; }
.fit-cols .fa { color: var(--muted); font-style: italic; }
.rank-small { font-size: 11px; color: var(--muted); }
/* teams tab */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.chips button, button.secondary { padding: 4px 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg); cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.pos-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.pos-chip { font-size: 12px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); }
.pos-chip.strong { background: var(--strong); }
.pos-chip.weak { background: var(--weak); }
/* evaluate tab */
.ev-pickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; margin-bottom: 12px; }
.ev-team { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; }
.ev-team h3 { margin: 0 0 6px; font-size: 15px; }
.ev-row { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 2px 0; cursor: pointer; }
.ev-row select { margin-left: auto; font-size: 12px; padding: 1px 4px; }
.verdict { font-weight: 600; padding: 8px 12px; border-radius: var(--radius); }
.verdict.good { background: var(--strong); }
.verdict.bad { background: var(--weak); }
@media (max-width: 600px) { .fit-cols { grid-template-columns: 1fr; } }
.pos-cards .flat { grid-column: 1 / -1; margin: 0; }
/* header + values picker */
.site-header { position: relative; }
.source-pick { margin-left: auto; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.source-pick select { font-size: 15px; font-weight: 600; padding: 6px 10px; border: 2px solid var(--accent); border-radius: 8px;
  background: var(--bg); color: var(--text); max-width: none; }
.lede { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.lede .about { display: inline; margin-left: 6px; }
.lede .about[open] { display: block; margin: 8px 0 0; }
#about { margin-top: 6px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  color: var(--text); font-size: 14px; max-width: 760px; }
#about p { margin: 6px 0; }
#about ul { margin: 4px 0 8px; padding-left: 20px; }
#about li { margin: 2px 0; }
/* instant tooltips */
#tip { position: fixed; z-index: 50; max-width: 300px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--tip-bg); color: var(--text); font-size: 12.5px; line-height: 1.45; white-space: pre-line; pointer-events: none;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.18), 0 1px 3px rgb(0 0 0 / 0.12); animation: tip-in 90ms ease-out; }
#tip.rich { min-width: 210px; padding: 8px 10px 7px; white-space: normal; }
@keyframes tip-in { from { opacity: 0; transform: translateY(2px); } }
@media (prefers-reduced-motion: reduce) { #tip { animation: none; } }
.tip-head { font-size: 13px; padding-bottom: 5px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.tip-head .spare, .tip-head .need { font-size: 11px; }
.tip-row { display: flex; justify-content: space-between; gap: 14px; }
.tip-row .v { font-variant-numeric: tabular-nums; }
.tip-row.starter { font-weight: 600; }
.tip-row.bench { color: var(--muted); }
.tip-row.fa { color: var(--muted); font-style: italic; }
.tip-row i { color: var(--muted); font-style: normal; font-weight: 400; font-size: 11px; }
.tip-foot { margin-top: 5px; color: var(--muted); font-size: 11px; }
[data-tip] { cursor: default; }
/* by-position player lists */
.fit-cols li { margin: 0 0 10px; }
.pl { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 1.45; }
.pl .v { font-variant-numeric: tabular-nums; }
.pl.bench, .pl.bench .v { color: var(--muted); }
.pl.starter { font-weight: 600; }
.pl .at { color: var(--muted); font-size: 12px; font-weight: 400; }
.pl.fa { color: var(--muted); font-style: italic; }
/* trade cards */
.side { padding: 10px 14px; }
.side-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.side-head b { font-size: 16px; }
.side-head .gain { font-size: 16px; font-weight: 700; }
.side-head .gain small { font-size: 11px; font-weight: 400; }
.move { display: grid; grid-template-columns: 46px 1fr; gap: 6px; margin: 2px 0; }
.lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 3px; }
.prow { display: flex; align-items: baseline; gap: 6px; font-size: 14px; line-height: 1.5; }
.prow .pname { font-weight: 600; }
.prow .from { font-size: 12px; color: var(--muted); }
.prow .pmeta { margin-left: auto; font-size: 11px; color: var(--muted); }
.prow .val { min-width: 34px; text-align: right; font-size: 13px; }
.lineup { display: grid; grid-template-columns: 46px 1fr; gap: 6px; margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--border); font-size: 12px; }
.lineup .in { color: var(--up); margin-right: 6px; white-space: nowrap; }
.lineup .out { color: var(--muted); margin-right: 6px; white-space: nowrap; }
.lineup small { font-size: 10px; opacity: 0.8; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 11px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--border); }
.chip.warn { color: var(--down); border-color: var(--down); }
.chip.up { color: var(--up); }
.chip.down { color: var(--down); }
.trade-head { display: flex; justify-content: space-between; }
@media (max-width: 600px) { .source-pick { margin-left: 0; } }
