/* Fantasy Hockey HQ — "rink board" palette: ice, blue line, goal light. */
:root {
  --ice: #f3f5f8;
  --board: #ffffff;
  --ink: #13202e;
  --ink-2: #4a5b6d;
  --ink-3: #7a8999;
  --rule: #d9e2ea;
  --rule-2: #e8eef3;
  --blue: #2457c5;
  --blue-soft: #e3ecfb;
  --red: #c8283c;
  --red-soft: #fbe7ea;
  --green: #167a52;
  --green-soft: #e2f4ec;
  --amber: #8f5f00;
  --amber-soft: #fdf1d6;
  --mine: #7656dd;
  --mine-soft: #efeafd;
  --stripe: #fafbfc;
  --fa-bg: #fff1e0;
  color-scheme: light;
  --radius-s: 6px;
  --radius-m: 10px;
  --shadow: 0 1px 0 rgba(19, 32, 46, .06);
  --font: "Helvetica Neue", Helvetica, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-c: var(--font);
}
/* Dark theme: follows the device unless the person picks Light or Dark in the app */
:root[data-theme="dark"] {
    --ice: #0f1722; --board: #162130; --ink: #ebe6dc; --ink-2: #b9b4aa; --ink-3: #8c8a85;
    --rule: #26354a; --rule-2: #1e2b3c; --blue: #7ea6ff; --blue-soft: #1a2c4d; --red: #ff7a8a; --red-soft: #3a1b24;
    --green: #5fd3a0; --green-soft: #133428; --amber: #f2c45a; --amber-soft: #352a10; --mine: #c3b3ff; --mine-soft: #2e2650;
    --stripe: #182435; --fa-bg: #3a2a14; --shadow: none; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ice: #0f1722; --board: #162130; --ink: #ebe6dc; --ink-2: #b9b4aa; --ink-3: #8c8a85;
    --rule: #26354a; --rule-2: #1e2b3c; --blue: #7ea6ff; --blue-soft: #1a2c4d; --red: #ff7a8a; --red-soft: #3a1b24;
    --green: #5fd3a0; --green-soft: #133428; --amber: #f2c45a; --amber-soft: #352a10; --mine: #c3b3ff; --mine-soft: #2e2650;
    --stripe: #182435; --fa-bg: #3a2a14; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ice); color: var(--ink); font: 14px/1.4 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--board); border-right: 1px solid var(--rule); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; }
.brand { font-weight: 700; font-size: 16px; line-height: 1.2; }
.brand small { display: block; font-family: var(--font); font-weight: 500; font-size: 13px; color: var(--ink-2); margin-top: 4px; letter-spacing: 0; }
.scoreline { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scoreline div { background: var(--ice); border-radius: var(--radius-s); padding: 8px 10px; }
.scoreline b { display: block; font-size: 20px; font-weight: 600; line-height: 1.1; }
.scoreline span { font-size: 12px; color: var(--ink-2); }
.scoreline .warn b { color: var(--red); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: var(--radius-s); color: var(--ink-2); font-weight: 500; cursor: pointer; }
.nav button:hover { background: var(--ice); color: var(--ink); }
.nav button[aria-current="page"] { background: var(--blue-soft); color: var(--blue); }
.freshness { margin-top: auto; font-size: 12px; color: var(--ink-3); }
.freshness p { margin: 2px 0; }
main { min-width: 0; padding: 20px 24px 60px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.topbar h1 { font-size: 22px; font-weight: 700; margin: 0; }
.search { position: relative; margin-left: auto; width: min(320px, 100%); }
.search input { width: 100%; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--board); }
.search ul { position: absolute; z-index: 30; top: 40px; left: 0; right: 0; margin: 0; padding: 4px; list-style: none; background: var(--board); border: 1px solid var(--rule); border-radius: var(--radius-m); box-shadow: 0 8px 24px rgba(19,32,46,.14); max-height: 320px; overflow-y: auto; }
.search li button { width: 100%; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: var(--radius-s); cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.search li button:hover, .search li button:focus { background: var(--ice); }
.mobile-tabs { display: none; }

@media (max-width: 899px) {
  .shell { display: block; }
  .rail { display: none; }
  main { padding: 0 16px 60px; }
  .topbar { position: sticky; top: 0; z-index: 20; background: var(--ice); margin: 0 -16px; padding: 10px 16px 6px; flex-wrap: wrap; }
  .topbar h1 { font-size: 22px; }
  .search { width: 100%; margin-left: 0; order: 3; }
  .mobile-tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 -16px 12px; padding: 4px 16px 6px; position: sticky; top: 96px; z-index: 19; background: var(--ice); scrollbar-width: none; }
  .mobile-tabs::-webkit-scrollbar { display: none; }
  .mobile-tabs button { flex: 0 0 auto; border: 1px solid var(--rule); background: var(--board); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
  .mobile-tabs button[aria-current="page"] { background: var(--blue); border-color: var(--blue); color: #fff; }
  .mobile-meta { font-size: 12px; color: var(--ink-3); width: 100%; order: 2; margin-top: -4px; }
}
@media (min-width: 900px) { .mobile-meta { display: none; } }

/* ---------- Sections ---------- */
.panel { background: var(--board); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.panel > h2 { font-size: 15px; font-weight: 700; margin: 0 0 10px; }
.panel > h2 .hint { font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 6px; }
.lede { color: var(--ink-2); font-size: 13px; margin: -4px 0 10px; max-width: 72ch; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 899px) { .field { flex-wrap: wrap; width: 100%; } .field select, .field input[type="date"] { flex: 1 1 200px; max-width: 100%; } }
.empty { color: var(--ink-3); padding: 10px 0; }
.note { font-size: 12px; color: var(--ink-3); margin-top: 8px; max-width: 80ch; }

/* ---------- Controls ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.seg { display: inline-flex; background: var(--rule-2); border-radius: var(--radius-s); padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 5px; font-weight: 600; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--board); color: var(--ink); box-shadow: 0 1px 2px rgba(19,32,46,.12); }
.field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.field input, .field select, .input { padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--board); }
.input { min-width: 0; }
.btn { border: 1px solid var(--rule); background: var(--board); border-radius: var(--radius-s); padding: 6px 10px; font-weight: 600; font-size: 13px; cursor: pointer; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.ghost { border-color: transparent; background: none; color: var(--blue); padding: 6px 4px; }

/* ---------- Tables ---------- */
.tw { overflow-x: auto; margin: 0 -16px; padding: 0 16px; -webkit-overflow-scrolling: touch; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
th { font-weight: 600; font-size: 12px; color: var(--ink-2); text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--rule); white-space: nowrap; background: var(--board); }
th.sort { cursor: pointer; user-select: none; }
th.sort:hover { color: var(--ink); }
th[aria-sort] { color: var(--blue); }
td { padding: 6px 8px; border-bottom: 1px solid var(--rule-2); white-space: nowrap; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; }
td.dim { color: var(--ink-3); }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--ice); }
.sticky1 th:first-child, .sticky1 td:first-child { position: sticky; left: 0; z-index: 1; background: var(--board); }
tbody tr.click:hover td:first-child { background: var(--ice); }
.colgroup { border-left: 1px solid var(--rule); }
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }

/* ---------- Player name + tags ---------- */
.pn { border: 0; background: none; padding: 0; font-weight: 600; cursor: pointer; text-align: left; color: var(--ink); }
.pn:hover { text-decoration: underline; }
.pn.mine { color: var(--mine); }
.sub { font-size: 12px; color: var(--ink-3); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; line-height: 16px; padding: 0 6px; border-radius: 4px; background: var(--rule-2); color: var(--ink-2); margin-left: 4px; vertical-align: 1px; }
.tag.fa { background: var(--green-soft); color: var(--green); }
.tag.w { background: var(--amber-soft); color: var(--amber); }
.tag.inj { background: var(--red-soft); color: var(--red); }
.tag.new { background: var(--blue); color: #fff; }
.tag.line { background: var(--rule-2); color: var(--ink); }
.tag.pp1 { background: var(--blue-soft); color: var(--blue); }
.tag.hot { background: var(--red-soft); color: var(--red); }
.tag.cold { background: var(--rule-2); color: var(--ink-3); }
.tag.volume, .tag.sustained, .tag.workhorse { background: var(--green-soft); color: var(--green); }
.tag.buy-low, .tag.shooting-luck-low { background: var(--amber-soft); color: var(--amber); }
.tag.pp-heavy { background: var(--blue-soft); color: var(--blue); }
.tag.lock { background: var(--mine-soft); color: var(--mine); }

/* ---------- Alerts ---------- */
.alert { border-left: 3px solid var(--ink-3); background: var(--ice); padding: 8px 10px; border-radius: 0 var(--radius-s) var(--radius-s) 0; margin-bottom: 6px; font-size: 14px; }
.alert.red { border-color: var(--red); background: var(--red-soft); }
.alert.green { border-color: var(--green); background: var(--green-soft); }
.alert.amber { border-color: var(--amber); background: var(--amber-soft); }

/* ---------- Lineup board (the signature piece) ---------- */
.score { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.score div { min-width: 84px; }
.score b { display: block; font-size: 26px; font-weight: 600; line-height: 1.1; }
.score span { font-size: 13px; color: var(--ink-2); }
.score .delta { font-size: 14px; font-weight: 600; margin-left: 4px; }
.score .bad b { color: var(--red); }
.board { border-collapse: separate; border-spacing: 3px; font-size: 13px; }
.board th { background: none; border: 0; text-align: center; padding: 2px 2px 6px; font-size: 12px; color: var(--ink-2); }
.board th .gc { display: block; font-family: var(--font); font-size: 11px; font-weight: 600; color: var(--ink-3); }
.board th.light .gc { color: var(--blue); }
.board th.light { box-shadow: inset 0 -3px 0 var(--blue); }
.board td { border: 0; padding: 0; }
.board td.slot { font-weight: 600; font-size: 12px; color: var(--ink-2); padding-right: 6px; text-align: right; position: sticky; left: 0; background: var(--board); }
.cell { display: block; width: 100%; min-width: 76px; padding: 5px 6px; border-radius: 5px; background: var(--ice); text-align: left; line-height: 1.15; border: 0; cursor: pointer; }
.cell .nm { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; max-width: 96px; }
.cell .op { display: block; font-size: 11px; color: var(--ink-3); }
.cell.soft { background: var(--green-soft); }
.cell.soft .op { color: var(--green); font-weight: 600; }
.cell.tough { background: var(--rule-2); }
.cell.added { box-shadow: inset 0 0 0 2px var(--blue); }
.cell.open { background: none; border: 1px dashed var(--rule); color: var(--ink-3); cursor: default; text-align: center; font-size: 12px; }
.cell.sit { background: var(--red-soft); }
.cell.sit .nm { color: var(--red); }
tr.benchrow td.slot { color: var(--red); }
.legend-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.legend-row i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* ---------- Lines chart ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.chips button { border: 1px solid var(--rule); background: var(--board); border-radius: var(--radius-s); padding: 4px 8px; font-weight: 600; font-size: 12px; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--board); border-color: var(--ink); }
.chips button .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); margin-left: 4px; vertical-align: 2px; }
.lines { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0 4px; table-layout: fixed; }
.lines col.lab { width: 84px; }
.lines th { border: 0; padding: 4px 8px 4px 0; font-size: 13px; vertical-align: middle; color: var(--ink); background: none; }
.lines .spot b, .lines .spot .pn { overflow-wrap: anywhere; white-space: normal; }
.lines td { border: 0; padding: 0 4px 0 0; vertical-align: top; }
.lines .spot { background: var(--ice); border-radius: var(--radius-s); padding: 7px 9px; min-height: 44px; }
.lines .spot .sub { display: block; }
.lines .spot.isnew { box-shadow: inset 3px 0 0 var(--blue); }
.lines tr.gap td, .lines tr.gap th { padding-top: 10px; }

/* ---------- Player sheet ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(15, 23, 34, .38); z-index: 50; }
.sheet { position: fixed; z-index: 51; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--board); overflow-y: auto; padding: 18px 20px 40px; box-shadow: -12px 0 32px rgba(15,23,34,.18); animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 899px) { .sheet { top: 6vh; width: 100%; border-radius: 14px 14px 0 0; padding: 16px; animation: slideup .2s ease-out; } @keyframes slideup { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } } }
.sheet h2 { font-size: 22px; font-weight: 700; margin: 0; line-height: 1.15; color: var(--ink); }
.sheet h2.mine { color: var(--mine); }
.sheet .close { position: sticky; top: 0; float: right; border: 0; background: var(--ice); border-radius: 999px; width: 34px; height: 34px; font-size: 18px; cursor: pointer; }
.sheet h3 { font-size: 14px; font-weight: 700; margin: 18px 0 6px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.kv div { background: var(--ice); border-radius: var(--radius-s); padding: 7px 9px; }
.kv b { display: block; font-size: 18px; font-weight: 600; line-height: 1.1; }
.kv span { font-size: 12px; color: var(--ink-2); }
.upcoming { display: flex; gap: 4px; flex-wrap: wrap; }
.upcoming span { font-size: 12px; padding: 4px 6px; border-radius: 5px; background: var(--ice); }
.upcoming span.soft { background: var(--green-soft); color: var(--green); font-weight: 600; }
.upcoming span.light { box-shadow: inset 0 -2px 0 var(--blue); }

.news-item { padding: 10px 0; border-bottom: 1px solid var(--rule-2); }
.news-item:last-child { border-bottom: 0; }
.news-item p { margin: 3px 0; max-width: 75ch; }

/* ---------- Round 3 additions ---------- */
tbody tr:nth-child(even) td { background: var(--stripe); }
.sticky1 tbody tr:nth-child(even) td:first-child { background: var(--stripe); }
.pn.mine { color: var(--mine); }
.sheet h2.mine { color: var(--mine); }
.wstat { font-size: 11px; color: var(--amber); margin-left: 4px; }
.notes .tag { margin-left: 0; margin-right: 3px; }
.btn.try { padding: 3px 8px; font-size: 12px; font-weight: 500; }
.trying { display: inline-flex; align-items: center; gap: 6px; background: var(--blue-soft); color: var(--ink); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px; }
.trying button { border: 0; background: var(--board); border-radius: 999px; width: 22px; height: 22px; cursor: pointer; }
.typeahead { position: relative; }
.typeahead ul { position: absolute; z-index: 25; top: 34px; left: 0; min-width: 280px; margin: 0; padding: 4px; list-style: none; background: var(--board); border: 1px solid var(--rule); border-radius: var(--radius-m); box-shadow: 0 8px 24px rgba(19,32,46,.14); max-height: 300px; overflow-y: auto; }
.typeahead li button { width: 100%; text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: var(--radius-s); cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.typeahead li button:hover { background: var(--ice); }
.split th, .split td { padding: 5px 6px; }
.split td:first-child { font-weight: 600; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); margin: 8px 0 0; padding: 0; list-style: none; }
.facts b { color: var(--ink); font-weight: 600; }
.upcoming span.sits { opacity: .55; text-decoration: line-through; }
.upcoming span .mk { font-weight: 700; margin-right: 3px; }
/* lines: whole-box states */
.lines .spot.fa { background: var(--fa-bg); }
.lines .spot.pick { background: var(--green-soft); }

.oop { display: inline-block; font-size: 10px; font-weight: 700; color: var(--amber); border: 1px solid currentColor; border-radius: 3px; padding: 0 3px; margin-left: 4px; line-height: 14px; vertical-align: 1px; cursor: help; }
.legend-row i.fa { background: var(--fa-bg); }
/* team stats quartiles */
.q-good { color: var(--green); }
.q-bad { color: var(--red); }
/* tooltips */
[data-tip] { cursor: help; }
button[data-tip], th[data-tip] { cursor: pointer; }
#tip { position: fixed; z-index: 80; max-width: 300px; background: #13202e; color: #fff; font-size: 12.5px; line-height: 1.4; padding: 8px 10px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.22); pointer-events: none; }
#tip[hidden] { display: none; }
.lines tbody tr td, .board tbody tr td, .split tbody tr td { background: none !important; }
.board td.slot { background: var(--board) !important; }

.lines .spot.mine { background: var(--mine-soft); }
.elig { color: var(--ink-3); }
.elig-oop { color: var(--amber); font-weight: 600; cursor: help; }
.scoreline[hidden] { display: none; }
.lines .spot .elig, .lines .spot .elig-oop { margin-right: 6px; font-weight: 600; }

/* theme switch */
.theme { display: flex; gap: 2px; background: var(--rule-2); border-radius: var(--radius-s); padding: 2px; margin-top: 8px; }
.theme button { flex: 1; border: 0; background: none; padding: 4px 6px; border-radius: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.theme button[aria-pressed="true"] { background: var(--board); color: var(--ink); }
.theme-mobile { display: none; border: 1px solid var(--rule); background: var(--board); border-radius: 999px; width: 36px; height: 36px; margin-left: auto; cursor: pointer; font-size: 16px; }
@media (max-width: 899px) { .theme-mobile { display: inline-block; } }
#tip { background: var(--ink); color: var(--board); }
[hidden] { display: none !important; }
.nd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
