:root {
  color-scheme: dark;
  --bg: #0b1220;
  --bg-elevated: #121b2e;
  --card: #1a2740;
  --card-raised: #22314d;
  --line: #314863;
  --ink: #e8eef7;
  --muted: #b7c9dc;
  --cyan: #8fd0de;
  --lime: #c8f25a;
  --lime-ink: #14210a;
  --danger-bg: #3d242b;
  --danger-ink: #ffd5d8;
  --focus: #c8f25a;
  --radius: 18px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(143, 208, 222, 0.08), transparent 50%),
    var(--bg);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  line-height: 1.5;
  font-size: 1.05rem;
  padding-top: 3.6rem;
}

h1, h2, h3 {
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-weight: 650;
  line-height: 1.2;
  overflow-wrap: anywhere;
  letter-spacing: -0.02em;
}

h1 { font-size: 2.4rem; margin: 0.35rem 0 0.45rem; }
h2 { font-size: 1.55rem; margin: 0 0 0.45rem; }
h3 { font-size: 1.12rem; margin: 0; }

p { overflow-wrap: anywhere; }

a { color: var(--cyan); }
a:hover { color: var(--lime); }

.wrap {
  width: min(74rem, calc(100% - 2.5rem));
  margin-inline: auto;
}

.horizon {
  height: 0.35rem;
  background: linear-gradient(90deg, var(--cyan), var(--lime) 55%, transparent);
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  background: var(--lime);
  color: var(--lime-ink);
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  z-index: 40;
}

.skip:focus { top: 3.7rem; }

.site-header { padding: 1.4rem 0 0.4rem; }

.header-row, .catalogue-controls, .button-row, .card-bar, .group-bar, .pager, .fate-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.identity { flex: 1 1 22rem; min-width: 0; }

.release-pill {
  display: inline-block;
  margin: 0;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--lime);
  color: var(--lime-ink);
  font-size: 0.85rem;
  font-weight: 700;
}

.credit { font-size: 1.12rem; max-width: 44rem; }
.invite, .note, .topic-line, #reading-meta { color: var(--muted); }
.invite { max-width: 44rem; font-size: 1.05rem; }

.lang-wrap, .search-wrap, .sort-wrap { flex: 1 1 14rem; min-width: 0; }

label, .field-label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--cyan);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input, select, button { font: inherit; min-height: 2.75rem; }

input, select {
  width: 100%;
  max-width: 100%;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #10192b;
  color: var(--ink);
}

button {
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--lime);
  color: var(--lime-ink);
  padding: 0.45rem 1rem;
  font-weight: 700;
  max-width: 100%;
}

button.secondary, button.collapse {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

button.collapse {
  min-width: 2.75rem;
  border-radius: 12px;
  color: var(--lime);
}

.preset-row button {
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

.chapter-credits {
  margin: 1rem 0 0;
  padding: 0.95rem 1rem 1.05rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.chapter-credits h3 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
}
.credit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.credit-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.55rem;
  min-width: 0;
}
.credit-tag {
  color: var(--muted);
  font-size: 0.82rem;
}
.chapter-credits a { white-space: nowrap; }

.chapter-nav, #catalogue, #about, #reading, .lifetime-card, .group, .card {
  margin: 1rem 0;
}

.chapter-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.9rem;
  padding: 0;
  margin: 0.8rem 0 0;
  list-style: none;
}

.chapter-list li { min-width: 0; }

.chapter-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  width: 100%;
  height: 100%;
  min-height: 9.5rem;
  padding: 1.05rem 1.1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.chapter-tile[aria-current="true"],
.preset-row button[aria-pressed="true"] {
  background: var(--lime);
  color: var(--lime-ink);
  border-color: transparent;
}

