:root {
  color-scheme: dark;
  --bg: #07131b;
  --panel: rgba(12, 32, 43, 0.88);
  --panel-soft: rgba(15, 43, 55, 0.7);
  --line: rgba(142, 214, 205, 0.18);
  --text: #e8f6f3;
  --muted: #9cbab8;
  --accent: #61e1cf;
  --accent-deep: #1e9b9b;
  --orange: #ffbd76;
  --blue: #74b9ff;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.26);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  background: radial-gradient(circle at 12% 0%, #123f4b 0, transparent 42%), linear-gradient(145deg, #07131b 0%, #0b2029 55%, #071119 100%);
  color: var(--text);
}

button, input { font: inherit; }

.viz-shell { width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 46px; }
.hero { padding: 34px 10px 28px; }
.hero h1 { max-width: 900px; margin: 8px 0 12px; font-size: clamp(2rem, 4vw, 4.2rem); line-height: 1.03; letter-spacing: -0.05em; }
.subtitle { max-width: 700px; margin: 0; color: var(--muted); font-size: clamp(1rem, 1.8vw, 1.2rem); line-height: 1.65; }
.eyebrow { margin: 0; color: var(--accent); font-size: .71rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }

.card { border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(145deg, var(--panel), rgba(8, 25, 34, .83)); box-shadow: var(--shadow); }
.controls { padding: 23px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.section-heading h2 { margin: 5px 0 0; font-size: clamp(1.15rem, 2vw, 1.45rem); letter-spacing: -.025em; }
.section-heading.compact { min-height: 54px; }
.control-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.control { display: grid; gap: 10px; min-width: 0; }
.control-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--text); font-size: .94rem; font-weight: 650; }
.control-label output { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.control small { min-height: 34px; color: var(--muted); font-size: .76rem; line-height: 1.45; }
input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
.preset-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 21px; }
.preset-label { margin-right: 3px; color: var(--muted); font-size: .8rem; }
.button { border: 1px solid rgba(142, 214, 205, .3); border-radius: 999px; padding: 9px 14px; color: var(--text); background: rgba(255, 255, 255, .05); cursor: pointer; transition: .18s ease; }
.button:hover, .button:focus-visible { border-color: var(--accent); color: #052329; background: var(--accent); outline: none; transform: translateY(-1px); }
.button-ghost { color: var(--muted); }
.button-accent { border-color: transparent; color: #062328; background: var(--accent); font-weight: 800; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin: 16px 0; }
.stat { display: grid; gap: 8px; padding: 17px 18px; background: var(--panel-soft); }
.stat span { color: var(--muted); font-size: .8rem; }
.stat strong { color: var(--accent); font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.visual-grid, .education-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { min-width: 0; padding: 20px; }
canvas { display: block; width: 100%; height: auto; min-height: 280px; border: 1px solid rgba(142, 214, 205, .12); border-radius: 14px; background: #081a23; }
.status-pill { border: 1px solid rgba(97, 225, 207, .3); border-radius: 999px; padding: 5px 10px; color: var(--accent); font-size: .72rem; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; padding-top: 13px; color: var(--muted); font-size: .78rem; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.swatch { display: inline-block; width: 22px; height: 3px; border-radius: 9px; }
.swatch.curve { background: var(--accent); }
.swatch.points { width: 9px; height: 9px; border-radius: 50%; background: var(--orange); }
.swatch.marker { background: var(--blue); }
.molecular-readout { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-top: 13px; color: var(--muted); font-size: .79rem; }
.molecular-readout strong { color: var(--text); font-variant-numeric: tabular-nums; }
.education-grid { margin-top: 16px; }
.education { padding: 23px; }
.education h2 { margin: 5px 0 15px; font-size: 1.25rem; }
.education p { color: var(--muted); font-size: .9rem; line-height: 1.75; }
.equation { margin: 15px 0; padding: 15px; overflow-x: auto; border: 1px solid rgba(97, 225, 207, .2); border-radius: 12px; color: var(--accent); font-family: "SFMono-Regular", Consolas, monospace; font-size: clamp(1.05rem, 2vw, 1.45rem); text-align: center; }
.equation span { color: var(--orange); }
.equation.small { font-size: .9rem; }
.assumptions { display: grid; gap: 10px; padding-left: 23px; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.assumptions li::marker { color: var(--accent); font-weight: 800; }
.observe { margin-bottom: 0; padding: 12px 14px; border-left: 3px solid var(--orange); background: rgba(255, 189, 118, .08); }
.footer-note { padding: 22px 4px 0; color: #72918f; font-size: .76rem; text-align: center; }

@media (max-width: 980px) {
  .control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .viz-shell { width: min(100% - 20px, 640px); padding-top: 16px; }
  .hero { padding: 24px 4px 20px; }
  .controls, .panel, .education { padding: 16px; }
  .control-grid, .visual-grid, .education-grid { grid-template-columns: 1fr; }
  .stats-grid { gap: 9px; }
  .stat { padding: 13px; }
  .stat strong { font-size: 1.15rem; }
  canvas { min-height: 230px; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .molecular-readout { display: grid; grid-template-columns: 1fr 1fr; }
}
