/*
  Reward tracker: "floodlight" theme.
  Dark by default, with a light theme. Archivo throughout: expanded for headings, condensed for figures.
  Theme: html[data-theme="light|dark"] wins; without it, the system setting decides.
*/
[hidden] { display: none !important; }

:root {
  --bg: #0a0c0e;
  --side: #0d1013;
  --surface: #12161a;
  --raise: #192025;
  --hover: #161c21;
  --line: #20272d;
  --line-strong: #2f3840;
  --text: #edf1ee;
  --muted: #9aa49f;
  --faint: #66706c;
  --accent: #d4ff3a;
  --accent-ink: #0b0e05;
  --accent-text: #d4ff3a;
  --accent-soft: rgba(212, 255, 58, .1);
  --good: #42d98a;
  --good-soft: rgba(66, 217, 138, .12);
  --bad: #ff6159;
  --bad-soft: rgba(255, 97, 89, .12);
  --warn: #f2b84b;
  --limited: #f1c232;
  --rare: #f0434d;
  --super-rare: #3d84f6;
  --unique: #b9b6ad;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 20px 50px -30px rgba(0,0,0,.8);
  --pitch: rgba(212, 255, 58, .09);
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 12px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f2f3ef; --side: #e9ebe5; --surface: #ffffff; --raise: #f4f5f1; --hover: #f7f8f4;
  --line: #e0e3dc; --line-strong: #cbd0c7;
  --text: #0e1311; --muted: #56605b; --faint: #87908b;
  --accent: #b7d65a; --accent-ink: #141a08; --accent-text: #4b6a00; --accent-soft: rgba(120, 160, 0, .12);
  --good: #11804a; --good-soft: rgba(17, 128, 74, .1); --bad: #cf3328; --bad-soft: rgba(207, 51, 40, .09); --warn: #9a6608;
  --limited: #c99a0e; --rare: #d32e38; --super-rare: #2a64cc; --unique: #6b675d;
  --shadow: 0 1px 2px rgba(20, 30, 20, .05), 0 12px 32px -24px rgba(20, 30, 20, .35);
  --pitch: rgba(75, 106, 0, .1);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f2f3ef; --side: #e9ebe5; --surface: #ffffff; --raise: #f4f5f1; --hover: #f7f8f4;
    --line: #e0e3dc; --line-strong: #cbd0c7;
    --text: #0e1311; --muted: #56605b; --faint: #87908b;
    --accent: #b7d65a; --accent-ink: #141a08; --accent-text: #4b6a00; --accent-soft: rgba(120, 160, 0, .12);
    --good: #11804a; --good-soft: rgba(17, 128, 74, .1); --bad: #cf3328; --bad-soft: rgba(207, 51, 40, .09); --warn: #9a6608;
    --limited: #c99a0e; --rare: #d32e38; --super-rare: #2a64cc; --unique: #6b675d;
    --shadow: 0 1px 2px rgba(20, 30, 20, .05), 0 12px 32px -24px rgba(20, 30, 20, .35);
    --pitch: rgba(75, 106, 0, .1);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.5 var(--font); font-stretch: 100%; font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- app shell: sidebar + content ---------- */
body.in-app {
  display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--side) 235px, var(--line) 235px 236px, var(--bg) 236px);
}
body:not(.in-app) main { max-width: none; padding: 0; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 22px 14px 18px;
}
.brand {
  display: inline-flex; align-items: baseline; gap: 0; text-decoration: none; white-space: nowrap;
  font: 800 19px/1 var(--font); font-stretch: 118%; letter-spacing: -.02em;
}
.brand em { font-style: normal; color: var(--accent); }
:root[data-theme="light"] .brand em { color: var(--accent-text); }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .brand em { color: var(--accent-text); } }
.side .brand { padding: 4px 10px 22px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14.5px;
}
.side nav a svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.side nav a:hover { color: var(--text); background: var(--hover); }
.side nav a.active { color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.side nav a.active svg { color: var(--accent-text); opacity: 1; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 14px 4px 0; border-top: 1px solid var(--line); }
.sync-box { display: grid; gap: 6px; }
.sync-box .primary { width: 100%; justify-content: center; }
.sync-status { font-size: 12px; color: var(--faint); text-align: center; }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* theme switch: segmented */
.theme-switch { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); }
.theme-switch button {
  border: 0; background: none; padding: 5px 7px; border-radius: 6px; color: var(--faint); display: inline-flex;
}
.theme-switch button svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-switch button:hover { color: var(--text); border: 0; }
.theme-switch button[aria-pressed="true"] { background: var(--raise); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); }