.chapter-tile[aria-pressed="true"] {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.chapter-tile.is-default { min-height: 4.5rem; justify-content: center; }

.debug-dock {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  padding: 0.4rem 0.75rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.debug-toggle {
  min-height: 2.75rem;
  max-width: calc(100vw - 1.5rem);
}

.lifetime-card,
#technical-details,
#reading,
#selected-stage {
  scroll-margin-top: 6rem;
}

.chapter-tile.is-ready {
  border-color: var(--lime);
  background: linear-gradient(180deg, rgba(200, 242, 90, 0.12), var(--card) 42%);
}

.tile-status {
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chapter-tile.is-ready .tile-status { color: var(--lime); }

.tile-title { font-size: 1.35rem; color: var(--ink); }
.tile-blurb { color: var(--muted); font-size: 0.98rem; }

.lifetime-card, #reading, .card, #about, #diagnostics {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.25rem;
}

.lifetime-card { border-color: #45607a; }

.kicker {
  margin: 0 0 0.35rem;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.formula {
  margin: 0.2rem 0 0.8rem;
  color: var(--ink);
  font-size: 1.15rem;
}

.fates { display: grid; gap: 0.85rem; }

.fate {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(8rem, 0.6fr) minmax(8rem, 0.6fr);
  gap: 0.75rem;
  align-items: end;
  padding: 0.85rem;
  border-radius: 14px;
  background: var(--card-raised);
}

.fate h3 { margin-bottom: 0.15rem; font-size: 1rem; }

.live-result {
  margin: 1rem 0 0.7rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: var(--lime);
  color: var(--lime-ink);
}

.live-label {
  margin: 0;
  color: var(--lime-ink);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#lifetime-result, #addition-result {
  display: block;
  min-height: 1.15em;
  font-size: 2.6rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

#lifetime-result { color: var(--lime-ink); }

.precision-hint {
  margin: 0.15rem 0 0;
  color: var(--lime-ink);
  font-size: 0.82rem;
  font-weight: 650;
}

#addition-result { color: var(--ink); font-size: 2rem; }

.live-result.addition-live {
  background: #10192b;
  color: var(--ink);
}

.live-result.addition-live .live-label { color: var(--cyan); }

#delay-status,
#growth-status,
#lifetime-status, #addition-status {
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: #10192b;
  color: var(--ink);
}

#delay-status[data-status="empty"],
#delay-status[data-status="malformed"],
#delay-status[data-status="1"],
#delay-status[data-status="2"],
#delay-status[data-status="3"],
#delay-status[data-status="4"],
#delay-status[data-status="load-failed"],
#growth-status[data-status="empty"],
#growth-status[data-status="malformed"],
#growth-status[data-status="1"],
#growth-status[data-status="2"],
#growth-status[data-status="3"],
#growth-status[data-status="4"],
#growth-status[data-status="5"],
#growth-status[data-status="6"],
#growth-status[data-status="7"],
#growth-status[data-status="load-failed"],
#lifetime-status[data-status="empty"],
#lifetime-status[data-status="malformed"],
#lifetime-status[data-status="1"],
#lifetime-status[data-status="2"],
#lifetime-status[data-status="3"],
#lifetime-status[data-status="4"],
#lifetime-status[data-status="5"],
#lifetime-status[data-status="load-failed"],
#addition-status[data-status="empty"],
#addition-status[data-status="malformed"],
#addition-status[data-status="1"],
#addition-status[data-status="2"],
#addition-status[data-status="load-failed"] {
  background: var(--danger-bg);
  color: var(--danger-ink);
}

.growth-curve {
  width: 100%;
  height: 12rem;
  display: block;
  margin: 0.4rem 0 0.8rem;
  background: #10192b;
  border-radius: 14px;
}

.growth-curve polyline {
  fill: none;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.growth-curve .series-chosen { stroke: var(--lime); }

.throughput-plot-wrap {
  display: grid;
  grid-template-columns: auto minmax(4.8rem, max-content) minmax(0, 1fr);
  column-gap: 0.4rem;
  align-items: start;
  margin: 0.4rem 0 0.8rem;
}
#throughput-y-label {
  grid-column: 1;
  grid-row: 1;
  height: 16rem;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
}
.throughput-y-ticks {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  height: 16rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.throughput-y-ticks span {
  position: absolute;
  right: 0;
  white-space: nowrap;
}
.throughput-plot-frame {
  grid-column: 3;
  grid-row: 1;
  position: relative;
  min-width: 0;
  height: 16rem;
}
.throughput-plot {
  display: block;
  width: 100%;
  height: 16rem;
  background: #10192b;
  border-radius: 12px;
  overflow: hidden;
}
.plot-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.near-zero-label {
  position: absolute;
  right: 0.45rem;
  left: 34%;
  margin: 0;
  text-align: right;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.2;
  color: var(--ink);
  text-shadow: 0 0 2px #0b1220, 0 1px 2px #0b1220;
}
.near-zero-label[data-kind="1"] { color: var(--lime); }
.near-zero-label[data-kind="2"] { color: var(--cyan); }
.near-zero-label[data-kind="3"] { color: #d7dde8; }
.near-zero-label[data-kind="0"] { color: #f2d48a; }
.throughput-x-ticks {
  grid-column: 3;
  grid-row: 2;
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  min-height: 1.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
#throughput-x-label { grid-column: 3; grid-row: 3; }
.throughput-plot polyline,
.throughput-plot .target-line,
.throughput-plot .target-mark,
.throughput-plot .choice-mark,
.legend-swatch line,
.legend-swatch circle {
  vector-effect: non-scaling-stroke;
}
.throughput-plot .series-human,
.legend-swatch .series-human { stroke: var(--lime); stroke-width: 2.5; }
.throughput-plot .series-bacterial,
.legend-swatch .series-bacterial { stroke: var(--cyan); stroke-width: 2.5; stroke-dasharray: 1.4 3.2; stroke-linecap: round; }
.throughput-plot .series-link,
.legend-swatch .series-link { stroke: #d7dde8; stroke-width: 2.5; stroke-dasharray: 7 3.5; }
.throughput-plot .series-custom,
.legend-swatch .series-custom { stroke: #f2d48a; stroke-width: 2.5; stroke-dasharray: 7 2.4 1.4 2.4; }
.throughput-plot .series-chosen,
.legend-swatch .series-chosen { stroke-width: 4; }
.throughput-plot .series-near-zero,
.legend-swatch .series-near-zero { stroke-width: 4.5; }
.throughput-plot .series-halo,
.legend-swatch .series-halo { stroke: #e7eef8; stroke-width: 8; }
.throughput-plot .target-line,
.legend-swatch .target-line { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 3; }
.throughput-plot .target-mark,
.legend-swatch .target-mark { fill: var(--ink); stroke: none; }
.plot-legend {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin: 0.35rem 0 0.75rem;
  padding: 0;
  list-style: none;
}
.plot-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.4rem;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.25;
}
.legend-swatch {
  width: 2.4rem;
  height: 0.85rem;
  flex: 0 0 auto;
  overflow: visible;
}
#choice-plot .series-choice,
.legend-swatch .series-choice { stroke: var(--lime); stroke-width: 2.5; }
#choice-plot .choice-mark,
.legend-swatch .choice-mark { fill: var(--ink); stroke: none; }
.lottery-charts {
  display: grid;
  gap: 1rem;
}
@media (min-width: 860px) {
  .lottery-charts { grid-template-columns: 1fr 1fr; }
}
#lottery-card .preset-row button {
  max-width: 100%;
  white-space: normal;
  text-align: left;
}
#lottery-card .throughput-plot-frame { overflow: hidden; }
#lottery-card .throughput-x-ticks span:last-child { text-align: right; }
#research-index-plot .series-discoveries,
.legend-swatch .series-discoveries,
#research-ratio-plot .series-ratio,
.legend-swatch .series-ratio { stroke: var(--lime); stroke-width: 2.5; }
#research-index-plot .series-researchers,
.legend-swatch .series-researchers { stroke: var(--cyan); stroke-width: 2.5; }
#research-index-plot .research-mark,
#research-ratio-plot .research-mark,
.legend-swatch .research-mark { fill: var(--ink); stroke: none; }
#research-card .preset-row button,
#lottery-card .preset-row button {
  max-width: 100%;
  white-space: normal;
  text-align: left;
}
#research-card .throughput-plot-frame,
#lottery-card .throughput-plot-frame { overflow: hidden; }
#research-card .throughput-x-ticks span:last-child,
#lottery-card .throughput-x-ticks span:last-child { text-align: right; }
#lottery-expected-plot .series-lottery,
.legend-swatch .series-lottery { stroke: var(--lime); stroke-width: 2.5; }
#lottery-chance-plot .series-lottery-chance,
.legend-swatch .series-lottery-chance { stroke: var(--cyan); stroke-width: 2.5; }
#lottery-expected-plot .lottery-mark,
#lottery-chance-plot .lottery-mark,
.legend-swatch .lottery-mark { fill: var(--ink); stroke: none; }
.growth-curve .series-baseline {
  stroke: var(--cyan);
  stroke-dasharray: 3 1.6;
}
.growth-curve .target-line {
  stroke: var(--ink);
  stroke-width: 1;
  stroke-dasharray: 1.4 1.1;
  vector-effect: non-scaling-stroke;
}
.growth-curve .target-mark { fill: var(--ink); }
.growth-curve .eval-line {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 0.8 0.8;
  vector-effect: non-scaling-stroke;
}
.metric-note {
  margin: 0.15rem 0 0;
  color: var(--lime-ink);
  font-size: 0.82rem;
  font-weight: 650;
}
.swatch.elapsed { background: var(--muted); }

.growth-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem 1rem;
}

.growth-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

#delay-one-way, #delay-round {
  display: block;
  min-height: 1.15em;
  font-size: 1.8rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--lime-ink);
  overflow-wrap: anywhere;
}

.preset-row { flex-wrap: wrap; }

.delay-track {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem 0.4rem;
  margin: 0.6rem 0 0.8rem;
}

.delay-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.delay-num {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 800;
}

.delay-num.reply { background: var(--cyan); }

.delay-name {
  max-width: 6.5rem;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.2;
  text-align: center;
}

.delay-leg {
  color: var(--cyan);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 40rem) {
  .delay-track {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .delay-node { flex-direction: row; justify-content: flex-start; }
  .delay-name { max-width: none; text-align: left; }
  .delay-leg { grid-column: 1 / -1; text-align: left; padding-left: 2.2rem; }
}

#delay-events { margin: 0.2rem 0 1rem; padding-left: 1.2rem; }
#delay-events li { margin: 0.25rem 0; }

.growth-metrics output {
  display: block;
  min-height: 1.15em;
  font-size: 1.8rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--lime-ink);
  overflow-wrap: anywhere;
}

#growth-target-status {
  margin: 0.2rem 0 0.8rem;
  font-weight: 700;
}

#growth-target-year {
  margin-left: 0.35rem;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

#growth-target-status[data-target-status="empty"],
#growth-target-status[data-target-status="malformed"],
#growth-target-status[data-target-status="4"],
#growth-target-status[data-target-status="5"] {
  color: var(--danger-ink);
}

.scale-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin: 0.2rem 0 0.6rem;
}

