:root {
  color-scheme: light;
  --paper: #f2efe7;
  --ink: #17211d;
  --muted: #65716b;
  --line: #c9cec5;
  --panel: #faf8f2;
  --green: #17694d;
  --green-soft: #dceadf;
  --orange: #b6542f;
  --orange-soft: #f2dfd5;
  --blue: #315f7d;
  --gold: #ad7b21;
  --red: #9d322e;
  --display: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); }
button, input, select { font: inherit; }
a { color: inherit; }

.site-header,
main,
.site-footer {
  width: min(1280px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  min-height: 78px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--ink);
}

.brand {
  width: max-content;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.04em;
}
.brand span { color: var(--orange); }
.baseline-label { color: var(--muted); font-size: 0.76rem; letter-spacing: 0.03em; text-align: center; }
.service-status { justify-self: end; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.76rem; text-transform: capitalize; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.service-status.online .status-dot { background: var(--green); }

main { padding-bottom: 48px; }
.kicker { margin: 0 0 12px; color: var(--orange); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }

.verdict-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 330px);
  gap: 48px;
  padding: clamp(44px, 6vw, 76px) 0 40px;
  border-bottom: 1px solid var(--line);
}
.verdict-copy { max-width: 870px; }
.verdict-line { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.verdict-badge { padding: 6px 10px; border: 1px solid currentColor; border-radius: 99px; color: var(--gold); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
body[data-verdict="beneficial"] .verdict-badge { color: var(--green); }
body[data-verdict="harmful"] .verdict-badge { color: var(--red); }
.scenario-summary { color: var(--muted); font-size: 0.78rem; }
h1, h2 { font-family: var(--display); font-weight: 500; }
h1 { max-width: 900px; margin: 0; font-size: clamp(2.9rem, 6.5vw, 6.7rem); line-height: 0.96; letter-spacing: -0.055em; }
.verdict-explanation { max-width: 760px; margin: 28px 0 0; color: #45524c; font-size: clamp(1rem, 1.5vw, 1.25rem); line-height: 1.6; }
.hero-question { align-self: end; padding: 22px 0 5px 24px; border-left: 4px solid var(--orange); }
.hero-question span { display: block; margin-bottom: 9px; color: var(--muted); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.hero-question strong { font-family: var(--display); font-size: 1.25rem; line-height: 1.35; }
.hero-question small { display: block; margin-top: 14px; color: var(--muted); font-size: 0.72rem; line-height: 1.5; }

.headline-metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--ink); }
.headline-metrics article { padding: 28px 28px 30px 0; }
.headline-metrics article + article { padding-left: 28px; border-left: 1px solid var(--line); }
.headline-metrics span, .headline-metrics small { display: block; color: var(--muted); }
.headline-metrics span { font-size: 0.74rem; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
.headline-metrics strong { display: block; margin: 12px 0 4px; font-family: var(--display); font-size: clamp(2.4rem, 4vw, 4.7rem); font-weight: 500; line-height: 1; letter-spacing: -0.05em; }
.headline-metrics small { font-size: 0.75rem; }
.headline-metrics .term-label { position: relative; display: inline-flex; align-items: center; gap: 6px; overflow: visible; }
.info-button {
  width: 18px; height: 18px; padding: 0; display: inline-grid; flex: 0 0 auto; place-items: center;
  border: 1px solid currentColor; border-radius: 50%; background: transparent; color: var(--muted);
  cursor: help; font-family: var(--display); font-size: 0.72rem; font-weight: 700; line-height: 1; text-transform: none;
}
.info-button:hover, .info-button:focus-visible, .info-button[aria-expanded="true"] { color: var(--green); }
.info-button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.headline-metrics .info-popover {
  position: absolute; z-index: 20; top: calc(100% + 10px); left: 0; width: min(300px, calc(100vw - 32px));
  padding: 12px 14px; display: none; border: 1px solid var(--ink); background: var(--panel); color: var(--ink);
  box-shadow: 4px 4px 0 rgba(23, 33, 29, 0.12); font-size: 0.72rem; font-weight: 500; letter-spacing: 0;
  line-height: 1.5; text-align: left; text-transform: none;
}
.headline-metrics article:last-child .info-popover { right: 0; left: auto; }
.info-button:hover + .info-popover,
.info-button:focus-visible + .info-popover,
.info-button[aria-expanded="true"] + .info-popover { display: block; }

.story-section, .causal-section, .theory-section, .stress-section, .validation-section, .verdict-reasons, .sources, .winners-section, .sensitivity-section { padding: 60px 0; border-bottom: 1px solid var(--ink); }
.section-intro { display: grid; grid-template-columns: 0.65fr 1.5fr 1fr; gap: 30px; align-items: start; margin-bottom: 38px; }
.section-intro .kicker { margin-top: 8px; }
.section-intro h2 { margin: 0; font-size: clamp(2rem, 4vw, 4.15rem); line-height: 1.02; letter-spacing: -0.045em; }
.section-intro > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.55; }
.section-intro.compact { grid-template-columns: 0.65fr 2.5fr; }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
figure { min-width: 0; margin: 0; padding-top: 18px; border-top: 1px solid var(--ink); }
figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; }
figcaption strong { font-family: var(--display); font-size: 1.35rem; }
figcaption span { color: var(--muted); font-size: 0.72rem; text-align: right; }
.chart { min-height: 290px; margin-top: 16px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.grid-line { stroke: #d8d9d2; stroke-width: 1; }
.baseline-line { stroke: #8d968f; stroke-width: 1; stroke-dasharray: 4 5; }
.axis-label, .series-value { fill: var(--muted); font-family: var(--sans); font-size: 11px; }
.data-line { stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.data-point { stroke-width: 2; }
.series-label { font-family: var(--sans); font-size: 11px; font-weight: 800; }
.series-a { stroke: var(--green); fill: var(--green); }
.series-b { stroke: var(--orange); fill: var(--orange); }
.series-c { stroke: var(--blue); fill: var(--blue); }
.series-d { stroke: var(--gold); fill: var(--gold); }
text.series-a { stroke: none; fill: var(--green); }
text.series-b { stroke: none; fill: var(--orange); }
text.series-c { stroke: none; fill: var(--blue); }
text.series-d { stroke: none; fill: var(--gold); }

.causal-flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid var(--ink); }
.causal-flow li { position: relative; min-width: 0; padding: 22px 24px 28px 0; display: flex; gap: 14px; }
.causal-flow li + li { padding-left: 24px; border-left: 1px solid var(--line); }
.causal-flow li:not(:last-child)::after { content: "→"; position: absolute; right: -10px; top: 50%; z-index: 1; width: 20px; height: 20px; display: grid; place-items: center; background: var(--paper); color: var(--orange); }
.step-number { color: var(--orange); font-size: 0.68rem; font-weight: 800; }
.causal-flow div > span, .causal-flow small { display: block; color: var(--muted); }
.causal-flow div > span { font-size: 0.72rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.06em; }
.causal-flow strong { display: block; margin: 12px 0 7px; font-family: var(--display); font-size: clamp(1.35rem, 2vw, 2.1rem); line-height: 1.05; overflow-wrap: anywhere; }
.causal-flow small { font-size: 0.72rem; line-height: 1.45; }
.plain-language-answer { display: flex; gap: 18px; margin-top: 22px; padding: 18px 22px; background: var(--green-soft); color: #244236; font-size: 0.88rem; line-height: 1.5; }
.plain-language-answer strong { white-space: nowrap; }

.theory-intro { grid-template-columns: 0.65fr 2.5fr; }
.theory-intro > div > p { max-width: 780px; margin: 18px 0 0; color: var(--muted); line-height: 1.6; }
.theory-title-line { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.theory-title-line h2 { margin: 0; }
.theory-badge { margin-top: 8px; padding: 6px 9px; border: 1px solid currentColor; border-radius: 99px; color: var(--gold); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.theory-badge[data-rating="active"] { color: var(--orange); }
.theory-badge[data-rating="inactive"] { color: var(--green); }
.theory-chain { display: grid; grid-template-columns: repeat(5, 1fr); margin: 0 0 34px; padding: 0; list-style: none; border-block: 1px solid var(--ink); }
.theory-chain li { min-width: 0; padding: 20px 18px 22px 0; }
.theory-chain li + li { padding-left: 18px; border-left: 1px solid var(--line); }
.theory-chain span, .theory-chain small { display: block; color: var(--muted); }
.theory-chain span { font-size: 0.63rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
.theory-chain strong { display: block; margin: 12px 0 6px; font-family: var(--display); font-size: clamp(1.25rem, 2vw, 2rem); line-height: 1.05; overflow-wrap: anywhere; }
.theory-chain small { font-size: 0.68rem; line-height: 1.4; }
.theory-visual { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 40px; align-items: stretch; }
.theory-reading { display: flex; flex-direction: column; justify-content: center; padding-left: 26px; border-left: 4px solid var(--orange); }
.theory-reading span { color: var(--orange); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.theory-reading p { margin: 15px 0 0; font-size: 0.82rem; line-height: 1.55; }
.theory-reading p:last-child { color: var(--muted); }

.stress-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; align-items: stretch; }
.stress-table-wrap { min-width: 0; }
.stress-axis-guide { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 14px; padding: 14px 0; border-block: 1px solid var(--line); }
.stress-axis-guide strong, .stress-axis-guide span { display: block; }
.stress-axis-guide strong { margin-bottom: 5px; font-size: 0.68rem; letter-spacing: 0.05em; text-transform: uppercase; }
.stress-axis-guide span { color: var(--muted); font-size: 0.72rem; line-height: 1.45; }
.stress-table { width: 100%; border-collapse: separate; border-spacing: 5px; table-layout: fixed; }
.stress-table th { padding: 9px 5px; color: var(--muted); font-size: 0.68rem; font-weight: 750; }
.stress-table thead th { vertical-align: bottom; }
.stress-table tbody th { color: var(--ink); font-size: 0.78rem; }
.stress-table td { padding: clamp(11px, 2vw, 20px) 4px; text-align: center; font-family: var(--display); font-size: clamp(0.85rem, 1.5vw, 1.25rem); font-weight: 700; }
.stress-table .stable, .stress-legend .stable { background: #dce8da; }
.stress-table .elevated, .stress-legend .elevated { background: #ede3b8; }
.stress-table .high, .stress-legend .high { background: #efc694; }
.stress-table .crisis, .stress-legend .crisis { background: #e99b79; }
.stress-table .extreme, .stress-legend .extreme { background: #c75f52; color: #fff; }
.stress-table .hyperinflation, .stress-legend .hyperinflation { background: #6f1d2c; color: #fff; }
.stress-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 5px 0; }
.stress-legend span { padding: 5px 7px; font-size: 0.62rem; }
.threshold-note { display: flex; flex-direction: column; justify-content: center; padding: 28px; border: 1px solid var(--ink); }
.threshold-note > span { color: var(--orange); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.threshold-note > strong { margin: 14px 0 18px; font-family: var(--display); font-size: 2.15rem; line-height: 1; }
.threshold-note p { margin: 0 0 18px; line-height: 1.5; }
.threshold-note small { color: var(--muted); line-height: 1.5; }

.validation-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.validation-chart-wrap { min-width: 0; }
.validation-caption { margin: 8px 0 0; color: var(--muted); font-size: 0.72rem; }
.validation-notes { display: flex; flex-direction: column; gap: 22px; }
.validation-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.validation-metrics > div { padding: 18px; border: 1px solid var(--ink); }
.validation-metrics span { display: block; color: var(--orange); font-size: 0.64rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.validation-metrics strong { display: block; margin: 8px 0 4px; font-family: var(--display); font-size: 1.7rem; line-height: 1; }
.validation-metrics small { color: var(--muted); font-size: 0.68rem; line-height: 1.4; }
.validation-table { width: 100%; border-collapse: collapse; }
.validation-table th, .validation-table td { padding: 8px 6px; text-align: right; font-size: 0.76rem; border-bottom: 1px solid var(--line); }
.validation-table th:first-child, .validation-table td:first-child { text-align: left; }
.validation-table thead th { color: var(--muted); font-weight: 750; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; }
.validation-table td { font-family: var(--display); }
.validation-table tr.out-of-band td { color: var(--orange); }
.validation-caveats span { display: block; margin-bottom: 8px; color: var(--orange); font-size: 0.64rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.validation-caveats ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.74rem; }
.validation-caveats li { margin: 6px 0; line-height: 1.5; }
.validation-sources { display: grid; gap: 4px; border-top: 1px solid var(--line); padding-top: 12px; }
.validation-sources a { display: grid; padding: 6px 0; text-decoration: none; }
.validation-sources strong { font-family: var(--display); font-size: 0.9rem; }
.validation-sources small { color: var(--muted); font-size: 0.66rem; }
.validation-sources a:hover strong { color: var(--green); }

.reason-grid { display: grid; grid-template-columns: 1fr 1fr; }
.reason-grid article { padding: 30px 34px; }
.benefit-reason { background: var(--green-soft); }
.risk-reason { background: var(--orange-soft); }
.reason-grid span { display: block; margin-bottom: 15px; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.reason-grid strong { font-family: var(--display); font-size: clamp(1.5rem, 2.5vw, 2.4rem); font-weight: 500; line-height: 1.12; }
.reason-grid p { max-width: 540px; margin: 18px 0 0; line-height: 1.6; }
.debt-answer { margin: 22px 0 0; padding-left: 20px; border-left: 4px solid var(--ink); line-height: 1.6; }

.caveat-link { color: var(--green); text-decoration: underline; text-underline-offset: 2px; }
.caveat-link:hover { color: var(--orange); }

.winners-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.winner-card { display: flex; flex-direction: column; padding: 22px; border: 1px solid var(--line); background: var(--panel); border-top: 4px solid var(--muted); }
.winner-card[data-rating="better-off"] { border-top-color: var(--green); }
.winner-card[data-rating="worse-off"] { border-top-color: var(--red); }
.winner-card[data-rating="mixed"] { border-top-color: var(--gold); }
.winner-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.winner-head h3 { margin: 0; font-family: var(--display); font-size: 1.3rem; font-weight: 500; }
.winner-badge { padding: 4px 9px; border-radius: 99px; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.winner-card[data-rating="better-off"] .winner-badge { background: var(--green-soft); color: var(--green); }
.winner-card[data-rating="worse-off"] .winner-badge { background: var(--orange-soft); color: var(--red); }
.winner-card[data-rating="mixed"] .winner-badge { background: #ede3b8; color: var(--gold); }
.diverging-bar { margin: 20px 0 14px; }
.bar-track { position: relative; height: 12px; background: #e7e4da; border: 1px solid var(--line); }
.bar-track::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink); }
.bar-fill { position: absolute; top: 0; bottom: 0; }
.bar-fill.positive { background: var(--green); }
.bar-fill.negative { background: var(--red); }
.winner-value { font-family: var(--display); font-size: clamp(1.4rem, 2vw, 1.9rem); font-weight: 500; line-height: 1.05; }
.winner-drivers { margin: 12px 0 0; color: var(--muted); font-size: 0.72rem; line-height: 1.5; }

.sensitivity-flip { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px 18px; margin-bottom: 30px; padding: 16px 22px; background: var(--green-soft); color: #244236; }
.sensitivity-flip span { color: var(--green); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.sensitivity-flip p { grid-column: 2 / 3; margin: 0; font-family: var(--display); font-size: clamp(1.05rem, 1.6vw, 1.4rem); line-height: 1.3; }
.sensitivity-flip .link-button { justify-self: end; }
.sensitivity-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; align-items: start; }
.tornado-chart { min-height: 320px; }
.tornado-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.tornado-bar { cursor: pointer; }
.tornado-bar rect.bar-beneficial { fill: var(--green); }
.tornado-bar rect.bar-harmful { fill: var(--orange); }
.tornado-bar rect.bar-flat { fill: var(--muted); }
.tornado-bar:hover rect { fill: var(--ink); }
.tornado-bar:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.tornado-label { fill: var(--ink); font-family: var(--sans); font-size: 12px; font-weight: 600; }
.tornado-value { fill: var(--muted); font-family: var(--sans); font-size: 11px; }
.tornado-center { stroke: var(--ink); stroke-width: 1; }
.tornado-axis { fill: var(--muted); font-family: var(--sans); font-size: 11px; }
.sensitivity-reading { padding: 22px 24px; border: 1px solid var(--line); background: var(--panel); }
.sensitivity-reading span { display: block; margin-bottom: 12px; color: var(--muted); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.sensitivity-reading p { margin: 0 0 14px; color: var(--muted); font-size: 0.84rem; line-height: 1.6; }
.sensitivity-note { color: var(--ink); font-weight: 600; }
.uncertainty-panel { margin-top: 46px; padding: 30px; border: 1px solid var(--ink); background: var(--panel); }
.uncertainty-intro { display: grid; grid-template-columns: 1.35fr 1fr; gap: 42px; align-items: start; }
.uncertainty-intro > div > span { display: block; margin-bottom: 10px; color: var(--green); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.uncertainty-intro h3 { margin: 0 0 12px; font-family: var(--display); font-size: clamp(1.6rem, 2.5vw, 2.5rem); font-weight: 500; line-height: 1.08; }
.uncertainty-intro p { max-width: 70ch; margin: 0; color: var(--muted); font-size: 0.86rem; line-height: 1.65; }
.uncertainty-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.uncertainty-controls label { display: grid; gap: 6px; color: var(--muted); font-size: 0.7rem; font-weight: 700; }
.uncertainty-controls select, .uncertainty-controls input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-weight: 500; }
.uncertainty-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; }
.uncertainty-progress { display: grid; grid-template-columns: minmax(160px, 0.6fr) 1fr; gap: 18px; align-items: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.uncertainty-progress progress { width: 100%; accent-color: var(--green); }
.uncertainty-progress p, .uncertainty-note { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }
.uncertainty-results { margin-top: 26px; }
.verdict-frequency { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 28px; }
.verdict-frequency article { padding: 16px; border: 1px solid var(--line); }
.verdict-frequency span { display: block; color: var(--muted); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.verdict-frequency strong { display: block; margin-top: 6px; font-family: var(--display); font-size: 1.8rem; font-weight: 500; }
.uncertainty-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 36px; }
.uncertainty-grid h4 { margin: 0 0 12px; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.uncertainty-grid h4:not(:first-child) { margin-top: 26px; }
.uncertainty-table-wrap { overflow-x: auto; }
.uncertainty-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.uncertainty-table th, .uncertainty-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.uncertainty-table th:first-child, .uncertainty-table td:first-child { text-align: left; white-space: normal; }
.uncertainty-list { margin: 0; padding-left: 22px; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }
.uncertainty-list li { margin-bottom: 7px; padding-left: 4px; }
.uncertainty-list strong { color: var(--ink); }
.uncertainty-population-effect { margin: 14px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }
.uncertainty-note { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
/* While a fresh sweep runs, the rendered bars/button describe the old scenario —
   dim them and block interaction so a click can't apply a now-stale value. */
.sensitivity-section.is-stale .tornado-chart,
.sensitivity-section.is-stale .sensitivity-flip { opacity: 0.45; pointer-events: none; }

.persona-card { display: grid; grid-template-columns: 1fr 1fr; gap: 30px 40px; margin-top: 40px; padding: 34px; border: 1px solid var(--ink); background: var(--green-soft); }
.persona-intro { grid-column: 1 / -1; }
.persona-intro h3 { margin: 6px 0 0; font-family: var(--display); font-size: clamp(1.5rem, 2.5vw, 2.2rem); font-weight: 500; line-height: 1.1; }
.persona-intro p { margin: 12px 0 0; color: #33463c; font-size: 0.84rem; line-height: 1.55; }
#persona-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-content: start; }
#persona-form label { color: #2c3d34; }
#persona-form label:first-child { grid-column: 1 / -1; }
.persona-result { align-self: start; padding: 22px 24px; background: var(--panel); border-left: 4px solid var(--muted); }
.persona-result[data-rating="better-off"] { border-left-color: var(--green); }
.persona-result[data-rating="worse-off"] { border-left-color: var(--red); }
.persona-result[data-rating="mixed"] { border-left-color: var(--gold); }
.persona-result strong { display: block; font-family: var(--display); font-size: 1.2rem; }
.persona-result span { display: block; margin-top: 12px; font-size: 0.86rem; line-height: 1.6; }
.persona-result small { display: block; margin-top: 14px; color: var(--muted); font-size: 0.72rem; line-height: 1.5; }

.model-details { border-bottom: 1px solid var(--ink); }
.model-details > summary { list-style: none; display: flex; justify-content: space-between; align-items: baseline; gap: 24px; padding: 25px 0; cursor: pointer; }
.model-details > summary::-webkit-details-marker { display: none; }
.model-details > summary span { font-family: var(--display); font-size: 1.45rem; }
.model-details > summary small { color: var(--muted); }
.model-details[open] > summary { border-bottom: 1px solid var(--line); }

.scenario-anchor { position: absolute; width: 1px; height: 1px; overflow: hidden; }
body.scenario-drawer-open { position: fixed; inset: 0; width: 100%; overflow: hidden; }
.scenario-drawer-trigger {
  position: fixed; right: max(24px, env(safe-area-inset-right)); bottom: max(24px, env(safe-area-inset-bottom)); z-index: 40;
  display: grid; gap: 2px; min-width: 150px; padding: 13px 18px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper); box-shadow: 0 8px 28px rgba(23, 33, 29, 0.24); cursor: pointer; text-align: left;
}
.scenario-drawer-trigger:hover { border-color: var(--green); background: var(--green); }
.scenario-drawer-trigger:focus-visible { outline: 3px solid rgba(23, 105, 77, 0.32); outline-offset: 3px; }
.scenario-drawer-trigger-label { font-size: 0.82rem; font-weight: 800; }
.scenario-drawer-trigger-status { color: #cde5d4; font-size: 0.64rem; font-weight: 700; }
.scenario-drawer-trigger.is-recalculating { border-color: var(--green); }
.scenario-drawer-trigger.has-recalc-error { border-color: var(--red); background: var(--red); }
body[data-view="story"] .scenario-drawer-trigger { display: none; }

.scenario-drawer {
  position: fixed; inset: 0 0 0 auto; width: min(560px, calc(100vw - 48px)); max-width: none; height: 100dvh; max-height: none;
  margin: 0; padding: 0; overflow: hidden; border: 0; border-left: 1px solid var(--ink); background: var(--paper); color: var(--ink);
  opacity: 0; transform: translateX(100%); transition: opacity 0.18s ease, transform 0.18s ease;
}
.scenario-drawer[open] { opacity: 1; transform: translateX(0); }
.scenario-drawer::backdrop { background: rgba(23, 33, 29, 0.42); opacity: 1; transition: opacity 0.18s ease; }
@starting-style {
  .scenario-drawer[open] { opacity: 0; transform: translateX(100%); }
  .scenario-drawer[open]::backdrop { opacity: 0; }
}
#scenario-form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: 100%; height: 100%; padding: 0; }
.scenario-drawer-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 22px 24px 18px; border-bottom: 1px solid var(--ink); background: var(--paper); }
.scenario-drawer-heading { min-width: 0; }
.scenario-drawer-heading .kicker { margin-bottom: 5px; }
.scenario-drawer-heading h2 { margin: 0; font-size: 1.8rem; line-height: 1; letter-spacing: -0.035em; }
#scenario-drawer-summary { margin: 8px 0 0; color: var(--muted); font-size: 0.72rem; line-height: 1.35; }
.drawer-action-feedback { margin: 10px 0 0; padding: 8px 10px; border-left: 3px solid var(--green); background: var(--green-soft); color: var(--ink); font-size: 0.7rem; font-weight: 700; line-height: 1.35; }
.drawer-action-feedback[hidden] { display: none; }
.drawer-action-feedback.error { border-left-color: var(--red); background: #f8e5df; color: var(--red); }
.scenario-drawer-header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.scenario-drawer-header-actions .preset-share-button { padding: 8px 10px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); cursor: pointer; font-size: 0.68rem; font-weight: 750; }
.scenario-drawer-header-actions .preset-share-button:hover { border-color: var(--green); background: var(--green); }
.scenario-drawer-close { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; font-size: 1.35rem; line-height: 1; }
.scenario-drawer-close:hover { border-color: var(--red); color: var(--red); }
.scenario-drawer-body { min-height: 0; padding: 4px 24px 28px; overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; scrollbar-gutter: stable; }
.assumption-guide { margin: 14px 0 0; color: var(--muted); font-size: 0.72rem; line-height: 1.5; }
.scenario-drawer-body > fieldset { padding: 22px 0; border-bottom: 1px solid var(--line); }
.scenario-drawer-body > fieldset:not(.wealth-tax-fieldset) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.scenario-drawer-body > fieldset > legend { grid-column: 1 / -1; }
.policy-presets { padding: 18px 0; border-bottom: 1px solid var(--line); }
.policy-presets, .behavior-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.policy-presets span, .behavior-presets span { margin-right: 6px; color: var(--muted); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.policy-presets button, .behavior-presets button { padding: 8px 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; font-size: 0.7rem; font-weight: 700; }
.policy-presets button:hover:not(:disabled), .behavior-presets button:hover:not(:disabled) { border-color: var(--green); color: var(--green); }
.policy-presets button[aria-pressed="true"], .behavior-presets button[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: var(--paper); box-shadow: inset 0 0 0 1px var(--green); }
.policy-presets button[aria-pressed="true"]:hover, .behavior-presets button[aria-pressed="true"]:hover { color: var(--paper); }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.wealth-tax-controls, .split-fieldset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; align-content: start; }
.behavior-fieldset { padding: 0 0 20px; }
.behavior-presets { margin-bottom: 4px; }
.behavior-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.behavior-grid label { margin-top: 0; }
.field-hint { color: var(--muted); font-size: 0.66rem; font-weight: 500; line-height: 1.45; }
legend { margin-bottom: 12px; color: var(--orange); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
label { display: grid; gap: 6px; margin-top: 11px; color: var(--muted); font-size: 0.7rem; font-weight: 700; }
label.is-disabled { opacity: 0.45; }
input, select { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid #aeb6ad; border-radius: 0; background: var(--panel); color: var(--ink); outline: none; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(23, 105, 77, 0.15); }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: 0.5; }
input:disabled, select:disabled { background: color-mix(in srgb, var(--line) 48%, var(--panel)); color: var(--muted); }
input.scenario-focus-target, select.scenario-focus-target { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(182, 84, 47, 0.2); }
.scenario-control-section { border-bottom: 1px solid var(--line); }
.scenario-control-section > summary { list-style: none; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 18px 0; color: var(--ink); cursor: pointer; }
.scenario-control-section > summary::-webkit-details-marker { display: none; }
.scenario-control-section > summary::after { content: "+"; color: var(--orange); font-size: 1rem; font-weight: 800; }
.scenario-control-section[open] > summary::after { content: "−"; }
.scenario-control-section > summary span { font-family: var(--display); font-size: 1.05rem; }
.scenario-control-section > summary small { margin-left: auto; color: var(--muted); font-size: 0.66rem; text-align: right; }
.scenario-control-section .split-fieldset { padding-bottom: 20px; }
.advanced-controls > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-actions { display: grid; gap: 12px; padding: 15px 24px max(15px, env(safe-area-inset-bottom)); border-top: 1px solid var(--ink); background: var(--paper); }
.form-action-status { display: flex; align-items: center; min-height: 18px; gap: 10px; }
.form-action-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-action-buttons .run-button { margin-left: auto; }
.run-button { padding: 12px 18px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); cursor: pointer; font-weight: 750; }
.run-button:hover { background: var(--green); border-color: var(--green); }
.run-button:disabled { opacity: 0.55; cursor: wait; }
.form-status { min-width: 0; margin: 0; overflow: hidden; color: var(--muted); font-size: 0.7rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.form-status.error { color: var(--red); }

.policy-presets-real button { border-style: dashed; }
.policy-presets-real button:hover { border-style: solid; }
.policy-presets-real button[aria-pressed="true"] { border-style: solid; }
.policy-presets-diagnostic { background: color-mix(in srgb, var(--orange) 8%, transparent); padding-inline: 10px; }
.policy-presets-diagnostic button { border-color: var(--orange); }
.preset-reference-link { margin-left: auto; color: var(--orange); font-size: 0.7rem; font-weight: 750; text-decoration: none; }
.preset-reference-link:hover { color: var(--green); }

/* Audited definition of a named real-world proposal (issue #40): filing unit,
   schedule, spending linkage, unmodeled gaps, and model-vs-benchmark revenue. */
.preset-definition { padding: 16px 0 4px; border-bottom: 1px solid var(--line); font-size: 0.78rem; }
.preset-def-title { margin: 0 0 10px; font-family: var(--display); font-weight: 500; font-size: 1rem; }
.preset-def-section { margin: 0 0 12px; }
.preset-def-heading { margin: 0 0 4px; color: var(--muted); font-size: 0.64rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.preset-def-line { margin: 0 0 4px; line-height: 1.45; }
.preset-def-muted { color: var(--muted); font-size: 0.72rem; }
.preset-badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 0.64rem; font-weight: 800; letter-spacing: 0.02em; border: 1px solid currentColor; }
.preset-badge-scope { color: var(--blue); margin-bottom: 6px; }
.preset-badge-low { color: var(--orange); }
.preset-badge-high { color: var(--red); }
.preset-badge-amb { color: var(--gold); }
.preset-unmodeled { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.preset-unmodeled-item { line-height: 1.4; }
.preset-unmodeled-note { color: var(--muted); }
.preset-benchmarks { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 0.72rem; }
.preset-benchmarks th { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.62rem; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 800; }
.preset-benchmarks td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.preset-benchmarks a { color: var(--orange); text-decoration: none; font-weight: 700; }
.preset-benchmarks a:hover { color: var(--green); }
.preset-benchmark-meta { display: block; color: var(--muted); font-size: 0.62rem; }
.preset-benchmark-published, .preset-benchmark-model, .preset-benchmark-deviation { font-variant-numeric: tabular-nums; white-space: nowrap; }

.bracket-editor { margin-top: 14px; padding: 12px; border: 1px solid var(--line); background: var(--panel); }
.bracket-editor-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.bracket-editor-head span { color: var(--orange); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.bracket-editor-head small { color: var(--muted); font-size: 0.68rem; }
.bracket-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 10px 0; }
.bracket-rows:empty { margin: 0; }
.bracket-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 0.72fr) auto auto; align-items: center; gap: 6px; min-width: 0; }
.bracket-row span { color: var(--muted); font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.bracket-row input { width: 100%; min-width: 0; font-variant-numeric: tabular-nums; }
.bracket-remove { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); background: var(--paper); color: var(--muted); cursor: pointer; font-size: 1rem; font-weight: 700; line-height: 1; }
.bracket-remove:hover { border-color: var(--red); color: var(--red); }
.bracket-actions { display: flex; gap: 8px; }
.bracket-actions button { padding: 8px 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; font-size: 0.68rem; font-weight: 700; }
.bracket-actions button:hover:not(:disabled) { border-color: var(--green); color: var(--green); }
.bracket-actions button:disabled { opacity: 0.45; cursor: default; }
.bracket-error { margin: 10px 0 0; color: var(--red); font-size: 0.72rem; font-weight: 700; }

.policy-references { padding: 60px 0; border-bottom: 1px solid var(--ink); }
.policy-references h2 { margin: 0 0 16px; font-size: clamp(1.8rem, 3.4vw, 3.2rem); letter-spacing: -0.03em; }
.policy-references-intro { max-width: 62ch; margin: 0 0 32px; color: var(--muted); }
.reference-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.reference-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; border: 1px solid var(--ink); background: var(--panel); }
.reference-card[data-kind="proposal"] { border-left: 4px solid var(--green); }
.reference-card[data-kind="history"] { border-left: 4px solid var(--orange); }
.reference-card h3 { margin: 0; font-family: var(--display); font-size: 1.05rem; }
.reference-card p { margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.reference-card a { margin-top: auto; color: var(--orange); font-size: 0.72rem; font-weight: 750; text-decoration: none; }
.reference-card a:hover { color: var(--green); }

.toast-container { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { padding: 12px 18px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-size: 0.82rem; font-weight: 650; box-shadow: 0 8px 24px rgba(23, 33, 29, 0.22); opacity: 0; transform: translateY(10px); transition: opacity 0.24s ease, transform 0.24s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); border-color: var(--red); }

.model-details { padding-bottom: 0; }
.model-details[open] { padding-bottom: 40px; }
.population-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin: 28px 0; border-block: 1px solid var(--line); }
.population-strip div { padding: 18px 20px 18px 0; }
.population-strip div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.population-strip div:nth-child(4) { padding-left: 0; border-left: 0; }
.population-strip span { display: block; color: var(--muted); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; }
.population-strip strong { display: block; margin-top: 7px; font-family: var(--display); font-size: 1.4rem; }
.strategy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 26px; }
.strategy-card { padding: 20px; border: 1px solid var(--line); background: var(--panel); }
.strategy-card h3 { margin: 0 0 20px; font-family: var(--display); font-size: 1.2rem; }
.strategy-primary { display: block; font-family: var(--display); font-size: 2rem; font-weight: 500; }
.strategy-card > span { color: var(--muted); font-size: 0.68rem; }
.strategy-card dl { display: grid; grid-template-columns: 1fr auto; gap: 7px 15px; margin: 20px 0 0; font-size: 0.74rem; }
.strategy-card dt { color: var(--muted); }
.strategy-card dd { margin: 0; font-weight: 750; }
.detail-table { margin-top: 28px; }
.detail-table h3, .caveats h3 { margin: 0 0 12px; font-family: var(--display); font-size: 1.25rem; }
.detail-explainer { max-width: 760px; margin: -4px 0 12px; color: var(--muted); font-size: 0.72rem; line-height: 1.5; }
.detail-heading { display: flex; justify-content: space-between; align-items: end; }
.detail-heading label { display: flex; align-items: center; gap: 8px; margin: 0; }
.detail-heading select { width: auto; }
.table-scroll { overflow-x: auto; }
.detail-table table { width: 100%; border-collapse: collapse; font-size: 0.74rem; }
.detail-table th, .detail-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.detail-table th:first-child, .detail-table td:first-child { text-align: left; }
.detail-table th { color: var(--muted); font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.06em; }
.caveats { margin-top: 28px; color: var(--muted); font-size: 0.76rem; }
.caveats li { margin: 7px 0; line-height: 1.5; }

.sources { border-bottom: 0; }
.sources h2 { margin: 0 0 30px; font-size: clamp(2rem, 4vw, 4rem); letter-spacing: -0.04em; }
#source-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; border-top: 1px solid var(--ink); }
#source-list a { display: grid; grid-template-columns: 30px 1fr; gap: 3px 10px; padding: 16px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
#source-list a > span { grid-row: 1 / 3; color: var(--orange); font-size: 0.65rem; font-weight: 800; }
#source-list strong { font-family: var(--display); font-size: 1rem; }
#source-list small { color: var(--muted); font-size: 0.68rem; }
#source-list a:hover strong { color: var(--green); }

.site-footer { display: flex; justify-content: space-between; gap: 24px; padding: 24px 0 38px; border-top: 1px solid var(--ink); color: var(--muted); font-size: 0.7rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
.site-footer a:hover { color: var(--ink); }

/* Story mode ------------------------------------------------------------- */
#story { display: none; }
body[data-view="story"] #story { display: block; }
body[data-view="story"] #dashboard-view { display: none; }

.story { padding: 24px 0 40px; }
.story-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--ink); }
.story-head .kicker { margin: 0; }
.story-progress { display: flex; justify-content: center; gap: 9px; }
.story-dot { width: 11px; height: 11px; padding: 0; border: 1px solid var(--muted); border-radius: 50%; background: transparent; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.story-dot:hover { border-color: var(--green); }
.story-dot[aria-current="step"] { background: var(--orange); border-color: var(--orange); }
.story-skip { justify-self: end; padding: 8px 12px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; font-size: 0.72rem; font-weight: 750; }
.story-skip:hover { border-color: var(--green); color: var(--green); }

.story-stage { display: grid; gap: 18px; padding: clamp(20px, 3vw, 36px) 0 24px; transition: opacity 0.15s; }
.story-stage.is-busy { opacity: 0.55; }
.story-copy { max-width: 900px; }
.story-copy .kicker { margin-bottom: 14px; }
.story-copy h1 { font-size: clamp(2.3rem, 5vw, 4.6rem); line-height: 1; letter-spacing: -0.045em; }
.story-body { max-width: 760px; margin: 14px 0 0; color: #45524c; font-size: clamp(1rem, 1.4vw, 1.2rem); line-height: 1.55; }

.story-presets { display: flex; flex-wrap: wrap; gap: 10px; }
.story-presets button { padding: 13px 16px; border: 1px solid var(--ink); background: var(--panel); color: var(--ink); cursor: pointer; font-size: 0.82rem; font-weight: 750; }
.story-presets button:hover:not(:disabled) { background: var(--green); border-color: var(--green); color: var(--paper); }
.story-presets button[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: var(--paper); box-shadow: inset 0 0 0 2px var(--paper); }

.story-dial { display: grid; gap: 8px; max-width: 620px; margin: 0; color: var(--ink); }
.story-dial-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.story-dial-head span { color: var(--muted); font-size: 0.74rem; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; }
.story-dial-head strong { font-family: var(--display); font-size: 1.7rem; }
.story-dial input[type="range"] { width: 100%; height: 6px; margin: 0; appearance: none; -webkit-appearance: none; background: var(--line); border-radius: 99px; outline: none; }
.story-dial input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--green); border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--green); cursor: pointer; }
.story-dial input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--green); border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--green); cursor: pointer; }
.story-dial input[type="range"]:focus-visible { box-shadow: 0 0 0 3px rgba(23, 105, 77, 0.2); }

.story-viz { width: min(100%, 720px); min-width: 0; }
.story-viz .chart { min-height: 0; margin-top: 8px; }
.strip-chart svg, .story-viz .chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.strip-bar { fill: #c8cec6; }
.strip-bar.taxed { fill: var(--orange); }
.story-note { margin: 12px 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }

.payment-split { display: flex; width: 100%; height: 62px; margin-top: 10px; overflow: hidden; border: 1px solid var(--ink); }
.split-seg { display: flex; align-items: center; justify-content: center; min-width: 0; padding: 0 8px; color: var(--paper); font-size: 0.78rem; font-weight: 750; white-space: nowrap; overflow: hidden; }
.split-seg.seg-cash { background: var(--blue); }
.split-seg.seg-borrow { background: var(--orange); }
.split-seg.seg-sell { background: var(--gold); }

.story-readout { max-width: 760px; margin: 0; padding: 12px 16px; background: var(--green-soft); color: #244236; font-size: 0.95rem; font-weight: 600; line-height: 1.5; }
.story-error { max-width: 760px; margin: 0; padding: 14px 20px; background: var(--orange-soft); color: var(--red); font-size: 0.9rem; font-weight: 650; line-height: 1.5; }
.story-error[hidden] { display: none; }

.story-verdict { display: grid; gap: 16px; padding: 26px 30px; border: 1px solid var(--ink); background: var(--panel); }
.story-verdict .verdict-badge { width: max-content; }
.story-verdict strong { font-family: var(--display); font-size: clamp(1.6rem, 3vw, 2.8rem); font-weight: 500; line-height: 1.08; }
.story-enter { width: max-content; }

.story-nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 16px; border-top: 1px solid var(--ink); }
.story-nav button { padding: 12px 18px; border: 1px solid var(--ink); background: var(--panel); color: var(--ink); cursor: pointer; font-weight: 750; }
.story-nav button:hover:not(:disabled) { background: var(--green); border-color: var(--green); color: var(--paper); }
.story-nav button:disabled { opacity: 0.4; cursor: default; }
.story-forward[hidden] { display: none; }
.story-counter { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.04em; }

.story-launch { display: block; width: 100%; margin: 22px 0 0; padding: 15px 20px; border: 1px solid var(--orange); background: var(--orange-soft); color: #7a3418; cursor: pointer; font-size: 0.86rem; font-weight: 650; text-align: left; }
.story-launch span { font-weight: 850; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.72rem; }
.story-launch:hover { background: var(--orange); color: var(--paper); }
.story-launch[hidden] { display: none; }

@media (max-width: 720px) {
  .story-head { grid-template-columns: 1fr auto; row-gap: 14px; }
  .story-progress { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .story-copy h1 { font-size: 2.35rem; }
  .story-nav button { padding: 11px 14px; font-size: 0.85rem; }
}

/* --- Live controls: sliders paired with the numeric field ----------------- */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}
.field-slider {
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 5px; margin: 2px 0 0; padding: 0;
  background: var(--line); border: 0; border-radius: 99px;
  outline: none; cursor: pointer;
}
.field-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 17px; height: 17px; border-radius: 50%;
  background: var(--green); border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--green); cursor: pointer;
}
.field-slider::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--green); border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--green); cursor: pointer;
}
.field-slider:focus-visible { box-shadow: 0 0 0 3px rgba(23, 105, 77, 0.2); }
label.is-disabled .field-slider { pointer-events: none; opacity: 0.5; }
input:disabled + .field-slider,
.field-slider:disabled { pointer-events: none; opacity: 0.4; cursor: not-allowed; }

.recalc-indicator {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--green); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.02em;
}
.recalc-indicator[hidden] { display: none; }
.recalc-indicator::before {
  content: ""; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--green-soft); border-top-color: var(--green);
  animation: recalc-spin 0.7s linear infinite;
}
@keyframes recalc-spin { to { transform: rotate(360deg); } }

#pin-button[aria-pressed="true"] { border-color: var(--green); color: var(--paper); background: var(--green); }

/* --- Chart interactivity: crosshair, tooltip, ghosted pinned scenario ----- */
.chart { position: relative; }
.crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; pointer-events: none; }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart svg:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.tooltip-box { fill: var(--ink); opacity: 0.96; }
.tooltip-title { fill: var(--paper); font-family: var(--sans); font-size: 11px; font-weight: 800; }
.tooltip-row { fill: var(--paper); font-family: var(--sans); font-size: 11px; }
.tooltip-swatch { rx: 2; }
.hover-point { stroke: var(--paper); stroke-width: 2; }
.data-line.ghost { stroke-width: 2; stroke-dasharray: 5 5; opacity: 0.42; }
.data-point.ghost { opacity: 0.4; }
text.series-label.ghost, text.series-value.ghost { opacity: 0.55; }
@media (prefers-reduced-motion: reduce) {
  .recalc-indicator::before { animation: none; }
  .scenario-drawer, .scenario-drawer::backdrop { transition: none; }
}

/* --- A/B comparison table ------------------------------------------------- */
.pin-comparison { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 24px; }
.pin-comparison-head { margin-bottom: 14px; }
.pin-comparison-head h3 { margin: 4px 0 6px; font-family: var(--display); font-size: 1.3rem; }
.pin-comparison-head p { margin: 0; color: var(--muted); font-size: 0.82rem; }
.pin-comparison-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.pin-comparison-table th, .pin-comparison-table td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--line); }
.pin-comparison-table th:first-child, .pin-comparison-table td:first-child { text-align: left; }
.pin-comparison-table thead th { color: var(--muted); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.pin-comparison-table td.delta-up { color: var(--green); font-weight: 700; }
.pin-comparison-table td.delta-down { color: var(--red); font-weight: 700; }

@media (max-width: 1000px) {
  .section-intro { grid-template-columns: 0.5fr 1.5fr; }
  .section-intro > p:last-child { grid-column: 2; }
  .chart-grid, .stress-layout, .theory-visual, .validation-layout, .sensitivity-layout, .uncertainty-intro, .uncertainty-grid { grid-template-columns: 1fr; }
  .winners-grid { grid-template-columns: 1fr 1fr; }
  .theory-reading { min-height: 190px; }
  .theory-chain { grid-template-columns: repeat(3, 1fr); }
  .theory-chain li:nth-child(4) { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .theory-chain li:nth-child(5) { border-top: 1px solid var(--line); }
  .threshold-note { min-height: 240px; }
  .causal-flow { grid-template-columns: 1fr 1fr; }
  .causal-flow li:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; }
  .causal-flow li:nth-child(4) { border-top: 1px solid var(--line); }
  .causal-flow li:nth-child(2)::after { display: none; }
}

@media (max-width: 720px) {
  .site-header, main, .site-footer { width: min(100% - 28px, 1280px); }
  .site-header { grid-template-columns: 1fr auto; min-height: 68px; }
  .baseline-label { grid-column: 1 / -1; grid-row: 2; padding-bottom: 13px; text-align: left; }
  .verdict-section { grid-template-columns: 1fr; gap: 32px; padding-top: 55px; }
  .hero-question { max-width: 420px; }
  .headline-metrics { grid-template-columns: 1fr; }
  .headline-metrics article { padding: 22px 0; }
  .headline-metrics article + article { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .headline-metrics article { position: relative; }
  .headline-metrics .term-label { position: static; }
  .headline-metrics .info-popover,
  .headline-metrics article:last-child .info-popover { top: 48px; right: auto; left: 0; width: min(300px, 100%); }
  .story-section, .causal-section, .theory-section, .stress-section, .validation-section, .verdict-reasons, .sources, .policy-references { padding: 44px 0; }
  .section-intro, .section-intro.compact { grid-template-columns: 1fr; gap: 8px; }
  .section-intro > p:last-child { grid-column: auto; }
  figcaption { display: block; }
  figcaption span { display: block; margin-top: 5px; text-align: left; }
  .chart { min-height: 0; }
  .causal-flow { grid-template-columns: 1fr; }
  .causal-flow li, .causal-flow li + li { padding: 20px 0; border-left: 0; border-top: 1px solid var(--line); }
  .causal-flow li:first-child { border-top: 0; }
  .causal-flow li::after { display: none !important; }
  .theory-intro, .theory-title-line { grid-template-columns: 1fr; }
  .theory-title-line { gap: 8px; }
  .theory-badge { width: max-content; margin-top: 0; }
  .theory-chain { grid-template-columns: 1fr; }
  .theory-chain li, .theory-chain li + li { padding: 18px 0; border-left: 0; border-top: 1px solid var(--line); }
  .theory-chain li:first-child { border-top: 0; }
  .plain-language-answer { display: block; }
  .plain-language-answer strong { display: block; margin-bottom: 7px; }
  .stress-table { border-spacing: 2px; }
  .stress-axis-guide { grid-template-columns: 1fr; gap: 12px; }
  .stress-table th { font-size: 0.58rem; }
  .stress-table td { font-size: 0.76rem; }
  .winners-grid { grid-template-columns: 1fr; }
  .persona-card { grid-template-columns: 1fr; padding: 24px; }
  #persona-form { grid-template-columns: 1fr 1fr; }
  .sensitivity-flip { grid-template-columns: 1fr; }
  .sensitivity-flip p, .sensitivity-flip .link-button { grid-column: 1; justify-self: start; }
  .uncertainty-panel { padding: 22px; }
  .uncertainty-controls, .uncertainty-progress, .verdict-frequency { grid-template-columns: 1fr; }
  .reason-grid { grid-template-columns: 1fr; }
  .reason-grid article { padding: 25px; }
  .scenario-drawer { width: 100vw; border-left: 0; }
  .scenario-drawer-trigger { right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); }
  .toast-container { bottom: max(92px, calc(env(safe-area-inset-bottom) + 92px)); max-width: calc(100vw - 28px); }
  .population-strip, .strategy-grid { grid-template-columns: 1fr 1fr; }
  .population-strip div:nth-child(odd) { border-left: 0; }
  .population-strip div:nth-child(even) { padding-left: 20px; border-left: 1px solid var(--line); }
  .strategy-card:last-child { grid-column: 1 / -1; }
  #source-list { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; }
}

@media (max-width: 520px) {
  .scenario-drawer-header { padding: 18px 16px 15px; }
  .scenario-drawer-heading h2 { font-size: 1.55rem; }
  .scenario-drawer-body { padding-inline: 16px; scrollbar-gutter: auto; }
  .policy-presets { align-items: stretch; }
  .policy-presets span { width: 100%; }
  .preset-reference-link { width: 100%; margin: 4px 0 0; }
  .scenario-drawer-body > fieldset:not(.wealth-tax-fieldset),
  .wealth-tax-controls,
  .split-fieldset-grid,
  .behavior-grid,
  .advanced-controls > div { grid-template-columns: minmax(0, 1fr); }
  .scenario-control-section > summary small { display: none; }
  .form-actions { padding-inline: 16px; }
  .form-action-status { align-items: flex-start; flex-direction: column; gap: 4px; }
  .form-status { max-width: 100%; white-space: normal; }
  .form-action-buttons { display: grid; grid-template-columns: 1fr 1fr; }
  .form-action-buttons .run-button { grid-column: 1 / -1; width: 100%; margin-left: 0; }
}

@media (max-width: 420px) {
  h1 { font-size: 2.75rem; }
  .verdict-line { align-items: flex-start; flex-direction: column; }
  .population-strip { grid-template-columns: 1fr; }
  .population-strip div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .strategy-grid { grid-template-columns: 1fr; }
  .strategy-card:last-child { grid-column: auto; }
  .model-details > summary { align-items: flex-start; flex-direction: column; gap: 5px; }
  .stress-table td { padding: 11px 1px; font-size: 0.65rem; }
  .stress-table th { padding-inline: 1px; }
}

/* --- Model constants (issue #8) ------------------------------------------ */
.advanced-controls-note { grid-column: 1 / -1; margin: 14px 0 0; color: var(--muted); font-size: 0.72rem; line-height: 1.5; }
.model-constants { margin-top: 26px; }
.model-constants h4 { margin: 0 0 6px; font-family: var(--display); font-size: 1.05rem; }
.model-constants-note { margin: 0 0 12px; font-size: 0.74rem; line-height: 1.5; }
.model-constants-table { width: 100%; border-collapse: collapse; font-size: 0.74rem; }
.model-constants-table th, .model-constants-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.model-constants-table th { color: var(--muted); font-weight: 750; }
.model-constants-table .constant-value { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; }
.model-constants-table .constant-name { font-weight: 650; }
.constant-tunable-badge { display: inline-block; padding: 2px 7px; border-radius: 99px; background: var(--green-soft); color: var(--green); font-size: 0.56rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
