:root {
  color-scheme: dark;
  --bg: #0b0f17;
  --surface: #121826;
  --surface-2: #182032;
  --surface-3: #212b40;
  --border: #263049;
  --text: #e7ecf5;
  --muted: #8d98ae;
  --faint: #5d6880;
  --accent: #4da3ff;
  --accent-soft: rgba(77, 163, 255, .14);
  --gold: #f2c14e;
  --gold-soft: rgba(242, 193, 78, .16);
  --green: #3ecf8e;
  --green-soft: rgba(62, 207, 142, .14);
  --exact: #1d8a5c;
  --exact-border: #2aa873;
  --red: #ff6b6b;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(11, 15, 23, .88);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.tabs a { padding: 6px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.tabs a.active { background: var(--surface-3); color: var(--text); }
@media (max-width: 420px) {
  .brand span { display: none; }
  .tabs a { padding: 6px 12px; }
}

main { max-width: 1600px; margin: 0 auto; padding: 16px; }

/* ---------- Generic building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-pad { padding: 16px; }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-weight: 600; cursor: pointer; min-height: 38px;
}
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06121f; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 38px; padding: 0; }
input[type=number], input[type=text], select {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-height: 36px;
}
input[type=number] { width: 72px; }
input:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; cursor: pointer; }
.seg button.active { background: var(--surface-3); color: var(--text); }

/* ---------- Team badge ---------- */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; height: 24px; padding: 0 6px; border-radius: 6px;
  font-size: .72rem; font-weight: 800; letter-spacing: .04em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
  flex: none;
}

/* ---------- Season header ---------- */
.year-bar { display: flex; align-items: center; gap: 8px; }
.year-scroll { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; flex: 1; scroll-behavior: smooth; }
.year-scroll::-webkit-scrollbar { display: none; }
.year-chip { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 700; cursor: pointer; }
.year-chip.active { background: var(--accent); border-color: var(--accent); color: #06121f; }
.year-chip.live::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-left: 6px; vertical-align: middle; }

.hero { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; margin-top: 16px; padding: 18px; background: linear-gradient(135deg, #18233a, #121826 60%); }
.hero h1 { font-size: 1.6rem; }
.hero .sub { color: var(--muted); margin-top: 4px; }
.champ { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--gold-soft); border: 1px solid rgba(242, 193, 78, .35); }
.champ svg { flex: none; }
.champ .who { font-weight: 800; font-size: 1.1rem; color: var(--gold); }
.champ .pts { color: var(--muted); font-size: .85rem; }
.cup-winner { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; margin-top: 8px; }
@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; }
}

/* ---------- Standings ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; text-align: right; white-space: nowrap; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid rgba(38, 48, 73, .6); }
tr:last-child td { border-bottom: 0; }
th.l, td.l { text-align: left; }
td.total { font-weight: 800; font-size: 1.05rem; }
.rank { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; background: var(--surface-3); color: var(--muted); }
.rank.r1 { background: var(--gold); color: #1a1405; }
.rank.r2 { background: #c9d2e3; color: #151b27; }
.rank.r3 { background: #c98a55; color: #1d1209; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: rgba(255, 255, 255, .02); }
tr.focus td { background: var(--accent-soft); }
.adj-mark { color: var(--gold); font-weight: 700; margin-left: 2px; cursor: help; }
.sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 8px; }

/* ---------- Bracket ---------- */
.bracket-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

