:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f1f0ec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6e69;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --track: #ecebe6;
  /* ore tiers: reference categorical slots 1-5, in fixed order */
  --t64: #2a78d6;
  --t32: #eb6834;
  --t16: #1baf7a;
  --t8: #eda100;
  --t4: #e87ba4;
  --warn: #9a6400;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #9a998f;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #5598e7;
    --track: #2a2a28;
    --t64: #3987e5;
    --t32: #d95926;
    --t16: #199e70;
    --t8: #c98500;
    --t4: #d55181;
    --warn: #fab219;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #9a998f;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #5598e7;
  --track: #2a2a28;
  --t64: #3987e5;
  --t32: #d95926;
  --t16: #199e70;
  --t8: #c98500;
  --t4: #d55181;
  --warn: #fab219;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: 0.92em; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }

.top { background: var(--surface); border-bottom: 1px solid var(--border); padding: 24px 0 18px; }
h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.sub { margin: 4px 0 14px; color: var(--ink-2); max-width: 760px; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.stat b { display: block; font-size: 20px; font-weight: 600; }
.stat span { color: var(--muted); font-size: 12px; }

.filters {
  display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: end;
  padding: 16px 0 10px;
}
.filters label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.filters label > span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.filters input, .filters select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; height: 34px;
  max-width: 100%;
}
.filters input:focus, .filters select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.f-search { flex: 1 1 260px; }
.f-search input { width: 100%; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--ink-2); padding: 2px 0 10px; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg.muted { color: var(--muted); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.t64 { background: var(--t64); } .t32 { background: var(--t32); } .t16 { background: var(--t16); }
.t8 { background: var(--t8); } .t4 { background: var(--t4); }

.count { margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; vertical-align: middle; }
th { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
     border-bottom: 1px solid var(--grid); white-space: nowrap; }
td { border-bottom: 1px solid var(--grid); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.moon { cursor: pointer; }
tr.moon:hover td, tr.moon.open td { background: var(--surface-2); }
tr.moon:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mname { font-weight: 600; white-space: nowrap; }
.msys { color: var(--muted); font-size: 12px; }
.tier-badge { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 12px; white-space: nowrap; }
.sec { font-variant-numeric: tabular-nums; }
.comp { min-width: 240px; }
.bar { display: flex; gap: 2px; height: 12px; width: 100%; max-width: 280px; background: var(--track); border-radius: 4px; overflow: hidden; }
.seg { height: 100%; }
.seg:first-child { border-radius: 4px 0 0 4px; }
.seg:hover { filter: brightness(1.15); }
.comp-text { margin-top: 4px; font-size: 12px; color: var(--ink-2); }
.flag { font-size: 11px; color: var(--warn); white-space: nowrap; }
.rel { font-size: 11px; color: var(--muted); white-space: nowrap; }
.none { color: var(--muted); font-size: 12px; }
.isk { white-space: nowrap; font-weight: 600; }

tr.detail td { background: var(--surface-2); padding: 0; }
.det { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr) minmax(320px, 1.4fr); gap: 20px; padding: 16px; }
.det h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.det table { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.det th, .det td { padding: 5px 8px; }
.det tr:last-child td { border-bottom: 0; }
.det .note { font-size: 12px; color: var(--ink-2); margin: 8px 0 0; }
.det .links { font-size: 12px; margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.kills-scroll { max-height: 340px; overflow: auto; border-radius: 8px; }

.more { text-align: center; padding: 14px 0; }
.more button {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 7px 18px; cursor: pointer;
}
.more button:hover { background: var(--surface-2); }

.method { margin: 16px 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.method summary { cursor: pointer; padding: 12px 16px; font-weight: 600; }
.method-body { padding: 0 16px 8px; color: var(--ink-2); max-width: 900px; }
.foot { color: var(--muted); font-size: 12px; padding: 8px 0 32px; }

.tip {
  position: fixed; z-index: 10; pointer-events: none;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 9px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.tip b { font-size: 13px; }
.tip .k { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 6px; }

@media (max-width: 900px) {
  .det { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hide-sm, .moons th:nth-child(4), .moons tr.moon td:nth-child(4) { display: none; }
  .comp { min-width: 150px; }
  th, td { padding: 7px 6px; }
  .filters label { flex: 1 1 140px; }
  .filters select { width: 100%; }
}