main { width: 100%; max-width: 1240px; padding: 34px 36px 90px; }

/* ---------- type ---------- */
h1 { font: 800 38px/1.02 var(--font); font-stretch: 116%; letter-spacing: -.025em; margin: 0; }
h2 { font: 700 19px/1.25 var(--font); font-stretch: 108%; letter-spacing: -.01em; margin: 40px 0 12px; }
h3 { font: 700 16px/1.3 var(--font); font-stretch: 106%; margin: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head p { margin: 10px 0 0; max-width: 70ch; font-size: 14.5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.fig { font-stretch: 82%; font-weight: 750; letter-spacing: -.01em; }

/* ---------- surfaces ---------- */
.panel, .table-wrap, .card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
}
.panel { padding: 22px 24px; margin-bottom: 16px; }
.panel > h2:first-child { margin-top: 0; }
.notice {
  display: block; padding: 11px 14px; margin: 0 0 14px; border-radius: 10px;
  background: color-mix(in srgb, var(--warn) 9%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent); color: var(--text); font-size: 14px;
}
.notice::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 10px; border-radius: 50%; background: var(--warn); vertical-align: 1px; }
.notice a { color: var(--warn); font-weight: 600; }

/* ---------- dashboard scoreboard ---------- */
.scoreboard {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px;
  padding: 28px 30px; margin-bottom: 18px;
}
/* centre-circle and halfway line, drawn faintly behind the numbers */
.scoreboard::before {
  content: ""; position: absolute; right: -120px; top: 50%; width: 340px; height: 340px; transform: translateY(-50%);
  border: 2px solid var(--pitch); border-radius: 50%; pointer-events: none;
}
.scoreboard::after { content: ""; position: absolute; right: 48px; top: 0; bottom: 0; width: 2px; background: var(--pitch); pointer-events: none; }
.score-main { position: relative; z-index: 1; }
.score-label { color: var(--muted); font-size: 13.5px; font-weight: 500; }
.score-big { font: 800 76px/.95 var(--font); font-stretch: 78%; letter-spacing: -.03em; margin: 10px 0 18px; }
.inout { display: grid; gap: 8px; max-width: 420px; }
.inout-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--raise); }
.inout-bar span { display: block; height: 100%; }
.inout-bar .in { background: var(--good); }
.inout-bar .out { background: var(--bad); opacity: .85; }
.inout-key { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.inout-key i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.score-stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-self: end; margin: 0; }
.score-stats div { padding: 4px 0 4px 18px; border-left: 1px solid var(--line); }
.score-stats dt { color: var(--muted); font-size: 12.5px; }
.score-stats dd { margin: 6px 0 0; font: 750 28px/1 var(--font); font-stretch: 80%; letter-spacing: -.01em; }

/* ---------- league table ---------- */
.league td.name { white-space: normal; min-width: 240px; }
.league .name a { font-weight: 650; text-decoration: none; }
.league .name a:hover { text-decoration: underline; }
.league .detail { color: var(--faint); font-size: 12.5px; margin-top: 4px; }
.league .detail span + span::before { content: " · "; }
.league td.pos { font: 800 22px/1 var(--font); font-stretch: 75%; color: var(--faint); width: 44px; }
.league tbody tr:first-child td.pos { color: var(--accent-text); }
.league td.net { font: 800 22px/1 var(--font); font-stretch: 80%; min-width: 140px; }
.netbar { display: block; height: 4px; margin: 8px 0 0 auto; border-radius: 99px; background: currentColor; opacity: .55; }
.league tfoot td { background: var(--raise); border-bottom: 0; font-weight: 650; }
.league tfoot td.num { font: 800 19px/1 var(--font); font-stretch: 80%; }
.pos { color: var(--faint); width: 28px; }
.footnote { color: var(--faint); font-size: 13px; line-height: 1.6; margin-top: 16px; max-width: 86ch; }

