/* MCSR Lab — tokens first, light and dark selected separately (not an automatic flip). */
:root {
  color-scheme: light;
  --page: #f3f3f0;
  --surface: #ffffff;
  --surface-2: #f7f7f4;
  --surface-3: #eeeee9;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #7d7c76;
  --grid: #e7e6e0;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.09);
  --border-strong: rgba(11, 11, 11, 0.18);
  --good: #006300;
  --good-mark: #0ca30c;
  --bad: #b42323;
  --warn: #8a5a00;
  --focus: #2a78d6;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --s-nether: #e34948;
  --s-bastion: #2a78d6;
  --s-fortress: #eda100;
  --s-blind: #e87ba4;
  --s-stronghold: #008300;
  --s-end: #4a3aa7;
  --s-finish: #1baf7a;
  --seq-1: #86b6ef; --seq-2: #5598e7; --seq-3: #2a78d6; --seq-4: #1c5cab; --seq-5: #104281;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0c0d10;
    --surface: #15171c;
    --surface-2: #1b1e24;
    --surface-3: #23262d;
    --ink: #f3f3f0;
    --ink-2: #c3c2b7;
    --muted: #8d8c86;
    --grid: #252830;
    --axis: #3a3d46;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --good: #2bbd3c;
    --good-mark: #0ca30c;
    --bad: #f07a7a;
    --warn: #e0a83a;
    --focus: #6aa8f0;
    --shadow: none;
    --s-nether: #e66767;
    --s-bastion: #3987e5;
    --s-fortress: #c98500;
    --s-blind: #d55181;
    --s-stronghold: #008300;
    --s-end: #9085e9;
    --s-finish: #199e70;
    --seq-1: #184f95; --seq-2: #2a78d6; --seq-3: #5598e7; --seq-4: #86b6ef; --seq-5: #cde2fb;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0c0d10;
  --surface: #15171c;
  --surface-2: #1b1e24;
  --surface-3: #23262d;
  --ink: #f3f3f0;
  --ink-2: #c3c2b7;
  --muted: #8d8c86;
  --grid: #252830;
  --axis: #3a3d46;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --good: #2bbd3c;
  --good-mark: #0ca30c;
  --bad: #f07a7a;
  --warn: #e0a83a;
  --focus: #6aa8f0;
  --shadow: none;
  --s-nether: #e66767;
  --s-bastion: #3987e5;
  --s-fortress: #c98500;
  --s-blind: #d55181;
  --s-stronghold: #008300;
  --s-end: #9085e9;
  --s-finish: #199e70;
  --seq-1: #184f95; --seq-2: #2a78d6; --seq-3: #5598e7; --seq-4: #86b6ef; --seq-5: #cde2fb;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.num, td.t, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px max(16px, calc((100vw - 1320px) / 2));
  background: color-mix(in srgb, var(--page) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand b { font-weight: 650; color: var(--muted); }
.search { display: flex; gap: 8px; flex: 1; max-width: 560px; margin-left: auto; min-width: 0; }
.search select { flex: none; }
.search input {
  flex: 1 1 0; min-width: 0; width: 0;
  height: 38px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface);
}
.search input::placeholder { color: var(--muted); }
select {
  height: 38px; padding: 0 30px 0 10px;
  border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 11px center;
  appearance: none; -webkit-appearance: none;
}
.btn {
  height: 38px; padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--ink); color: var(--page); border-color: var(--ink); font-weight: 600; }
.btn.primary:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.small { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.icon-btn {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--border);
  background: transparent; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }

main { padding: 24px max(16px, calc((100vw - 1320px) / 2)) 48px; }

