:root {
  color-scheme: light;
  --paper: #fbfaf7;
  --panel: #fff;
  --ink: #1a1a1a;
  --navy: #09253a;
  --brand: #1f4e6b;
  --muted: #625f59;
  --rule: #dedbd2;
  --wash: #f1efe8;
  --red: #a84333;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p, dl, dd { margin: 0; }
a { color: var(--navy); text-underline-offset: .22em; }
a:hover { color: var(--red); }
button, input { font: inherit; accent-color: var(--brand); }
button, input[type=range], summary { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #39738f; outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.shell { width: min(1250px, calc(100% - 64px)); margin-inline: auto; }
.mast { margin-top: 17px; border-block: 3px solid var(--navy); border-bottom-width: 1px; border-bottom-color: var(--rule); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 9px 0; }
.mast a { font-weight: 700; font-size: 13px; text-decoration: none; }
.brand img { display: block; width: 188px; height: auto; }
.method-link { justify-self: end; text-align: right; }
.skip { position: absolute; left: 1rem; top: -8rem; padding: 10px; background: white; z-index: 2; }
.skip:focus { top: 1rem; }

.intro { display: flex; gap: 14px 24px; align-items: flex-end; justify-content: space-between; padding: 18px 0 16px; }
h1 { color: var(--navy); font: 600 clamp(2.4rem, 5.4vw, 3.6rem)/1.06 var(--serif); letter-spacing: -.045em; }
.intro p { color: var(--muted); margin-top: 6px; max-width: 660px; font-size: 15px; line-height: 1.42; }

.playbar { display: grid; grid-template-columns: auto minmax(185px,1fr) auto; align-items: center; gap: 12px; border-block: 1px solid var(--rule); padding: 5px 0; margin-bottom: 12px; background: var(--paper); }
.play { min-width: 87px; min-height: 42px; display: inline-flex; gap: 7px; align-items: center; justify-content: center; color: var(--panel); border: 1px solid var(--navy); border-radius: 3px; background: var(--navy); padding: 5px 9px; font-weight: 700; font-size: 13px; }
.play:hover { background: var(--brand); }
.play svg { width: 13px; height: 13px; fill: currentColor; }
.time { display: flex; gap: 10px; align-items: center; color: var(--navy); font-size: 13px; font-variant-numeric: tabular-nums; }
.time span { flex: 0 0 95px; white-space: nowrap; }
.time input { width: 100%; min-width: 0; height: 38px; margin: 0; }
.timeline-help { color: var(--muted); font-size: 12px; }

.chain-map { border: 1px solid var(--rule); border-top: 2px solid var(--navy); background: var(--panel); }
.signal-route, .receipt-route { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; text-align: center; font-size: 12px; font-weight: 700; color: var(--brand); }
.signal-route { border-bottom: 1px solid #dfe8eb; background: #edf4f6; }
.receipt-route { border-top: 1px solid #dde9e2; background: #eff6f1; color: #2c6658; }
.route-arrow { font-size: 19px; line-height: 1; }
.chain { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); direction: rtl; }
.chain > .card { direction: ltr; min-width: 0; padding: 14px 12px 11px; }
.chain > .card + .card { border-right: 1px solid var(--rule); }
.panel { min-width: 0; border: 1px solid var(--rule); background: var(--panel); }
.card-head { min-height: 48px; }
h2, h3 { color: var(--navy); font-family: var(--serif); }
h2 { font-size: clamp(17px, 2vw, 22px); line-height: 1.12; letter-spacing: -.02em; }
h3 { font-size: 18px; line-height: 1.25; }
.card-head p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.card svg { width: 100%; height: auto; display: block; }
.card-tools { min-height: 45px; margin-block: 2px 6px; }
.tool-note { display: flex; min-height: 34px; align-items: center; font-weight: 700; font-size: 12px; color: var(--brand); }
.card .chart { background: #f5f8f9; border: 1px solid #dce6ea; border-radius: 6px; }
.chart text { fill: #435a68; font: 10.5px 'Helvetica Neue', Helvetica, Arial, sans-serif; }
.chart .plot-unit, .chart .plot-date-current { fill: var(--navy); font-weight: 700; }
.chart .plot-grid { stroke: #dce6ea; stroke-width: 1; }
.chart .plot-zero { stroke: #adbec6; }
.chart .plot-cursor { stroke: #9eb2bc; stroke-dasharray: 2 3; }
.chart .plot-band-label { fill: #294952; font-weight: 700; }
.chart .plot-tick, .chart .plot-band-label, .chart .plot-cursor { pointer-events: none; }
.chart .wheel-product, .chart .wheel-sequence, .chart .cycle-product { fill: var(--navy); font-weight: 700; }
.chart .wheel-product { font-size: 13px; }
.chart .wheel-sequence { font-size: 12px; }
.chart-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); row-gap: 8px; margin-top: 9px; padding: 8px 7px; background: #f5f8f9; border-radius: 4px; }
.chart-metrics > div { min-width: 0; padding-inline: 6px; }
.chart-metrics > div + div { border-left: 1px solid #dce6ea; }
.chart-metrics dt { font-size: 10px; color: var(--muted); }
.chart-metrics dd { margin-top: 3px; color: var(--navy); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-note { margin: 7px 1px 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.plot-legend { display: flex; flex-wrap: wrap; column-gap: 9px; margin-top: 8px; font-size: 11px; color: var(--navy); }
.plot-legend span::before { content: ''; display: inline-block; width: 12px; margin-right: 4px; border-top: 2px solid #286684; vertical-align: middle; }
.plot-legend .legend-dashed::before { border-top: 2px dashed #183c50; }
#ddmrp-readout .chart-metrics > div:nth-child(odd) { border-left: 0; }
#prog { margin-top: 7px; }
.control { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 8px; font-size: 12px; padding: 3px 1px 7px; color: var(--navy); }
.control label, .control b { font-weight: 700; }
.control input { grid-column: 1 / -1; width: 100%; min-height: 19px; margin: 0; }
.ct-scale { grid-template-columns: repeat(3,minmax(0,1fr)); text-align: center; }
.ct-scale dd { white-space: nowrap; }
.overrun { color: #8d3528; margin: 0 0 6px; padding: 5px 6px; background: #fcf0eb; font-size: 11.5px; line-height: 1.32; }

.results { display: grid; grid-template-columns: minmax(180px,.6fr) minmax(0,1.4fr); gap: 12px; margin-top: 12px; padding: 12px 15px; }
.results p { font-size: 12px; color: var(--muted); margin-top: 4px; }
table { width: 100%; text-align: left; border-collapse: collapse; font-size: 13px; }
table th, table td { padding: 5px 7px; border-bottom: 1px solid #ebe8e0; }
thead th { background: #f7f6f1; color: var(--navy); }
.results td { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.results tr:last-child > * { border-bottom: 0; }

.settings { margin-top: 12px; }
.settings summary { min-height: 43px; padding: 12px 15px; font-weight: 700; color: var(--navy); font-size: 14px; }
.settings-body { padding: 0 15px 14px; }
.settings-inputs, .detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px 20px; }
.detail-grid { margin-top: 12px; }
.detail-grid svg { display: block; max-width: 420px; width: 100%; }
.zones { margin-top: 6px; }
.zones i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit,minmax(109px,1fr)); gap: 6px; margin-top: 10px; }
.stats div { padding: 8px; background: var(--wash); }
.stats dt { min-height: 25px; font-size: 11px; color: var(--muted); }
.stats dd { color: var(--navy); font-size: 15px; font-weight: 700; }
.stats small { font-size: 10px; font-weight: 400; }
.optimizer { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--rule); }
.optimizer p, .travel { font-size: 13px; line-height: 1.5; color: var(--muted); }
#optGo { border: 1px solid var(--navy); background: var(--navy); color: white; padding: 7px 12px; min-height: 36px; border-radius: 3px; font-weight: 700; font-size: 13px; flex-shrink: 0; }
#optGo:disabled { opacity: .6; cursor: wait; }
.optgrid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.optgrid:not(:empty), .travel:not(:empty) { margin-top: 8px; }
.optc { text-align: left; border: 1px solid var(--rule); background: var(--wash); color: var(--navy); padding: 8px 9px; font-size: 12px; }
.optc.on { border-color: var(--brand); background: #eaf0f2; }
.optc.warn { border-color: var(--red); }
.optc h4 { margin: 0 0 3px; }
.optc p { margin: 4px 0; }
.optc .tag { font-size: 10px; font-weight: 400; margin-left: 4px; }
.optc .num { display: flex; gap: 5px; flex-wrap: wrap; }
.footer { border-top: 1px solid var(--rule); margin-block: 17px 13px; padding-top: 10px; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; }
.footer a { color: inherit; }
.article { max-width: 720px; margin-inline: auto; padding: 25px 0 13px; }
.article h2 { margin-top: 25px; }
.article p, .article li { margin-top: 9px; line-height: 1.55; font-size: 16px; }
.article ul { padding-left: 22px; }
.guide-chart { margin: 20px 0 12px; scroll-margin-top: 18px; }
.guide-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.guide-controls > span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.guide-chart img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); }
.guide-diagram { position: relative; }
.guide-hotspot { position: absolute; top: 18.7%; height: 59.6%; padding: 0; border: 1px solid transparent; border-radius: 4px; background: transparent; }
.guide-hotspot:hover, .guide-hotspot[aria-pressed="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.guide-hotspot:focus-visible { outline-offset: 2px; }
.guide-wheel { left: 3.3%; width: 26.1%; }
.guide-signal { left: 31%; width: 37.4%; }
.guide-stock { left: 70.2%; width: 26.4%; }
.guide-chart .guide-detail { min-height: 3em; margin: 0; padding: 8px 10px; background: #edf3f5; color: var(--navy); font-size: 13px; }
.guide-chart figcaption { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.45; }

@media (max-width: 990px) {
  .shell { width: calc(100% - 38px); }
  .chain { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .card svg { max-width: 350px; margin-inline: auto; }
  .chain > .card:nth-child(odd) { border-right: 0; }
  .chain > .card:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .route-arrow { display: none; }
  .playbar { position: sticky; top: 0; z-index: 2; }
}
@media (max-width: 590px) {
  .shell { width: calc(100% - 24px); }
  .mast { margin-top: 10px; padding: 7px 0; }
  .mast a { font-size: 12px; }
  .brand img { width: clamp(87px, 29vw, 145px); }
  .intro { display: grid; padding: 13px 0 11px; }
  .playbar { grid-template-columns: auto minmax(0,1fr); gap: 3px 8px; }
  .timeline-help { grid-column: 2; padding-bottom: 3px; }
  .time { gap: 5px; }
  .time span { flex-basis: 87px; }
  .chain { grid-template-columns: minmax(0,1fr); }
  .chain > .card + .card { border-right: 0; border-top: 1px solid var(--rule); }
  .results, .settings-inputs, .detail-grid, .optgrid { grid-template-columns: minmax(0,1fr); }
  .results { padding: 9px; }
  .results th, .results td { padding: 5px 3px; font-size: 12px; }
  .optimizer { flex-wrap: wrap; }
}

.buffer-example { border: 1px solid var(--rule); border-top: 2px solid var(--navy); background: var(--panel); margin-bottom: 16px; }
.buffer-example-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 10px 13px; }
.buffer-example-head p { color: var(--muted); font-size: 12px; margin-top: 3px; }
#buffer-step { flex: 0 0 auto; min-height: 37px; background: var(--navy); color: white; border: 1px solid var(--navy); border-radius: 3px; padding: 6px 11px; font-weight: 700; font-size: 13px; }
#buffer-step:hover { background: var(--brand); }
#buffer-step span { margin-left: 4px; }
.buffer-explanation { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule); direction: rtl; }
.buffer-explanation > div { direction: ltr; min-width: 0; padding: 9px 13px; }
.buffer-cycle { border-right: 1px solid var(--rule); background: #f5f8f9; }
.buffer-explanation h3 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; font-size: 16px; }
.buffer-explanation h3 span { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; color: var(--muted); font-size: 11px; font-weight: 500; }
.buffer-explanation p { margin-top: 4px; font-size: 13px; line-height: 1.4; }
.buffer-levels { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; }
.buffer-levels span { background: #eef3ec; color: #2b4e41; padding: 3px 5px; border-radius: 2px; font-size: 11px; font-weight: 700; }
.buffer-cycle .buffer-levels span { background: #e6eef3; color: var(--navy); }
.simulation-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; }
.simulation-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 14px; }
.simulation-heading a { color: var(--brand); font-size: 12px; font-weight: 700; }
@media (max-width: 520px) {
  .buffer-example-head { align-items: flex-start; }
  .buffer-example-head h2 { font-size: 16px; }
  #buffer-step { max-width: 46%; white-space: normal; text-align: left; }
  .buffer-explanation { grid-template-columns: 1fr; }
  .buffer-cycle { border-right: 0; border-top: 1px solid var(--rule); }
}

.page-nav { justify-self: end; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 18px; }
.plan-choice, .stock-product { display: flex; align-items: center; gap: 7px; color: var(--navy); font-size: 12px; font-weight: 700; }
select { min-height: 32px; padding: 4px 8px; max-width: 100%; border: 1px solid #a2adb3; border-radius: 3px; background: var(--panel); color: var(--navy); font: inherit; }
.stock-product { min-height: 35px; }
.stock-product select { margin-left: auto; }
.buffer-refill, .carryover { padding: 6px 2px; margin-block: 0 3px; font-size: 12px; line-height: 1.35; color: var(--navy); }
.carryover { padding-inline: 6px; background: #eaf2f5; }
.factoring { align-self: start; flex-wrap: wrap; }
.reading { margin-top: 29px; border-top: 2px solid var(--navy); padding-block: 11px 2px; }
.reading-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 10px; }
.reading-head a { font-size: 13px; font-weight: 700; }
.reading-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.reading-card { display: block; border: 1px solid var(--rule); background: var(--panel); text-decoration: none; }
.reading-card:hover h3 { text-decoration: underline; text-underline-offset: .18em; }
.reading-card img { display: block; width: 100%; height: auto; aspect-ratio: 16/8; object-fit: cover; }
.reading-copy { padding: 13px; }
.reading-copy span { font-size: 11px; color: var(--brand); font-weight: 700; }
.reading-copy h3 { margin-top: 4px; font-size: 20px; }
.reading-copy p { margin-top: 5px; font-size: 13px; line-height: 1.42; color: var(--muted); }
.reading-method img { object-fit: contain; background: #f3f6f7; }
#simulation, #articles { scroll-margin-top: 14px; }
@media (max-width: 650px) {
  .reading-grid { grid-template-columns: minmax(0,1fr); }
  .reading-card { display: grid; grid-template-columns: minmax(90px,29%) 1fr; }
  .reading-card img { height: 100%; min-height: 96px; }
  .reading-copy h3 { font-size: 17px; }
}
@media (max-width: 520px) {
  .page-nav { gap: 5px 10px; }
  .simulation-head { align-items: flex-start; }
  .plan-choice { flex-wrap: wrap; }
}

.landing-intro { display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: 26px 38px; padding-block: 29px 24px; }
.eyebrow { font-size: 11px; font-weight: 700; color: var(--brand); letter-spacing: .035em; margin-bottom: 10px; }
.landing-copy h1 { font-size: clamp(38px,5.5vw,65px); }
.landing-copy > p { max-width: 650px; line-height: 1.5; font-size: 14px; margin-top: 11px; color: var(--muted); }
.landing-copy .landing-lead { font: 600 clamp(17px,2vw,22px)/1.3 var(--serif); color: var(--navy); }
.landing-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 13px 18px; margin-top: 18px; font-size: 13px; font-weight: 700; }
.primary-link { display: inline-flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 3px; color: #fff; background: var(--navy); text-decoration: none; }
.primary-link:hover { color: #fff; background: var(--brand); }
.landing-principle { border-block: 1px solid var(--rule); padding-bottom: 14px; }
.landing-principle img { display: block; width: 100%; height: auto; }
.landing-principle h2 { margin: 12px 0 6px; }
.landing-principle p { font-size: 14px; line-height: 1.5; color: var(--muted); }
.landing-principle > a { display: inline-block; margin-top: 9px; font-size: 13px; font-weight: 700; }
.basics-strip { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border-block: 1px solid var(--rule); margin-bottom: 24px; padding-block: 12px; gap: 12px 25px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.basics-strip strong { color: var(--navy); }
.balance { margin-top: 12px; padding: 15px; }
.balance-head p, .balance-note, .balance-help { font-size: 12px; line-height: 1.45; color: var(--muted); margin-top: 5px; }
.balance-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-block: 12px; }
.balance-metric { border-left: 2px solid #cbd8dd; padding-left: 11px; }
.balance-metric h3 { font-size: 18px; }
.balance-metric .balance-value { font-size: 26px; font-weight: 700; color: var(--navy); margin-block: 4px; }
.balance-value small { font-size: 11px; font-weight: 400; }
.balance-metric > p { font-size: 12px; line-height: 1.45; color: var(--muted); }
.balance-state { font-weight: 700; }
.balance-state[data-level="positive"] { color: #267258; }
.balance-state[data-level="negative"] { color: #a84333; }
.balance-state[data-level="investment"] { color: #99601f; }
.balance-help summary { cursor: pointer; text-decoration: underline; text-underline-offset: .2em; }
.balance-help p { max-width: 900px; margin-top: 7px; }
.article .article-deck { color: var(--brand); font-size: 20px; }
.article .byline { font-size: 13px; color: var(--muted); }
@media (max-width: 800px) {
  .landing-intro { grid-template-columns: 1fr; gap: 18px; }
  .landing-principle { display: none; }
  .basics-strip { grid-template-columns: 1fr; gap: 7px; }
}
@media (max-width: 520px) {
  .balance-grid { grid-template-columns: 1fr; gap: 14px; }
  .landing-intro { padding-top: 20px; }
}
.guide-audio-options { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 12px; margin: 0 0 8px; }
.guide-audio-options label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.article .guide-script { font-size: 13px; margin-top: 6px; }
.guide-chart .guide-detail { min-height: 6.3em; }

.guide-visual { display: block; width: 100%; height: auto; border: 1px solid var(--rule); }
.guide-svg-title { font: 700 27px Georgia, 'Times New Roman', serif; }
.guide-svg-heading { font: 700 24px Georgia, 'Times New Roman', serif; }
.sound-choice { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; cursor: pointer; white-space: nowrap; }
.audio-feedback { color: var(--muted); font-size: 12px; margin: 5px 0; }

.project-note { margin-top: 22px; color: var(--muted); font-size: 11px; line-height: 1.45; }
