/* PP Stacks. Tokens and base components follow the NHL API Network Map so the
   two tools look like one site. */

:root {
  --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --page: #f3f1ec;
  --paper: #ffffff;
  --ink: #15181d;
  --ink-2: #4b525c;
  --ink-3: #7a818b;
  --rule: #e2ded5;
  --rule-2: #cdc8bd;
  --chip: #f3f1ec;
  --focus: #1c6fc4;
  --shadow: 0 1px 2px rgb(20 22 28 / 6%), 0 8px 24px rgb(20 22 28 / 8%);

  --pp1: #1c62b0;
  --pp1-bg: #e5eef9;
  --pp2: #9a5600;
  --pp2-bg: #f7ecdc;
  --warn: #a24a00;
  --warn-bg: #fbf0e4;

  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0d1015;
    --paper: #151920;
    --ink: #eceef1;
    --ink-2: #b4bbc5;
    --ink-3: #868f9a;
    --rule: #252b34;
    --rule-2: #353d48;
    --chip: #1c2129;
    --focus: #4e9bea;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 28px rgb(0 0 0 / 35%);
    --pp1: #79b6f2;
    --pp1-bg: #162536;
    --pp2: #f2a65a;
    --pp2-bg: #2e2216;
    --warn: #f2a65a;
    --warn-bg: #2e2216;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --page: #0d1015;
  --paper: #151920;
  --ink: #eceef1;
  --ink-2: #b4bbc5;
  --ink-3: #868f9a;
  --rule: #252b34;
  --rule-2: #353d48;
  --chip: #1c2129;
  --focus: #4e9bea;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 28px rgb(0 0 0 / 35%);
  --pp1: #79b6f2;
  --pp1-bg: #162536;
  --pp2: #f2a65a;
  --pp2-bg: #2e2216;
  --warn: #f2a65a;
  --warn-bg: #2e2216;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

[hidden] { display: none !important; }

.wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* ---------- masthead ---------- */

.masthead { padding-top: 28px; padding-bottom: 20px; }
.masthead-top { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; }
.mark { width: 30px; height: 30px; }
.brand-text { font-weight: 700; letter-spacing: 0.14em; font-size: 13px; color: var(--ink-2); }
.masthead-actions { display: flex; align-items: center; gap: 8px; }

.home-link {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 14px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: 14px; font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.home-link:hover { color: var(--ink); border-color: var(--ink-3); }

.theme-toggle {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-2);
  cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-3); }

h1 {
  margin: 18px 0 10px;
  font-size: clamp(40px, 7vw, 76px);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.lede { margin: 0; max-width: 66ch; font-size: 17px; color: var(--ink-2); text-wrap: pretty; }

.facts {
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  margin: 18px 0 0; padding: 0;
  list-style: none;
  font-size: 14px; color: var(--ink-3);
}
.facts b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.facts .stale { color: var(--warn); font-weight: 600; }

/* ---------- controls ---------- */

.controls {
  display: flex; flex-wrap: wrap; align-items: end; gap: 14px 18px;
  padding-top: 8px; padding-bottom: 8px;
}

.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.slate-field { flex: 0 1 380px; }

select {
  width: 100%; min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--rule-2);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: 500 15px/1.2 var(--font);
  cursor: pointer;
}
select:hover { border-color: var(--ink-3); }

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--paper);
}
.segmented button {
  min-height: 32px; padding: 0 14px;
  border: 0; border-radius: 999px;
  background: none;
  color: var(--ink-2);
  font: 600 14px/1 var(--font);
  white-space: nowrap;
  cursor: pointer;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.segmented button:disabled { opacity: .4; cursor: default; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--rule-2);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: 600 14px/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }

/* ---------- sections ---------- */

.section-head { margin: 48px 0 18px; }
.section-head h2 { margin: 0 0 4px; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.section-head p { margin: 0; color: var(--ink-2); }

/* ---------- team picker ---------- */

.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 10px;
}

.game {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 6px;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--paper);
}
.game .at { align-self: center; color: var(--ink-3); font-size: 13px; font-weight: 600; }

.team {
  display: grid; gap: 1px; justify-items: start;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--chip);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.team:hover { border-color: var(--ink-3); }
