:root {
  --ink: #050807;
  --surface: #0b100e;
  --surface-2: #111815;
  --paper: #e8e9e4;
  --paper-2: #b9bfb8;
  --muted: #8b938b;
  --neutral: #7d877f;
  --line: rgba(232, 233, 228, 0.13);
  --line-strong: rgba(232, 233, 228, 0.24);
  --acid: #c9ff45;
  --acid-wash: rgba(201, 255, 69, 0.1);
  --warn: #ff9a6b;
  --pad: clamp(16px, 4.3vw, 72px);
  --radius: 14px;
  --mono: 'DM Mono', ui-monospace, monospace;
  --display: Syne, 'Manrope', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--ink); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--paper);
  font: 400 16px/1.6 Manrope, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, a, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
b { font-weight: 600; color: var(--paper); }
:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 50;
  padding: 10px 16px; border-radius: 999px; background: var(--acid); color: var(--ink);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 16px; }

.grain {
  position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#hero-canvas { position: absolute; inset: 0 0 auto 0; width: 100%; height: 100vh; opacity: 0.55; pointer-events: none; }

.overline {
  display: flex; align-items: center; gap: 12px; margin: 0 0 28px;
  font: 500 11px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.overline span { color: var(--acid); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: -0.03em; }
h1 em, h2 em { font-style: normal; color: var(--acid); }

/* ------------------------------------------------------------------ header */
.site-header {
  position: absolute; z-index: 10; top: 0; left: 0; width: 100%; height: 88px; padding: 0 var(--pad);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 11px; width: max-content; text-decoration: none;
  font: 700 17px var(--display); letter-spacing: 0.14em;
}
.brand svg { width: 29px; fill: none; stroke: var(--acid); stroke-width: 1.4; }
.brand svg circle { fill: var(--acid); stroke: none; }
.site-header nav { display: flex; gap: 34px; }
.site-header nav a {
  text-decoration: none; text-transform: uppercase; font: 500 11px var(--mono); letter-spacing: 0.14em; color: var(--paper-2);
}
.site-header nav a:hover { color: var(--acid); }
.system-status {
  justify-self: end; display: inline-flex; align-items: center; gap: 10px;
  font: 400 11px var(--mono); letter-spacing: 0.08em; color: var(--muted);
}
.system-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 12px var(--acid); }
body.paused .system-status i { background: var(--muted); box-shadow: none; }

/* -------------------------------------------------------------------- hero */
.hero {
  position: relative; min-height: 100vh; padding: 150px var(--pad) 110px;
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr); align-items: end; gap: 48px;
}
.hero h1 { font-size: clamp(56px, 10.5vw, 168px); line-height: 0.88; letter-spacing: -0.055em; }
.lede { max-width: 620px; margin: 36px 0 0; font-size: clamp(17px, 1.5vw, 20px); color: var(--paper-2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 38px; }
.magnetic-button {
  display: inline-flex; align-items: center; gap: 22px; padding: 16px 18px 16px 26px; border-radius: 999px;
  background: var(--acid); color: var(--ink); text-decoration: none; font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.magnetic-button:hover { transform: translateY(-2px); box-shadow: 0 10px 40px rgba(201, 255, 69, 0.25); }
.magnetic-button i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--acid); font-style: normal; }
.sound-button {
  display: inline-flex; align-items: center; gap: 12px; padding: 14px 22px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--paper);
}
.sound-button:hover { border-color: var(--acid); }
.sound-bars { display: inline-flex; align-items: end; gap: 2px; height: 14px; }
.sound-bars i { width: 2px; height: 100%; background: var(--acid); animation: bars 1s ease-in-out infinite; }
.sound-bars i:nth-child(2) { animation-delay: -0.3s; }
.sound-bars i:nth-child(3) { animation-delay: -0.6s; }
.sound-bars i:nth-child(4) { animation-delay: -0.15s; }
body.paused .sound-bars i { animation: none; height: 30%; }
@keyframes bars { 50% { height: 25%; } }
@media (prefers-reduced-motion: reduce) { .sound-bars i { animation: none; height: 40%; } }

