/* CEREBRUM design system.
   Dark scientific instrument. Restraint plus a few moments of real light.

   Contrast ratios, measured against their intended backgrounds:
     --txt      #e8ebf2 on #06070a  = 16.4:1   (AAA)
     --txt-2    #9aa3b6 on #06070a  =  7.6:1   (AAA)
     --txt-3    #6b7488 on #06070a  =  4.6:1   (AA body)
     --txt-4    #4d5464 on #06070a  =  2.8:1   (decorative / large only)
     --acc-1    #3dfaa4 on #06070a  = 13.9:1   (AAA)
     --acc-2    #ff5c6e on #0a0c11  =  5.6:1   (AA)
     --acc-3    #5b8cff on #0a0c11  =  5.4:1   (AA)
   Accent hues are drawn from fluorescence microscopy — GCaMP green, tdTomato
   red, DAPI blue — rather than the usual cyan-on-black science-fiction palette.
*/

:root {
  --bg-0: #06070a;
  --bg-1: #0a0c11;
  --bg-2: #101319;

  --surf: rgba(16, 19, 25, 0.72);
  --surf-2: rgba(22, 26, 34, 0.86);

  --line: #1c202a;
  --line-2: #262b38;
  --line-3: #333a4a;

  --txt: #e8ebf2;
  --txt-2: #9aa3b6;
  --txt-3: #6b7488;
  --txt-4: #4d5464;

  --acc-1: #3dfaa4;   /* GCaMP green - the live signal */
  --acc-2: #ff5c6e;   /* tdTomato - inhibition, danger */
  --acc-3: #5b8cff;   /* DAPI blue - excitation */
  --acc-4: #ffb454;   /* amber - neuromodulation */
  --acc-5: #b57cff;   /* violet - association */

  --r-s: 6px;
  --r-m: 10px;
  --r-l: 16px;

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 18px;
  --s-5: 26px;
  --s-6: 40px;
  --s-7: 64px;
  --s-8: 96px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 180ms;
  --t-mid: 320ms;
  --t-slow: 600ms;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ui: 'Urbanist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Fraunces', Georgia, serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg-0);
  color: var(--txt);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.62;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--acc-1); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--acc-1);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------------- boot ---------------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(1200px 700px at 50% 42%, #0d1119 0%, var(--bg-0) 62%);
  display: grid;
  place-items: center;
  transition: opacity var(--t-slow) var(--ease-out), visibility var(--t-slow);
}
.boot.done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-inner { text-align: center; padding: var(--s-5); max-width: 560px; }
.boot-mark {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.44em;
  color: var(--acc-1);
  margin-bottom: var(--s-5);
  animation: pulse 2.4s var(--ease-io) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
.boot-bar {
  width: 220px;
  height: 2px;
  background: var(--line);
  margin: 0 auto var(--s-4);
  overflow: hidden;
  border-radius: 2px;
}
.boot-bar i {
  display: block;
  height: 100%;
  width: 38%;
  background: linear-gradient(90deg, transparent, var(--acc-1), transparent);
  animation: sweep 1.5s var(--ease-io) infinite;
}
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(360%); } }
.boot-title { font-size: 17px; color: var(--txt); }
.boot-sub { font-family: var(--mono); font-size: 11px; color: var(--txt-3); margin-top: var(--s-1); }
.boot.failed .boot-bar { display: none; }
.boot-fail { color: var(--acc-2); font-size: 15px; margin: var(--s-3) 0; }
.boot-fail-sub { color: var(--txt-3); font-size: 13px; }
.boot-detail {
  font-family: var(--mono); font-size: 10px; color: var(--txt-4);
  text-align: left; background: var(--bg-1); padding: var(--s-3);
  border-radius: var(--r-s); overflow-x: auto; max-height: 160px;
}
.noscript {
  position: fixed; inset-inline: 0; top: 0; z-index: 200;
  background: var(--acc-2); color: #12060a; padding: var(--s-3);
  text-align: center; font-weight: 600;
}

/* ---------------- 3D canvas ---------------- */
#brain-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
  touch-action: none;
}