/* ---------- stat strip on list pages ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: -6px 0 22px; }
.stats div { padding: 2px 18px; border-left: 1px solid var(--line); }
.stats div:first-child { padding-left: 0; border-left: 0; }
.stats dt { font-size: 12.5px; color: var(--muted); }
.stats dd { margin: 4px 0 0; font: 750 24px/1.1 var(--font); font-stretch: 80%; }

/* ---------- controls ---------- */
button, .button {
  font: 600 13.5px/1 var(--font); padding: 0 14px; height: 36px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 7px; transition: background .12s, border-color .12s, transform .06s;
}
button:hover, .button:hover { border-color: var(--faint); background: var(--hover); }
button:active { transform: translateY(1px); }
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
button.primary:hover, .button.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
button.ghost { background: none; border-color: transparent; color: var(--muted); padding: 0 8px; }
button.ghost:hover { color: var(--text); background: var(--hover); }
button.small { height: 28px; font-size: 12.5px; padding: 0 9px; border-radius: 7px; }
button:disabled { opacity: .55; cursor: progress; }
button.split { height: auto; font-weight: 500; text-align: left; white-space: normal; max-width: 250px; padding: 5px 8px; margin-left: -8px; color: var(--text); line-height: 1.35; }

input, select, textarea {
  font: inherit; font-size: 14px; height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--bg); color: var(--text); max-width: 100%; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 9px 11px; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b948f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
