/* The stress test (5 Dec 2026; it was the sequence risk calculator), on the backtest's tokens so the two tools read as
   siblings, see /DESIGN.md. Cream page, white cards with the warm shadow, ink, the one brown accent. One column: the
   FIRE number and spending with the assumptions folded, then the chart, the stress cards, the guardrails switch. */
:root {
    --sq-bg: #FAF7F3;
    --sq-panel: #FFFFFF;
    --sq-line: #E8E1D9;
    --sq-text: #1C1714;
    --sq-text-2: #5C5049;
    --sq-muted: #6E6159;
    --sq-accent: #7A4E00;
    --sq-accent-dark: #5E3C00;
    --sq-accent-rgb: 122, 78, 0;
    --sq-tint: #FFF6E5;
    --sq-tint-2: #F6EBD9;
    --sq-shadow: 0 1px 2px rgba(122, 78, 0, 0.06), 0 12px 28px -12px rgba(122, 78, 0, 0.18);
    --sq-r: 12px;
    --sq-rc: 6px;
    --t-1: 14px; --t0: 17px; --t1: 21px; --t2: 26px; --t3: 34px;
}

.sq { max-width: 1160px; margin: 0 auto; padding: 40px 24px 64px; box-sizing: border-box; font-size: var(--t0); line-height: 1.55; color: var(--sq-text); }
.sq *, .sq *::before, .sq *::after { box-sizing: border-box; }
.sq [hidden] { display: none !important; }
.sq p { margin: 0; }
.sq a { color: var(--sq-accent); }
.sq button, .sq input { font-family: inherit; }
.sq :focus-visible { outline: 2px solid var(--sq-accent); outline-offset: 2px; }

/* The header */
.sq .eyebrow { font-size: 13px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sq-accent); }
.sq h1 { margin: 8px 0 0; font-size: clamp(36px, 5.4vw, 54px); line-height: 1.04; font-weight: 800; letter-spacing: -0.025em; }
.sq .lede { margin-top: 12px; max-width: 44rem; font-size: clamp(18px, 2vw, var(--t1)); line-height: 1.45; color: var(--sq-text-2); }
.sq .market { display: inline-flex; margin-top: 20px; padding: 3px; border-radius: 12px; background: var(--sq-panel); border: 1px solid var(--sq-line); }
.sq .market button { height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--sq-text-2); font-size: 15px; font-weight: 600; cursor: pointer; }
.sq .market button[aria-pressed="true"] { background: var(--sq-accent); color: #fff; }

/* Cards and steps */
.sq .card { margin-top: 22px; background: var(--sq-panel); border-radius: var(--sq-r); box-shadow: var(--sq-shadow); padding: clamp(18px, 2.6vw, 30px); }
.sq .step-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.sq .step-h h2 { margin: 0; font-size: clamp(21px, 2.2vw, 24px); font-weight: 800; letter-spacing: -0.01em; }
.sq .step-h h2 .n { color: var(--sq-accent); margin-right: 6px; }
.sq .step-h p { font-size: 15px; color: var(--sq-muted); }

/* Your plan: two across, the folded assumptions four across, one column on a phone */
.sq .inputs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.sq .inputs.two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
/* The assumptions, folded into one line that opens */
.sq details.assume { margin-top: 16px; }
.sq details.assume summary { cursor: pointer; list-style: none; font-size: 15px; color: var(--sq-text-2); }
.sq details.assume summary::-webkit-details-marker { display: none; }
.sq details.assume .change { margin-left: 4px; font-weight: 700; color: var(--sq-accent); text-decoration: underline; text-underline-offset: 3px; }
.sq details.assume[open] .change { display: none; }
.sq .ctl { min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 10px; background: var(--sq-bg); }
.sq .ctl .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; }
.sq .ctl label, .sq .ctl .lab { font-size: var(--t-1); font-weight: 700; color: var(--sq-text-2); }
.sq .ctl .help { font-size: 13.5px; line-height: 1.4; color: var(--sq-muted); }
.sq .ctl .help b { color: var(--sq-text); font-weight: 700; }
.sq .err { font-size: 13.5px; line-height: 1.4; font-weight: 700; color: var(--sq-accent-dark); }
.sq .ctl.bad .money, .sq .ctl.bad .val { border-color: var(--sq-accent); }
.sq .val { display: inline-flex; align-items: baseline; gap: 2px; padding: 0 6px; border-radius: var(--sq-rc); border: 1.5px solid var(--sq-line); background: var(--sq-panel); font-size: var(--t2); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--sq-text); }
.sq .val:focus-within { border-color: var(--sq-accent); }
.sq .val input { width: 3.2ch; border: 0; padding: 0; background: transparent; font: inherit; color: inherit; text-align: right; outline: none; }
.sq .val .u { font-size: 18px; font-weight: 700; color: var(--sq-muted); }
.sq .money { display: flex; align-items: center; height: 56px; padding: 0 14px; border-radius: var(--sq-rc); background: var(--sq-panel); border: 1.5px solid var(--sq-line); transition: border-color 150ms ease-out; }
.sq .money:focus-within { border-color: var(--sq-accent); }
.sq .money span { font-size: 24px; font-weight: 700; color: var(--sq-muted); }
.sq .money input { flex: 1 1 auto; min-width: 0; width: 100%; border: 0; outline: none; background: transparent; font-size: var(--t2); font-weight: 800; letter-spacing: -0.02em; color: var(--sq-text); padding: 0 0 0 4px; font-variant-numeric: tabular-nums; }
.sq .presets { display: flex; flex-wrap: wrap; gap: 6px; }
.sq .presets button { height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--sq-line); background: var(--sq-panel); color: var(--sq-text-2); font-size: 13px; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; }
.sq .presets button:hover { border-color: rgba(var(--sq-accent-rgb), 0.5); color: var(--sq-accent); }
.sq .presets button[aria-pressed="true"] { background: var(--sq-text); border-color: var(--sq-text); color: #fff; }

/* The years slider: the filled part in the accent, the rest in the tint */
.sq input[type="range"].rng { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; --p: 50%; }
.sq .rng::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--sq-accent) 0 var(--p), var(--sq-tint-2) var(--p) 100%); }
.sq .rng::-moz-range-track { height: 6px; border-radius: 999px; background: var(--sq-tint-2); }
.sq .rng::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--sq-accent); }
.sq .rng::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%; background: var(--sq-accent); border: 4px solid #fff; box-shadow: 0 1px 4px rgba(28, 23, 20, 0.35); }
.sq .rng::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--sq-accent); border: 4px solid #fff; box-shadow: 0 1px 4px rgba(28, 23, 20, 0.35); }
.sq .rng:focus-visible { outline: none; }
.sq .rng:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(var(--sq-accent-rgb), 0.25); }

