:root {
  color-scheme: dark;
  --bg: #12141a;
  --surface: #1b1e27;
  --line: #3a4254;
  --text: #e8eaed;
  --muted: #b8c0cc;
  --focus: #8ab4ff;
  --configured: #7dcea0;
  --configured-bg: #163326;
  --suggested: #e8c36a;
  --suggested-bg: #3a2e12;
  --none: #c5cad3;
  --none-bg: #2a2e38;
  --bm: #e06666;
  --bm-fill: #c0392b;
  --pool: #3f4a63;
  --share: #7a3a3f;
  --cap: #e8c36a;
  --danger: #f0a8a8;
  --radius: 4px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --header-h: 56px;
}

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

html {
  overflow-x: clip;
}
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}

h1 { font-size: 20px; margin: 0; font-weight: 650; }
h2 { font-size: 20px; margin: 0 0 8px; }
h3 { font-size: 16px; margin: 24px 0 8px; }

.kicker, .row-meta, .hint, .foot-note, .meta, .note, .limits, footer {
  color: var(--muted);
  font-size: 13px;
}

.kicker { text-transform: uppercase; letter-spacing: 0.06em; }

a { color: var(--focus); }

:focus-visible,
.skip-link:focus-visible,
.row-btn:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -64px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border: 1px solid var(--line);
  z-index: 100;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 8px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.top {
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 8px 16px 0;
  min-height: var(--header-h);
}

.brand { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.live-dot { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--configured); }

.search-wrap { position: relative; margin: 8px 0; }
.search-wrap input {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 36px 10px 12px;
  min-height: 44px;
}
.slash { position: absolute; right: 10px; top: 10px; color: var(--muted); font-size: 12px; border: 1px solid var(--line); padding: 2px 6px; }
#search-results {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  position: absolute;
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  max-height: 320px;
  overflow: auto;
  z-index: 12;
}
#search-results button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 10px 12px;
  min-height: 44px;
  cursor: pointer;
}
#search-results .group-label { padding: 8px 12px 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.tabs { display: flex; gap: 0; overflow-x: auto; }
.tabs button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  padding: 10px 12px;
  min-height: 44px;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--focus); }

.banner { margin: 0; padding: 8px 16px; background: var(--suggested-bg); color: var(--suggested); }
.status-line { margin: 0; padding: 8px 16px; color: var(--muted); min-height: 1.5em; }
.status-line[data-kind="error"] { color: var(--danger); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 0;
  align-items: start;
}

body.compare-view .layout { grid-template-columns: minmax(0, 1fr); }
body.compare-view #detail { display: none; }

.compare-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.add-slot { min-height: 44px; min-width: 44px; }
.compare-picker { position: relative; width: 100%; max-width: 100%; margin: 8px 0; }
.compare-picker input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-height: 44px;
}
#compare-pick-results {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  position: absolute;
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  max-height: 320px;
  overflow: auto;
  z-index: 12;
}
#compare-pick-results button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 10px 12px;
  min-height: 44px;
  cursor: pointer;
}
#compare-pick-results .group-label { padding: 8px 12px 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

main, #detail { padding: 16px; min-width: 0; }
#detail { border-left: 1px solid var(--line); background: var(--surface); min-height: 60vh; }

.profile-list, .group-list, .id-list { list-style: none; margin: 0; padding: 0; }
.profile-row, .group-row { border-bottom: 1px solid var(--line); }
.row-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 12px 4px;
  min-height: 44px;
  cursor: pointer;
}
.row-btn.selected, .group-row.selected > .row-btn { box-shadow: inset 3px 0 0 var(--configured); }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.row-name { font-size: 16px; }
.row-go, .chev { color: var(--muted); width: 1rem; }
.profile-kids, .kids { padding: 0 16px 12px 44px; color: var(--muted); font-size: 13px; }
.skel { height: 56px; margin: 8px 0; background: var(--surface); border-radius: var(--radius); }

.icon-box {
  width: 36px;
  height: 32px;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #161922;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cache-icon { width: 36px; height: 32px; image-rendering: pixelated; }
.monogram { font-size: 11px; color: var(--muted); font-family: var(--mono); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 13px;
  font-weight: 600;
}
.pill.configured { background: var(--configured-bg); color: var(--configured); }
.pill.suggested { background: var(--suggested-bg); color: var(--suggested); }
.pill.none { background: var(--none-bg); color: var(--none); }
.pill.off, .check.off { border: 1px dashed var(--line); color: var(--muted); background: none; }
.tier-badge {
  display: inline-flex;
  width: 28px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
}

.term {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 0;
  min-height: 0;
  cursor: help;
  text-decoration: underline dotted var(--muted);
  vertical-align: baseline;
}
.term::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}
[role="tooltip"] {
  max-width: 22rem;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 13px;
  z-index: 30;
}

