:root {
  --ink: #17312f;
  --teal: #143c3b;
  --teal-2: #285a57;
  --paper: #f4f1e8;
  --card: #fffdf7;
  --lime: #d9f36a;
  --blue: #4f88a3;
  --orange: #d87858;
  --green: #4f8a70;
  --muted: #6f7770;
  --line: #d8d9ce;
  --shadow: 0 16px 45px rgba(23, 49, 47, .08);
  --sans: Inter, Avenir, "Segoe UI", system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.55; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }

.topbar {
  height: 74px;
  padding: 0 max(4vw, 28px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--teal);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, .18);
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.36); border-radius: 50%; display: grid; place-items: center; color: var(--lime); font: 12px var(--mono); }
.brand b, .brand small { display: block; }
.brand b { font-size: 15px; text-transform: uppercase; letter-spacing: .02em; }
.brand small { font-size: 11px; color: rgba(255,255,255,.64); }
.topbar nav { display: flex; align-self: stretch; gap: 6px; }
.topbar nav a { display: grid; place-items: center; padding: 0 18px; font-weight: 700; color: rgba(255,255,255,.68); border-bottom: 3px solid transparent; }
.topbar nav a:first-child, .topbar nav a:hover { color: white; border-bottom-color: var(--lime); }

.hero {
  min-height: 226px;
  padding: 46px max(4vw, 28px) 40px;
  background: var(--teal);
  color: white;
  display: block;
}
.hero-copy { max-width: 1120px; margin: auto; }
.hero .eyebrow { color: var(--lime); }
.eyebrow, .chart-kicker {
  margin: 0 0 9px;
  color: #58716d;
  font: 11px var(--mono);
  letter-spacing: .13em;
  text-transform: uppercase;
}
.hero h1 { margin: 0 0 12px; max-width: 900px; font-size: clamp(38px, 5vw, 62px); line-height: 1.06; letter-spacing: -.045em; font-weight: 500; }
.lede { margin: 0; max-width: 830px; color: rgba(255,255,255,.72); font-size: 17px; }
.hero-orbit, .primary-link { display: none; }

.lab { max-width: 1190px; margin: auto; padding: 34px 28px 90px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 36px; margin: 0 0 26px; }
.section-heading h2, .model h2, .reading h2 { margin: 0; font-size: clamp(30px, 4vw, 46px); line-height: 1.05; letter-spacing: -.035em; }
.section-heading > p { max-width: 540px; margin: 0; color: var(--muted); }
.lab-grid { display: grid; gap: 26px; }