/* ---- landing ---- */
.landing { max-width: 760px; margin: 8vh auto 0; text-align: center; }
.landing h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 14px; font-weight: 700; }
.landing p.lede { color: var(--ink-2); font-size: 17px; max-width: 580px; margin: 0 auto 28px; }
.landing .search { margin: 0 auto; max-width: 520px; }
.landing .search input { height: 48px; font-size: 17px; }
.landing .search select, .landing .search .btn { height: 48px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 14px;
}
.chip:hover { border-color: var(--border-strong); }
.chip img { width: 18px; height: 18px; border-radius: 4px; image-rendering: pixelated; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 56px; text-align: left; }
.feature { padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.feature h3 { margin: 10px 0 4px; font-size: 15px; }
.feature p { margin: 0; color: var(--ink-2); font-size: 14px; }
.feature .swatches { display: flex; gap: 4px; }
.feature .swatches i { width: 18px; height: 6px; border-radius: 3px; }

/* ---- player strip ---- */
.player { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.player .head { width: 56px; height: 56px; border-radius: 10px; image-rendering: pixelated; background: var(--surface-3); flex: none; }
.player h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; line-height: 1.1; }
.player .meta { color: var(--muted); font-size: 14px; display: flex; gap: 6px 14px; flex-wrap: wrap; margin-top: 3px; }
.player .actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sync-status { font-size: 13px; color: var(--muted); text-align: right; }
.progress { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; width: 180px; margin-top: 6px; margin-left: auto; }
.progress i { display: block; height: 100%; width: 0; background: var(--ink-2); transition: width 0.25s; }
.notice {
  padding: 12px 14px; border-radius: 10px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border-strong); font-size: 14px;
}
.notice.error { border-color: color-mix(in srgb, var(--bad) 55%, transparent); }

/* ---- filters ---- */
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 10px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.filters .group { display: flex; align-items: center; gap: 6px; }
.filters label.lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-right: 2px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-3); }
.seg button {
  height: 28px; padding: 0 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--ink-2); cursor: pointer; font-size: 13px; white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.12); font-weight: 600; }
.filters select { height: 34px; font-size: 13px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--ink); width: 15px; height: 15px; }
.filters .count { margin-left: auto; font-size: 13px; color: var(--muted); }
.filters-toggle { display: none; }
.player > .who { flex: 1; min-width: 0; }

/* ---- tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { padding: 16px 16px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); min-width: 0; }
.tile .label { font-size: 13px; color: var(--ink-2); }
.tile .value { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; margin: 4px 0 2px; white-space: nowrap; }
.tile .sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.delta { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.delta.flat { color: var(--muted); }

/* ---- cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 18px 14px; margin-bottom: 20px; min-width: 0; }
.card > header { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card h2 { font-size: 16px; margin: 0; letter-spacing: -0.01em; }
.card .desc { font-size: 13px; color: var(--muted); margin: 2px 0 0; max-width: 640px; }
.card header .tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid2 > .card { margin-bottom: 20px; }
.chart { width: 100%; height: 300px; }
.chart.xl { height: 420px; }
.chart.sm { height: 240px; }
.empty { padding: 40px 12px; text-align: center; color: var(--muted); font-size: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 8px; border-radius: 2px; display: inline-block; }
.legend i.line { height: 2px; border-radius: 1px; width: 14px; }
.legend i.dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---- split grid ---- */
.splits { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.split-card.rate { cursor: default; }
.split-card.rate:hover { border-color: var(--border); }
.split-card {
  position: relative; text-align: left;
  padding: 12px 12px 6px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; min-width: 0;
}
.split-card:hover { border-color: var(--border-strong); }
.split-card[aria-pressed="true"] { border-color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--ink-2); }
.split-card .top { display: flex; align-items: baseline; gap: 8px; }
.split-card .name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.split-card .name i { width: 9px; height: 9px; border-radius: 50%; }
.split-card .reach { margin-left: auto; font-size: 12px; color: var(--muted); }
.split-card .big { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; }
.split-card .row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.split-card .mini { height: 92px; margin: 2px -4px 0; }
.split-card .foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); padding-top: 2px; }