input[type="number"] { text-align: right; }
input[type="checkbox"] { accent-color: var(--accent); width: 17px; height: 17px; padding: 0; cursor: pointer; }
input[type="date"] { min-width: 150px; }
td input:not([type=checkbox]), td select { height: 32px; font-size: 13.5px; background: transparent; border-color: var(--line); border-radius: 7px; }
td input:not([type=checkbox]):hover, td select:hover { border-color: var(--line-strong); background: var(--bg); }
td input:focus, td select:focus { background: var(--bg); }
td select { max-width: 200px; }
td input.notes { width: 130px !important; }
td button.split { max-width: 170px; }
label { display: block; margin: 18px 0 7px; font-weight: 600; font-size: 13.5px; }
.hint { color: var(--faint); font-size: 12.5px; margin-top: 7px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select { min-width: 230px; }
.count { color: var(--faint); font-size: 13px; }

/* ---------- tables: inside a card ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
tbody tr:last-child td { border-bottom: 0; }
th { font-weight: 600; font-size: 12px; color: var(--faint); background: var(--raise); letter-spacing: .01em; padding-top: 10px; padding-bottom: 10px; white-space: normal; line-height: 1.3; }
thead th:first-child { border-top-left-radius: var(--r); }
thead th:last-child { border-top-right-radius: var(--r); }
tbody tr { transition: background .1s; }
tbody tr:hover td { background: var(--hover); }
td.num, th.num { text-align: right; }
td.num { font-weight: 650; }
.panel table th, .panel table td { padding-left: 0; }
.panel table th { background: none; }
.sub { color: var(--faint); font-size: 12.5px; margin-top: 2px; font-weight: 400; }
.player { font-weight: 650; }
.empty {
  padding: 46px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--r); margin: 0 0 16px;
}

/* ---------- card pictures ---------- */
.card-cell { display: flex; align-items: center; gap: 12px; }
.thumb-link { display: inline-flex; text-decoration: none; }
.thumb { display: block; width: 38px; height: 61px; min-width: 38px; flex: none; border-radius: 4px; overflow: hidden; background: var(--raise); box-shadow: 0 0 0 1px var(--line); }
.thumb img { display: block; width: 38px !important; height: 61px !important; max-width: none; object-fit: cover; }
.thumb.none { box-shadow: none; border: 1px dashed var(--line-strong); }
.thumb-link:hover .thumb { box-shadow: 0 0 0 2px var(--accent-text); }
#preview { position: fixed; z-index: 30; width: 180px; pointer-events: none; border-radius: 10px; box-shadow: 0 24px 60px rgba(0,0,0,.55); }
.card-pill { padding-left: 3px; }
.card-pill .thumb { width: 18px; height: 29px; min-width: 18px; border-radius: 2px; }
.card-pill .thumb img { width: 18px !important; height: 29px !important; }

/* ---------- chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; background: var(--raise); border: 1px solid var(--line); font-size: 12.5px; font-weight: 500; margin: 2px 4px 2px 0; }
.rar { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 8px; }
.rar::before { content: ""; width: 8px; height: 11px; border-radius: 2px; background: currentColor; }
.rar-limited::before { background: var(--limited); }
.rar-rare::before { background: var(--rare); }
.rar-super_rare::before { background: var(--super-rare); }
.rar-unique::before { background: linear-gradient(135deg, #3a3a3a, #d8d4c8); }
.pill .rar { margin-left: 2px; }

/* ---------- auth: split screen ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-art {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  padding: 44px 52px; background: var(--side); border-right: 1px solid var(--line);
}
/* a pitch, top down, in faint accent lines */
.auth-art .pitch { position: absolute; inset: 8% -18% 8% 34%; opacity: .9; border: 2px solid var(--pitch); border-radius: 6px; }
.auth-art .pitch::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--pitch); }
.auth-art .pitch::after { content: ""; position: absolute; left: 50%; top: 50%; width: 30%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 2px solid var(--pitch); border-radius: 50%; }
.auth-art .box { position: absolute; left: 30%; right: 30%; height: 14%; border: 2px solid var(--pitch); }
.auth-art .box.top { top: -2px; border-top: 0; }
.auth-art .box.bottom { bottom: -2px; border-bottom: 0; }
.auth-art .brand { position: relative; font-size: 22px; }
.auth-art blockquote { position: relative; margin: 0; max-width: 15ch; font: 800 54px/1 var(--font); font-stretch: 118%; letter-spacing: -.035em; }
.auth-art blockquote em { font-style: normal; color: var(--accent-text); }
.auth-art p { position: relative; color: var(--muted); max-width: 40ch; margin: 18px 0 0; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth { width: min(380px, 100%); }
.auth h1 { font-size: 30px; }
.auth input { width: 100%; height: 44px; }
.auth .primary { width: 100%; justify-content: center; height: 46px; margin-top: 24px; font-size: 14.5px; }
.auth .small a { color: var(--accent-text); font-weight: 600; text-decoration: none; }

/* ---------- toast + dialog ---------- */
#toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 40; max-width: min(440px, calc(100% - 32px));
  background: var(--text); color: var(--bg); padding: 12px 16px 12px 14px; border-radius: 10px; font-weight: 500; font-size: 14px;
  box-shadow: 0 20px 40px -12px rgba(0,0,0,.45); border-left: 4px solid var(--accent);
  animation: toast-in .18s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
dialog {
  border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); color: var(--text);
  width: min(560px, calc(100% - 32px)); padding: 26px 28px; box-shadow: 0 40px 80px -20px rgba(0,0,0,.6);
}
dialog::backdrop { background: rgba(5, 7, 8, .62); backdrop-filter: blur(3px); }
dialog h2 { margin-top: 0; font-size: 22px; }
.split-row { display: grid; grid-template-columns: 1fr 120px auto; gap: 8px; margin-bottom: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

/* ---------- settings: label column + fields ---------- */
.set { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; padding: 28px 0; border-top: 1px solid var(--line); }
.set:first-of-type { border-top: 0; padding-top: 4px; }
.set-head h2 { margin: 0 0 8px; }
.set-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.set-body > label:first-child, .set-body > form > label:first-child { margin-top: 0; }
.set-body .field { width: min(360px, 100%); }
.set-body .card { padding: 4px 18px; }
.set-body .card table td { padding-left: 0; padding-right: 0; }
.saved { color: var(--good); font-size: 12px; font-weight: 600; margin-left: 6px; }

/* ---------- gameweek coverage ---------- */
.gws-cell { white-space: normal; min-width: 260px; }
.gws-cell summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.gws-cell summary:hover { color: var(--text); }
.gw-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; max-width: 460px; }
.gw { font-size: 11.5px; font-weight: 600; min-width: 26px; text-align: center; padding: 2px 6px; border-radius: 5px; background: var(--raise); color: var(--faint); border: 1px solid var(--line); }
.gw.won { color: var(--accent-ink); background: var(--accent); border-color: transparent; }