.controls, .chart-card, .replicate-card, .metric {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.controls { padding: 26px 28px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 34px; }
.group-title { grid-column: 1 / -1; margin: 20px 0 0; padding: 17px 0 7px; border-top: 1px solid var(--line); color: var(--teal); font: 700 11px var(--mono); letter-spacing: .11em; text-transform: uppercase; }
.group-title:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.control-group { padding: 18px 0; border-top: 1px solid var(--line); }
.control-group label { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: #4d5955; font-size: 13px; }
.control-group output { padding: 2px 7px; border-radius: 4px; background: #edf2e7; color: var(--ink); font: 12px var(--mono); }
.info { width: 18px; height: 18px; padding: 0; border: 1px solid #aeb7ad; border-radius: 50%; background: transparent; color: var(--muted); font: 10px var(--mono); cursor: help; }
input[type="range"] { width: 100%; height: 4px; margin: 17px 0 3px; appearance: none; background: #d7dad4; border-radius: 999px; }
input[type="range"]::-webkit-slider-thumb { width: 16px; height: 16px; appearance: none; border: 0; border-radius: 50%; background: var(--teal-2); cursor: pointer; }
select, input[type="number"] { width: 100%; padding: 10px 11px; background: white; color: var(--ink); border: 1px solid var(--line); border-radius: 7px; outline: none; }
select:focus, input:focus { outline: 2px solid var(--lime); outline-offset: 2px; }
.compact-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.compact-row label, .advanced label { display: block; }
.compact-row span, .advanced span { display: block; margin-bottom: 7px; }
.controls details { grid-column: 1 / -1; padding: 18px 0; border-top: 1px solid var(--line); }
.controls summary { color: var(--ink); font: 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; cursor: pointer; }
.advanced { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 16px; }
.paper-defaults { grid-column: 1 / -1; margin: 0 0 18px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: #f6f7f2; color: var(--muted); font: 10px/1.5 var(--mono); text-align: center; }
.run-actions { grid-column: 1 / -1; display: flex; gap: 9px; }
.run-button { flex: 1; padding: 14px; border: 0; border-radius: 9px; background: var(--teal); color: white; font-weight: 700; cursor: pointer; }
.run-button:hover { background: var(--teal-2); }
.run-dot { display: inline-block; width: 0; height: 0; margin-right: 9px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 8px solid white; }
.icon-button { width: 50px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); cursor: pointer; }
.progress-wrap { grid-column: 1 / -1; margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--muted); font: 11px var(--mono); }
.progress { height: 4px; background: #e2e3dd; border-radius: 999px; overflow: hidden; }
.progress i { display: block; width: 0; height: 100%; background: var(--lime); transition: width .2s; }

.results { display: grid; gap: 20px; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.metric { min-height: 118px; padding: 19px 21px; box-shadow: none; }
.metric.accent { background: var(--teal); color: white; border-color: var(--teal); }
.metric span, .metric small { display: block; }
.metric span { font: 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.metric strong { display: block; margin: 12px 0 8px; font-size: 38px; line-height: 1; }
.metric small { color: var(--muted); font-size: 11px; }
.metric.accent small { color: rgba(255,255,255,.68); }
.chart-card { padding: 18px; }
.chart-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.chart-heading h3, .replicate-card h3 { margin: 2px 0 0; font-size: 20px; letter-spacing: -.02em; }
.legend { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 14px; color: var(--muted); font-size: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.sexual-dot, .locus-one { background: var(--blue); }
.asexual-dot, .locus-two { background: var(--orange); }
.parasite-dot { background: var(--green); }
.locus-three { background: #b49a3b; }
.chart-card canvas { display: block; width: 100%; height: auto; }
.chart-note { display: flex; justify-content: space-between; gap: 20px; padding-top: 9px; border-top: 1px solid #ecece5; color: #858b84; font: 9px var(--mono); }
.small-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.replicate-card { display: grid; grid-template-columns: 1fr 1.8fr auto; align-items: center; gap: 20px; padding: 20px; }
.replicate-list { display: flex; flex-wrap: wrap; gap: 7px; }
.replicate-pill { padding: 7px 9px; border: 1px solid var(--line); border-radius: 999px; background: white; font: 9px var(--mono); }
.replicate-pill b { color: var(--teal-2); }
.empty-state { margin: 0; color: var(--muted); font-size: 11px; }
.download-button { padding: 11px 13px; border: 1px solid var(--teal); border-radius: 8px; background: white; color: var(--ink); font: 10px var(--mono); cursor: pointer; }
.download-button:disabled { opacity: .35; cursor: not-allowed; }

.model { padding: 80px max(4vw, 28px); background: #e5eadf; }
.model > * { max-width: 1134px; margin-left: auto; margin-right: auto; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 38px; border-top: 1px solid #bdc8b9; }
.steps article { min-height: 190px; padding: 23px 22px 6px 0; border-right: 1px solid #bdc8b9; }
.steps article + article { padding-left: 22px; }
.steps article:last-child { border-right: 0; }
.steps b { color: var(--teal-2); font: 10px var(--mono); }
.steps h3 { margin: 27px 0 10px; font-size: 19px; }
.steps p { color: #53615c; font-size: 13px; }
.equation-band { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 20px; margin-top: 42px; padding: 24px 28px; border-radius: 14px; background: var(--teal); color: white; }
.equation-band span { display: block; margin-bottom: 5px; color: rgba(255,255,255,.56); font: 9px var(--mono); text-transform: uppercase; }
.equation-band strong { font-size: 15px; }
.equation-band .arrow { color: var(--lime); font-size: 22px; }

.reading { max-width: 1180px; margin: auto; padding: 84px 28px; display: grid; grid-template-columns: .85fr 1.15fr; gap: 80px; }
.reading-copy { align-self: start; position: sticky; top: 30px; }
.reading-body { color: var(--muted); font-size: 14px; line-height: 1.75; }
.reading-body > p { margin: 0 0 19px; }
.concept-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 30px 0; }
.concept-grid article { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.concept-grid h3, .reading-title { margin: 0 0 8px; color: var(--ink); font-size: 17px; }
.concept-grid p { margin: 0; }
.reading-citation { padding: 16px 18px; border-left: 3px solid var(--lime); background: #f5f6f0; font: 11px/1.65 var(--mono); }
.reading-title { margin-top: 38px; padding-top: 25px; border-top: 1px solid var(--line); }
.parameter-list { margin: 16px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.parameter-list div { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.parameter-list dt { color: var(--teal); font: 700 11px var(--mono); }
.parameter-list dd { margin: 0; font-size: 12px; line-height: 1.5; }
.method-note { max-width: 1134px; margin: 0 auto 80px; padding: 30px 0 0; display: grid; grid-template-columns: 210px 1fr; gap: 28px; border-top: 1px solid var(--line); }
.method-note h2 { font-size: 18px; }
.method-note p { max-width: 850px; color: var(--muted); font-size: 12px; }
.method-note .citation { grid-column: 2; font: 10px var(--mono); }
footer { padding: 25px max(4vw, 28px); display: flex; justify-content: space-between; background: var(--teal); color: rgba(255,255,255,.6); font: 10px var(--mono); }
footer a { color: var(--lime); }
.tooltip { position: fixed; z-index: 20; display: none; max-width: 230px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); box-shadow: var(--shadow); font-size: 11px; pointer-events: none; }

@media (max-width: 900px) {
  .section-heading { align-items: start; flex-direction: column; gap: 14px; }
  .controls { grid-template-columns: 1fr; }
  .control-group, .controls details, .paper-defaults, .run-actions, .progress-wrap, .group-title { grid-column: 1; }
  .small-charts { grid-template-columns: 1fr; }
  .replicate-card { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .steps article:nth-child(2) { border-right: 0; }
  .reading { grid-template-columns: 1fr; gap: 35px; }
  .reading-copy { position: static; }
  .method-note { margin-left: 28px; margin-right: 28px; grid-template-columns: 1fr; }
  .method-note .citation { grid-column: 1; }
}

@media (max-width: 620px) {
  .topbar nav { display: none; }
  .hero { padding: 38px 22px 34px; }
  .hero h1 { font-size: 39px; }
  .lab { padding: 24px 14px 65px; }
  .controls { padding: 20px 17px; }
  .compact-row, .advanced, .metric-grid { grid-template-columns: 1fr; }
  .chart-heading { align-items: start; flex-direction: column; }
  .legend { justify-content: flex-start; }
  .chart-note { display: grid; gap: 5px; }
  .model { padding: 65px 22px; }
  .steps { grid-template-columns: 1fr; }
  .steps article, .steps article + article { min-height: auto; padding: 20px 0; border-right: 0; border-bottom: 1px solid #bdc8b9; }
  .steps h3 { margin: 12px 0 7px; }
  .equation-band { grid-template-columns: 1fr; }
  .equation-band .arrow { justify-self: center; transform: rotate(90deg); }
  .reading { padding: 65px 22px; }
  .concept-grid, .parameter-list { grid-template-columns: 1fr; }
  .method-note { margin: 0 22px 65px; }
  footer { flex-direction: column; gap: 15px; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