.hero-readout {
  justify-self: end; display: grid; gap: 6px; min-width: min(100%, 300px); padding: 24px 26px;
  border: 1px solid var(--line); border-radius: var(--radius); background: rgba(11, 16, 14, 0.72); backdrop-filter: blur(6px);
}
.readout-label { font: 500 11px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.hero-readout strong { font: 600 clamp(48px, 6vw, 76px)/1 Manrope, sans-serif; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.readout-verdict { font-size: 14px; color: var(--paper-2); }

.scroll-cue {
  position: absolute; left: var(--pad); bottom: 36px; display: flex; align-items: center; gap: 14px;
  font: 400 10px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.scroll-cue i { width: 60px; height: 1px; background: var(--line-strong); }

/* ------------------------------------------------------------- sections */
.lab-section, .evidence, .method, .closing { padding: 120px var(--pad); border-top: 1px solid var(--line); }
.section-heading {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr); gap: 48px; align-items: end; margin-bottom: 56px;
}
.section-heading h2 { font-size: clamp(40px, 6vw, 92px); line-height: 0.95; }
.section-heading > p { margin: 0; max-width: 560px; color: var(--paper-2); }

/* -------------------------------------------------------------------- lab */
.lab-shell {
  display: grid; gap: 16px;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  grid-template-areas:
    'controls stage verdict'
    'graph spectrum depth';
}
.lab-controls { grid-area: controls; }
.lab-stage { grid-area: stage; }
.lab-verdict { grid-area: verdict; }
.lab-graph { grid-area: graph; }
.lab-spectrum { grid-area: spectrum; }
.lab-depth { grid-area: depth; }

.lab-controls, .lab-stage, .lab-verdict, .lab-panel {
  margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.lab-controls { display: grid; gap: 22px; align-content: start; padding: 22px; }
.control label { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 15px; }
.control output { font: 400 13px var(--mono); color: var(--acid); }
.control small { display: block; margin-top: 6px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
input[type='range'] { width: 100%; margin: 12px 0 0; accent-color: var(--acid); height: 24px; background: transparent; }
.control-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ghost-button {
  flex: 1 1 auto; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--paper); font-size: 14px;
}
.ghost-button:hover { border-color: var(--acid); color: var(--acid); }

.lab-stage { display: flex; flex-direction: column; overflow: hidden; }
.stage-toolbar {
  display: flex; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line);
  font: 400 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.stage-toolbar div { display: flex; align-items: center; gap: 10px; }
.stage-toolbar p { margin: 0; font-variant-numeric: tabular-nums; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--acid); }
body.paused .live-dot { background: var(--muted); }
#trace-canvas { display: block; width: 100%; flex: 1 1 auto; min-height: 300px; }
.stage-progress { height: 2px; background: var(--line); }
.stage-progress b { display: block; height: 100%; width: 0; background: var(--acid); }

.lab-verdict { display: grid; gap: 14px; align-content: start; padding: 22px; }
.verdict-row { display: grid; gap: 2px; }
.verdict-row > span { font: 500 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.verdict-row strong { display: grid; gap: 4px; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.verdict-row small, .edge-line small { display: block; font: 400 12.5px var(--mono); color: var(--paper-2); }
.edge-line { display: block; }
.verdict-status {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 14px; border-radius: 10px;
  background: var(--surface-2); font-weight: 600; font-size: 15px;
}
.verdict-status i { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font: 700 12px var(--mono); font-style: normal; color: var(--ink); background: var(--neutral); }
.verdict-status[data-state='good'] i { background: var(--acid); }
.verdict-status[data-state='good'] i::before { content: '✓'; }
.verdict-status[data-state='bad'] i { background: var(--warn); }
.verdict-status[data-state='bad'] i::before { content: '!'; }
.verdict-status[data-state='partial'] i::before { content: '~'; }
.verdict-status[data-state='idle'] i::before { content: '…'; }
.tally { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.tally div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; }
.tally dt { font: 400 10px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.tally dd { margin: 0; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.verdict-note { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--paper-2); }

.lab-panel { padding: 18px 20px 20px; }
.lab-panel figcaption {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px;
  font-weight: 600; font-size: 15px;
}
.lab-panel figcaption span { font: 400 11px var(--mono); color: var(--muted); text-align: right; }
#edge-graph { display: block; width: 100%; height: auto; }
#spectrum-canvas { display: block; width: 100%; height: 220px; }
.depth-hero { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.depth-hero strong { font-size: 48px; font-weight: 600; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.depth-hero span { font: 400 12px var(--mono); color: var(--muted); }
.depth-meters { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.depth-meters li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13px; color: var(--paper-2); }
.depth-meters li b { font: 400 12.5px var(--mono); color: var(--paper); font-variant-numeric: tabular-nums; }
.depth-meters .meter { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: rgba(201, 255, 69, 0.12); overflow: hidden; }
.depth-meters .meter i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--acid); transition: width 0.4s ease; }
@media (prefers-reduced-motion: reduce) { .depth-meters .meter i { transition: none; } }
.depth-others { margin: 14px 0 0; font: 400 12.5px var(--mono); color: var(--muted); }

/* --------------------------------------------------------------- evidence */
.evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.evidence-card {
  position: relative; margin: 0; min-width: 0; padding: 26px 26px 20px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface);
}
.evidence-card.wide { grid-column: 1 / -1; }
.evidence-card figcaption h3, .evidence-card h3 { font-size: clamp(22px, 2.2vw, 30px); line-height: 1.1; }
.evidence-card figcaption p { margin: 8px 0 0; max-width: 720px; font-size: 14.5px; color: var(--paper-2); }
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin: 18px 0 4px; font-size: 13px; color: var(--paper-2); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.swatch.accent { background: var(--acid); }
.swatch.neutral { background: var(--neutral); }
.swatch.paper { background: var(--paper); }
.chart { display: block; width: 100%; height: auto; margin-top: 8px; overflow: visible; }
.chart text { font: 400 11.5px var(--mono); fill: var(--muted); }
.chart .value { fill: var(--paper); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ref { stroke: var(--paper-2); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .hit:hover + .mark, .chart .mark:hover { opacity: 0.85; }
details { margin-top: 14px; font-size: 13.5px; color: var(--paper-2); }
summary { cursor: pointer; color: var(--muted); font: 400 12px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
summary:hover { color: var(--acid); }
details table { width: 100%; margin-top: 12px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
details th, details td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
details th:first-child, details td:first-child { text-align: left; }
details th { font-weight: 600; color: var(--paper); }
.chart-tooltip {
  position: fixed; z-index: 40; pointer-events: none; max-width: 260px; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #141b18; color: var(--paper); font-size: 13px; line-height: 1.45;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.chart-tooltip b { display: block; font-weight: 600; }

.verdict-card { display: grid; gap: 16px; align-content: start; }
.verdict-card.wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 40px; }
.verdict-card.wide > .stat-pair { grid-column: 2; grid-row: 1 / span 4; align-self: center; }
@media (max-width: 900px) {
  .verdict-card.wide { grid-template-columns: 1fr; }
  .verdict-card.wide > .stat-pair { grid-column: 1; grid-row: auto; }
}
.claim-chip {
  display: inline-flex; align-items: center; gap: 8px; width: max-content; margin: 0; padding: 6px 12px 6px 8px;
  border-radius: 999px; border: 1px solid rgba(255, 154, 107, 0.45); color: var(--paper);
  font: 500 12px var(--mono); letter-spacing: 0.1em; text-transform: uppercase;
}
.claim-chip i { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--warn); color: var(--ink); font-style: normal; font-size: 11px; }
.stat-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat-pair div { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; }
.stat-pair strong { font-size: clamp(34px, 3.4vw, 48px); font-weight: 600; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-pair span { font-size: 13px; color: var(--muted); }
.verdict-card p:not(.claim-chip) { margin: 0; color: var(--paper-2); font-size: 14.5px; }
.verdict-card a { color: var(--acid); text-decoration: none; font-weight: 600; }
.verdict-card a:hover { text-decoration: underline; }

/* ----------------------------------------------------------------- method */
.method { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); gap: 56px; }
.method-intro h2 { font-size: clamp(40px, 5.2vw, 80px); line-height: 0.98; }
.method-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.method-list li { display: grid; grid-template-columns: 56px minmax(0, 1fr) 40px; gap: 18px; padding: 30px 0; border-bottom: 1px solid var(--line); }
.method-list li > span { font: 400 12px var(--mono); color: var(--acid); padding-top: 8px; }
.method-list h3 { font-size: 30px; }
.method-list p { margin: 8px 0 0; color: var(--paper-2); }
.method-list b { font-size: 26px; color: var(--acid); font-weight: 400; text-align: right; }
.method-boundary { grid-column: 2; margin: 0; padding: 18px 20px; border-left: 2px solid var(--acid); background: var(--surface); color: var(--paper-2); font-size: 14.5px; }

/* ---------------------------------------------------------------- closing */
.closing { text-align: center; }
.closing > p { margin: 0 0 18px; font: 500 11px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.closing h2 { font-size: clamp(44px, 7vw, 110px); line-height: 0.95; }
.install {
  display: block; width: fit-content; max-width: 100%; margin: 48px auto 36px; padding: 22px 28px; overflow-x: auto;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  text-align: left; font: 400 14px/1.9 var(--mono); color: var(--paper);
}
.install span { color: var(--acid); user-select: none; }
.closing > a {
  display: inline-flex; gap: 10px; padding: 15px 26px; border-radius: 999px; border: 1px solid var(--line-strong);
  text-decoration: none; font-weight: 600;
}
.closing > a:hover { border-color: var(--acid); color: var(--acid); }

footer {
  display: grid; grid-template-columns: 1fr auto auto; gap: 56px; align-items: start; padding: 40px var(--pad);
  border-top: 1px solid var(--line); font-size: 14px;
}
footer p { margin: 0; }
footer p span { color: var(--muted); }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .lab-shell {
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-areas: 'controls stage' 'verdict stage' 'graph spectrum' 'depth depth';
  }
}
@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr auto; }
  .site-header nav { display: none; }
  .hero { grid-template-columns: 1fr; align-items: start; padding-top: 130px; }
  .hero-readout { justify-self: start; }
  .section-heading, .method { grid-template-columns: 1fr; gap: 24px; }
  .method-boundary { grid-column: 1; }
  .evidence-grid { grid-template-columns: 1fr; }
  .lab-shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'stage' 'controls' 'verdict' 'graph' 'spectrum' 'depth'; }
  #trace-canvas { min-height: 240px; }
  footer { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 520px) {
  .lab-section, .evidence, .method, .closing { padding-top: 80px; padding-bottom: 80px; }
  .system-status span { display: none; }
  .tally dd { font-size: 17px; }
  .stat-pair { grid-template-columns: 1fr; }
  .method-list li { grid-template-columns: 36px minmax(0, 1fr); }
  .method-list b { display: none; }
  .evidence-card { padding: 20px 16px 16px; }
}
