:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1c1f24;
  --muted: #5f6672;
  --border: #dcdfe4;
  --accent: #d9480f;
  --accent-ink: #ffffff;
  --win: #15803d;
  --loss: #c62828;
  --mine: #d9480f;
  --theirs: #3b5bdb;
  --good: #15803d;       /* ratings: green = best */
  --good-light: #8fd3a8;

  /* Game-type row colours */
  --row-league: #ffffff;
  --row-b3: #ffe0bd;
  --row-cup: #d6eaff;
  --row-scrimmage: #e6e7ea;
  --row-playoffs: #fbe49a;
  --row-private: #d3f0d3;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: #1c1f24; color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; text-decoration: none; color: #fff; }
.brand .ball { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); position: relative; overflow: hidden; }
.brand .ball::before, .brand .ball::after { content: ""; position: absolute; border: 1.5px solid #1c1f24; }
.brand .ball::before { left: 50%; top: -2px; bottom: -2px; transform: translateX(-50%); }
.brand .ball::after { top: 50%; left: -2px; right: -2px; transform: translateY(-50%); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { color: #c9ccd2; text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.topbar nav a.active, .topbar nav a:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.topbar .spacer { flex: 1; }
.topbar .user { color: #c9ccd2; font-size: 13px; }
.topbar .user a { color: #fff; margin-left: 10px; }
.badge-mock { background: #f59f00; color: #1c1f24; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }

main { padding: 20px; max-width: 1800px; margin: 0 auto; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }

.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .sub { color: var(--muted); }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-left: auto; }
select, input[type="text"], input[type="password"] {
  font: inherit; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
}
button, .btn {
  font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; display: inline-block;
}
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }

/* ---------- legend ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.legend .chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 13px; user-select: none;
}
.legend .chip .sw { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, .18); }
.legend .chip.off { opacity: .4; text-decoration: line-through; }
.legend .record { margin-left: auto; color: var(--muted); }
.legend .record b { color: var(--text); }

/* ---------- schedule table ---------- */
.table-wrap { overflow: auto; max-height: calc(100vh - 210px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table.sched { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13px; }
table.sched th, table.sched td { padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; }
table.sched thead th { position: sticky; background: #eef0f3; font-size: 12px; font-weight: 600; color: #3a404a; z-index: 2; }
table.sched thead tr:first-child th { top: 0; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; text-align: center; }
table.sched thead tr:nth-child(2) th { top: 29px; }
table.sched thead th.grp-me { background: #fde8dc; color: #8a2c06; }
table.sched thead th.grp-opp { background: #e2e8fb; color: #23379a; }
table.sched thead tr:first-child th.team-hdr { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 700; }
a.opp-link { text-decoration: none; font-weight: 600; }
a.opp-link:hover { text-decoration: underline; }
table.sched th.sticky, table.sched td.sticky { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--border); }
table.sched thead th.sticky { z-index: 3; }
table.sched td.sticky { background: inherit; }
table.sched tbody tr { background: var(--row-league); }
table.sched tbody tr.cat-b3 { background: var(--row-b3); }
table.sched tbody tr.cat-cup { background: var(--row-cup); }
table.sched tbody tr.cat-scrimmage { background: var(--row-scrimmage); }
table.sched tbody tr.cat-playoffs { background: var(--row-playoffs); }
table.sched tbody tr.cat-private { background: var(--row-private); }
table.sched tbody tr:hover td { box-shadow: inset 0 0 0 9999px rgba(0, 0, 0, .035); }
table.sched tbody tr.upcoming td:not(.sticky) { color: var(--muted); }
table.sched td.sep { border-left: 2px solid rgba(0, 0, 0, .12); }
table.sched td.center, table.sched th.center { text-align: center; }

.score a { font-weight: 700; text-decoration: none; padding: 2px 8px; border-radius: 6px; display: inline-block; }
.score a:hover { text-decoration: underline; }
.score.W a { color: var(--win); background: rgba(21, 128, 61, .1); }
.score.L a { color: var(--loss); background: rgba(198, 40, 40, .1); }
.score .live { color: var(--loss); font-weight: 700; }
.na { color: #9aa0a9; cursor: help; }
.pending { display: inline-block; width: 60px; height: 10px; border-radius: 4px; background: linear-gradient(90deg, rgba(0,0,0,.06), rgba(0,0,0,.12), rgba(0,0,0,.06)); background-size: 200% 100%; animation: shimmer 1.2s infinite; vertical-align: middle; }
@keyframes shimmer { to { background-position: -200% 0; } }
.tot b { font-weight: 700; }
.tot .hi { color: var(--win); }
.tot .lo { color: var(--loss); }
.type-abbr { font-weight: 700; font-size: 12px; letter-spacing: .03em; }

.status { color: var(--muted); font-size: 13px; margin: 8px 2px; min-height: 18px; }
.error { background: #fdecea; border: 1px solid #f5c2c0; color: #8a1c1c; padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }

/* ---------- match page ---------- */
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; text-align: center; }
.scoreboard .team-name { font-size: 18px; font-weight: 700; }
.scoreboard .team-name .tag { display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.scoreboard .big { font-size: 40px; font-weight: 800; letter-spacing: -.02em; }
.scoreboard .big .W { color: var(--win); }
.scoreboard .big .L { color: var(--loss); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; color: var(--muted); font-size: 13px; margin-top: 10px; }
.quarters { margin: 12px auto 0; border-collapse: collapse; font-size: 13px; }
.quarters th, .quarters td { padding: 3px 10px; text-align: center; border-bottom: 1px solid var(--border); }
.quarters th { color: var(--muted); font-weight: 600; }
.quarters td:first-child { text-align: left; font-weight: 600; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; margin-top: 16px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.chart-legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.chart-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.bars .row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: center; margin-bottom: 10px; }
.bars .label { font-size: 13px; font-weight: 600; }
.bars .track { display: grid; gap: 3px; }
.bars .bar { position: relative; height: 18px; background: #f0f1f4; border-radius: 4px; }
.bars .fill { height: 100%; border-radius: 4px; }
.bars .bar .val { position: absolute; left: 8px; top: 0; line-height: 18px; font-size: 11.5px; font-weight: 600; color: #fff; white-space: nowrap; text-shadow: 0 0 2px rgba(0,0,0,.25); }
.bars .bar .val.out { color: var(--text); text-shadow: none; }
.bars .axis { display: grid; grid-template-columns: 130px 1fr; gap: 10px; font-size: 11px; color: var(--muted); }
.bars .axis .ticks { display: flex; justify-content: space-between; }
.tactics { display: grid; grid-template-columns: 130px 1fr 1fr; gap: 6px 10px; font-size: 13px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.tactics .h { color: var(--muted); font-weight: 600; }
.placeholder { color: var(--muted); background: repeating-linear-gradient(-45deg, #fafbfc, #fafbfc 8px, #f3f4f6 8px, #f3f4f6 16px); border: 1px dashed var(--border); border-radius: 8px; padding: 22px; text-align: center; }

.box { margin-top: 16px; }
.box h2 { display: flex; align-items: center; gap: 8px; }
.box h2 .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
table.boxscore { border-collapse: collapse; width: 100%; font-size: 13px; }
.box .scroll { overflow-x: auto; }
table.boxscore th, table.boxscore td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.boxscore th:nth-child(-n+2), table.boxscore td:nth-child(-n+2) { text-align: left; }
table.boxscore thead th { background: #eef0f3; font-size: 12px; cursor: pointer; user-select: none; position: relative; }
table.boxscore thead th:hover { background: #e3e6ea; }
table.boxscore thead th[aria-sort="ascending"]::after { content: " ▲"; font-size: 9px; }
table.boxscore thead th[aria-sort="descending"]::after { content: " ▼"; font-size: 9px; }
table.boxscore tbody tr:hover { background: #f7f8fa; }
table.boxscore tfoot td { font-weight: 700; background: #fafbfc; }
table.boxscore .pos { color: var(--muted); font-size: 12px; }
.pm-pos { color: var(--win); } .pm-neg { color: var(--loss); }

/* ---------- overview ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; padding: 12px 16px; }
.fgroup { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.flabel { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: 2px; }
.radio { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin-right: 6px; }
.radio select, .radio input[type="number"] { padding: 4px 6px; }
.radio input[type="number"] { width: 58px; font: inherit; border: 1px solid var(--border); border-radius: 8px; }
button.tog {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 10px;
  border-radius: 99px; background: var(--surface); color: var(--muted); border: 1px solid var(--border);
}
button.tog .sw { width: 10px; height: 10px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .2); }
button.tog[aria-pressed="true"] { background: #1c1f24; color: #fff; border-color: #1c1f24; }
button.tog:not([aria-pressed="true"]) { text-decoration: line-through; opacity: .7; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.filters #reset { margin-left: auto; }
.updated { color: var(--muted); font-size: 12.5px; }
button:disabled { opacity: .6; cursor: progress; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; }
.tile .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile .v { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.tile .v small { font-size: 13px; font-weight: 600; color: var(--muted); }
.chart-sub { color: var(--muted); font-size: 12.5px; margin: -8px 0 12px; }

.linechart { position: relative; }
.linechart svg { display: block; width: 100%; height: auto; overflow: visible; }
.linechart .grid line { stroke: #e7e9ed; }
.linechart .axis text { fill: var(--muted); font-size: 11px; }
.linechart .line { fill: none; stroke: var(--mine); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.linechart .pt { fill: var(--mine); stroke: var(--surface); stroke-width: 2; }
.linechart .pt.on { r: 6; }
.linechart .xhair { stroke: #9aa0a9; stroke-width: 1; stroke-dasharray: 3 3; }
.tooltip {
  position: absolute; pointer-events: none; background: #1c1f24; color: #fff; font-size: 12px; line-height: 1.4;
  padding: 8px 10px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); white-space: nowrap; z-index: 5; transform: translate(-50%, calc(-100% - 12px));
}
.tooltip .muted { color: #b9bec6; }
.empty { color: var(--muted); text-align: center; padding: 40px 10px; }
table.boxscore tr.former td { color: var(--muted); }
table.boxscore td .tagx { font-size: 11px; color: var(--muted); margin-left: 6px; }

/* ---------- schedule summary / players ---------- */
.sched-summary { color: var(--muted); font-size: 13px; margin: 0 2px 10px; }
.sched-summary b { color: var(--text); }
.filters { margin-bottom: 4px; }
.leaders { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 8px; }
.leader h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.leader ol { list-style: none; margin: 0; padding: 0; }
.leader li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); }
.leader li:first-child { border-top: 0; }
.leader li:first-child .v { font-size: 22px; }
.leader .rank { width: 22px; height: 22px; border-radius: 50%; background: #eef0f3; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.leader li:first-child .rank { background: var(--mine); color: #fff; }
.leader .who { font-weight: 600; }
.leader .who .pos { margin-left: 6px; font-weight: 500; }
.leader .v { font-size: 17px; font-weight: 800; }
.leader li.former .who, .leader li.former .v { color: var(--muted); }
.empty.small { padding: 12px 0; }
.ptable table.boxscore th:nth-child(3), .ptable table.boxscore td:nth-child(3) { text-align: left; }

/* ---------- tactics ---------- */
.tac-overall { margin-top: 8px; }
.tac-overall .bars .row { grid-template-columns: 150px 1fr; margin-bottom: 14px; }
.tac-overall .bars .axis { grid-template-columns: 150px 1fr; }
.tac-overall .bars .bar { height: 26px; }
.tac-overall .bars .bar .val { line-height: 26px; font-size: 13px; }
.tac-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 860px) { .tac-grid { grid-template-columns: 1fr; } }
.tac-col { display: grid; gap: 16px; align-content: start; }
.tac-colhead { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: -6px; }
h2 .gcount { font-weight: 600; color: var(--muted); font-size: 14px; }

/* ---------- my roster ---------- */
.roster-skills table.boxscore th:nth-child(2), .roster-skills table.boxscore td:nth-child(2) { text-align: left; }
.roster-skills table.boxscore th:nth-child(3), .roster-skills table.boxscore td:nth-child(3) { text-align: right; }
.roster-skills table.boxscore td:first-child { width: 28px; }
.flag { display: block; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.ccode { font-size: 10.5px; color: var(--muted); background: #eef0f3; border-radius: 4px; padding: 1px 4px; }
.injured { color: var(--loss); font-weight: 600; cursor: help; }
.inj-key { color: var(--loss); font-weight: 600; }
.sk { display: inline-block; min-width: 26px; text-align: center; padding: 1px 4px; border-radius: 4px; background: rgba(22, 163, 74, var(--a)); font-weight: 600; }
.warn { color: #9a6700; }
/* shooting (match page) */
.sh-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 22px 0 8px; padding-top: 14px; border-top: 1px solid var(--border); }
#shoot > .sh-title:first-child { margin-top: 4px; padding-top: 0; border-top: 0; }
.sh-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 18px; align-items: start; }
@media (max-width: 520px) { .sh-grid { grid-template-columns: 1fr; } }
.sh-col { min-width: 0; }
.sh-team { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 0 0 6px; }
.sh-team .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
table.sh { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.sh th, table.sh td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; vertical-align: middle; }
table.sh th:first-child, table.sh td:first-child { text-align: left; }
table.sh thead th { background: #eef0f3; font-size: 11.5px; font-weight: 600; }
table.sh .ma { display: block; font-weight: 600; line-height: 1.2; }
table.sh .pc { display: block; font-size: 11px; color: var(--muted); line-height: 1.2; }
table.sh .na { color: #9aa0a9; font-weight: 500; }
table.sh tr.area td { font-weight: 700; background: #fafbfc; }
table.sh tr.zone td:first-child { padding-left: 22px; color: var(--muted); }
table.sh tr.total td, table.sh tfoot td { font-weight: 800; border-top: 2px solid var(--border); background: #fafbfc; }
table.sh tr.muted-row td { color: var(--muted); }
table.sh .pc-inline { color: var(--muted); font-size: 11.5px; }
table.sh-players td.pos { color: var(--muted); font-size: 12px; text-align: left; }
table.sh-players { font-size: 12.5px; }
table.sh-players th, table.sh-players td { padding: 5px 4px; }
table.sh-players thead th { white-space: normal; line-height: 1.2; vertical-align: bottom; }
table.sh-players td.pn { max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
table.sh-players th:nth-child(2) { text-align: left; }
table.sh-players td.tot { background: rgba(0,0,0,.025); }
table.sh-players td.def { background: rgba(59, 91, 219, .06); }
.sh-note { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* shot efficiency (players page) */
.eff-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.eff-head h2 { margin: 0; }
.eff table.boxscore td .ev { display: block; line-height: 1.15; }
.eff table.boxscore td .ev.b { font-weight: 800; }
.eff table.boxscore td .en { display: block; font-size: 10.5px; color: var(--muted); line-height: 1.1; }
.eff table.boxscore thead tr:last-child th:nth-child(6), .eff table.boxscore td:nth-child(6),
.eff table.boxscore thead tr:last-child th:nth-child(11), .eff table.boxscore td:nth-child(11) { border-left: 2px solid var(--border); }
.eff table.boxscore thead tr:last-child th:nth-child(6), .eff table.boxscore thead tr:last-child th:nth-child(11) { font-weight: 800; }
.eff table.boxscore thead tr:last-child th:nth-child(3), .eff table.boxscore td:nth-child(3) { text-align: left; }
.eff table.boxscore thead tr:last-child th:nth-child(2) { text-align: left; }
table.boxscore thead tr.grp th { cursor: default; text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; background: #e6e8ec; border-bottom: 1px solid var(--border); }
table.boxscore thead tr.grp th:hover { background: #e6e8ec; }
.ptable table.boxscore thead tr.grp th { text-align: center; }
table.boxscore thead tr.grp th:empty { background: transparent; }
table.boxscore thead tr.grp th.g-off, table.boxscore thead tr.grp th.g-def { border-left: 2px solid var(--border); }
table.boxscore thead tr.grp th.g-off { color: #8a2c06; background: #fde8dc; }
table.boxscore thead tr.grp th.g-def { color: #23379a; background: #e2e8fb; }

/* transfer targets (my roster) */
.tgt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; margin-bottom: 4px; }
.tgt-bar input { min-width: 300px; flex: 0 1 380px; }
.tgt-status { font-size: 12.5px; color: var(--muted); }
.tgt-status.ok { color: var(--win); } .tgt-status.bad { color: var(--loss); }
.tgt-badge { display: inline-block; font-size: 9.5px; font-weight: 800; letter-spacing: .06em; color: #fff; background: #7048e8; border-radius: 4px; padding: 1px 5px; margin-right: 6px; vertical-align: 1px; }
.lu-name .tgt-badge { margin: 0 0 0 4px; }
table.boxscore tr.target td, table.lu tr.target td { background: #f3f0ff; }
table.boxscore tr.target td:first-child { box-shadow: inset 3px 0 0 #7048e8; }
.tgt-name { white-space: nowrap; }
.tgt-exp { display: block; font-size: 10.5px; color: #6741d9; margin-top: 1px; }
.rm-target { background: none; border: 0; color: var(--loss); font-weight: 800; font-size: 13px; padding: 0 4px; margin-left: 6px; cursor: pointer; border-radius: 4px; line-height: 1; }
.rm-target:hover { background: rgba(198, 40, 40, .12); }
.gs-sel { font: inherit; font-size: 12.5px; padding: 1px 4px; border-radius: 6px; border: 1px solid #b197fc; background: #fff; }

/* ideal lineup */
.lu-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; justify-content: space-between; }
.lu-head h2 { margin: 0; }
.lu-opts { display: flex; gap: 18px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .slider { width: 34px; height: 20px; border-radius: 99px; background: #c9ccd2; position: relative; transition: background .15s; flex: none; }
.switch .slider::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + .slider { background: var(--mine); }
.switch input:checked + .slider::after { transform: translateX(14px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--mine); outline-offset: 2px; }
.lu-head + .chart-sub { margin-top: 6px; }
.lu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.lu-box h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
table.lu { width: 100%; border-collapse: collapse; font-size: 14px; }
table.lu td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
table.lu .lu-pos { width: 44px; font-weight: 700; color: var(--muted); }
.lu-name { display: flex; align-items: center; gap: 8px; }
table.lu .lu-val { text-align: right; font-weight: 700; width: 70px; }
table.lu tfoot td { font-weight: 800; border-bottom: 0; }
table.lu tfoot td.num { text-align: right; font-size: 16px; }
.sk.top { font-weight: 800; box-shadow: inset 0 0 0 1.5px var(--good); }
.legend-note { margin: 12px 0 0; line-height: 1.6; }

footer { color: var(--muted); font-size: 12px; text-align: center; padding: 24px 20px 30px; }

/* ---------- login ---------- */
.login { max-width: 440px; margin: 8vh auto; }
.login h1 { margin-bottom: 6px; }
.login p { color: var(--muted); margin-top: 0; }
.login .or { text-align: center; color: var(--muted); margin: 18px 0; font-size: 13px; }
.login form { display: grid; gap: 8px; }
.login .hint { font-size: 12px; color: var(--muted); }
.login .full { width: 100%; text-align: center; }

/* ---------- player links ---------- */
a.plink { color: inherit; text-decoration: none; border-bottom: 1px dotted #b3b8c0; }
a.plink:hover { color: var(--accent); border-bottom-color: var(--accent); }
a.plink.injured { color: var(--loss); }

/* ---------- player details: profile card ---------- */
.pcard { margin-top: 16px; padding: 0; overflow: hidden; }
.pc-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); background: #fafbfc; }
.pc-who { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.pc-name { font-size: 20px; font-weight: 700; }
.pc-num { color: var(--muted); font-size: 13px; }
.pc-ratings { flex: 1; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; font-variant-numeric: tabular-nums; }
.pc-ratings .pr { display: inline-flex; align-items: baseline; gap: 6px; font-size: 19px; font-weight: 800; padding: 4px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.pc-ratings .pr small { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .03em; }
.pc-ratings .pr.best { color: var(--good); border-color: #9fd9b4; background: #eefaf2; }
.pc-ratings .pr.best small { color: var(--good); }
.pc-pos { font-size: 12px; font-weight: 700; color: #fff; background: #db7a68; border-radius: 4px; padding: 3px 9px; margin-left: auto; }
.pc-body { display: grid; grid-template-columns: 132px minmax(230px, 300px) 1fr; gap: 18px; padding: 16px; align-items: start; }
.pc-avatar { position: relative; width: 132px; height: 150px; border: 1px solid var(--border); border-radius: 8px; background: #eef0f3; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.pc-avatar svg { width: 110px; height: 110px; fill: #c9cdd4; }
.pc-avatar .ovr { position: absolute; top: 6px; right: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 5px; font-size: 11px; font-weight: 600; padding: 1px 6px; color: var(--muted); }
.pc-avatar .ovr b { color: var(--text); font-size: 15px; }
.pc-info { display: grid; grid-template-columns: auto 1fr; gap: 0 18px; font-size: 14px; }
.pc-info .k, .pc-info .v { padding: 4px 0; border-bottom: 1px solid #f0f1f4; }
.pc-info .k { color: var(--muted); }
.pc-info .v { font-weight: 600; }
.pc-skills { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 0 18px; font-size: 14px; }
.pc-skills .sk-l, .pc-skills .sk-v { padding: 4px 8px; border-bottom: 1px solid #f0f1f4; }
.pc-skills .sk-l { color: var(--muted); background: #fafbfc; border-radius: 4px 0 0 4px; }
.pc-skills .sk-v { white-space: nowrap; }
.pc-skills.none { display: block; color: var(--muted); padding: 8px; }
.lv { font-weight: 700; }
.arr { font-size: 10px; margin-left: 4px; vertical-align: 1px; }
.arr.up { color: var(--win); }
.arr.down { color: var(--loss); }
.pc-foot { padding: 0 16px 12px; font-size: 12px; color: var(--muted); }
@media (max-width: 1000px) { .pc-body { grid-template-columns: 132px 1fr; } .pc-skills { grid-column: 1 / -1; } }
@media (max-width: 560px) { .pc-body { grid-template-columns: 1fr; } .pc-skills { grid-template-columns: auto 1fr; } .pc-ratings { justify-content: flex-start; } }

/* ---------- player details: chart ---------- */
.combo .legend { font-size: 12px; color: var(--muted); gap: 18px; margin-bottom: 6px; }
.combo .legend span { display: inline-flex; align-items: center; gap: 6px; }
.combo .lg-line { width: 18px; height: 3px; border-radius: 2px; background: var(--mine); display: inline-block; }
.combo .lg-bar { width: 12px; height: 12px; border-radius: 2px; background: #b7c6f2; display: inline-block; }
.combo .mbar { fill: #b7c6f2; }
.combo .xband { fill: rgba(59, 91, 219, .07); }
.combo .ax-t { font-size: 10px; }

/* ---------- player details: weekly tables ---------- */
.wk table.boxscore thead th { cursor: default; }
.wk table.boxscore thead th:hover { background: #eef0f3; }
.wk table.boxscore th, .wk table.boxscore td { text-align: right; padding: 5px 7px; }
.wk table.boxscore th.l, .wk table.boxscore td.wk-dates { text-align: left; }
.wk table.boxscore thead tr.grp th { text-align: center; }
.wk table.boxscore tr.cur td { background: #fffaf0; }
.wk .arr { margin-left: 2px; font-size: 9px; }
.est { font-style: italic; opacity: .8; }
.sk.est { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.wk .full { color: var(--win); font-weight: 700; }

/* ---------- player details: rating charts ---------- */
.pd-charts { align-items: stretch; }
.pd-charts .card { display: flex; flex-direction: column; }
.chart-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; margin-bottom: 12px; }
.chart-head h2 { margin: 0; }
.pos-tog { display: flex; gap: 4px; }
.pos-tog button.tog { padding: 2px 10px; font-size: 12px; }
.pos-tog button.tog:not([aria-pressed="true"]) { text-decoration: none; opacity: 1; }
.linechart .pt.hollow { fill: var(--surface); stroke: var(--mine); stroke-width: 2; }
.tooltip .up { color: #6ee7a0; } .tooltip .down { color: #ff9b9b; }
.posbars { display: flex; flex-direction: column; justify-content: space-around; flex: 1; min-height: 240px; }
.posbars .row { grid-template-columns: 70px 1fr; margin-bottom: 0; }
.posbars .axis { grid-template-columns: 70px 1fr; }
.posbars .bar { height: 30px; }
.posbars .bar .val { line-height: 30px; font-size: 13px; }
.posbars .label { font-size: 14px; }
.best-tag { font-size: 10px; font-weight: 700; color: var(--good); text-transform: uppercase; letter-spacing: .04em; margin-left: 4px; }

/* Rating charts on Player Details use green (good) */
#trend .line { stroke: var(--good); }
#trend .pt { fill: var(--good); }
#trend .pt.hollow { fill: var(--surface); stroke: var(--good); }
.bars .row.total { padding-top: 10px; border-top: 1px dashed var(--border); }
.bars .row.total .label { font-weight: 800; }
.linechart .xtick { stroke: #c9cdd4; }

/* ---------- My Roster: lineup checkboxes ---------- */
.lu-inc { margin: 0 7px 0 0; vertical-align: -2px; accent-color: var(--good); cursor: pointer; }
.lu-card { margin-top: 0; }
.tgt-bar { margin-top: 16px; }

/* ---------- Preferences ---------- */
.pref-actions { display: flex; align-items: center; gap: 12px; }
.pref-status { font-size: 12.5px; color: var(--muted); }
.pref-status.ok { color: var(--win); }
.pref-status.bad { color: var(--loss); }
.pref-table th, .pref-table td { text-align: center !important; }
.pref-table thead th { cursor: default; vertical-align: bottom; }
.pref-table thead th:hover { background: #eef0f3; }
.pref-table th .sk-name { display: block; font-size: 10px; font-weight: 500; color: var(--muted); white-space: normal; line-height: 1.2; max-width: 70px; margin: 2px auto 0; }
.pref-table td:first-child, .pref-table th:first-child { text-align: left !important; }
.pref-table select { padding: 3px 6px; min-width: 52px; }
.pref-table td.custom select { border-color: var(--good); background: #eefaf2; font-weight: 700; }
.custom-key { background: #eefaf2; border: 1px solid var(--good); border-radius: 4px; padding: 0 4px; }
.pct-table td.pct { font-weight: 600; border: 1px solid #fff; }

/* ---------- top bar: team switcher + preferences gear ---------- */
.team-switch select { background: #2a2e35; color: #fff; border: 1px solid #3a3f48; border-radius: 8px; padding: 4px 8px; font-size: 13px; max-width: 220px; }
.team-switch select:disabled { opacity: 1; cursor: default; }
.topbar .gear { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 6px; color: #c9ccd2; }
.topbar .gear:hover, .topbar .gear.active { color: #fff; background: rgba(255, 255, 255, .1); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#teamWrap { display: none !important; } /* replaced by the team switcher in the top bar */
.topbar nav { align-items: center; }
.topbar nav .nav-sep { color: #5a606b; padding: 0 6px; user-select: none; }
.lvn { font-weight: 700; }
.topbar .upd-all { font: inherit; font-size: 13px; font-weight: 600; color: #fff; background: var(--accent); border: 0; border-radius: 8px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.topbar .upd-all:hover { filter: brightness(1.08); }
.topbar .upd-all:disabled { opacity: .85; cursor: progress; }
.topbar .upd-all.ok { background: var(--win); }
.topbar .upd-all.bad { background: #b45309; }
/* keep the top bar on one line on normal laptop widths */
.topbar { gap: 12px; }
.topbar nav a { padding: 6px 9px; }
@media (max-width: 1500px) { .topbar .user .lbl { display: none; } }
@media (max-width: 1440px) {
  .topbar { gap: 8px; padding: 10px 14px; }
  .topbar nav { gap: 0; }
  .topbar nav a { padding: 6px 7px; font-size: 13.5px; }
  .topbar nav .nav-sep { padding: 0 3px; }
  .team-switch select { max-width: 170px; }
}

/* ---------- analytics ---------- */
.an-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.an-legend span { display: inline-flex; align-items: center; gap: 6px; }
.an-legend .sw { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--mine); }
.an-legend .sw.users { border-top: 2px dashed var(--theirs); }
.an-chart .line.users { stroke: var(--theirs); stroke-dasharray: 6 4; }
.an-chart .pt.users { fill: var(--theirs); }
table.an-table td.zero { color: var(--muted); }
table.an-table th.period, table.an-table td.period { font-weight: 700; border-left: 2px solid var(--border); }
table.an-table th:first-child, table.an-table td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; box-shadow: 1px 0 0 var(--border); }
table.an-table thead th:first-child { background: #eef0f3; }
table.an-table th:nth-child(2), table.an-table td:nth-child(2) { text-align: right; }
table.an-table thead th { cursor: default; }

/* ---------- match: court heat map (points per shot by zone) ---------- */
:root { --court-empty: #e6e7ea; }
.ct-heads { display: flex; justify-content: space-between; gap: 12px; max-width: 980px; margin: 0 auto; }
.ct-heads .sh-team:last-child { flex-direction: row-reverse; }
.court-wrap { position: relative; max-width: 980px; margin: 0 auto; }
svg.court { display: block; width: 100%; height: auto; }
svg.court .zones path { stroke: var(--surface); stroke-width: .3; }
svg.court .zones path.on { stroke: #1c1f24; stroke-width: .45; }
svg.court .lines { fill: none; stroke: rgba(255, 255, 255, .9); stroke-width: .35; pointer-events: none; }
svg.court .ct-labels { pointer-events: none; text-anchor: middle; fill: #1c1f24; font-variant-numeric: tabular-nums; }
svg.court .ct-pps { font-size: 2.3px; font-weight: 800; }
svg.court .ct-pps.sm { font-size: 1.9px; }
svg.court .ct-ma { font-size: 1.6px; font-weight: 500; }
svg.court .ct-none { font-size: 2px; fill: var(--muted); }
.ct-legend { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; flex-wrap: wrap; }
.ct-ramp { width: 160px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, hsl(0 62% 58%), hsl(60 62% 58%), hsl(120 62% 58%)); }
.ct-key { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; white-space: nowrap; }
.ct-key-none { width: 14px; height: 10px; border-radius: 3px; background: var(--court-empty); }