.region-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 14px);
  z-index: 40;
  background: var(--surf-2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line-2);
  border-radius: var(--r-m);
  padding: var(--s-3) var(--s-4);
  max-width: min(440px, 88vw);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-mid) var(--ease-out), transform var(--t-mid) var(--ease-out);
}
.region-toast.show { opacity: 1; transform: translate(-50%, 0); }
.rt-name { font-weight: 600; font-size: 14px; }
.rt-note { color: var(--txt-2); font-size: 13px; margin-top: 2px; }
.rt-mni { font-family: var(--mono); font-size: 10px; color: var(--txt-4); margin-top: var(--s-2); }

/* ---------------- topbar ---------------- */
.topbar {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-5);
  background: linear-gradient(180deg, rgba(6, 7, 10, 0.92), rgba(6, 7, 10, 0));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand-mark {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--txt);
}
.brand-sub {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--txt-4);
}
.topnav { display: flex; gap: var(--s-4); }
.topnav a {
  color: var(--txt-2);
  font-size: 13px;
  text-decoration: none;
  transition: color var(--t-fast) var(--ease-io);
}
.topnav a:hover { color: var(--txt); text-decoration: none; }
.topctl { display: flex; align-items: center; gap: var(--s-3); }
.speed-wrap {
  display: flex; align-items: center; gap: var(--s-2);
  font-family: var(--mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--txt-4);
}
select, .btn-ghost {
  background: var(--surf);
  border: 1px solid var(--line-2);
  color: var(--txt-2);
  border-radius: var(--r-s);
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-io), color var(--t-fast) var(--ease-io);
}
select:hover, .btn-ghost:hover { border-color: var(--line-3); color: var(--txt); }

/* ---------------- hero ---------------- */
.hero {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--s-6);
  max-width: 720px;
  pointer-events: none;
}
.hero > * { pointer-events: auto; }
.hero-title {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-variation-settings: 'opsz' 144;
  font-weight: 600;
  font-size: clamp(42px, 7.2vw, 88px);
  line-height: 0.94;
  letter-spacing: -0.025em;
  margin: 0 0 var(--s-4);
  animation: rise var(--t-slow) var(--ease-out) both;
}
.hero-title em {
  display: block;
  font-style: italic;
  color: var(--txt);
}
.hero-title span {
  display: block;
  color: var(--txt-3);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
.hero-lede {
  color: var(--txt-2);
  font-size: 16px;
  max-width: 56ch;
  margin: 0 0 var(--s-5);
  animation: rise var(--t-slow) var(--ease-out) 120ms both;
}
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-6);
  margin-bottom: var(--s-4);
  animation: rise var(--t-slow) var(--ease-out) 240ms both;
}
.hero-stats b {
  display: block;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 400;
  color: var(--acc-1);
  font-variant-numeric: tabular-nums;
}
.hero-stats span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--txt-4);
}
.hero-hint {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--txt-4);
  animation: rise var(--t-slow) var(--ease-out) 360ms both;
}

/* ---------------- instrument grid ---------------- */
.instrument {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-4);
  padding: var(--s-6);
  align-items: start;
}
.col { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }

.panel {
  background: var(--surf);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: var(--s-4);
  min-width: 0;
}
.panel-h {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--txt-3);
  margin: 0 0 var(--s-2);
  font-weight: 600;
}
.panel-sub {
  font-size: 12.5px;
  color: var(--txt-3);
  margin: 0 0 var(--s-3);
  line-height: 1.5;
}

/* ---------------- brain states ---------------- */
.state-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-2);
}
.state-btn {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: var(--s-3);
  text-align: left;
  cursor: pointer;
  color: var(--txt-2);
  font-family: var(--ui);
  transition: border-color var(--t-fast) var(--ease-io),
              background var(--t-fast) var(--ease-io),
              transform var(--t-fast) var(--ease-io);
}
.state-btn:hover { border-color: var(--line-3); transform: translateY(-1px); }
.state-btn.active {
  border-color: var(--acc-1);
  background: rgba(61, 250, 164, 0.07);
  color: var(--txt);
}
.state-name { display: block; font-weight: 600; font-size: 13.5px; }
.state-band {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--txt-4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.state-btn.active .state-band { color: var(--acc-1); }
.state-mech {
  font-size: 12.5px;
  color: var(--txt-2);
  margin: var(--s-3) 0 0;
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
  line-height: 1.55;
}

/* ---------------- neuromodulators ---------------- */
.chem { margin-bottom: var(--s-4); }
.chem:last-child { margin-bottom: 0; }
.chem-head { display: flex; justify-content: space-between; align-items: baseline; }
.chem-head label { font-size: 13.5px; font-weight: 600; }
.chem-head output {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--acc-4);
  font-variant-numeric: tabular-nums;
}
.chem-src {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--txt-4);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 3px;
}
.chem-fx { font-size: 12px; color: var(--txt-3); margin-top: var(--s-1); line-height: 1.5; }