/* ---- focus ---- */
.focus-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.focus-tabs button {
  height: 32px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--border); background: transparent; color: var(--ink-2);
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px;
}
.focus-tabs button i { width: 9px; height: 9px; border-radius: 50%; }
.focus-tabs button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); border-color: var(--border-strong); font-weight: 600; }
.focus-stats { display: flex; flex-wrap: wrap; gap: 8px 26px; padding: 4px 2px 12px; }
.focus-stats div { font-size: 12.5px; color: var(--muted); }
.focus-stats b { display: block; font-size: 18px; color: var(--ink); font-weight: 650; letter-spacing: -0.01em; }
.focus-stats b.good { color: var(--good); }
.focus-stats b.bad { color: var(--bad); }
td .paused-n { font-style: italic; color: var(--muted); }
.outcome.dot-only { display: none; margin-right: 6px; }
td .short { display: none; }
.target { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.target input { width: 70px; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); font-variant-numeric: tabular-nums; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th[aria-sort="ascending"]::after { content: " ▲"; font-size: 9px; }
th[aria-sort="descending"]::after { content: " ▼"; font-size: 9px; }
td.t, th.t { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--surface-2); }
td .pb { display: inline-block; margin-left: 5px; padding: 0 4px; border-radius: 4px; font-size: 10px; font-weight: 700; color: var(--good); border: 1px solid currentColor; vertical-align: 1px; }
td .gold { font-weight: 700; }
.outcome { display: inline-flex; align-items: center; gap: 6px; }
.outcome i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.outcome.finish i, .outcome.goal i, .outcome.won i { background: var(--good-mark); }
.outcome.forfeit i { background: transparent; border: 1.5px solid var(--muted); }
.outcome.reset i { background: transparent; border: 1.5px dashed var(--muted); }
.bar-cell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.bar-cell span.bar { display: inline-block; width: 60px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar-cell span.bar i { display: block; height: 100%; background: var(--ink-2); border-radius: 3px; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding-top: 12px; font-size: 13px; color: var(--muted); }
.seed-tables { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; }
.seed-tables > p { grid-column: 1 / -1; }
.seed-tables h3 { font-size: 13px; margin: 0 0 4px; color: var(--ink-2); font-weight: 600; }
.mate { display: flex; align-items: center; gap: 8px; }
.mate img { width: 20px; height: 20px; border-radius: 4px; image-rendering: pixelated; }

/* ---- drawer ---- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(480px, 100vw); overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--border-strong);
  padding: 20px 20px 32px;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.25);
}
.drawer header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.drawer h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.drawer .when { color: var(--muted); font-size: 13px; margin-top: 2px; }
.drawer .close { margin-left: auto; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); }
.drawer h3 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 20px 0 6px; }
.drawer table td, .drawer table th { padding: 7px 6px; }
.drawer .note { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-top: 14px; }
.swatch { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 0; }

/* ---- footer ---- */
footer.site {
  padding: 24px max(16px, calc((100vw - 1320px) / 2)) 40px;
  color: var(--muted); font-size: 13px; border-top: 1px solid var(--border);
}
footer.site details { max-width: 820px; }
footer.site summary { cursor: pointer; color: var(--ink-2); }
footer.site p, footer.site li { line-height: 1.55; }
footer.site .row { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin-top: 14px; }

.is-loading .chart, .is-loading .split-card .mini { opacity: 0.55; transition: opacity 0.2s; }

/* ---- responsive ---- */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .splits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seed-tables { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .features { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  html { scroll-padding-top: 124px; }
  body { font-size: 14.5px; }
  .toggle { min-height: 32px; }
  main { padding-top: 16px; }
  .splits { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .split-card { padding: 10px 9px 4px; }
  .split-card .big { font-size: 20px; }
  .split-card .reach { font-size: 11px; }
  .split-card .mini { height: 70px; margin: 0 -4px; }
  .split-card .foot { font-size: 11px; }
  .split-card .foot .cnt { display: none; }
  .split-card .w { display: none; }
  .col-seed, .col-result { display: none; }
  .outcome.dot-only { display: inline-flex; }
  /* The attempt number stays put while the splits scroll sideways. */
  th.sticky, td.sticky { position: sticky; left: 0; z-index: 1; background: var(--surface); }
  tbody tr:hover td.sticky { background: var(--surface-2); }
  td .long { display: none; }
  td .short { display: inline; }
  th, td { padding: 8px 7px; }
  .card header .tools { margin-left: 0; }
  .player { gap: 12px; }
  .player .head { width: 44px; height: 44px; }
  .player h1 { font-size: 23px; }
  .filters { gap: 10px; padding-top: 0; }
  .filters-toggle { display: inline-flex; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .filters:not(.open) > :not(.filters-toggle):not(.count) { display: none; }
  .filters .count { width: auto; margin-left: auto; align-self: center; }
  .drawer { padding: 16px 14px 28px; }
  .focus-stats { gap: 8px 18px; }
  .focus-stats b { font-size: 16px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar .search { order: 3; flex-basis: 100%; max-width: none; }
  .topbar .icon-btn { margin-left: auto; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile .value { font-size: 23px; }
  .chart.xl { height: 340px; }
  .player .actions { margin-left: 0; width: 100%; justify-content: space-between; }
  .sync-status { text-align: left; }
  .progress { margin-left: 0; }
  .filters .count { margin-left: 0; width: 100%; }
  .card { padding: 14px 12px 10px; }
  .landing { margin-top: 4vh; }
  .landing .search { flex-wrap: wrap; }
  .landing .search input { flex-basis: 100%; }
  .landing .search select { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