.bracket { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.bcol { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bcol-body { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 10px; }
.bcol-title { text-align: center; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 700; }
.bcol.final .bcol-body { justify-content: center; }
.bracket-tabs { display: none; }

.series { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; position: relative; }
.series.final-card { border-color: rgba(242, 193, 78, .45); box-shadow: 0 0 0 1px rgba(242, 193, 78, .15), var(--shadow); }
.final-label { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 800; color: var(--gold); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; padding: 6px; background: var(--gold-soft); }
.side {
  --tc: 90, 100, 120;
  position: relative; isolation: isolate; overflow: hidden;
  padding: 9px 10px 9px 12px;
  background: linear-gradient(100deg, rgba(var(--tc), .16) 0%, rgba(var(--tc), .05) 45%, rgba(var(--tc), 0) 75%);
  box-shadow: inset 3px 0 0 rgba(var(--tc), .6);
}
/* Large faded logo in the background */
.side::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  right: -18px; top: 50%; width: 120px; height: 120px;
  transform: translateY(-50%) rotate(-10deg);
  background: var(--logo, none) center / contain no-repeat;
  opacity: .09;
}
.side + .side { border-top: 1px solid var(--border); }
.side.won { background: linear-gradient(100deg, rgba(var(--tc), .22) 0%, rgba(var(--tc), .08) 50%, rgba(var(--tc), 0) 80%); }
.side.won::before { opacity: .12; }
.side.lost { background: linear-gradient(100deg, rgba(var(--tc), .07) 0%, rgba(var(--tc), 0) 55%); box-shadow: inset 3px 0 0 rgba(var(--tc), .25); }
.side.lost::before { opacity: .04; filter: grayscale(1); }
.side .trow .tname { text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.trow { display: flex; align-items: center; gap: 8px; }
.trow .tname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .88rem; }
.trow .wins { font-weight: 500; font-size: 1.75rem; line-height: 1; min-width: 1ch; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.side.won .tname, .side.won .wins { color: var(--text); }
.side.won .wins { color: var(--green); }
.side.lost .tname { color: var(--muted); }
.side.lost .badge, .side.lost .logo img { opacity: .45; filter: grayscale(.6); }
.logo { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 34px; flex: none; }
.logo img { width: 40px; height: 34px; object-fit: contain; }
.logo .badge { display: none; }
.logo.nologo img { display: none; }
.logo.nologo { width: auto; }
.logo.nologo .badge { display: inline-flex; }
.cup-winner .logo, .cup-winner .logo img { width: 40px; height: 36px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 7px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  cursor: pointer; user-select: none;
}
.chip b { font-weight: 800; color: inherit; opacity: .85; }
.chip.exact { background: var(--exact); border-color: var(--exact-border); color: #fff; }
.chip.team { background: var(--green-soft); border-color: rgba(62, 207, 142, .55); color: var(--green); }
.chip.wrong { opacity: .55; text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, .25); }
.chip.pending { color: var(--text); }
.series-foot { padding: 5px 8px; font-size: .75rem; color: var(--muted); background: var(--surface-2); border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 6px; }
.series-foot .res { color: var(--text); font-weight: 700; }
.bracket.focusing .chip:not(.me) { opacity: .2; }
.bracket.focusing .chip.me { box-shadow: 0 0 0 2px var(--accent); }

.focus-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.focus-bar .chip { height: 28px; padding: 0 12px; font-size: .82rem; }
.focus-bar .chip.on { background: var(--accent); color: #06121f; border-color: var(--accent); }

@media (max-width: 1100px) {
  .bracket-tabs { display: flex; margin-top: 12px; }
  .bracket { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
  .bracket .bcol { flex: 0 0 min(300px, 82vw); scroll-snap-align: start; }
  .bracket[data-show="east"] .w, .bracket[data-show="east"] .f,
  .bracket[data-show="west"] .e, .bracket[data-show="west"] .f,
  .bracket[data-show="final"] .e, .bracket[data-show="final"] .w { display: none; }
  .bracket[data-show="final"] .bcol.final { flex-basis: 100%; max-width: 420px; margin: 0 auto; }
  /* East is drawn right-to-left on desktop; on phones show it Round 1 first */
  .bracket[data-show="east"] .e.r1 { order: 1; }
  .bracket[data-show="east"] .e.r2 { order: 2; }
  .bracket[data-show="east"] .e.r3 { order: 3; }
}

/* ---------- Stats ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; }
.kpi .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.kpi .value { font-size: 1.6rem; font-weight: 800; margin-top: 4px; }
.kpi .detail { color: var(--muted); font-size: .85rem; }
@media (max-width: 800px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

.bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar.gold > i { background: var(--gold); }
.bar.exact > i { background: var(--exact-border); }
.trophies { color: var(--gold); letter-spacing: 1px; }
.years { color: var(--muted); font-size: .8rem; white-space: normal; text-align: left; }

.finish-grid td, .finish-grid th { padding: 6px 4px; text-align: center; min-width: 34px; }
.finish-grid .cell { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; font-weight: 700; font-size: .8rem; }
.champ-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.champ-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; }
.champ-item .y { font-weight: 800; color: var(--muted); }
.champ-item .w { font-weight: 700; color: var(--gold); text-align: right; }

/* ---------- Manage ---------- */
.form-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scoring-table td, .scoring-table th { text-align: center; }
.scoring-table td.l, .scoring-table th.l { text-align: left; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.check input { accent-color: var(--accent); }

.editor-series { padding: 12px; }
.editor-series + .editor-series { border-top: 1px solid var(--border); }
.editor-series .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.editor-series .head .id { font-weight: 800; color: var(--muted); width: 34px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; margin-top: 10px; }
.pick-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 8px; background: var(--surface-2); }
.pick-row .pname { flex: 1; font-weight: 600; font-size: .88rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pick-row select { min-height: 30px; padding: 3px 4px; }
.toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.toggle button { border: 0; background: var(--bg); padding: 4px 8px; font-size: .75rem; font-weight: 800; cursor: pointer; min-width: 44px; min-height: 30px; color: var(--muted); }
.toggle button + button { border-left: 1px solid var(--border); }
.toggle button.on { color: var(--text); }
.savebar {
  position: sticky; bottom: 0; z-index: 10; margin: 20px -16px -16px; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: rgba(11, 15, 23, .94); border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; align-items: center;
}
.savebar .status { margin-right: auto; color: var(--muted); font-size: .85rem; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--surface-3); border: 1px solid var(--border); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow);
  transition: opacity .2s, transform .2s; z-index: 50; font-weight: 600;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { border-color: var(--red); color: var(--red); }

.empty { padding: 30px; text-align: center; color: var(--muted); }

@media (max-width: 560px) {
  main { padding: 12px; }
  th, td { padding: 8px 5px; }
  th { font-size: .68rem; letter-spacing: .03em; }
  .maxlbl { display: none; }
  .hero { padding: 14px; }
  .hero h1 { font-size: 1.35rem; }
}

/* ---------- Pick submission ---------- */
.pick-wrap { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.pick-card { overflow: hidden; }
.pick-card-head { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--border); }
.pick-teams { display: grid; grid-template-columns: 1fr 1fr; }
.pick-team {
  --tc: 90, 100, 120;
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; gap: 10px; padding: 14px 12px; min-height: 64px; text-align: left;
  border: 0; border-bottom: 1px solid var(--border); background: transparent; cursor: pointer;
  box-shadow: inset 3px 0 0 rgba(var(--tc), .25);
}
.pick-team + .pick-team { border-left: 1px solid var(--border); }
.pick-team::before {
  content: ""; position: absolute; z-index: -1; right: -16px; top: 50%; width: 96px; height: 96px;
  transform: translateY(-50%) rotate(-10deg); background: var(--logo, none) center / contain no-repeat; opacity: .05;
}
.pick-team.on { background: linear-gradient(100deg, rgba(var(--tc), .30), rgba(var(--tc), .08) 70%); box-shadow: inset 0 0 0 2px var(--green), inset 6px 0 0 rgba(var(--tc), .9); }
.pick-team.on::before { opacity: .14; }
.pick-team:disabled { cursor: default; }
.pick-team:not(.on):disabled { opacity: .6; }
.pt-name { display: flex; flex-direction: column; min-width: 0; }
.pt-city { font-weight: 700; font-size: 1rem; color: var(--text); }
.pt-full { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-games { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; }
.pick-games .seg button { min-width: 48px; min-height: 38px; font-size: 1rem; }
.pick-games .seg button.active { background: var(--green); color: #06170f; }
.pick-submit { display: flex; flex-direction: column; gap: 10px; }
.pick-submit input[type=password] { min-height: 44px; font-size: 1rem; }
.btn.big { min-height: 48px; font-size: 1.05rem; }
.error-text { color: var(--red); font-weight: 600; }
.notice { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); border: 1px solid rgba(77, 163, 255, .35); }
@media (max-width: 420px) {
  .pick-team { flex-direction: column; align-items: flex-start; gap: 6px; }
  .pt-full { display: none; }
}

/* ---------- Manage: passwords + pick links ---------- */
.player-row { flex-wrap: wrap; }
.player-row input[type=password] { width: 150px; }
.pw-status { font-size: .8rem; font-weight: 700; color: var(--muted); padding: 3px 8px; border-radius: 999px; background: var(--surface-3); }
.pw-status.set { color: var(--green); background: var(--green-soft); }
.check.open-on { border-color: var(--green); color: var(--green); }
details.links { margin-bottom: 10px; }
details.links summary { padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--accent); }
details.links .list-item { flex-wrap: wrap; }
details.links input[readonly] { width: min(420px, 60vw); color: var(--muted); font-size: .85rem; }

/* Pick page: password screen + draft/submit bar */
.pick-login { display: flex; flex-direction: column; gap: 12px; margin-top: 8vh; text-align: center; align-items: stretch; }
.pick-login-icon { display: flex; justify-content: center; }
.pick-login h1 { font-size: 1.5rem; }
.pick-login p { margin: 0; }
.pick-login input[type=password] { min-height: 48px; font-size: 1.05rem; text-align: center; }
.pick-login .check { align-self: center; }
.pick-bar { margin: 4px 0 0; border-radius: 12px 12px 0 0; flex-wrap: wrap; background: #2a3a5c; border: 1px solid rgba(77, 163, 255, .55); border-bottom: 0; box-shadow: 0 -8px 24px rgba(0, 0, 0, .5); }
.pick-bar .pick-status { color: var(--text); }
.pick-bar .draft-state { color: #a9b6cf; }
.hero #logout { align-self: start; justify-self: end; }
.pick-status { flex: 1 1 220px; }
.pick-status.ok { color: var(--green); font-weight: 600; }
.pick-status.warn { color: var(--gold); font-weight: 600; }
.draft-state { font-size: .8rem; color: var(--faint); }

/* ---------- Player page ---------- */
.player-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.player-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.player-switch .chip { height: 28px; padding: 0 12px; font-size: .82rem; color: var(--muted); }
.player-switch .chip.on { background: var(--accent); border-color: var(--accent); color: #06121f; }
.chart-card { padding: 12px 12px 6px; position: relative; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 11px; }
.chart .cl { fill: var(--text); font-size: 11px; font-weight: 700; }
.chart .hit { cursor: pointer; }
.chart .hit.on { fill: rgba(255, 255, 255, .04); }
.legend i.dash { width: 16px; height: 0; border-radius: 0; border-top: 2px dashed var(--muted); }
.chart-tip {
  position: absolute; display: none; z-index: 60; pointer-events: none; padding: 8px 10px; border-radius: 8px; font-size: .82rem; line-height: 1.35;
  background: var(--surface-3); border: 1px solid var(--border); box-shadow: var(--shadow); white-space: nowrap;
}
.team-cell { display: inline-flex; align-items: center; gap: 8px; }
.team-cell .logo, .team-cell .logo img { width: 28px; height: 24px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.fact { padding: 14px 16px; }
.fact .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.fact .value { font-size: 1.6rem; font-weight: 800; margin: 4px 0; }
.fact .detail { color: var(--muted); font-size: .85rem; }
.fact-teams { display: flex; gap: 6px; }
.h2h-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-3); gap: 2px; min-width: 80px; }
.h2h-bar i { display: block; height: 100%; }
.h2h-bar .a { background: var(--green); }
.h2h-bar .t { background: var(--muted); }
.h2h-bar .b { background: var(--red); opacity: .7; }
a.plink { color: var(--text); }
a.plink:hover { color: var(--accent); }
@media (max-width: 560px) { .chart .axis { font-size: 10px; } }

/* ---------- Account (top right) ---------- */
.topbar .tabs { margin-left: auto; }
.account { position: relative; flex: none; }
.account-btn { gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; position: relative; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #06121f; font-weight: 800; font-size: .8rem; }
.account-btn .dot { position: absolute; top: 2px; right: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--bg); }
.login-btn { border-radius: 999px; background: var(--accent); border-color: var(--accent); color: #06121f; }
.login-btn:hover { background: var(--accent); filter: brightness(1.1); }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 40; padding: 6px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.account-menu[hidden] { display: none; }
.account-menu a, .account-menu button { display: block; text-align: left; padding: 9px 10px; border-radius: 8px; color: var(--text); background: none; border: 0; cursor: pointer; font-weight: 600; }
.account-menu a:hover, .account-menu button:hover { background: var(--surface-3); }
.account-menu .menu-head { padding: 8px 10px; color: var(--muted); font-size: .85rem; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.account-menu .role { color: var(--green); font-weight: 700; margin-left: 4px; }
.account-menu .menu-warn { color: var(--gold); }
@media (max-width: 480px) {
  .acct-name { display: none; }
  .account-btn { padding: 4px; }
  .topbar { gap: 8px; }
}

/* ---------- Picks-to-make banner ---------- */
.pick-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px; border-radius: 12px; color: var(--text);
  border: 1px solid; line-height: 1.35;
}
.pick-banner.warn { background: rgba(242, 193, 78, .1); border-color: rgba(242, 193, 78, .55); }
.pick-banner.ok { background: var(--green-soft); border-color: rgba(62, 207, 142, .45); }
.pick-banner .pb-icon { flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; }
.pick-banner.warn .pb-icon { background: var(--gold); color: #1a1405; }
.pick-banner.ok .pb-icon { background: var(--green); color: #06170f; }
.pick-banner .pb-go { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-weight: 700; white-space: nowrap; }
.pick-banner.warn .pb-go { color: var(--gold); }
.pick-banner.ok .pb-go { color: var(--green); }
.pick-login select { min-height: 48px; font-size: 1.05rem; }
/* Let the pick page's bottom panel sit flush against the bottom of the screen */
main:has(.pick-bar) { padding-bottom: 0; }
body:has(.pick-bar) { padding-bottom: 0; }

/* Manage: compact season cards */
.season-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.season-card { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.sg-year { font-size: 1.25rem; font-weight: 800; }
.sg-status { font-size: .85rem; min-height: 1.3em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-champ { color: var(--gold); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.sg-live { color: var(--green); font-weight: 700; }
.sg-actions { display: flex; gap: 6px; margin-top: 2px; }
.sg-actions .btn { flex: 1; }
@media (max-width: 400px) { .season-grid { grid-template-columns: 1fr 1fr; } }
.player-row.inactive input[type=text] { color: var(--muted); }
.player-row.inactive { opacity: .7; }

/* Sortable leaderboard headers */
.sort-btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.sort-btn:hover { color: var(--text); }
.sort-btn.on { color: var(--accent); }
.sort-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sort-btn .arrow { font-size: .65rem; min-width: .7em; }