input[type='range'] {
  width: 100%;
  height: 3px;
  margin: var(--s-2) 0 0;
  appearance: none;
  background: var(--line-2);
  border-radius: 2px;
  cursor: pointer;
}
input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--acc-4);
  border: 2px solid var(--bg-0);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-io);
}
input[type='range']::-webkit-slider-thumb:hover { transform: scale(1.22); }
input[type='range']::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--acc-4); border: 2px solid var(--bg-0); cursor: pointer;
}

/* ---------------- toggle ---------------- */
.toggle-row { display: flex; gap: var(--s-3); align-items: flex-start; }
.toggle {
  flex: none;
  width: 40px; height: 22px;
  border-radius: 11px;
  background: var(--line-2);
  border: 1px solid var(--line-3);
  position: relative;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-io), border-color var(--t-fast) var(--ease-io);
}
.toggle .knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--txt-3);
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-io);
}
.toggle.on { background: rgba(61, 250, 164, 0.22); border-color: var(--acc-1); }
.toggle.on .knob { transform: translateX(18px); background: var(--acc-1); }
.toggle-label { font-weight: 600; font-size: 13.5px; }
.toggle-sub { font-size: 12px; color: var(--txt-3); line-height: 1.5; }

/* ---------------- scope ---------------- */
.panel-scope { padding: var(--s-4); }
.scope-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}
.scope-title .lbl {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--txt-3);
  font-weight: 600;
}
.scope-title .sub { display: block; font-size: 11.5px; color: var(--txt-4); }
.scope-dom {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.scope-canvas {
  width: 100%;
  height: 96px;
  display: block;
  background: #08090d;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
}
.scope-canvas.raster { height: 132px; }

.band-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.band { text-align: center; }
.band-bar {
  height: 44px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--bg-1);
  border-radius: var(--r-s);
  overflow: hidden;
  border: 1px solid var(--line);
}
.band-bar i {
  display: block;
  width: 62%;
  height: 2%;
  border-radius: 2px 2px 0 0;
  transition: height 220ms var(--ease-io);
}
.band-name { font-size: 11px; color: var(--txt-3); margin-top: 3px; }
.band-hz { font-family: var(--mono); font-size: 9px; color: var(--txt-4); }
.band.dom .band-name { color: var(--txt); font-weight: 600; }
.band.dom .band-bar { border-color: var(--line-3); }

/* ---------------- readouts ---------------- */
.readouts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
}
.tile {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: var(--s-3);
}
.tile-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--txt-4);
}
.tile-value {
  font-family: var(--mono);
  font-size: 17px;
  color: var(--txt);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.tile-value em {
  font-style: normal;
  font-size: 10px;
  color: var(--txt-4);
  margin-left: 3px;
}

/* ---------------- mind state ---------------- */
.mind-label {
  font-family: var(--display);
  font-style: italic;
  font-size: 26px;
  line-height: 1.1;
  color: var(--acc-1);
}
.mind-detail { font-size: 13px; color: var(--txt-2); margin-bottom: var(--s-3); }
.mind-bars { display: flex; flex-direction: column; gap: var(--s-2); }
.mind-bar { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: var(--s-3); }
.mind-bar span {
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--txt-4);
}
.mb { height: 3px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.mb i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--acc-3), var(--acc-1));
  transition: width 320ms var(--ease-io);
}
.mind-note { font-size: 11.5px; color: var(--txt-4); margin: var(--s-3) 0 0; line-height: 1.5; }