.scale-toggle button[aria-pressed="true"] {
  background: var(--lime);
  color: var(--lime-ink);
  border-color: transparent;
}

.chart-plot {
  display: grid;
  grid-template-columns: auto minmax(2.4rem, max-content) minmax(0, 1fr);
  column-gap: 0.4rem;
  align-items: start;
}

#growth-y-label { grid-column: 1; grid-row: 1; height: 12rem; }
.y-ticks { grid-column: 2; grid-row: 1; }
.growth-curve { grid-column: 3; grid-row: 1; }
.x-ticks { grid-column: 3; grid-row: 2; }

.axis-name {
  margin: 0.2rem 0;
  color: var(--cyan);
  font-size: 0.82rem;
  font-weight: 750;
}

#growth-y-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
}

.y-ticks, .x-ticks {
  position: relative;
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.y-ticks { height: 12rem; }

.y-ticks span, .x-ticks span {
  position: absolute;
  white-space: nowrap;
}

.x-ticks { height: 1.35rem; }

.plot-stack { min-width: 0; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
  margin: 0.2rem 0 0.4rem;
  padding: 0;
  list-style: none;
}

.swatch {
  display: inline-block;
  width: 1.4rem;
  height: 0.28rem;
  margin-right: 0.4rem;
  vertical-align: middle;
  border-radius: 999px;
}

.swatch.chosen { background: var(--lime); }
.swatch.baseline { background: var(--cyan); }

.growth-samples-scroll { max-height: 16rem; overflow-y: auto; }

#growth-exact { margin: 0.6rem 0 0.8rem; }

.bars { display: grid; gap: 0.55rem; margin: 0.4rem 0 1rem; }

.bar-row { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: 0.6rem; align-items: center; }

.bar-track {
  height: 0.7rem;
  border-radius: 999px;
  background: #10192b;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--lime);
}

.bar-fill.bound { background: var(--cyan); }
.bar-fill.link { background: var(--muted); }

.link-reference {
  margin: 0.8rem 0 1rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.link-reference h3 { margin: 0 0 0.35rem; color: var(--ink); }
.link-reference output { display: block; font-size: 1.35rem; font-weight: 700; color: var(--ink); }

.field-label {
  margin: 0.7rem 0 0.2rem;
  color: var(--cyan);
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.bar-fill.chosen { background: var(--lime); }

#debug-dialog {
  width: min(36rem, calc(100vw - 1.5rem));
  max-height: calc(100vh - 2rem);
  margin: auto;
  padding: 1rem 1.1rem 1.15rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

#debug-dialog::backdrop { background: rgba(5, 8, 16, 0.72); }

#debug-dialog h2 { margin-top: 0; }

#debug-expectation {
  display: block;
  width: 100%;
  min-height: 8rem;
  margin: 0.35rem 0 0.6rem;
  padding: 0.55rem 0.7rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  table-layout: fixed;
}

th, td {
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th { color: var(--cyan); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 700; }

.section-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0;
  margin: 0.75rem 0 0;
  list-style: none;
}

.section-jump a, .card-bar a {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-raised);
  color: var(--ink);
  text-decoration: none;
}

.diag, .counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.7rem 1rem;
  margin: 0.6rem 0 0;
}

