:root {
  --ink: #eaf5f0;
  --muted: #9db2aa;
  --deep: #071814;
  --deep-two: #0b2820;
  --panel: rgba(13, 44, 35, .78);
  --line: rgba(175, 221, 203, .17);
  --green: #6ee7b7;
  --gold: #f6c773;
  --blue: #74c7dc;
  --red: #f09a84;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 3%, rgba(28, 112, 83, .28), transparent 34rem),
    radial-gradient(circle at 90% 16%, rgba(52, 105, 123, .22), transparent 30rem),
    var(--deep);
  font-family: Arial, Helvetica, sans-serif;
}
a { color: inherit; text-decoration: none; }
button, textarea, select, input { font: inherit; }

.lab-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(1240px, calc(100% - 32px));
  margin: 14px auto 0;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(7, 24, 20, .88);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 800; }
.brand b { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #082018; background: var(--green); font-family: Georgia, serif; font-size: 18px; }
.lab-nav > div { display: flex; gap: 20px; color: var(--muted); font-size: 12px; }
.lab-nav a:hover { color: white; }

main { width: min(1240px, calc(100% - 40px)); margin: 0 auto; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .55fr);
  gap: clamp(38px, 7vw, 100px);
  align-items: center;
  min-height: 690px;
  padding: 82px 0 72px;
}
.eyebrow { margin: 0 0 16px; color: var(--green); font-size: 10px; font-weight: 850; letter-spacing: .17em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h1 { max-width: 860px; margin-bottom: 26px; font-size: clamp(50px, 7.4vw, 94px); line-height: .96; letter-spacing: -.045em; }
.lead { max-width: 820px; margin-bottom: 0; color: #bfd0c8; font-size: clamp(17px, 2vw, 21px); line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero-actions a { padding: 12px 15px; border: 1px solid var(--line); border-radius: 10px; color: var(--green); background: rgba(255,255,255,.025); font-size: 12px; font-weight: 800; }
.hero-actions a:first-child { color: #0b241c; border-color: var(--green); background: var(--green); }
.verdict { padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(145deg, rgba(21, 61, 49, .84), rgba(10, 35, 28, .84)); box-shadow: 0 26px 80px rgba(0,0,0,.25); }
.verdict span { color: var(--gold); font-size: 9px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.verdict strong { display: block; margin: 14px 0 11px; font-family: Georgia, serif; font-size: 30px; font-weight: 500; line-height: 1.08; }
.verdict p { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.62; }
.verdict hr { margin: 25px 0; border: 0; border-top: 1px solid var(--line); }

.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 105px; padding: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); list-style: none; }
.pipeline li { min-height: 230px; padding: 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pipeline span { color: var(--gold); font-size: 10px; font-weight: 850; }
.pipeline h2 { margin: 72px 0 10px; font-size: 28px; }
.pipeline p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.58; }

.experiment, .wave-section, .depth-section, .manifest-section, .scan-section, .boundary-section { padding: 100px 0; border-top: 1px solid var(--line); }
.section-heading { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: clamp(34px, 7vw, 86px); align-items: end; margin-bottom: 44px; }
.section-heading h2, .boundary-section > div h2 { margin-bottom: 0; font-size: clamp(39px, 5.4vw, 68px); line-height: 1; letter-spacing: -.035em; }
.section-heading > p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.72; }
.section-heading code { color: var(--gold); }
.compact-heading { margin-bottom: 28px; }

.workbench { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .5fr); gap: 12px; }
.controls, .input-readout { min-width: 0; padding: clamp(20px, 4vw, 34px); border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.controls > label:first-child { display: flex; justify-content: space-between; gap: 20px; color: var(--ink); font-size: 13px; font-weight: 800; }
.controls label small { color: var(--muted); font-size: 10px; font-weight: 500; }
textarea { width: 100%; margin-top: 12px; padding: 17px; resize: vertical; border: 1px solid var(--line); border-radius: 12px; outline: 0; color: #eafff6; background: #061510; font-family: "Courier New", monospace; font-size: 13px; line-height: 1.55; }
textarea:focus, select:focus, input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(110,231,183,.1); }
.example-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 22px; }
.example-row button, .button-row button { border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: rgba(255,255,255,.035); cursor: pointer; }
.example-row button { padding: 7px 10px; font-size: 10px; }
.control-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.control-grid label { display: grid; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
select { width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--ink); background: #0b211a; text-transform: none; }
.button-row { display: flex; gap: 9px; margin-top: 22px; }
.button-row button { min-height: 46px; padding: 10px 15px; font-size: 11px; font-weight: 800; }
.button-row .run { flex: 1; color: #092219; border-color: var(--green); background: var(--green); }
.button-row button:disabled { opacity: .45; cursor: not-allowed; }
.run-status { margin: 14px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.run-status[data-state="error"] { color: var(--red); }
.run-status[data-state="working"] { color: var(--gold); }
.run-status[data-state="ready"] { color: var(--green); }
.input-readout > span { color: var(--gold); font-size: 9px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.input-readout > strong { display: block; margin-top: 30px; font-family: Georgia, serif; font-size: 72px; font-weight: 500; line-height: .8; }
.input-readout > small { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.input-readout dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 30px 0 22px; background: var(--line); }
.input-readout dl div { padding: 10px; background: #0a2019; }
.input-readout dt { color: var(--muted); font-size: 9px; }
.input-readout dd { margin: 7px 0 0; font-size: 15px; font-weight: 800; }
.input-readout p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.58; }
.input-readout code { color: var(--green); overflow-wrap: anywhere; }

.canvas-shell { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: radial-gradient(circle at 48% 42%, #153d35 0%, #0a231d 48%, #06140f 100%); }
canvas { display: block; width: 100%; height: 500px; }
.waveform-shell canvas { height: 300px; }
.base-legend { display: flex; flex-wrap: wrap; gap: 13px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.base-legend span:before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: currentColor; }
[data-base="A"] { color: #6ee7b7 !important; } [data-base="C"] { color: #74c7dc !important; } [data-base="G"] { color: #f6c773 !important; } [data-base="T"] { color: #f09a84 !important; } [data-base="N"] { color: #788b84 !important; }
.encoding-note { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.engine-shape { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; margin-bottom: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--line); }
.engine-shape div { min-width: 0; padding: 16px; background: var(--panel); }
.engine-shape span { display: block; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.engine-shape strong { display: block; margin-top: 10px; color: var(--ink); font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
.depth-shell canvas { height: 330px; }
.level-legend { display: flex; flex-wrap: wrap; gap: 17px; padding: 13px 3px 0; color: var(--muted); font-size: 10px; }
.level-legend span::before { content: ""; display: inline-block; width: 20px; height: 2px; margin: 0 7px 3px 0; background: var(--level-color); }

.view-controls { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin: -8px 0 18px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.view-controls label { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 10px; }
.view-controls input { width: 130px; accent-color: var(--green); }
.view-controls span { margin-left: auto; color: var(--gold); font-family: "Courier New", monospace; font-size: 10px; }
.torus-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.torus-grid > article { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.torus-grid header { display: flex; justify-content: space-between; gap: 20px; align-items: end; padding: 8px 5px 15px; }
.torus-grid header span { color: var(--gold); font-size: 9px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.torus-grid h3 { margin: 6px 0 0; font-size: 27px; }
.torus-grid header small { max-width: 42%; overflow-wrap: anywhere; color: var(--muted); font-family: "Courier New", monospace; font-size: 9px; text-align: right; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-top: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--line); }
.metric-grid div { min-width: 0; padding: 11px; background: #0a211a; }
.metric-grid span { display: block; color: var(--muted); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.metric-grid strong { display: block; margin-top: 7px; color: var(--ink); font-size: 15px; }
.observation-return { display: grid; grid-template-columns: .34fr 1.66fr; gap: 30px; margin-top: 12px; padding: 25px; border: 1px solid rgba(110,231,183,.35); border-radius: 16px; background: rgba(110,231,183,.07); }
.observation-return span { color: var(--green); font-size: 9px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.observation-return p { margin: 0; color: #ccddd6; font-family: Georgia, serif; font-size: 20px; line-height: 1.5; }

.table-shell { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
.table-shell:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(110,231,183,.1); outline: 0; }
table { width: 100%; min-width: 780px; border-collapse: collapse; background: var(--panel); }
th, td { padding: 16px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--gold); font-size: 8px; letter-spacing: .12em; text-transform: uppercase; }
td { color: #cadbd4; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { color: white; font-weight: 800; }
.no-optimum { margin: 14px 0 0; padding: 17px; border-left: 3px solid var(--gold); color: var(--muted); background: rgba(246,199,115,.06); font-size: 12px; line-height: 1.6; }
.no-optimum b { color: var(--gold); }
.scan-actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.scan-actions button { flex: 0 0 auto; min-height: 43px; padding: 9px 14px; border: 1px solid var(--green); border-radius: 9px; color: #092219; background: var(--green); font-size: 10px; font-weight: 850; cursor: pointer; }
.scan-actions button:disabled { opacity: .45; cursor: not-allowed; }
.scan-actions span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.scan-actions span[data-state="working"] { color: var(--gold); }
.scan-actions span[data-state="ready"] { color: var(--green); }
.scan-actions span[data-state="error"] { color: var(--red); }

.boundary-section { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: clamp(40px, 8vw, 100px); }
.boundary-section > div { position: sticky; top: 100px; align-self: start; }
.boundary-section ol { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.boundary-section li { padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.boundary-section li span { color: var(--gold); font-size: 9px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.boundary-section li h3 { margin: 29px 0 9px; font-size: 28px; }
.boundary-section li p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.62; }

footer { display: grid; grid-template-columns: 1.2fr .8fr; gap: 40px; margin-top: 30px; padding: 42px 0 70px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.65; }
footer p { margin: 0; }
footer strong, footer a { color: var(--green); }
footer nav { display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 900px) {
  .hero, .section-heading, .workbench, .boundary-section, footer { grid-template-columns: 1fr; }
  .hero { min-height: auto; padding: 78px 0; }
  .verdict { max-width: 620px; }
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .torus-grid { grid-template-columns: 1fr; }
  .boundary-section > div { position: static; }
}

@media (max-width: 620px) {
  .lab-nav { align-items: flex-start; flex-wrap: wrap; width: calc(100% - 20px); margin-top: 10px; }
  .lab-nav > div { width: 100%; margin-top: 9px; padding-top: 9px; overflow-x: auto; border-top: 1px solid var(--line); white-space: nowrap; }
  main { width: calc(100% - 24px); }
  h1 { font-size: clamp(45px, 14vw, 66px); }
  .lead { font-size: 16px; }
  .pipeline { grid-template-columns: 1fr; margin-bottom: 70px; }
  .pipeline li { min-height: 170px; }
  .pipeline h2 { margin-top: 45px; }
  .experiment, .wave-section, .depth-section, .manifest-section, .scan-section, .boundary-section { padding: 72px 0; }
  .section-heading h2, .boundary-section > div h2 { font-size: 42px; }
  .control-grid { grid-template-columns: 1fr; }
  .controls > label:first-child { flex-direction: column; gap: 6px; }
  .button-row { flex-direction: column; }
  .input-readout > strong { font-size: 58px; }
  canvas { height: 390px; }
  .waveform-shell canvas { height: 250px; }
  .view-controls { align-items: stretch; }
  .view-controls label { justify-content: space-between; width: 100%; }
  .view-controls input { flex: 1; width: auto; }
  .view-controls span { width: 100%; margin-left: 0; overflow-wrap: anywhere; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .engine-shape { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .engine-shape div:last-child { grid-column: 1 / -1; }
  .depth-shell canvas { height: 290px; }
  .observation-return { grid-template-columns: 1fr; gap: 12px; }
  .observation-return p { font-size: 18px; }
  .scan-actions { align-items: stretch; flex-direction: column; }
}

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