/* ---------------- demos ---------------- */
.demo-list { display: flex; flex-direction: column; gap: var(--s-2); }
.demo-btn {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: var(--s-3);
  text-align: left;
  cursor: pointer;
  color: var(--txt-2);
  font-family: var(--ui);
  transition: border-color var(--t-fast) var(--ease-io), transform var(--t-fast) var(--ease-io);
}
.demo-btn:hover { border-color: var(--acc-1); transform: translateX(2px); }
.demo-name { display: block; font-weight: 600; font-size: 13.5px; color: var(--txt); }
.demo-blurb { display: block; font-size: 12px; color: var(--txt-3); line-height: 1.45; }
.demo-dur {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--txt-4);
  margin-top: 3px;
}
.demo-stage {
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
}
.demo-stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: var(--s-2);
}
.demo-progress { height: 2px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.demo-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--acc-1);
  transition: width 200ms linear;
}
.demo-narrate {
  font-size: 12.5px;
  color: var(--txt-2);
  line-height: 1.55;
  margin: var(--s-3) 0;
  min-height: 4.6em;
}
.demo-chart {
  width: 100%;
  height: 74px;
  display: none;
  background: #08090d;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
}
.demo-metric {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--txt-3);
  margin-top: var(--s-2);
}
.demo-metric b { color: var(--txt); font-weight: 400; }
.demo-metric .bad { color: var(--acc-2); }

/* ---------------- regions ---------------- */
.region-search {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  color: var(--txt);
  padding: 7px 10px;
  font-family: var(--ui);
  font-size: 13px;
  margin-bottom: var(--s-3);
}
.region-list { max-height: 380px; overflow-y: auto; padding-right: 4px; }
.region-list::-webkit-scrollbar { width: 6px; }
.region-list::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
.region-group { margin-bottom: var(--s-3); }
.region-group-name {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--txt-4);
  margin-bottom: var(--s-1);
}
.region-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  border-radius: var(--r-s);
  transition: background var(--t-fast) var(--ease-io);
}
.region-item:hover { background: rgba(255, 255, 255, 0.028); }
.region-item.lesioned .region-label { color: var(--acc-2); text-decoration: line-through; }
.region-focus {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  background: none;
  border: 0;
  color: var(--txt-2);
  cursor: pointer;
  padding: 5px 6px;
  text-align: left;
  font-family: var(--ui);
  min-width: 0;
}
.region-focus .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.region-label { font-family: var(--mono); font-size: 11px; color: var(--txt); flex: none; }
.region-full {
  font-size: 11.5px;
  color: var(--txt-4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.region-lesion {
  flex: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--txt-4);
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: var(--r-s);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-io);
}
.region-lesion:hover { border-color: var(--acc-2); color: var(--acc-2); }
.region-lesion.on { background: rgba(255, 92, 110, 0.16); border-color: var(--acc-2); color: var(--acc-2); }

/* ---------------- hud ---------------- */
.hud {
  position: fixed;
  right: var(--s-4);
  bottom: var(--s-4);
  z-index: 25;
  background: var(--surf);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: var(--s-3);
  min-width: 156px;
  font-family: var(--mono);
  font-size: 10px;
}
.hud-row { display: flex; justify-content: space-between; gap: var(--s-3); }
.hud-k { color: var(--txt-4); }
.hud-v { color: var(--txt-2); font-variant-numeric: tabular-nums; }
.hud-graph { width: 100%; height: 26px; margin-top: var(--s-2); display: block; }

/* ---------------- essays ---------------- */
.essay, .scale {
  position: relative;
  z-index: 10;
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--s-8) var(--s-6);
}
.essay-h {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-5);
  color: var(--txt-3);
}
.essay-h em { font-style: italic; color: var(--txt); }
.essay-cols {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-6);
}
.essay-cols p { color: var(--txt-2); margin: 0 0 var(--s-3); }
.essay-cols b { color: var(--txt); font-weight: 600; }
.essay-kicker {
  color: var(--txt) !important;
  border-left: 2px solid var(--acc-1);
  padding-left: var(--s-3);
}