.diag dt, .counts dt { color: var(--cyan); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
.diag dd, .counts dd { margin: 0.15rem 0 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0;
}

fieldset {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elevated);
}

.filter-options { display: flex; flex-direction: column; gap: 0.35rem; max-height: 16rem; overflow: auto; }

.filter-options label {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.filter-options input { width: 1.1rem; min-height: 1.1rem; margin-top: 0.25rem; }

.group { padding: 0.35rem; background: transparent; border: 0; box-shadow: none; }
.card { margin: 0.55rem 0; }
.card-bar, .group-bar { align-items: center; padding: 0.2rem; }
.card-body, .group-body { padding: 0.2rem 0.55rem 0.8rem; }

.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 0.12rem 0.5rem;
  font-size: 0.78rem;
}

.badge.operational { border-color: var(--lime); color: var(--lime); }

#catalogue-tools, #technical-details {
  margin: 0.9rem 0 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 0.35rem 0.95rem 0.9rem;
}

#catalogue-tools summary, #technical-details summary {
  cursor: pointer;
  font-weight: 700;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
}

.addition-block { margin-top: 0.8rem; }
.operands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.quiet-actions { margin-top: 0.4rem; }
.pager-disabled { color: var(--muted); }
.empty { padding: 0.4rem 0 0.8rem; }
footer { padding: 0 0 2.5rem; color: var(--muted); }

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