/* ---------- seasons ---------- */
.season-tag {
  display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; vertical-align: 2px; margin-left: 6px;
  background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-text) 30%, transparent);
}
.season-tag.past { background: var(--raise); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.seasons-cell { white-space: normal; min-width: 190px; }
.seasons-cell .season-tag { margin: 0 4px 4px 0; }
.season-pick { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 500; color: var(--muted); }
.season-pick select { min-width: 180px; }
.season-row { display: grid; grid-template-columns: 1fr 170px auto; gap: 8px; margin-bottom: 8px; }
label.check { display: flex; gap: 9px; align-items: center; font-weight: 500; margin-top: 18px; }

/* Comps page: tracked comps grouped by season */
.season-group { margin: 0 0 12px; }
.group-head, .season-group > summary { display: flex; align-items: baseline; gap: 12px; padding: 6px 2px 12px; }
.season-group > summary { cursor: pointer; list-style: none; padding: 14px 18px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.season-group > summary:hover { border-color: var(--line-strong); }
.season-group[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-color: transparent; }
.season-group[open] > .table-wrap { border-top-left-radius: 0; border-top-right-radius: 0; margin-top: 0; }
.season-group[open] > .table-wrap thead th { border-radius: 0; }
.season-group > summary::-webkit-details-marker { display: none; }
.season-group > summary h3::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 12px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg) translateY(-2px); transition: transform .15s;
}
.season-group[open] > summary h3::before { transform: rotate(45deg) translateY(-3px); }
.season-group > summary:hover h3 { color: var(--accent-text); }
.past-note { margin: 30px 0 10px; font-weight: 600; color: var(--muted); }
.season-group input.nm { width: 100%; min-width: 230px; font-weight: 600; }

/* ---------- small screens ---------- */
@media (max-width: 960px) {
  body.in-app { display: block; }
  .side {
    position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px;
    padding: 12px 16px 0; border-right: 0; border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--side) 92%, transparent); backdrop-filter: blur(10px);
  }
  body.in-app { background: var(--bg); }
  .side .brand { padding: 0; }
  .side nav { order: 3; width: 100%; flex-direction: row; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 10px; }
  .side nav a { white-space: nowrap; padding: 7px 11px; font-size: 14px; }
  .side nav a svg { display: none; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; padding: 0; border: 0; gap: 8px; }
  .sync-box { display: flex; }
  .sync-box .primary { width: auto; height: 32px; }
  .sync-status, .foot-row .signout { display: none; }
  main { padding: 24px 16px 70px; }
}
@media (max-width: 720px) {
  h1 { font-size: 30px; }
  .scoreboard { grid-template-columns: 1fr; padding: 22px 20px; gap: 20px; }
  .score-big { font-size: 60px; }
  .score-stats dd { font-size: 22px; }
  .score-stats div { padding-left: 12px; }
  .score-stats div:first-child { padding-left: 0; border-left: 0; }
  .league .hide-sm, .league .pos { display: none; }
  .league td.name { min-width: 0; }
  .league th, .league td { padding-left: 8px; padding-right: 8px; }
  .league td.name, .league th:nth-child(2) { padding-left: 14px; }
  .league td.net { font-size: 18px; min-width: 0; }
  .set { grid-template-columns: 1fr; gap: 14px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { min-height: 220px; padding: 28px 24px; }
  .auth-art blockquote { font-size: 34px; }
  .auth-art p { display: none; }
  #toast { left: 16px; right: 16px; bottom: 16px; }
  .stats div { padding: 2px 12px; }
}

/* table fitting */
th.num { white-space: nowrap; }
td:has(.pill) { white-space: normal; min-width: 220px; }
.toolbar .count { display: none; }
td select { max-width: 180px; }
td input.notes { width: 110px !important; }

/* Light mode: solid dark buttons instead of lime, lime kept for small accents only */
:root[data-theme="light"] button.primary, :root[data-theme="light"] .button.primary { background: #1c2320; color: #f4f6f1; }
:root[data-theme="light"] button.primary:hover, :root[data-theme="light"] .button.primary:hover { background: #2c3530; }
:root[data-theme="light"] .gw.won { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-text) 30%, transparent); }
:root[data-theme="light"] #toast { border-left-color: var(--accent-text); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) button.primary, :root:not([data-theme]) .button.primary { background: #1c2320; color: #f4f6f1; }
  :root:not([data-theme]) button.primary:hover, :root:not([data-theme]) .button.primary:hover { background: #2c3530; }
  :root:not([data-theme]) .gw.won { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-text) 30%, transparent); }
  :root:not([data-theme]) #toast { border-left-color: var(--accent-text); }
}

