/* mersenne.remotecpu.com: clean stats page. Tokens follow the reference
   dataviz palette (single-series blue, recessive chrome, status colours
   only with an icon + label). */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --series: #2a78d6;
  --series-hover: #256abf;
  --track: #cde2fb;
  --good: #006300;
  --bad: #d03b3b;
  --badge-bg: #e8f1fc;
  --badge-ink: #184f95;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --ring: rgba(255, 255, 255, 0.10);
    --series: #3987e5;
    --series-hover: #5598e7;
    --track: #1d3554;
    --good: #0ca30c;
    --bad: #e66767;
    --badge-bg: #16263b;
    --badge-ink: #9ec5f4;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10);
  --series: #3987e5; --series-hover: #5598e7; --track: #1d3554;
  --good: #0ca30c; --bad: #e66767; --badge-bg: #16263b; --badge-ink: #9ec5f4;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.5 var(--font);
}
a { color: var(--series); text-underline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* ---- header ---- */
.top { padding-top: 48px; padding-bottom: 8px; }
.eyebrow { color: var(--muted); font-size: 13px; letter-spacing: 0.02em; }
h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.15; font-weight: 650; margin-top: 6px; letter-spacing: -0.01em; }
.lede { color: var(--ink-2); margin-top: 8px; max-width: 60ch; }
.loading { color: var(--muted); padding: 32px 0; }

/* ---- cards & sections ---- */
section { margin-top: 32px; }
h2 { font-size: 20px; font-weight: 620; letter-spacing: -0.005em; }
.sub { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--ring);
  padding: 20px;
  margin-top: 12px;
}

/* ---- hero + tiles ---- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 24px; }
@media (min-width: 760px) { .hero { grid-template-columns: 280px minmax(0, 1fr); } }
.hero-fig { display: flex; flex-direction: column; justify-content: center; margin-top: 0; }
.hero-num { font-size: 64px; line-height: 1; font-weight: 680; letter-spacing: -0.02em; }
.hero-label { color: var(--ink-2); margin-top: 8px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { margin-top: 0; }
.tile .label { color: var(--ink-2); font-size: 14px; }
.tile .value { font-size: 28px; font-weight: 640; line-height: 1.2; margin-top: 4px; }
.tile .note { color: var(--muted); font-size: 13px; margin-top: 2px; }
.delta { font-size: 14px; margin-top: 6px; font-weight: 550; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); font-weight: 400; }

/* ---- workers ---- */
.status-line { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.alert { color: var(--bad); font-weight: 550; }
.workers { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .workers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.worker { margin-top: 0; display: flex; flex-direction: column; gap: 10px; }
.worker-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.worker-kind { font-weight: 600; }
.worker-cores { color: var(--muted); font-size: 13px; white-space: nowrap; }
.exponent { font-size: 22px; font-weight: 640; overflow-wrap: anywhere; }
.exponent small { color: var(--ink-2); font-size: 15px; font-weight: 450; }
.badge {
  display: inline-block; align-self: flex-start;
  background: var(--badge-bg); color: var(--badge-ink);
  font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
}
.meter { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--series); border-radius: 4px; min-width: 4px; }
.meter-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--ink-2); }
.meter-row strong { color: var(--ink); font-weight: 600; }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--ink-2); }
dl.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; padding: 0 12px 8px 0; white-space: nowrap; }
td { padding: 10px 12px 10px 0; border-top: 1px solid var(--grid); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th:last-child, td:last-child { padding-right: 0; }
td .secondary { display: block; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; }
.result-composite { color: var(--ink-2); }
.result-prime { color: var(--good); font-weight: 650; }

/* ---- bar chart (work mix) ---- */
.hbars { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 16px; align-items: center; margin-top: 16px; }
.hbars .cat { color: var(--ink-2); font-size: 14px; }
.hbars .lane { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbars .bar {
  height: 16px; background: var(--series); border-radius: 0 4px 4px 0; min-width: 2px;
  outline: none; flex: 0 0 auto;
}
.hbars .bar:hover, .hbars .bar:focus-visible { background: var(--series-hover); }
.hbars .bar:focus-visible { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--series); }
.hbars .val { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- column chart (monthly) ---- */
.cols { position: relative; margin-top: 20px; }
.cols .plot { position: relative; height: 180px; margin-left: 36px; }
.cols .grid { position: absolute; left: -36px; right: 0; border-top: 1px solid var(--grid); }
.cols .grid span { position: absolute; left: 0; top: -9px; width: 30px; text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.cols .base { position: absolute; left: 0; right: 0; bottom: 0; border-top: 1px solid var(--axis); }
.cols .bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.cols .slot { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; position: relative; }
.cols .col { width: min(24px, 70%); background: var(--series); border-radius: 4px 4px 0 0; }
.cols .slot:hover .col, .cols .slot:focus-visible .col { background: var(--series-hover); }
.cols .slot:focus-visible { box-shadow: inset 0 0 0 2px var(--series); border-radius: 4px; }
.cols .cap { position: absolute; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cols .xaxis { display: flex; gap: 2px; margin-left: 36px; margin-top: 6px; }
.cols .xaxis span { flex: 1 1 0; text-align: center; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; }
details.tableview { margin-top: 16px; font-size: 14px; }
details.tableview summary { cursor: pointer; color: var(--ink-2); }
details.tableview .table-wrap { margin-top: 8px; }

/* ---- fleet ---- */
.tiles.four { margin-top: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.chart-title { font-size: 16px; font-weight: 600; }
.card > .chart-title + .hbars { margin-top: 12px; }
.cname { display: flex; align-items: center; gap: 8px; font-weight: 550; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.dot.active { background: #0ca30c; }
.dot.quiet { background: #fab219; }
.dot.lost { background: var(--axis); }
.tag { font-size: 11px; font-weight: 600; color: var(--badge-ink); background: var(--badge-bg); padding: 1px 6px; border-radius: 999px; }
.mini { display: grid; gap: 4px; min-width: 90px; }
.mini .meter { height: 6px; }
table.computers td:first-child { min-width: 180px; }
.found { color: var(--good); }
.linkbtn { margin-top: 12px; background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: var(--series); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.legend-note { color: var(--muted); font-size: 13px; margin-top: 12px; white-space: pre-wrap; }
.dot.inline { display: inline-block; vertical-align: 1px; }
.linkbtn { display: block; }

/* ---- tooltip ---- */
.tip {
  position: fixed; z-index: 10; pointer-events: none;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 0 0 1px var(--ring), 0 4px 16px rgba(0, 0, 0, 0.12);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.4; max-width: 240px;
}
.tip .tip-title { color: var(--ink-2); margin-bottom: 4px; }
.tip .tip-row { display: flex; align-items: center; gap: 8px; }
.tip .tip-row strong { font-variant-numeric: tabular-nums; }
.tip .key { width: 12px; height: 2px; background: var(--series); flex: 0 0 auto; }

@media (max-width: 560px) {
  .hide-sm { display: none; }
  .tile .value { font-size: 24px; }
  .hero-num { font-size: 56px; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .cols .xaxis span:nth-child(even) { visibility: hidden; }
  td .mono { font-size: 12px; }
}
sup { font-size: 0.7em; line-height: 0; }

/* ---- about / footer ---- */
.about p + p { margin-top: 10px; }
.about { color: var(--ink-2); max-width: 70ch; }
.foot { color: var(--muted); font-size: 13px; padding-top: 40px; padding-bottom: 48px; }
.foot p + p { margin-top: 4px; }
