@font-face {
  font-family: "Forma Display";
  src: url("assets/fonts/FormaDJRDisplay-Medium.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Forma Text";
  src: url("assets/fonts/FormaDJRText-Regular.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Forma Text";
  src: url("assets/fonts/FormaDJRText-Bold.woff2") format("woff2");
  font-display: swap;
  font-weight: 700;
}

:root {
  --ink: #191512;
  --burgundy: #4c1a09;
  --burgundy-deep: #3d1106;
  --paper: #fffdf9;
  --pink: #f5e1e1;
  --pink-strong: #f2c8c9;
  --line: #d9aaa4;
  --line-soft: #ead7d2;
  --muted: #77594f;
  --blue: #2951fe;
  --blue-soft: #dbe7f6;
  --teal: #16756e;
  --teal-soft: #d9eeea;
  --gold: #a66c0f;
  --gold-soft: #f5e8c8;
  --red: #b33a37;
  --red-soft: #f6dddd;
  --shadow: 0 14px 36px rgb(61 17 6 / 8%);
  --font-display: "Forma Display", Arial, sans-serif;
  --font-text: "Forma Text", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

button,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: var(--burgundy);
}

.skip-link {
  background: var(--burgundy);
  color: white;
  left: 10px;
  padding: 10px;
  position: fixed;
  top: -80px;
  z-index: 100;
}

.skip-link:focus {
  top: 10px;
}

.lab-header {
  align-items: center;
  background: rgb(255 253 249 / 96%);
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  gap: 18px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 68px;
  padding: 10px clamp(18px, 3vw, 42px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.lab-brand img {
  display: block;
  height: 42px;
  width: 110px;
}

.lab-title {
  border-left: 1px solid var(--line);
  display: grid;
  gap: 1px;
  padding-left: 18px;
}

.lab-title span,
.eyebrow {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.lab-title strong {
  color: var(--burgundy-deep);
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.lab-header nav,
.lab-footer div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lab-header nav a,
.lab-footer a {
  border: 1px solid var(--line);
  color: var(--burgundy);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 11px;
  text-decoration: none;
}

.lab-header nav a:hover,
.lab-header nav a:focus-visible,
.lab-footer a:hover,
.lab-footer a:focus-visible {
  background: var(--burgundy);
  color: white;
  outline: none;
}

.prototype-banner {
  align-items: center;
  background: var(--gold-soft);
  border-bottom: 1px solid #d9bc7f;
  color: #523b16;
  display: flex;
  font-size: 0.8rem;
  gap: 12px;
  padding: 8px clamp(18px, 3vw, 42px);
}

.prototype-banner strong {
  background: #523b16;
  color: white;
  font-size: 0.68rem;
  padding: 4px 7px;
  text-transform: uppercase;
}

.lab-workspace {
  margin: 0 auto;
  max-width: 1520px;
  padding: clamp(24px, 4vw, 58px) clamp(16px, 3vw, 46px) 80px;
}

.lab-intro {
  align-items: end;
  display: grid;
  gap: clamp(20px, 5vw, 80px);
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  margin-bottom: 26px;
}

.lab-intro h1 {
  color: var(--burgundy-deep);
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.4vw, 4.9rem);
  line-height: 0.96;
  margin: 8px 0 0;
  max-width: 930px;
}

.lab-intro > p {
  border-left: 4px solid var(--gold);
  color: var(--muted);
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
  line-height: 1.5;
  margin: 0;
  padding-left: 18px;
}

.lab-controls {
  align-items: stretch;
  background: var(--burgundy-deep);
  box-shadow: var(--shadow);
  color: white;
  display: grid;
  gap: 0;
  grid-template-columns: minmax(150px, 0.72fr) minmax(250px, 1.1fr) minmax(210px, 0.9fr) minmax(240px, 1.3fr);
  position: sticky;
  top: 68px;
  z-index: 25;
}

.control-field {
  border-right: 1px solid rgb(255 255 255 / 18%);
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px 14px;
}

.control-field:last-child {
  border: 0;
}

.control-field > span {
  color: #efd8d1;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.control-field select {
  background: white;
  border: 0;
  border-radius: 0;
  color: var(--burgundy-deep);
  font-weight: 700;
  min-height: 34px;
  padding: 4px 28px 4px 8px;
  width: 100%;
}

.segmented-control {
  border: 1px solid rgb(255 255 255 / 35%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.segmented-control button {
  background: transparent;
  border: 0;
  color: white;
  font-size: 0.8rem;
  min-height: 34px;
  padding: 5px 8px;
}

.segmented-control button + button {
  border-left: 1px solid rgb(255 255 255 / 35%);
}

.segmented-control button[aria-pressed="true"] {
  background: white;
  color: var(--burgundy-deep);
  font-weight: 700;
}

.year-field > span {
  display: flex;
  justify-content: space-between;
}

.year-field > span strong {
  color: white;
  font-size: 0.85rem;
}

input[type="range"] {
  accent-color: var(--gold);
  appearance: none;
  background: linear-gradient(90deg, var(--gold) var(--range-progress, 50%), rgb(255 255 255 / 25%) var(--range-progress, 50%));
  height: 4px;
  margin: 7px 0;
  width: 100%;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  background: white;
  border: 2px solid var(--gold);
  border-radius: 50%;
  height: 16px;
  width: 16px;
}

input[type="range"]::-moz-range-thumb {
  background: white;
  border: 2px solid var(--gold);
  border-radius: 50%;
  height: 14px;
  width: 14px;
}

.year-field small {
  color: #efd8d1;
  display: flex;
  font-size: 0.62rem;
  justify-content: space-between;
}

.active-policies {
  align-content: start;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 34px;
}

.active-policies em {
  align-self: center;
  color: #efd8d1;
  font-size: 0.78rem;
}

.policy-chip {
  align-items: center;
  background: var(--gold-soft);
  border: 0;
  color: #4e3510;
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 700;
  gap: 6px;
  min-height: 28px;
  padding: 4px 7px;
}

.policy-chip span {
  font-size: 1rem;
  line-height: 0.8;
}

.stage-nav {
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 28px 0 42px;
}

.stage-nav button {
  background: transparent;
  border: 0;
  border-top: 4px solid var(--line-soft);
  color: var(--muted);
  display: grid;
  gap: 2px;
  min-height: 78px;
  padding: 12px 14px;
  text-align: left;
}

.stage-nav button + button {
  border-left: 1px solid var(--line-soft);
}

.stage-nav button[aria-current="step"] {
  background: var(--pink);
  border-top-color: var(--burgundy);
  color: var(--burgundy-deep);
}

.stage-nav button span {
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
}

.stage-nav button strong {
  font-size: 0.9rem;
}

.stage-nav button small {
  font-size: 0.7rem;
}

.lab-status {
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 20px;
}

.lab-status[hidden] {
  display: none;
}

.stage-heading {
  align-items: end;
  display: grid;
  gap: 30px;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  margin: 0 0 26px;
}

.stage-heading h2 {
  color: var(--burgundy-deep);
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.6vw, 4rem);
  line-height: 0.98;
  margin: 8px 0 0;
}

.stage-heading > p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.scenario-definition {
  align-items: end;
  background: var(--blue-soft);
  border-left: 6px solid var(--blue);
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr auto;
  margin-bottom: 18px;
  padding: clamp(18px, 2.8vw, 34px);
}

.scenario-definition span {
  color: var(--blue);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.scenario-definition h3 {
  color: #153f7c;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.2vw, 2.25rem);
  margin: 7px 0;
}

.scenario-definition p {
  color: #314d70;
  margin: 0;
  max-width: 880px;
}

.scenario-definition a {
  color: #153f7c;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.section-block {
  border-top: 2px solid var(--burgundy);
  margin-top: 28px;
  padding-top: 16px;
}

.section-heading {
  align-items: end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-heading h3,
.pairing-strip h3,
.decision-readout h3,
.inspector-heading h3,
.output-heading h3 {
  color: var(--burgundy-deep);
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 2rem);
  margin: 5px 0 0;
}

.section-heading > span,
.section-heading label {
  color: var(--muted);
  font-size: 0.75rem;
}

.section-heading button,
.section-heading select {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--burgundy);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 8px 10px;
}

.primitive-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.primitive-card {
  border: 1px solid var(--line);
  display: grid;
  gap: 13px;
  min-height: 226px;
  padding: 16px;
}

.primitive-card > div:first-child {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.primitive-card > div:first-child > span {
  color: var(--burgundy-deep);
  font-weight: 700;
  max-width: 180px;
}

.primitive-card > div:first-child > strong {
  color: var(--burgundy);
  font-family: var(--font-display);
  font-size: 1.8rem;
  line-height: 0.9;
  text-align: right;
}

.primitive-card strong small {
  color: var(--muted);
  display: block;
  font-family: var(--font-text);
  font-size: 0.62rem;
  font-weight: 400;
  line-height: 1.2;
  margin-top: 5px;
  max-width: 100px;
}

.primitive-card p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  margin: 0;
}

.primitive-card a {
  align-self: end;
  font-size: 0.7rem;
  font-weight: 700;
}

.primitive-card input[type="range"] {
  background: linear-gradient(90deg, var(--burgundy) var(--range-progress), var(--line-soft) var(--range-progress));
}

.displacement-bar {
  display: flex;
  height: 20px;
  overflow: hidden;
}

.displacement-bar i {
  flex: var(--share);
}

.displacement-bar i[data-tone="one"] { background: var(--red); }
.displacement-bar i[data-tone="two"] { background: var(--gold); }
.displacement-bar i[data-tone="three"] { background: var(--blue); }
.displacement-bar i[data-tone="four"] { background: var(--teal); }

.displacement-legend {
  display: grid;
  font-size: 0.67rem;
  gap: 4px 10px;
  grid-template-columns: repeat(2, 1fr);
}

.consistency-note,
.method-note {
  align-items: start;
  background: var(--teal-soft);
  border-left: 5px solid var(--teal);
  display: grid;
  gap: 8px 18px;
  grid-template-columns: auto 1fr;
  margin-top: 12px;
  padding: 14px 16px;
}

.consistency-note[data-warning="true"] {
  background: var(--gold-soft);
  border-color: var(--gold);
}

.consistency-note strong,
.method-note strong {
  color: var(--burgundy-deep);
  font-size: 0.78rem;
}

.consistency-note span,
.method-note p {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  margin: 0;
}

.method-note {
  grid-template-columns: auto 1fr auto;
  margin-top: 28px;
}

.method-note a {
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.trajectory-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.line-chart {
  border: 1px solid var(--line-soft);
  margin: 0;
  min-width: 0;
  padding: 14px;
}

.line-chart figcaption {
  display: grid;
  grid-template-columns: 1fr auto;
}

.line-chart figcaption span {
  color: var(--burgundy-deep);
  font-size: 0.78rem;
  font-weight: 700;
}

.line-chart figcaption strong {
  color: var(--burgundy);
  font-family: var(--font-display);
  font-size: 1.65rem;
}

.line-chart figcaption small {
  color: var(--muted);
  font-size: 0.66rem;
}

.line-chart svg {
  display: block;
  width: 100%;
}

.line-chart svg line {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.line-chart svg path {
  fill: none;
  stroke-width: 3;
}

.line-chart .scenario-line { stroke: var(--burgundy); }
.line-chart .policy-line { stroke: var(--teal); }
.line-chart svg .selected-year { stroke: var(--gold); stroke-dasharray: 4 4; }
.line-chart .selected-dot { fill: var(--gold); stroke: white; stroke-width: 2; }
.line-chart svg text { fill: var(--muted); font-family: var(--font-text); font-size: 11px; }

.chart-legend {
  display: flex;
  font-size: 0.65rem;
  gap: 12px;
  justify-content: flex-end;
}

.chart-legend span {
  align-items: center;
  display: flex;
  gap: 4px;
}

.chart-legend i {
  display: inline-block;
  height: 3px;
  width: 18px;
}

.scenario-key { background: var(--burgundy); }
.policy-key { background: var(--teal); }

.source-band {
  background: var(--pink);
  margin-top: 28px;
  padding: 16px;
}

.source-band > strong {
  color: var(--burgundy-deep);
  display: block;
  font-size: 0.72rem;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.source-band > div {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(6, 1fr);
}

.source-band a {
  background: var(--paper);
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 10px;
  text-decoration: none;
}

.source-band a span,
.source-band a small {
  color: var(--muted);
  font-size: 0.62rem;
  overflow-wrap: anywhere;
}

.source-band a b {
  color: var(--burgundy);
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.next-stage {
  align-items: center;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 20px;
  justify-content: flex-end;
  margin-top: 36px;
  padding: 16px 0;
}

.next-stage > span {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.next-stage button {
  background: var(--burgundy);
  border: 0;
  color: white;
  font-weight: 700;
  padding: 12px 15px;
}

.next-stage button b {
  font-size: 1.15rem;
  margin-left: 8px;
}

.occupation-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 250px;
}

.occupation-scatter {
  border: 1px solid var(--line-soft);
  margin: 0;
  min-width: 0;
  padding: 10px;
}

.occupation-scatter svg {
  display: block;
  width: 100%;
}

.occupation-scatter .plot-bg { fill: #fffaf6; stroke: var(--line-soft); }
.occupation-scatter line { stroke: var(--muted); stroke-width: 1; }
.occupation-scatter .plot-guide { stroke: var(--line); stroke-dasharray: 5 5; }
.occupation-scatter circle { fill-opacity: 0.68; stroke-width: 2; transition: fill-opacity 150ms ease, stroke-width 150ms ease; }
.occupation-scatter circle[data-tone="risk"] { fill: var(--red); stroke: #7e211f; }
.occupation-scatter circle[data-tone="augment"] { fill: var(--teal); stroke: #0d4d48; }
.occupation-scatter circle[data-tone="mixed"] { fill: var(--gold); stroke: #704703; }
.occupation-scatter circle:hover,
.occupation-scatter circle:focus { fill-opacity: 1; outline: none; stroke-width: 4; }
.occupation-scatter text { fill: var(--muted); font-family: var(--font-text); font-size: 12px; }
.occupation-scatter .quadrant { font-size: 11px; font-weight: 700; }
.occupation-scatter .axis-label { fill: var(--burgundy-deep); font-size: 13px; font-weight: 700; }
.occupation-scatter figcaption { color: var(--muted); font-size: 0.68rem; padding: 4px 8px 8px; }

.map-explainer {
  display: grid;
  gap: 1px;
}

.map-explainer div {
  background: var(--pink);
  padding: 15px;
}

.map-explainer span {
  color: var(--burgundy);
  font-size: 0.78rem;
  font-weight: 700;
}

.map-explainer p {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
  margin: 7px 0 0;
}

.occupation-table {
  border: 1px solid var(--line-soft);
}

.occupation-table > div {
  align-items: center;
  border-top: 1px solid var(--line-soft);
  display: grid;
  font-size: 0.75rem;
  gap: 12px;
  grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(115px, 0.75fr)) minmax(150px, 1fr);
  min-height: 52px;
  padding: 9px 12px;
}

.occupation-table > div:first-child {
  border: 0;
}

.occupation-table .table-head {
  background: var(--burgundy-deep);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  min-height: 38px;
  text-transform: uppercase;
}

.occupation-table strong { color: var(--burgundy-deep); }
.occupation-table em { color: var(--muted); font-style: normal; }

.household-summary {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(4, 1fr);
}

.household-summary article {
  background: var(--burgundy-deep);
  color: white;
  display: grid;
  gap: 6px;
  min-height: 136px;
  padding: 16px;
}

.household-summary span,
.household-summary small {
  color: #efd8d1;
  font-size: 0.7rem;
}

.household-summary strong {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 3rem);
}

.stress-matrix {
  display: grid;
  gap: 3px;
  grid-template-columns: minmax(150px, 1.2fr) repeat(4, 1fr);
}

.stress-matrix > strong,
.matrix-corner {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.68rem;
  min-height: 38px;
  padding: 7px;
}

.stress-matrix > div:not(.matrix-corner) {
  background: color-mix(in srgb, var(--red) var(--stress), var(--teal-soft));
  display: grid;
  min-height: 72px;
  padding: 10px;
}

.stress-matrix > div span {
  color: var(--burgundy-deep);
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.stress-matrix > div small {
  align-self: end;
  color: var(--muted);
  font-size: 0.62rem;
}

.household-two-column {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.transition-flow {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(80px, 0.5fr) minmax(160px, 1fr);
  min-height: 250px;
}

.flow-origin {
  align-content: center;
  background: var(--burgundy-deep);
  color: white;
  display: grid;
  gap: 5px;
  padding: 18px;
}

.flow-origin span { color: #efd8d1; font-size: 0.75rem; }

.flow-lines,
.flow-destinations {
  display: grid;
  gap: 5px;
  grid-template-rows: repeat(4, 1fr);
}

.flow-lines i {
  align-self: center;
  background: var(--gold);
  height: max(3px, calc(var(--flow) * 1px));
  opacity: 0.65;
}

.flow-destinations div {
  align-items: center;
  background: var(--pink);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 9px;
}

.flow-destinations span { color: var(--muted); font-size: 0.7rem; }
.flow-destinations strong { color: var(--burgundy); font-family: var(--font-display); font-size: 1.25rem; }
.panel-caption { color: var(--muted); font-size: 0.7rem; line-height: 1.4; }

.distribution-rows {
  display: grid;
}

.distribution-rows > div {
  border-top: 1px solid var(--line-soft);
  display: grid;
  gap: 8px;
  grid-template-columns: 1.35fr repeat(3, 0.75fr);
  min-height: 58px;
  padding: 10px 0;
}

.distribution-rows > div span {
  color: var(--burgundy);
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.distribution-rows > div strong { color: var(--muted); font-size: 0.75rem; }
.distribution-rows .distribution-head { border: 0; min-height: 30px; }
.distribution-rows .distribution-head span { color: var(--muted); font-family: var(--font-text); font-size: 0.62rem; font-weight: 700; text-transform: uppercase; }

.policy-workbench {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(300px, 0.75fr) minmax(0, 1.5fr);
}

.policy-shelf {
  border: 1px solid var(--line);
  display: grid;
}

.policy-shelf article {
  align-items: center;
  border-top: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: 1fr auto;
  min-height: 92px;
}

.policy-shelf article:first-child { border: 0; }
.policy-shelf article[data-active="true"] { background: var(--teal-soft); }
.policy-shelf article[data-focused="true"] { box-shadow: inset 5px 0 var(--burgundy); }

.policy-main {
  background: transparent;
  border: 0;
  display: grid;
  gap: 3px;
  padding: 13px 16px;
  text-align: left;
}

.policy-main span { color: var(--teal); font-size: 0.6rem; font-weight: 700; text-transform: uppercase; }
.policy-main strong { color: var(--burgundy-deep); font-size: 0.88rem; }
.policy-main small { color: var(--muted); font-size: 0.66rem; line-height: 1.35; }

.policy-toggle {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--burgundy);
  font-size: 0.68rem;
  font-weight: 700;
  margin-right: 12px;
  padding: 7px 9px;
}

.policy-shelf article[data-active="true"] .policy-toggle {
  border-color: var(--teal);
  color: var(--teal);
}

.policy-inspector {
  background: var(--pink);
  border-top: 5px solid var(--burgundy);
  min-width: 0;
  padding: clamp(18px, 2.5vw, 32px);
}

.inspector-heading {
  align-items: start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.inspector-heading a { font-size: 0.72rem; font-weight: 700; }
.policy-rationale { color: var(--muted); line-height: 1.5; max-width: 850px; }

.policy-parameters {
  display: grid;
  gap: 1px;
  grid-template-columns: 1.4fr 0.7fr 0.6fr;
  margin-top: 20px;
}

.policy-parameters > * {
  background: var(--paper);
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 13px;
}

.policy-parameters span { color: var(--muted); font-size: 0.65rem; }
.policy-parameters strong { color: var(--burgundy); font-size: 0.85rem; }
.policy-parameters input[type="range"] { background: linear-gradient(90deg, var(--burgundy) 50%, var(--line-soft) 50%); }
.policy-parameters select { border: 1px solid var(--line); min-height: 34px; }

.policy-tradeoffs {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(2, 1fr);
  margin-top: 1px;
}

.policy-tradeoffs div { background: var(--paper); padding: 13px; }
.policy-tradeoffs strong { color: var(--burgundy-deep); font-size: 0.7rem; text-transform: uppercase; }
.policy-tradeoffs p { color: var(--muted); font-size: 0.75rem; line-height: 1.4; margin: 6px 0 0; }

.evidence-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.evidence-chips a {
  background: var(--paper);
  border: 1px solid var(--line);
  display: grid;
  gap: 1px;
  min-width: 130px;
  padding: 8px;
  text-decoration: none;
}

.evidence-chips span,
.evidence-chips small { color: var(--muted); font-size: 0.6rem; }
.evidence-chips strong { color: var(--burgundy); font-size: 0.82rem; }
.inspector-add { background: var(--burgundy); border: 0; color: white; font-size: 0.75rem; font-weight: 700; margin-top: 14px; padding: 10px 12px; }

.adaptive-trigger-panel,
.robustness-panel {
  margin-top: 18px;
}

.trigger-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.trigger-card {
  border: 1px solid var(--line);
  display: grid;
  gap: 13px;
  padding: 15px;
}

.trigger-card[data-active="true"] {
  background: var(--teal-soft);
  border-color: var(--teal);
}

.trigger-heading {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr auto;
}

.trigger-heading > div { display: grid; gap: 4px; }
.trigger-heading strong { color: var(--burgundy-deep); font-size: 0.84rem; }
.trigger-heading small { color: var(--muted); font-size: 0.68rem; line-height: 1.35; }

.trigger-toggle {
  background: var(--line-soft);
  border: 0;
  height: 22px;
  padding: 3px;
  width: 40px;
}

.trigger-toggle i {
  background: var(--paper);
  display: block;
  height: 16px;
  transition: transform 160ms ease;
  width: 16px;
}

.trigger-toggle[aria-checked="true"] { background: var(--teal); }
.trigger-toggle[aria-checked="true"] i { transform: translateX(18px); }

.trigger-rule {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.8fr);
}

.trigger-rule label { display: grid; gap: 5px; min-width: 0; }
.trigger-rule span { color: var(--muted); font-size: 0.6rem; text-transform: uppercase; }
.trigger-rule strong { color: var(--burgundy); font-size: 0.75rem; }
.trigger-rule input { background: linear-gradient(90deg, var(--gold) var(--range-progress), var(--line) var(--range-progress)); width: 100%; }
.trigger-rule select { border: 1px solid var(--line); min-height: 34px; width: 100%; }
.trigger-status { color: var(--muted); font-size: 0.68rem; font-weight: 700; margin: 0; }
.trigger-status[data-crossed="true"] { color: var(--teal); }

.robustness-matrix {
  border: 1px solid var(--line);
  overflow-x: auto;
}

.robustness-head,
.robustness-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.85fr) repeat(3, minmax(155px, 1fr));
  min-width: 680px;
}

.robustness-head {
  background: var(--burgundy-deep);
  color: white;
}

.robustness-head > *,
.robustness-row > * { padding: 11px 13px; }
.robustness-head strong { border-left: 1px solid rgb(255 255 255 / 25%); font-size: 0.68rem; text-transform: uppercase; }
.robustness-head span { color: #efd8d1; font-size: 0.62rem; font-weight: 700; text-transform: uppercase; }
.robustness-row { border-top: 1px solid var(--line-soft); }
.robustness-row > strong { color: var(--burgundy-deep); font-size: 0.73rem; }

.robustness-row > div {
  border-left: 1px solid var(--line-soft);
  display: grid;
  gap: 4px;
}

.robustness-row b { color: var(--burgundy); font-size: 0.7rem; }
.robustness-row small { color: var(--muted); font-size: 0.6rem; line-height: 1.3; }
.robustness-row div[data-tone="strong"] { background: var(--teal-soft); }
.robustness-row div[data-tone="costly"] { background: var(--gold-soft); }
.robustness-row div[data-tone="early"] { background: var(--pink); }

.pairing-strip {
  align-items: center;
  background: var(--gold-soft);
  border-left: 6px solid var(--gold);
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr auto;
  margin-top: 18px;
  padding: 18px 20px;
}

.pairing-strip p:last-child { color: var(--muted); margin: 6px 0 0; }
.pairing-strip button { background: #523b16; border: 0; color: white; font-weight: 700; padding: 11px 13px; }

.decision-readout {
  align-items: start;
  background: var(--burgundy-deep);
  color: white;
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr auto;
  margin-top: 28px;
  padding: clamp(20px, 3vw, 36px);
}

.decision-readout .eyebrow { color: #efd8d1; }
.decision-readout h3 { color: white; font-size: clamp(1.4rem, 2.3vw, 2.4rem); line-height: 1.18; max-width: 1100px; }
.decision-readout > span { border: 1px solid rgb(255 255 255 / 35%); color: #efd8d1; font-size: 0.7rem; padding: 7px 9px; white-space: nowrap; }

.result-console {
  border: 1px solid var(--line);
  margin-top: 18px;
}

.output-explain-strip {
  align-items: center;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
}

.output-explain-strip > span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  margin-right: 5px;
  text-transform: uppercase;
}

.output-explain-strip button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--burgundy);
  font-size: 0.66rem;
  min-height: 30px;
  padding: 5px 8px;
}

.output-explain-strip button[aria-pressed="true"] { background: var(--burgundy); color: white; }

.why-changed {
  background: var(--pink);
  border-bottom: 1px solid var(--line);
  padding: clamp(16px, 2.4vw, 26px);
}

.why-heading {
  align-items: start;
  display: flex;
  gap: 20px;
  justify-content: space-between;
}

.why-heading > strong {
  color: var(--burgundy);
  font-family: var(--font-display);
  font-size: 1.45rem;
  white-space: nowrap;
}

.calculation-path {
  align-items: stretch;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 15px;
}

.calculation-path > div {
  background: var(--paper);
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 11px;
}

.calculation-path > i { display: none; }
.calculation-path span { color: var(--teal); font-size: 0.57rem; font-weight: 700; text-transform: uppercase; }
.calculation-path b { color: var(--burgundy-deep); font-size: 0.68rem; line-height: 1.35; }
.calculation-path a,
.calculation-path small { color: var(--muted); font-size: 0.58rem; line-height: 1.3; }
.why-changed > p { color: var(--muted); font-size: 0.7rem; line-height: 1.45; margin: 13px 0 0; }

.result-tabs {
  background: var(--pink);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.result-tabs button {
  background: transparent;
  border: 0;
  color: var(--burgundy);
  font-size: 0.75rem;
  font-weight: 700;
  min-height: 44px;
}

.result-tabs button + button { border-left: 1px solid var(--line); }
.result-tabs button[aria-selected="true"] { background: var(--burgundy); color: white; }
.output-panel { padding: clamp(16px, 2.5vw, 28px); }
.output-heading p { color: var(--muted); margin: 6px 0 18px; }

.budget-summary {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(3, 1fr);
}

.budget-summary span {
  background: var(--pink);
  color: var(--muted);
  display: grid;
  font-size: 0.7rem;
  gap: 5px;
  padding: 13px;
}

.budget-summary strong { color: var(--burgundy); font-family: var(--font-display); font-size: 1.5rem; }

.waterfall {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.waterfall > div {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 170px 1fr 70px;
}

.waterfall span { color: var(--muted); font-size: 0.72rem; }
.waterfall i { background: var(--teal); height: 22px; width: var(--bar); }
.waterfall div[data-sign="negative"] i { background: var(--red); justify-self: end; }
.waterfall strong { color: var(--burgundy); font-size: 0.78rem; text-align: right; }

.lab-footer {
  align-items: center;
  background: var(--burgundy-deep);
  color: white;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 24px clamp(18px, 3vw, 42px);
}

.lab-footer p { color: #efd8d1; font-size: 0.75rem; margin: 0; max-width: 560px; }
.lab-footer a { border-color: rgb(255 255 255 / 35%); color: white; }

@media (max-width: 1050px) {
  .lab-controls {
    grid-template-columns: minmax(150px, 0.7fr) minmax(240px, 1fr) minmax(180px, 0.8fr);
  }

  .active-field {
    border-right: 0;
    grid-column: 1 / -1;
  }

  .primitive-grid,
  .trajectory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .source-band > div {
    grid-template-columns: repeat(3, 1fr);
  }

  .occupation-layout,
  .policy-workbench {
    grid-template-columns: 1fr;
  }

  .map-explainer {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 760px) {
  .lab-header {
    grid-template-columns: auto 1fr;
    position: relative;
  }

  .lab-header nav {
    grid-column: 1 / -1;
  }

  .prototype-banner {
    align-items: start;
    flex-direction: column;
    gap: 5px;
  }

  .lab-workspace {
    padding-top: 28px;
  }

  .lab-intro,
  .stage-heading {
    grid-template-columns: 1fr;
  }

  .lab-intro h1 {
    font-size: 2.55rem;
  }

  .lab-controls {
    grid-template-columns: 1fr;
    position: relative;
    top: auto;
  }

  .control-field,
  .active-field {
    border-bottom: 1px solid rgb(255 255 255 / 18%);
    border-right: 0;
    grid-column: auto;
  }

  .stage-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .stage-nav button:nth-child(3) {
    border-left: 0;
  }

  .scenario-definition,
  .primitive-grid,
  .trajectory-grid,
  .household-summary,
  .household-two-column,
  .policy-parameters,
  .policy-tradeoffs,
  .pairing-strip,
  .decision-readout,
  .budget-summary {
    grid-template-columns: 1fr;
  }

  .trigger-grid,
  .trigger-rule,
  .calculation-path {
    grid-template-columns: 1fr;
  }

  .adaptive-trigger-panel .section-heading,
  .robustness-panel .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 5px;
  }

  .scenario-definition a {
    white-space: normal;
  }

  .primitive-card {
    min-height: 0;
  }

  .method-note,
  .consistency-note {
    grid-template-columns: 1fr;
  }

  .source-band > div {
    grid-template-columns: repeat(2, 1fr);
  }

  .map-explainer {
    grid-template-columns: 1fr;
  }

  .occupation-table {
    overflow-x: auto;
  }

  .occupation-table > div {
    grid-template-columns: 170px repeat(3, 115px) 150px;
    min-width: 750px;
  }

  .stress-matrix {
    grid-template-columns: minmax(105px, 1.2fr) repeat(4, minmax(72px, 1fr));
    overflow-x: auto;
  }

  .stress-matrix > div:not(.matrix-corner) {
    min-height: 66px;
  }

  .transition-flow {
    grid-template-columns: 100px 50px 1fr;
  }

  .result-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .result-tabs button:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .result-tabs button:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .waterfall > div {
    grid-template-columns: 120px 1fr 60px;
  }

  .lab-footer {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 470px) {
  .lab-brand img {
    height: 36px;
    width: 92px;
  }

  .lab-title {
    padding-left: 10px;
  }

  .lab-title strong {
    font-size: 1.1rem;
  }

  .lab-intro h1 {
    font-size: 2.15rem;
  }

  .stage-nav button {
    min-height: 70px;
    padding: 9px;
  }

  .stage-nav button strong {
    font-size: 0.78rem;
  }

  .source-band > div {
    grid-template-columns: 1fr;
  }

  .household-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .policy-shelf article {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .inspector-heading {
    flex-direction: column;
  }

  .decision-readout > span {
    white-space: normal;
  }

  .why-heading {
    align-items: start;
    flex-direction: column;
  }

  .why-heading > strong { white-space: normal; }
}

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

  * {
    transition: none !important;
  }
}