/* logo: one version per theme (the ball is dark on light backgrounds, light on dark ones) */
.brand .logo { display: block; width: auto; height: 46px; }
.side .brand { padding: 0 6px 20px; }
.auth-art .brand .logo { height: 64px; }
.logo-l { display: none !important; }
:root[data-theme="light"] .logo-l { display: block !important; }
:root[data-theme="light"] .logo-d { display: none !important; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .logo-l { display: block !important; }
  :root:not([data-theme]) .logo-d { display: none !important; }
}
@media (max-width: 960px) { .side .brand { padding: 0; } .brand .logo { height: 34px; } }
.side .brand .logo { width: 176px; height: auto; }
@media (max-width: 960px) { .side .brand .logo { width: auto; height: 36px; } }

/* essence figures */
.ess-line { display: block; white-space: nowrap; }
.ess-line + .ess-line { margin-top: 3px; }
.ess-rar { font: 500 12px/1 var(--font); font-stretch: 100%; color: var(--muted); letter-spacing: 0; }
.score-stats dd .ess-line + .ess-line { font-size: 18px; }
.score-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { .score-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; } .score-stats div:nth-child(3) { padding-left: 0; border-left: 0; } }
.scoreboard { grid-template-columns: minmax(0, .9fr) minmax(0, 1.35fr); }
.score-stats dt { white-space: nowrap; }
.score-stats div { padding-left: 14px; }
@media (max-width: 720px) { .scoreboard { grid-template-columns: 1fr; } }