@media (max-width: 52rem) {
  .filters, .fate, .growth-fields, .growth-metrics { grid-template-columns: 1fr; }
  h1 { font-size: 2rem; }
}

@media (max-width: 40rem) {
  .operands, .chapter-list, .bar-row { grid-template-columns: 1fr; }
  .wrap { width: min(74rem, calc(100% - 1.25rem)); }
  .filter-options { max-height: none; }
  .chapter-tile { min-height: 0; }
  #lifetime-result { font-size: 2.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .galaxy-sky circle.star,
  .galaxy-sky circle.glow { transition: none; }
}

.schematic-flag {
  display: inline-block;
  margin: 0.2rem 0 0.8rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid #f0b429;
  border-radius: 999px;
  color: #f0b429;
  font-size: 0.85rem;
  font-weight: 700;
}

.spectrum-scroll {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  container-type: inline-size;
}

.spectrum-board { min-width: 40rem; }

.strip-name {
  position: sticky;
  left: 0;
  width: 100cqi;
  margin: 0.65rem 0 0.2rem;
  font-weight: 750;
}

.spectrum-strip, .spectrum-axis { display: block; }

.spectrum-legend, .spectrum-lines, .tc-stars {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 0;
}

.spectrum-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
}

.spectrum-legend li, .spectrum-lines li, .tc-stars li {
  min-width: 0;
}

.swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  margin-right: 0.35rem;
  border-radius: 2px;
  vertical-align: -0.1rem;
}

.swatch.shared { background: #d7e7ff; }
.swatch.tc { background: #f0b429; }
.swatch.self { background: #c45c26; }
.swatch.other { background: #6e7c8a; }

.tc-stars li { margin: 0.85rem 0; }

.galaxy-caption {
  font-size: 1.15rem;
  font-weight: 650;
}

.explain-box {
  margin: 0.2rem 0 0.85rem;
  padding: 0.85rem 1rem;
  border: 2px solid var(--cyan);
  border-radius: 0.6rem;
  background: rgba(143, 208, 222, 0.1);
  font-size: 1.28rem;
  font-weight: 650;
  line-height: 1.35;
}

.explain-box p { margin: 0.4rem 0 0; }
.explain-box p:first-child { margin-top: 0; }

.energy-scene svg, .hear-scene svg { width: 100%; height: auto; display: block; }
.energy-stages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin: 0.35rem 0 0.2rem;
}
.energy-stages span {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.energy-stages span.is-current {
  border-color: var(--lime);
  color: var(--ink);
  font-weight: 750;
}
.energy-bar {
  position: relative;
  height: 1.4rem;
  margin: 0.6rem 0 0.8rem;
  border-radius: 999px;
  background: #10192b;
  border: 1px solid var(--line);
  overflow: hidden;
}
.energy-bar span {
  display: block;
  height: 100%;
  background: rgba(200, 242, 90, 0.7);
}
.energy-stairs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  align-items: end;
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0.6rem;
}
.energy-stairs li {
  margin: 0;
  padding: 0.55rem 0.45rem;
  border-radius: 0.5rem;
  background: #22314d;
  border: 1px solid var(--line);
}
.energy-stairs li.is-here { border-color: var(--lime); }
.energy-stairs li:nth-child(1) { min-height: 4.5rem; }
.energy-stairs li:nth-child(2) { min-height: 7rem; }
.energy-stairs li:nth-child(3) { min-height: 9.5rem; }
.swatch.dashed {
  background: transparent;
  border-top: 3px dashed #9fb0c3;
  height: 0;
  vertical-align: 0.2rem;
}
.hear-generations {
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  gap: 2px;
  margin: 0.4rem 0 0.7rem;
}
.hear-generations span {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 2px;
  background: #35506a;
}
.hear-generations span.is-passed { background: #f0b429; }

.galaxy-readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.6rem;
}

.galaxy-readout output {
  display: block;
  font-size: 1.8rem;
  font-weight: 750;
  color: var(--lime);
}

.galaxy-transport button,
.galaxy-speeds button {
  min-height: 48px;
  min-width: 6.5rem;
  font-size: 1.05rem;
  font-weight: 750;
}

.galaxy-speeds {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.galaxy-sky circle.star,
.galaxy-sky circle.glow { transition: opacity 0.45s linear; }

#colony-field { max-width: 40rem; }
.colony-sieve {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  max-width: 28rem;
  margin: 0.4rem 0 0.6rem;
}
.colony-sieve button {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  min-width: 0;
  cursor: pointer;
}
.colony-sieve { cursor: pointer; }
.colony-sieve:focus { outline: 2px solid #8fd0de; outline-offset: 3px; }
.colony-sieve span {
  pointer-events: none;
  aspect-ratio: 1;
  border-radius: 50%;
  min-width: 0;
}
.colony-sieve span.is-self { background: #ff5a1f; }
.colony-sieve span.is-other { background: #3aa0ff; }
.colony-sieve span.is-faded { background: #c86bff; }
.colony-sieve span.is-escaper {
  background: #ffd23a;
  transform: scale(1.85);
  z-index: 2;
  box-shadow: 0 0 0 3px #ffd23a;
  opacity: 1;
}
.colony-sieve span.is-quiet { opacity: 0.28; }
.colony-sieve span.is-lit { opacity: 1; }
#colony-sieve-legend .swatch.self { background: #ff5a1f; }
#colony-sieve-legend .swatch.other { background: #3aa0ff; }
#colony-sieve-legend .swatch.faded { background: #c86bff; }
#colony-sieve-legend .swatch.tc { background: #ffd23a; }
.swatch.you { background: #ffffff; border: 1px solid #14210a; }
#hear-chart { touch-action: none; cursor: grab; }
#hear-chart:focus { outline: 2px solid #8fd0de; outline-offset: 3px; }
.colony-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.4rem 0;
}
.colony-count {
  flex: 1 1 11rem;
  min-width: 0;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  padding: 0.35rem 0.6rem;
}
.colony-count output { display: block; font-weight: 750; }
.colony-count.is-current { outline: 2px solid #c8f25a; }
.swatch.faded { background: #8d6b4a; }
.colony-sky { max-width: 22rem; margin: 0.4rem auto; }
.colony-sky svg { width: 100%; height: auto; display: block; }
.colony-sky [role="button"] { cursor: pointer; }
.colony-sky [role="button"]:focus { outline: 2px solid #8fd0de; }
#colony-card input[type="number"],
#colony-card input[type="range"] { width: 100%; max-width: 100%; min-width: 0; }
#colony-card .galaxy-chart svg,
#colony-card .colony-sky svg { max-width: 100%; }

.lem-note, .ours-note {
  margin: 0.45rem 0;
  padding: 0.55rem 0.7rem;
  border-radius: 0.6rem;
}
.lem-note {
  border: 2px solid #f0b429;
  background: rgba(240, 180, 41, 0.08);
}
.ours-note {
  border: 2px dashed #9fb0c3;
  background: transparent;
}
.dice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.6rem 0;
}
.die {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 0.45rem;
  background: #e7eef6;
  color: #142033;
  font-weight: 800;
  font-size: 1.2rem;
}
.die.is-six { outline: 3px solid #f0b429; }
.ladder { display: flex; flex-direction: column; gap: 0.45rem; margin: 0.6rem 0; }
.ladder button {
  position: relative;
  width: 100%;
  min-height: 52px;
  overflow: hidden;
  text-align: left;
  background: #10192b;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.ladder button[aria-pressed="true"] { border-color: var(--lime); }
.ladder .bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(200, 242, 90, 0.55);
  pointer-events: none;
}
.ladder .label { position: relative; }
.crowd {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.28rem;
  margin: 0.4rem 0 0.8rem;
}
.crowd span {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 0.3rem;
  background: #35506a;
  box-shadow: inset 0 0 0 1px #8ea0b5;
}
.crowd span::after {
  content: "";
  position: absolute;
  left: 41%;
  top: 41%;
  width: 18%;
  height: 18%;
  border-radius: 50%;
  background: #d5e2f0;
}
.crowd span.is-winner {
  background: #f0b429;
  box-shadow: inset 0 0 0 2px #8a6410;
}
.crowd span.is-winner::after { background: #142033; }
#galaxy-legend .swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
}
#galaxy-legend .swatch.shared { background: #8fb4d4; }
#galaxy-legend .swatch.tc {
  background: #f0b429;
  box-shadow: 0 0 0.28rem 0.08rem rgba(240, 180, 41, 0.45);
}

.galaxy-sky, .galaxy-chart { max-width: 100%; }
.galaxy-sky svg, .galaxy-chart svg { width: 100%; height: auto; display: block; }

.galaxy-control { margin-top: 0.8rem; }
#galaxy-life {
  width: 100%;
  min-height: 44px;
  accent-color: #f0b429;
}

.galaxy-pins {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.galaxy-pins button { min-height: 44px; }

.galaxy-modern {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
}
.tc-stars a { font-weight: 750; }
.tc-stars .note { display: block; margin-top: 0.2rem; }