button, select, input[type="number"] {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  min-height: 36px;
}
button { cursor: pointer; }
.chip, .text-btn, .id-chip {
  background: var(--bg);
  min-height: 36px;
}
.chip.on, .id-chip.on { border-color: var(--focus); color: var(--focus); }
.text-btn { background: none; border: 0; color: var(--focus); padding: 4px; }

.num, .band-vals, .chart-axis, .chart-markers { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.scenario { border: 1px solid var(--line); padding: 12px; margin: 12px 0; }
.scenario-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 8px; }
.player-picks { border: 0; padding: 0; display: flex; gap: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; }
.share-label { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 160px; flex-wrap: wrap; }
#sc-share-num { width: 4.5rem; min-height: 36px; }
.mod-grid { display: grid; gap: 8px; margin-top: 8px; }
.presets { margin-top: 8px; }
.warn { color: var(--danger); }

.chart { position: relative; margin: 16px 0; }
.chart-rows { display: flex; flex-direction: column; gap: 8px; }
.band-row { display: grid; grid-template-columns: 120px 1fr; gap: 8px; align-items: center; min-height: 28px; }
.band-track { position: relative; height: 16px; background: #161922; }
.band { position: absolute; top: 0; height: 100%; }
.band.pool { background: var(--pool); }
.band.share, .band.mods { background: var(--share); }
.band.grant { background: var(--bm-fill); }
.band.ghost {
  background: repeating-linear-gradient(-45deg, transparent, transparent 3px, #3a2e12 3px, #3a2e12 6px);
  opacity: 0.85;
}
.chart-cap {
  position: relative;
  border-left: 1px dashed var(--cap);
  height: 0;
  margin-bottom: 8px;
  color: var(--cap);
  font-size: 12px;
}
.chart-axis, .chart-markers { position: relative; height: 28px; }
.chart-markers { height: 44px; }
.chart-axis span, .chart-markers span { position: absolute; transform: translateX(-50%); font-size: 12px; color: var(--muted); }
.chart-markers .lane-1 { top: 18px; }
.chart-markers .tick-only {
  width: 2px;
  height: 10px;
  background: var(--muted);
  transform: translateX(-50%);
}
.base-tick { position: absolute; top: -4px; width: 2px; height: 24px; background: var(--text); }
.mean-mark { position: absolute; color: var(--bm); font-size: 12px; }
.band-note { grid-column: 2; margin: 0; font-size: 13px; color: var(--muted); }
figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.quantile-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; margin-top: 8px; }
.quantile-table th, .quantile-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }

.mini-bar { position: relative; height: 10px; background: #161922; }
.mini-bar span { position: absolute; top: 0; height: 100%; background: var(--bm-fill); }
.mini-bar.empty { background: repeating-linear-gradient(-45deg, #161922, #161922 4px, #2a2e38 4px, #2a2e38 8px); }

.compare-cards { display: flex; flex-direction: column; gap: 12px; }
.cmp-card { border: 1px solid var(--line); padding: 12px; }
.cmp-card.hollow { opacity: 0.75; }
.cmp-dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 8px 0 0; }
.cmp-dl dt { color: var(--muted); font-size: 13px; }
.cmp-dl dd { margin: 0; }

.all-toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; align-items: end; }
.pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.pager button[disabled] { opacity: 0.45; cursor: not-allowed; }

.pipeline { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.pipeline li { border: 1px solid var(--line); padding: 4px 8px; font-size: 13px; }
.plain { width: 100%; border-collapse: collapse; }
.plain th, .plain td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
.glossary { display: flex; flex-direction: column; gap: 12px; }
.gloss h3 { margin: 0 0 4px; font-size: 14px; }

.detail-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.detail-idline, .pool-line, .hourly, .grind { margin: 8px 0; }
.back { display: none; }
.not-live { color: var(--suggested); }

footer { padding: 16px; border-top: 1px solid var(--line); }

@media (max-width: 1023px) {
  .layout { grid-template-columns: 1fr; }
  #detail { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 720px) {
  .top { padding: 8px; }
  h1 { font-size: 16px; }
  .band-row { grid-template-columns: 1fr; }
  .band-label { font-size: 13px; color: var(--muted); }
  .compare-cards { display: flex; }
  .cmp-dl { grid-template-columns: 1fr; }
  body.detail-open main { display: none; }
  body.detail-open .back { display: inline-flex; }
  .tabs { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