/* ---------- lineups ---------- */
.week-switch a { padding: 6px 12px; border-radius: 6px; color: var(--muted); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.week-switch a:hover { color: var(--text); }
.week-switch a[aria-pressed="true"] { background: var(--raise); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); }
.lu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: stretch; }
.lu { padding: 0; overflow: hidden; display: flex; flex-direction: column; height: 100%; }
.lu-group + .lu-group { margin-top: 30px; }
.lu-group-head { margin: 0 0 14px; font-size: 16px; }
.lu-group-head .muted { font-weight: 500; margin-left: 6px; }
.lu-subhead { padding: 8px 18px 4px; border-top: 1px dashed var(--line-strong); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); }
.lu-subs { padding-top: 0; }
.lu-rw { margin-top: auto; }
.lu-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.lu-head .sub { margin-top: 3px; }
.lu-score { font-size: 30px; line-height: 1; color: var(--accent-text); }
.lu-players { list-style: none; margin: 0; padding: 4px 0; }
.lu-players li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 7px 18px; }
.lu-players li + li { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.lu-players li.bench { opacity: .6; }
.lu-players .thumb { width: 30px; height: 48px; min-width: 30px; }
.lu-players .thumb img { width: 30px !important; height: 48px !important; }
.lu-who { min-width: 0; }
.lu-who .player { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lu-state { display: inline-flex; align-items: center; gap: 8px; }
.lu-pts { display: inline-grid; place-items: center; min-width: 38px; height: 24px; padding: 0 7px; border-radius: 99px; background: var(--sc, var(--raise)); color: #0b0e0b; font: 800 14.5px/1 var(--font); font-stretch: 86%; font-variant-numeric: tabular-nums; }
.lu-c { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: 7px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 800; vertical-align: 1px; }
.lu-tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; background: var(--raise); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; margin-left: 6px; }
.lu-tag.dnp { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.lu-tag.live { color: var(--good); background: var(--good-soft); border-color: transparent; }
.lu-tag.live i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: lu-pulse 1.4s ease-in-out infinite; }
@keyframes lu-pulse { 50% { opacity: .25; } }
.lu-rw { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 11px 18px 13px; border-top: 1px solid var(--line); background: var(--raise); font-size: 13px; }
.lu-rw-k { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 8px; }
.lu-rw .pill { background: var(--surface); }
.lu-rw .pill .rar { margin-left: 0; }
@media (max-width: 520px) { .lu-grid { grid-template-columns: 1fr; } .lu-players li { padding: 7px 14px; } }

/* ---------- pro ladders ---------- */
.lu-switches { display: flex; gap: 10px; flex-wrap: wrap; }
.pro-board { padding: 20px 22px 22px; }
.pro-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.pro-head h2 { margin: 0 0 4px; }
.pro-left { display: flex; flex-direction: column; align-items: flex-end; }
.pro-left .fig { font-size: 30px; line-height: 1; color: var(--accent-text); }
.ladder { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; }
.rung { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--raise); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rung-top { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; }
.rung-lv { font-weight: 800; }
.rung-st { color: var(--muted); }
.rung-target { font-size: 24px; line-height: 1; }
.rung-rw .pill { font-size: 11.5px; padding: 2px 7px; margin: 0; background: var(--surface); }
.rung-tries { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: auto; }
.try { display: inline-block; min-width: 10px; height: 18px; padding: 0 5px; border-radius: 5px; font-size: 11px; font-weight: 700; line-height: 18px; background: var(--surface); border: 1px solid var(--line); }
.try-successful { color: var(--good); background: var(--good-soft); border-color: transparent; }
.try-failed, .try-expired, .try-cancelled { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.try-ready { color: var(--accent-text); border-color: var(--accent-text); }
.try-empty { width: 10px; padding: 0; border-style: dashed; }
.rung-tries .muted { margin-left: 2px; }
.rung.done { border-color: color-mix(in srgb, var(--good) 35%, var(--line)); }
.rung.done .rung-st { color: var(--good); }
.rung.cur { border-color: var(--accent-text); box-shadow: 0 0 0 1px var(--accent-text) inset; background: var(--surface); }
.rung.cur .rung-st { color: var(--accent-text); font-weight: 700; }
.rung.locked { opacity: .55; }
.pro-attempts { margin-top: 18px; }
.idle-boards { border-top-left-radius: 0; border-top-right-radius: 0; margin: 0; }
.rung[data-level] { cursor: pointer; transition: border-color .15s, transform .15s; }
.rung[data-level]:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.rung[data-level]:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.rung.picked:not(.cur) { border-color: var(--text); box-shadow: 0 0 0 1px var(--text) inset; }
.pro-shown { margin: 18px 0 -6px; }
.pro-shown a { color: var(--accent-text); font-weight: 600; }
.admin-pill { vertical-align: 3px; margin-left: 8px; font-size: 11px; color: var(--accent-text); }
td.guess { min-width: 130px; }
td.guess .guess-name { display: block; font-size: 13.5px; font-weight: 600; }
td.guess .use { margin-top: 4px; }

/* ---------- phones: tables become cards ---------- */
@media (max-width: 640px) {
  .table-wrap:has(table.stack) { overflow: visible; background: none; border: 0; box-shadow: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px 14px; margin-bottom: 12px; }
  table.stack tr:hover td { background: none; }
  table.stack td { position: relative; padding: 10px 0 10px 34% !important; border: 0; border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); text-align: right; min-width: 0 !important; }
  table.stack td:first-child { border-top: 0; }
  table.stack td::before { content: attr(data-label); position: absolute; left: 0; top: 11px; max-width: 32%; color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; }
  table.stack td:not([data-label]), table.stack td[data-label=""] { padding-left: 0 !important; }
  table.stack td .card-cell { display: inline-flex; }
  table.stack td:not([data-label])::before, table.stack td[data-label=""]::before { content: none; }
  table.stack td > * { max-width: 100%; }
  table.stack td .card-cell { text-align: left; }
  table.stack td input:not([type=checkbox]), table.stack td select { width: 100% !important; max-width: 100%; min-width: 0 !important; box-sizing: border-box; }
  table.stack td .sub { overflow-wrap: anywhere; }
  table.stack td:empty { display: none; }
  table.stack tfoot { display: block; }
  td.guess { min-width: 0; }
  td.guess .guess-name { display: inline; margin-right: 8px; }
  .toolbar select, .toolbar input { max-width: 100%; }
  .lu-switches { width: 100%; }
  .lu-switches .week-switch { flex-wrap: wrap; }
  .page-head > div:last-child:not(:first-child) { width: 100%; }
}

/* Installed app on a notched phone: keep clear of the status bar and home indicator. */
@supports (padding: env(safe-area-inset-top)) {
  @media (max-width: 960px) {
    .side { padding-top: calc(12px + env(safe-area-inset-top)); padding-left: calc(16px + env(safe-area-inset-left)); padding-right: calc(16px + env(safe-area-inset-right)); }
    main { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  }
}
.rung-rw .pill { max-width: 100%; flex-wrap: wrap; row-gap: 0; }

/* ---------- phones: long names wrap instead of pushing the page wide ---------- */
@media (max-width: 640px) {
  table.stack td { white-space: normal; }
  .card-cell { min-width: 0; }
  .card-cell > div { min-width: 0; }
  .card-cell .player, .lu-who .player, td.name { overflow-wrap: anywhere; }
}
@media (max-width: 960px) { html, body { overflow-x: clip; } }

/* ---------- phones: bottom tab bar + More sheet ---------- */
.tabbar, .more-sheet { display: none; }
@media (max-width: 960px) {
  .side nav, .side .theme-switch { display: none; }
  .side { padding-bottom: 12px; }
  .tabbar:not([hidden]) {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--side) 94%, transparent); backdrop-filter: blur(12px);
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 4px; border: 0; background: none; border-radius: 10px;
    color: var(--muted); font: 600 11px/1.1 var(--font); text-decoration: none; cursor: pointer;
  }
  .tabbar svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar #moreBtn svg circle { fill: currentColor; stroke: none; }
  .tabbar a.active, .tabbar button.active, .tabbar button[aria-expanded="true"] { color: var(--text); }
  .tabbar a.active svg, .tabbar button.active svg { color: var(--accent-text); }
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important; }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .more-sheet:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 40; }
  .more-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); animation: fade .15s ease; }
  .more-panel {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 14px calc(16px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -20px 50px -20px rgba(0,0,0,.5);
    animation: sheet-up .2s ease;
  }
  .more-grab { width: 38px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 2px auto 10px; }
  .more-panel > a { display: flex; align-items: center; gap: 14px; padding: 13px 10px; border-radius: 10px; color: var(--text); font-weight: 600; font-size: 16px; text-decoration: none; }
  .more-panel > a svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
  .more-panel > a.active { background: var(--raise); }
  .more-panel > a.active svg { color: var(--accent-text); }
  .more-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding: 14px 10px 0; border-top: 1px solid var(--line); }
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