/* Stocks and the safe part: one bar, drag the seam (the backtest's control) */
.sq .split { position: relative; height: 56px; border-radius: var(--sq-rc); overflow: hidden; display: flex; background: var(--sq-tint); }
.sq .split:focus-within { box-shadow: 0 0 0 3px rgba(var(--sq-accent-rgb), 0.3); }
.sq .split .a, .sq .split .b { display: flex; flex-direction: column; justify-content: center; padding: 0 12px; min-width: 0; overflow: hidden; white-space: nowrap; font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.sq .split .a { flex: none; background: var(--sq-accent); color: #fff; }
.sq .split .b { flex: 1 1 auto; color: var(--sq-accent); align-items: flex-end; text-align: right; }
.sq .split b { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sq .split .seam { position: absolute; top: 8px; bottom: 8px; width: 4px; margin-left: -2px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(var(--sq-accent-rgb), 0.35); pointer-events: none; }
.sq .split input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.sq .split.narrow-a .a span, .sq .split.narrow-a .a b { visibility: hidden; }
.sq .split.narrow-b .b span, .sq .split.narrow-b .b b { visibility: hidden; }

/* The result */
.sq .stale-note { margin-top: 22px; padding: 10px 14px; border-radius: 10px; background: var(--sq-tint); font-size: 15px; font-weight: 600; }
#resultsContainer.stale .card { opacity: 0.55; }
.sq .headline { margin: 16px 0 0; max-width: 48rem; font-size: clamp(20px, 2.2vw, 26px); line-height: 1.3; font-weight: 800; letter-spacing: -0.015em; }
.sq .legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 0; font-size: 14px; font-weight: 600; color: var(--sq-text-2); }
.sq .legend span { display: inline-flex; align-items: center; gap: 8px; }
.sq .legend i { display: inline-block; width: 26px; height: 0; border-top: 3px solid var(--sq-accent); }
.sq .legend i.last { border-top: 2.5px dashed var(--sq-text-2); }
.sq .legend i.band { width: 14px; height: 14px; border: 0; border-radius: 3px; background: var(--sq-tint-2); }
.sq svg.chart { display: block; width: 100%; margin-top: 10px; overflow: visible; }
/* Drawn one unit to one pixel at the width they show at (sequence-risk.js), so the words stay 13px */
.sq svg.chart { height: 300px; }
.sq .chart .grid { stroke: var(--sq-line); stroke-width: 1; }
.sq .chart text { font-family: inherit; font-size: 13px; fill: var(--sq-muted); font-variant-numeric: tabular-nums; }
.sq .chart .band { fill: var(--sq-tint-2); }
.sq .chart text.bandl { font-size: 12px; font-weight: 700; fill: var(--sq-accent); }
.sq .chart .first { fill: none; stroke: var(--sq-accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.sq .chart .last { fill: none; stroke: var(--sq-text-2); stroke-width: 2.5; stroke-dasharray: 7 6; stroke-linejoin: round; }
.sq .chart .dot-first { fill: var(--sq-accent); }
.sq .chart .dot-last { fill: var(--sq-text-2); }
.sq .chart text.endl { font-size: 14px; font-weight: 700; fill: var(--sq-text); }
/* A white edge behind the words a line may pass under, so the words always win */
.sq .chart text.endl, .sq .chart text.bandl { paint-order: stroke; stroke: var(--sq-panel); stroke-width: 5px; stroke-linejoin: round; }
.sq .note { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--sq-muted); max-width: 50rem; }
.sq .card h3 { margin: 0; font-size: clamp(19px, 2vw, 22px); font-weight: 800; letter-spacing: -0.01em; }
.sq .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sq .sub { margin-top: 6px; max-width: 50rem; font-size: 15.5px; line-height: 1.5; color: var(--sq-text-2); }

/* The stresses: a card each, the picked one in the accent, its result on the last line. A stress the plan survives
   says so in the accent; one that runs it out says so in ink. No red or green. */
.sq .stresses { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.sq .st { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 12px 14px; border-radius: 10px; border: 1.5px solid var(--sq-line); background: var(--sq-panel); text-align: left; cursor: pointer; color: var(--sq-text); }
.sq .st:hover { border-color: rgba(var(--sq-accent-rgb), 0.5); }
.sq .st[aria-checked="true"] { border: 2px solid var(--sq-accent); background: var(--sq-tint); padding: 11.5px 13.5px; }
.sq .st b { font-size: 16px; font-weight: 800; }
.sq .st span { font-size: 13.5px; line-height: 1.35; color: var(--sq-muted); }
.sq .st i { margin-top: auto; padding-top: 8px; font-style: normal; font-size: 14px; font-weight: 700; color: var(--sq-text); font-variant-numeric: tabular-nums; }
.sq .st.lasts i { color: var(--sq-accent); }

/* Guardrails, a switch */
.sq .toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.sq .toggle input { position: absolute; opacity: 0; pointer-events: none; }
.sq .toggle .sw { flex: none; position: relative; width: 46px; height: 28px; border-radius: 999px; background: var(--sq-line); transition: background 150ms ease-out; }
.sq .toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(28, 23, 20, 0.3); transition: transform 150ms ease-out; }
.sq .toggle input:checked + .sw { background: var(--sq-accent); }
.sq .toggle input:checked + .sw::after { transform: translateX(18px); }
.sq .toggle input:focus-visible + .sw { box-shadow: 0 0 0 3px rgba(var(--sq-accent-rgb), 0.3); }
.sq .toggle .t { font-size: 17px; font-weight: 800; }
.sq .guard .sub { margin: 8px 0 0 58px; }


/* After the result */
.sq .section { margin-top: 48px; }
.sq .section h2 { margin: 0; font-size: clamp(24px, 2.6vw, 30px); font-weight: 800; letter-spacing: -0.015em; }
.sq .linkbtn { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 10px; border: 0; background: var(--sq-accent); color: #fff; font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer; }
.sq .linkbtn:hover { background: var(--sq-accent-dark); color: #fff; }
.sq .linkbtn.quiet { height: 38px; padding: 0 14px; background: var(--sq-panel); color: var(--sq-accent); border: 1.5px solid rgba(var(--sq-accent-rgb), 0.4); font-size: 15px; }
.sq .linkbtn.quiet:hover { background: var(--sq-tint); color: var(--sq-accent-dark); }
.sq .planner-way p { max-width: 46rem; margin: 12px 0 20px; }
.sq .asks { display: grid; grid-template-columns: minmax(0, 34rem); gap: 20px; }
.sq .ask { background: var(--sq-panel); border-radius: var(--sq-r); box-shadow: var(--sq-shadow); padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.sq .ask p { max-width: 30rem; flex: 1; }
.sq .prose p { max-width: 46rem; margin-top: 12px; }
.sq .faqs { margin-top: 10px; }
.sq .faqs details { border-bottom: 1px solid var(--sq-line); padding: 14px 0; }
.sq .faqs summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; font-weight: 600; line-height: 1.4; }
.sq .faqs summary::-webkit-details-marker { display: none; }
.sq .faqs summary .plus { flex: none; color: var(--sq-accent); font-weight: 400; transition: transform 150ms ease; }
.sq .faqs details[open] summary .plus { transform: rotate(45deg); }
.sq .faqs details p { margin: 10px 0 0; }
.sq .fine { font-size: 14px; color: var(--sq-muted); }

@media (max-width: 980px) {
    .sq .inputs, .sq .stresses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .sq { padding: 28px 16px 48px; }
    .sq .inputs, .sq .inputs.two { grid-template-columns: 1fr; gap: 12px; }
    .sq .asks { grid-template-columns: 1fr; }
    .sq .guard .sub { margin-left: 0; margin-top: 10px; }
    .sq .stresses { gap: 8px; }
    .sq .st { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .sq .money, .sq .toggle .sw, .sq .toggle .sw::after, .sq .faqs summary .plus { transition: none; }
}