.scale-lede { color: var(--txt-2); max-width: 62ch; margin: 0 0 var(--s-5); }
.scale-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
  margin-bottom: var(--s-6);
}
.scale-card {
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: var(--s-4);
}
.scale-card.accent { border-color: rgba(61, 250, 164, 0.34); background: rgba(61, 250, 164, 0.045); }
.scale-n {
  font-family: var(--mono);
  font-size: 26px;
  color: var(--txt);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.scale-card.accent .scale-n { color: var(--acc-1); }
.scale-n small {
  display: block;
  font-size: 11px;
  color: var(--txt-4);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.scale-l {
  font-size: 12.5px;
  color: var(--txt-2);
  font-weight: 600;
  margin: var(--s-2) 0 var(--s-2);
}
.scale-card p { font-size: 12.5px; color: var(--txt-3); margin: 0; line-height: 1.55; }

.scale-prose { max-width: 68ch; }
.scale-prose h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--txt-3);
  margin: 0 0 var(--s-3);
}
.scale-prose p { color: var(--txt-2); margin: 0 0 var(--s-3); }
.scale-prose b { color: var(--txt); }
.scale-kicker {
  color: var(--txt) !important;
  border-left: 2px solid var(--acc-1);
  padding-left: var(--s-3);
}

/* ---------------- footer ---------------- */
.foot {
  position: relative;
  z-index: 10;
  border-top: 1px solid var(--line);
  padding: var(--s-5) var(--s-6);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-5);
  flex-wrap: wrap;
  background: var(--bg-0);
}
.foot-mark { font-family: var(--mono); font-size: 11px; letter-spacing: 0.3em; color: var(--txt-3); }
.foot-l p { font-size: 12px; color: var(--txt-4); max-width: 48ch; margin: var(--s-2) 0 0; }
.foot-r { display: flex; gap: var(--s-4); }
.foot-r a { color: var(--txt-3); font-size: 12px; }
.foot-r a:hover { color: var(--txt); }

/* ---------------- legal pages ---------------- */
.legal {
  position: relative;
  z-index: 10;
  max-width: 780px;
  margin: 0 auto;
  padding: var(--s-8) var(--s-5) var(--s-7);
}
.legal h1 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(30px, 5vw, 46px);
  margin: 0 0 var(--s-2);
}
.legal .updated { font-family: var(--mono); font-size: 11px; color: var(--txt-4); margin-bottom: var(--s-5); }
.legal h2 {
  font-size: 15px;
  margin: var(--s-6) 0 var(--s-2);
  color: var(--txt);
  scroll-margin-top: 80px;
}
.legal p, .legal li { color: var(--txt-2); font-size: 14px; }
.legal ul { padding-left: var(--s-4); }
.legal .toc {
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: var(--s-4);
  margin-bottom: var(--s-5);
}
.legal .toc a { display: block; font-size: 13px; padding: 2px 0; color: var(--txt-2); }
.legal .toc a:hover { color: var(--acc-1); }
.legal .callout {
  border-left: 2px solid var(--acc-4);
  padding: var(--s-2) 0 var(--s-2) var(--s-3);
  background: rgba(255, 180, 84, 0.05);
  border-radius: 0 var(--r-s) var(--r-s) 0;
}
.legal .callout strong { color: var(--txt); }
.legal-back { display: inline-block; margin-top: var(--s-5); font-size: 13px; }

/* ---------------- responsive ---------------- */
@media (max-width: 1080px) {
  .instrument { grid-template-columns: 1fr 1fr; }
  .col-right { grid-column: 1 / -1; }
  .scale-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .topbar { padding: var(--s-2) var(--s-3); flex-wrap: wrap; gap: var(--s-2); }
  .topnav { display: none; }
  .brand-sub { display: none; }
  .hero { padding: 0 var(--s-4); min-height: 92vh; }
  .hero-stats { gap: var(--s-4); }
  .instrument { grid-template-columns: 1fr; padding: var(--s-4); gap: var(--s-3); }
  .col-right { grid-column: auto; }
  .essay, .scale { padding: var(--s-6) var(--s-4); }
  .essay-cols { grid-template-columns: 1fr; gap: var(--s-3); }
  .scale-grid { grid-template-columns: 1fr; }
  .readouts { grid-template-columns: repeat(2, 1fr); }
  .hud { left: var(--s-3); right: var(--s-3); bottom: var(--s-3); min-width: 0; }
  .hud-graph { height: 20px; }
  .foot { flex-direction: column; gap: var(--s-3); padding: var(--s-5) var(--s-4); }
  .region-toast { bottom: 96px; }
  .region-list { max-height: 300px; }
}

@media (max-width: 400px) {
  .state-grid { grid-template-columns: 1fr; }
  .band-row { gap: 4px; }
  .band-hz { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