.team b { font-size: 16px; font-weight: 800; letter-spacing: 0.02em; }
.team small {
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; color: var(--ink-3);
}
.team[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.team[aria-pressed="true"] small { color: inherit; opacity: .75; }

.build-bar {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px 18px;
  margin: 18px 0 16px;
}
.picked { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 40px; color: var(--ink-3); font-size: 15px; }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 34px; padding: 5px 8px 5px 12px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: 700 14px/1 var(--font);
  cursor: pointer;
}
.chip span { color: var(--ink-3); font-size: 16px; line-height: 1; }
.chip:hover span { color: var(--ink); }
.chip.reset { border-color: var(--rule-2); color: var(--ink-2); font-weight: 600; padding-right: 12px; }

/* ---------- results ---------- */

.results { min-height: 120px; }

.empty, .status {
  margin: 0;
  padding: 28px 22px;
  border: 1px dashed var(--rule-2);
  border-radius: 12px;
  color: var(--ink-2);
  text-align: center;
}
.status { border-style: solid; background: var(--paper); }

.result-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 12px; }
.result-head h3 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.result-head p { margin: 0; color: var(--ink-3); font-size: 14px; }

.badge {
  display: inline-block;
  min-width: 34px; padding: 3px 6px;
  border-radius: 5px;
  font: 700 11px/1 var(--font);
  letter-spacing: .04em;
  text-align: center;
}
.badge.pp1 { background: var(--pp1-bg); color: var(--pp1); }
.badge.pp2 { background: var(--pp2-bg); color: var(--pp2); }
.badge.g { background: var(--chip); color: var(--ink-2); }
.badge.out, .badge.gtd { background: var(--warn-bg); color: var(--warn); }

.pos { font: 500 12px/1 var(--mono); color: var(--ink-3); }

/* tables */
.table-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); }

.data { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.data th, .data td { padding: 9px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--rule); }
.data tbody tr:last-child td { border-bottom: 0; }
.data th { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.data .num { text-align: right; white-space: nowrap; }
.data .muted { color: var(--ink-3); }

.stacks td:first-child { color: var(--ink-3); font-weight: 600; width: 1%; }
.stack-players { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; }
.stack-players li { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.stack-players .sal { color: var(--ink-3); font-size: 13px; }

/* lineups */
.lineups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 16px;
}

.lineup { border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); overflow: hidden; }
.lineup header { padding: 14px 16px 12px; border-bottom: 1px solid var(--rule); }
.lineup h4 { margin: 0 0 4px; font-size: 17px; font-weight: 800; }
.lineup-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; color: var(--ink-3); font-size: 13.5px; }
.lineup-meta b { color: var(--ink); font-variant-numeric: tabular-nums; }

.lineup .data td { padding: 7px 12px; }
.lineup .slot { width: 1%; font: 600 12px/1 var(--mono); color: var(--ink-3); }
.lineup .who { max-width: 0; width: 100%; }
.lineup .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lineup .who small { display: block; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lineup .warn { margin: 0; padding: 10px 16px; border-top: 1px solid var(--rule); background: var(--warn-bg); color: var(--warn); font-size: 13.5px; font-weight: 600; }

/* prices */
.price-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 12px; }
.price-count { margin: 0; color: var(--ink-3); font-size: 14px; }

.prices th button {
  padding: 0; border: 0; background: none;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
  cursor: pointer;
}
.prices th button:hover { color: var(--ink); }
.prices th[aria-sort] button { color: var(--ink); }
.prices th[aria-sort="ascending"] button::after { content: " ↑"; }
.prices th[aria-sort="descending"] button::after { content: " ↓"; }
.prices td.player { width: 100%; font-weight: 600; }
.prices td.player small { display: block; color: var(--ink-3); font-size: 12.5px; font-weight: 500; }
.prices td.site-col { font-weight: 700; }
.prices tr.is-out td { color: var(--ink-3); }
.prices tr.is-out td.player .name { text-decoration: line-through; }
.prices th .short { display: none; }

/* ---------- notes + footer ---------- */

.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.notes-grid article { padding: 18px 20px; background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; }
.notes-grid h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.notes-grid p { margin: 0; color: var(--ink-2); font-size: 15px; }

.footer { padding-top: 40px; padding-bottom: 48px; color: var(--ink-3); font-size: 14px; }
.footer p { margin: 0 0 4px; }

@media (max-width: 760px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .section-head { margin-top: 40px; }
  .controls { display: grid; }
  .slate-field { flex: none; }
  .build-bar { align-items: start; }
  .data th, .data td { padding: 8px 10px; }
  .prices th .long { display: none; }
  .prices th .short { display: inline; }
}
