/* Fonts, served from this site (no request to Google). Libre Caslon Text and Libre Franklin, SIL Open Font License. */
@font-face { font-family: 'Libre Caslon Text'; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/libre-caslon-text-400-italic-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Libre Caslon Text'; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/libre-caslon-text-400-italic.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Libre Caslon Text'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/libre-caslon-text-400-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Libre Caslon Text'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/libre-caslon-text-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Libre Caslon Text'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/libre-caslon-text-700-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Libre Caslon Text'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/libre-caslon-text-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Libre Franklin'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/libre-franklin-variable-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Libre Franklin'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/libre-franklin-variable.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Haybird shared styles. Direction: "Almanac".
   A printed almanac of money math: unbleached paper, Caslon type, ink and barn red,
   square corners, double rules, numbered pages, and charts drawn like engraved figures. */
:root {
  --paper: #f3eee2;
  --surface: #f8f4ea;
  --surface-2: #e5ddc8;
  --ink: #1c1a15;
  --muted: #5d5649;
  --line: rgba(28, 26, 21, 0.2);
  --grid: rgba(28, 26, 21, 0.085);
  --gold: #1f4732;          /* the main series ("what it's worth"): evergreen ink */
  --gold-area: #3d7656;     /* gain shading, drawn as hatching where it's soft */
  --base-fill: rgba(93, 86, 73, 0.55); /* neutral "your own money" bars */
  --gold-soft: #dfe3cc;     /* selected rows, highlights */
  --slate: #4d6079;         /* comparison */
  --rust: #bd3c1c;          /* losses, withdrawals: barn red */
  --red: #bd3c1c;           /* almanac accent: folios, labels, links */
  --focus: #bd3c1c;
  --radius: 0px;

  --font-display: "Libre Caslon Text", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Libre Franklin", "Segoe UI", system-ui, -apple-system, sans-serif;
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: 1.55rem;
  --step-3: clamp(1.7rem, 1.3rem + 1.6vw, 2.3rem);
  --step-4: clamp(2rem, 1.4rem + 2.6vw, 3.1rem);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #191712; --surface: #1f1d17; --surface-2: #2a271f; --ink: #ebe4d2; --muted: #a39b88;
    --line: rgba(235, 228, 210, 0.2); --grid: rgba(235, 228, 210, 0.08);
    --gold: #94c4a1; --gold-area: #6ea481; --gold-soft: #263329; --slate: #93a5bc; --rust: #d4735b; --red: #d4735b; --focus: #d4735b; --base-fill: rgba(196, 180, 146, 0.68);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #191712; --surface: #1f1d17; --surface-2: #2a271f; --ink: #ebe4d2; --muted: #a39b88;
  --line: rgba(235, 228, 210, 0.2); --grid: rgba(235, 228, 210, 0.08);
  --gold: #94c4a1; --gold-area: #6ea481; --gold-soft: #263329; --slate: #93a5bc; --rust: #d4735b; --red: #d4735b; --focus: #d4735b; --base-fill: rgba(196, 180, 146, 0.68);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: var(--step-0); line-height: 1.6; }
img, svg { max-width: 100%; }
a { color: inherit; text-decoration-color: var(--gold); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--gold); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius); }
h1, h2, h3 { font-family: var(--font-display); font-optical-sizing: auto; font-weight: 500; line-height: 1.1; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }
p { margin: 0; }
code { font-size: 0.9em; background: var(--surface-2); padding: 1px 5px; border-radius: var(--radius); }
.num { font-variant-numeric: tabular-nums lining-nums; }
.wrap { max-width: 1160px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* Masthead */
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 18px 14px; border-bottom: 1px solid var(--ink); }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; letter-spacing: -0.01em; }
.brand svg { width: 28px; height: 28px; }
.site-nav { display: flex; gap: 22px; font-size: var(--step--1); }
.site-nav a { text-decoration: none; color: var(--muted); }
.site-nav a:hover { color: var(--ink); }
@media (max-width: 560px) { .site-nav a:not(.nav-main) { display: none; } }
.site-footer { margin-top: 80px; color: var(--muted); font-size: var(--step--1); }
.site-footer .wrap { padding-block: 22px 32px; display: flex; flex-wrap: wrap; gap: 10px 28px; justify-content: space-between; border-top: 1px solid var(--ink); }
.site-footer em { font-family: var(--font-display); font-style: normal; color: var(--muted); }

/* Question and answer */
.hero-head { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px 48px; align-items: end; padding-block: 34px 10px; }
@media (max-width: 820px) { .hero-head { grid-template-columns: minmax(0, 1fr); padding-top: 26px; } }
.eyebrow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.15em; font-weight: 700; color: var(--gold); }
.hero-head h1 { font-size: var(--step-4); margin-top: 8px; max-width: 18ch; }
.lede { color: var(--muted); max-width: 54ch; margin-top: 12px; }
.answer { display: grid; gap: 4px; justify-items: start; }
.answer .label { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.big { font-family: var(--font-display); font-weight: 500; font-size: clamp(3.4rem, 2.2rem + 4.6vw, 5.4rem); letter-spacing: -0.045em; line-height: 0.92; font-variant-numeric: lining-nums tabular-nums; }
.big small { font-family: var(--font-body); font-size: 0.2em; letter-spacing: 0; font-weight: 500; color: var(--muted); margin-left: 8px; }
.big.is-loss { color: var(--rust); }
.answer-line { color: var(--muted); max-width: 44ch; font-size: 0.93rem; }
.answer-line strong { color: var(--ink); font-weight: 600; }
.example-tag { font-size: 0.8rem; color: var(--muted); font-style: normal; font-family: var(--font-display); }

/* Chart */
.landscape { margin: 0; padding-top: 18px; }
.chart-box { position: relative; width: 100%; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart-box text { font-family: var(--font-body); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chart-box .ax { fill: var(--muted); }
.chart-box .gridline { stroke: var(--grid); stroke-width: 1; }
.chart-box .baseline { stroke: var(--ink); stroke-width: 1; }
.chart-box .l-worth { fill: none; stroke: var(--gold); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart-box .l-in { fill: none; stroke: var(--ink); stroke-width: 1.3; stroke-linejoin: round; }
.chart-box .l-cmp { fill: none; stroke: var(--slate); stroke-width: 1.5; stroke-dasharray: 5 5; }
.chart-box .end-dot { fill: var(--gold); stroke: var(--paper); stroke-width: 2; }
.chart-box .tag-v { font-size: 13px; font-weight: 700; }
.chart-box .tag-s { fill: var(--muted); }
.chart-box .gain-label { font-family: var(--font-body); font-style: normal; font-size: 12.5px; font-weight: 600; fill: var(--gold); }
.chart-box .tick-in { fill: var(--paper); stroke: var(--ink); stroke-width: 1.3; }
.chart-box .tick-out { fill: var(--paper); stroke: var(--rust); stroke-width: 1.6; }
.chart-box .cross { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.45; }
.chart-box .hover-dot { fill: var(--gold); stroke: var(--paper); stroke-width: 2; }
.tip { position: absolute; top: 0; left: 0; pointer-events: none; min-width: 176px; z-index: 3; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); padding: 10px 12px; font-size: 0.84rem; display: grid; gap: 3px; transform: translate(-50%, 0); }
.tip .t-date { font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; margin-bottom: 2px; }
.tip .t-row { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.tip .t-row span:first-child { color: var(--muted); }
.tip .t-event { color: var(--gold); font-weight: 600; }
.tip .t-event.out { color: var(--rust); }
.hero-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-block: 10px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 0.84rem; color: var(--muted); }
.legend button { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; padding: 2px 0; cursor: pointer; color: inherit; }
.legend button[aria-pressed="false"] { opacity: 0.45; text-decoration: line-through; }
.chip { width: 16px; height: 0; border-top: 2.4px solid; display: inline-block; }
.chip-hay { border-color: var(--gold); }
.chip-soil { border-color: var(--ink); border-top-width: 1.5px; }
.chip-cmp { border-color: var(--slate); border-top-style: dashed; }
.foot-note { font-size: 0.8rem; color: var(--muted); max-width: 62ch; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 28px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.stat { padding: 12px 16px 14px 0; display: grid; gap: 2px; min-width: 0; }
.stat + .stat { padding-left: 16px; border-left: 1px solid var(--line); }
.stat .label { font-size: 0.76rem; font-weight: 600; color: var(--muted); }
.stat .v { font-family: var(--font-display); font-weight: 500; font-size: 1.5rem; font-variant-numeric: lining-nums tabular-nums; overflow-wrap: anywhere; line-height: 1.2; }
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* Inputs */
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 10px 20px; margin-bottom: 16px; }
.tool { padding-top: 52px; }
.bench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1020px) { .bench { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .bench .card-moves { grid-column: 1 / -1; grid-row: 2; } }
@media (max-width: 640px) { .bench { grid-template-columns: minmax(0, 1fr); } .bench .card-moves { grid-row: auto; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 13px; min-width: 0; }
.card h3 { display: flex; align-items: baseline; gap: 10px; font-size: 1.15rem; }
.card h3 .step { font-family: var(--font-display); font-style: normal; font-size: 1rem; color: var(--gold); }
.hint { font-size: var(--step--1); color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field label, .label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
input, select, textarea, button { font: inherit; color: inherit; }
input[type="text"], input[type="date"], select, textarea { width: 100%; min-width: 0; padding: 9px 11px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-variant-numeric: tabular-nums; }
input[type="date"] { min-height: 42px; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
.money { position: relative; }
.money span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 0.95rem; }
.money input { padding-left: calc(14px + var(--sym-w, 0.7em)); }
.pct { position: relative; }
.pct span { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.moves { display: grid; gap: 8px; }
.move, .moves-head { display: grid; grid-template-columns: 7.5rem minmax(0, 1.5fr) minmax(0, 1fr) 28px; gap: 6px; align-items: center; }
.move select { padding-inline: 6px; font-size: 0.9rem; }
.move input[type="date"] { padding-inline: 6px; }
.move.is-out select { color: var(--rust); font-weight: 600; }
.move.is-in select { color: var(--gold); font-weight: 600; }
.icon-btn { width: 28px; height: 34px; border-radius: var(--radius); border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); color: var(--rust); }
@media (max-width: 560px) {
  .moves-head { display: none; }
  .moves { gap: 10px; }
  .move { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) 30px; grid-template-areas: "type type x" "date amt amt"; border-top: 1px solid var(--line); padding-top: 10px; }
  .move input[type="date"] { grid-area: date; }
  .move .money { grid-area: amt; }
  .move .icon-btn { grid-area: x; }
}
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.btn:hover { border-color: var(--ink); }
.btn-hay { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-hay:hover { background: var(--gold); border-color: var(--gold); color: var(--paper); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); padding-inline: 8px; }
.btn-ghost:hover { color: var(--ink); border-color: transparent; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
details.paste summary { cursor: pointer; font-size: var(--step--1); color: var(--muted); font-weight: 600; }
details.paste[open] { display: grid; gap: 8px; }
details.paste textarea { min-height: 110px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.85rem; }
.errors { border: 1px solid var(--rust); border-left-width: 3px; border-radius: var(--radius); padding: 12px 16px; margin-top: 14px; }
.errors ul { margin: 6px 0 0; padding-left: 20px; }
.privacy { display: inline-flex; gap: 8px; align-items: center; font-size: var(--step--1); color: var(--muted); }

/* Comparison */
.versus-wrap { padding-top: 60px; display: grid; gap: 16px; }
.versus { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
@media (max-width: 720px) { .versus { grid-template-columns: minmax(0, 1fr); } }
.vs { padding: 16px 18px 6px 0; display: grid; gap: 4px; align-content: start; }
.vs + .vs { padding-left: 18px; border-left: 1px solid var(--line); }
@media (max-width: 720px) { .vs + .vs { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); } }
.vs .v { font-family: var(--font-display); font-weight: 500; font-size: 2rem; font-variant-numeric: lining-nums tabular-nums; line-height: 1.15; }
.vs p { font-size: var(--step--1); color: var(--muted); }
.vs.is-yours .v { color: var(--gold); }
.compare-line { font-size: 1rem; max-width: 70ch; }

/* Reading */
.prose { max-width: 700px; display: grid; gap: 16px; }
.prose ul, .prose ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.section { padding-top: 72px; }
.section h2 { margin-bottom: 4px; }
.formula { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92rem; background: var(--surface-2); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; white-space: pre; }
.example-table { overflow-x: auto; }
.example-table table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 0.95rem; border-top: 1px solid var(--ink); }
.example-table th, .example-table td { text-align: left; padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line); }
.example-table th { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.example-table td:last-child, .example-table th:last-child { text-align: right; white-space: nowrap; }
.faq { display: grid; border-top: 1px solid var(--ink); }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-family: var(--font-display); font-size: 1.12rem; }
.faq details p { margin-top: 10px; color: var(--muted); max-width: 66ch; }
.page-updated { margin: 8px 0 0; font-size: var(--step--1); color: var(--muted); }
.disclaimer { margin-top: 56px; max-width: 700px; font-size: var(--step--1); color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }

/* Floating result while editing */
.float-pill { position: fixed; left: 50%; transform: translateX(-50%); z-index: 20; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: inline-flex; align-items: center; gap: 12px; padding: 7px 7px 7px 16px; border-radius: var(--radius); background: var(--ink); color: var(--paper); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); font-size: 0.92rem; white-space: nowrap; }
.float-pill b { font-family: var(--font-display); font-size: 1.2rem; font-weight: 500; }
.float-pill a { text-decoration: none; background: var(--gold); color: var(--paper); border-radius: var(--radius); padding: 5px 11px; font-size: 0.84rem; font-weight: 600; }

/* Home: calculators overview */
.group-jump { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.group-jump a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; font-size: var(--step--1); font-weight: 600; }
.group-jump a:hover { border-color: var(--ink); }
.calc-group { scroll-margin-top: 16px; }
.home-hero { padding-block: 40px 8px; }
.home-hero h1 { font-size: clamp(2.3rem, 1.7rem + 3vw, 3.9rem); margin-top: 8px; }
.home-hero h1 em { font-style: normal; color: inherit; }
.home-hero .lede { max-width: 58ch; }
#calculators { scroll-margin-top: 12px; }
.calc-group { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 16px 40px; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--ink); }
.calc-group-head h2 { font-size: var(--step-3); }
.calc-group-head p { color: var(--muted); font-size: var(--step--1); margin-top: 6px; max-width: 26ch; }
@media (max-width: 900px) {
  .calc-group { grid-template-columns: minmax(0, 1fr); margin-top: 34px; }
  .calc-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
  .calc-group-head p { margin-top: 0; max-width: none; }
}
.calc-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 30px 24px; }
.calc-grid > li { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.calc-card { display: flex; flex-direction: column; gap: 5px; text-decoration: none; color: inherit; }
a.calc-card:hover { color: inherit; }
.calc-prev-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 10px; margin-bottom: 9px; }
a.calc-card:hover .calc-prev-box { border-color: var(--ink); }
a.calc-card:hover .calc-q { color: var(--gold); }
.calc-prev { display: block; width: 100%; height: auto; overflow: visible; }
.calc-name { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; color: var(--gold); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.calc-q { font-size: 1.28rem; line-height: 1.18; }
.calc-line { color: var(--muted); font-size: var(--step--1); line-height: 1.5; }
.calc-soon { font-size: 0.66rem; letter-spacing: 0.1em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.calc-also { font-size: 0.82rem; color: var(--muted); }
.calc-also a { color: var(--ink); text-decoration-color: var(--line); white-space: nowrap; }
.calc-also a:hover { color: var(--gold); text-decoration-color: var(--gold); }
.is-soon .calc-name { color: var(--muted); }
.is-soon .calc-prev { opacity: 0.5; filter: saturate(0.6); }
.is-soon .calc-q { color: var(--muted); }
@media (max-width: 560px) {
  .home-hero { padding-top: 28px; }
  .calc-group { margin-top: 30px; }
  .calc-grid { gap: 20px; }
  .calc-card { display: grid; grid-template-columns: 108px minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 14px; row-gap: 3px; align-items: start; }
  .calc-prev-box { grid-row: 1 / span 3; margin: 2px 0 0; padding: 9px 8px 7px; border-radius: var(--radius); }
  .calc-q { font-size: 1.1rem; }
  .calc-name { font-size: 0.66rem; letter-spacing: 0.12em; }
  .calc-line { font-size: 0.82rem; }
  .calc-also { padding-left: 122px; }
}
@media (prefers-reduced-motion: no-preference) {
  .calc-prev-box, .calc-q { transition: border-color 0.15s, color 0.15s; }
}
/* Small charts on the cards */
.calc-prev path, .calc-prev line, .calc-prev rect, .calc-prev circle { vector-effect: non-scaling-stroke; }
.calc-prev .p-base { stroke: var(--line); stroke-width: 1; }
.calc-prev .p-ink { fill: none; stroke: var(--ink); stroke-width: 1.3; stroke-linejoin: round; }
.calc-prev .p-ink-dash { fill: none; stroke: var(--ink); stroke-width: 1.3; stroke-dasharray: 4 3; }
.calc-prev .p-gold { fill: none; stroke: var(--gold); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.calc-prev .p-gold-faint { fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-dasharray: 3 4; opacity: 0.5; }
.calc-prev .p-rust { fill: none; stroke: var(--rust); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.calc-prev .p-slate { fill: none; stroke: var(--slate); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.calc-prev .p-gain { fill: var(--gold-area); fill-opacity: 0.2; }
.calc-prev .p-loss { fill: var(--rust); fill-opacity: 0.11; }
.calc-prev .p-dot { fill: var(--gold); stroke: var(--surface); stroke-width: 2; }
.calc-prev .p-dot-ink { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.calc-prev .p-dot-rust { fill: var(--rust); stroke: var(--surface); stroke-width: 2; }
.calc-prev .p-dot-hollow { fill: var(--surface); stroke: var(--ink); stroke-width: 1.4; }
.calc-prev .p-target { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.55; }
.calc-prev .p-drop { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.35; }
.calc-prev .p-bar-ink { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.calc-prev .p-bar-gold { fill: var(--gold-area); }
.calc-prev .p-seg-gold { fill: var(--gold-area); }
.calc-prev .p-seg-slate { fill: var(--slate); }
.calc-prev .p-seg-soft { fill: var(--muted); fill-opacity: 0.4; }
.calc-prev .p-flow { opacity: 0.2; }
.calc-prev .p-gap { stroke: var(--rust); stroke-width: 2; stroke-linecap: round; }

/* Shared header and footer (js/site.js) */
.site-header[data-site]:not([data-ready]) { min-height: 61px; }
/* Keep the masthead and footer rules the same width as the content below them. */
.site-header .wrap, .site-footer .wrap { position: relative; border-top: 0; border-bottom: 0; }
.site-header .wrap::after, .site-footer .wrap::before { content: ""; position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); height: 1px; background: var(--ink); }
.site-header .wrap::after { bottom: 0; }
.site-footer .wrap::before { top: 0; }
.site-nav .nav-page { display: contents; }
.site-nav a[aria-current="page"] { color: var(--ink); }
@media (max-width: 560px) { .site-nav .nav-page { display: none; } }
.site-footer[data-site] .wrap { display: block; padding-block: 26px 34px; }
.foot-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 24px 40px; }
.foot-brand { display: grid; gap: 8px; align-content: start; }
.foot-brand .brand { color: var(--ink); font-size: 1.15rem; }
.foot-brand .brand svg { width: 27px; height: auto; }
.foot-brand p { max-width: 32ch; }
.foot-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 24px; }
.foot-col h2 { font-family: var(--font-body); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.foot-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.foot-col a { text-decoration: none; }
.foot-col a:hover { color: var(--gold); }
.foot-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); }
@media (max-width: 640px) { .foot-top { grid-template-columns: minmax(0, 1fr); } }

@media (prefers-reduced-motion: no-preference) {
  .btn, .icon-btn { transition: border-color 0.15s, background-color 0.15s, color 0.15s; }
}

/* Theme switch */
.site-nav { align-items: center; }
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 9px; cursor: pointer; color: var(--muted); font-size: 0.82rem; }
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }
.theme-toggle[data-next="light"] .i-moon, .theme-toggle[data-next="dark"] .i-sun { display: none; }

/* Inputs, refined */
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.inline-field select { width: auto; padding-block: 7px; }
.field-err { font-size: 0.8rem; color: var(--rust); min-height: 0; }
.field-err:empty { display: none; }
input[aria-invalid="true"] { border-color: var(--rust); box-shadow: 0 0 0 1px var(--rust); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--gold-soft); }
.seg { display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; height: 40px; }
.seg button { border: 0; background: var(--paper); color: var(--muted); font-weight: 600; font-size: 0.85rem; cursor: pointer; padding: 0 6px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"].in { background: var(--gold-soft); color: var(--gold); }
.seg button[aria-pressed="true"].out { background: var(--rust); color: var(--paper); }
.move.is-out .money input { color: var(--rust); }
.move-err { grid-column: 2 / -1; font-size: 0.8rem; color: var(--rust); }
.move-err:empty { display: none; }
.moves-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; }
.moves-sum { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.moves-sum b { color: var(--ink); font-weight: 600; }
.helpers { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.empty-moves { border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.preset { border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); padding: 7px 11px; font-size: 0.88rem; font-weight: 600; cursor: pointer; color: var(--muted); }
.preset:hover { border-color: var(--ink); color: var(--ink); }
.preset[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.preset-custom { width: 6.2rem; }
.preset-custom input { padding-block: 7px; padding-right: 24px; }
@media (max-width: 560px) {
  .move { grid-template-areas: "type type x" "date amt amt" "err err err"; }
  .move .seg { grid-area: type; width: 9rem; }
  .move-err { grid-area: err; }
}

/* Forecast */
.card-forecast { grid-column: 1 / -1; }
.fc-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 20px; }
.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; margin: 0; transition: background-color 0.15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.switch input:checked { background: var(--gold); }
.switch input:checked::after { transform: translateX(16px); }
.fc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 18px; align-items: start; }
.fc-grid.is-off { opacity: 0.45; pointer-events: none; }
@media (max-width: 900px) { .fc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .fc-grid { grid-template-columns: minmax(0, 1fr); } }
.fc-amount-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.fc-amount-row select { width: auto; }
.pct input { padding-right: 34px; }
.linkish { background: none; border: 0; padding: 0; color: var(--gold); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.chip-fc { width: 16px; height: 10px; border: 0; background: var(--gold-area); opacity: 0.4; border-radius: 2px; }
.forecast-line { margin-top: 14px; font-size: 1rem; max-width: 80ch; }
.forecast-line .fc-note { color: var(--muted); font-size: 0.85rem; }
.chart-box .fc-zone { fill: var(--surface-2); opacity: 0.55; }
.chart-box .fc-band { fill: var(--gold-area); fill-opacity: 0.16; }
.chart-box .fc-mid { fill: none; stroke: var(--gold); stroke-width: 2; stroke-dasharray: 6 4; stroke-linecap: round; }
.chart-box .fc-edge { fill: none; stroke: var(--gold); stroke-width: 1; stroke-opacity: 0.45; }
.chart-box .fc-put { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 3 4; }
.chart-box .today-line { stroke: var(--ink); stroke-width: 1; stroke-opacity: 0.5; }
.chart-box .zone-label { fill: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }

/* Info tips and small helpers */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.info { position: relative; display: inline-flex; vertical-align: middle; }
.info-btn { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-family: var(--font-display); font-style: italic; font-size: 11px; font-weight: 600; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.info-btn:hover, .info-btn[aria-expanded="true"] { border-color: var(--ink); color: var(--ink); }
.info-pop { position: absolute; z-index: 30; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: min(260px, 80vw); background: var(--ink); color: var(--paper); font-family: var(--font-body); font-size: 0.82rem; font-weight: 400; font-style: normal; line-height: 1.45; letter-spacing: 0; text-transform: none; padding: 10px 12px; border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); text-align: left; }
.card .info-pop { left: 0; transform: none; }
.hero-foot .info-pop { left: auto; right: 0; transform: none; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.label-row label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.linkish { font-size: 0.8rem; }
.hero-foot .wrap { align-items: center; }

/* v3: simple layout. Graph first, then three short groups of inputs, then year by year. */
.landscape { padding-top: 22px; }
.legend-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 24px; padding-top: 10px; }
.legend-row .hint { font-size: 0.8rem; }
.stats:not(.has-fc) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat .sub { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.stat-fc .v { color: var(--gold); }
.tool { padding-top: 44px; }
.simple { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr); border-top: 1px solid var(--ink); }
.simple .col { border: 0; margin: 0; padding: 16px 22px 18px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.simple .col:first-child { padding-left: 0; }
.simple .col:last-child { padding-right: 0; }
.simple .col + .col { border-left: 1px solid var(--line); }
.simple legend { float: left; width: 100%; padding: 0; font-family: var(--font-display); font-size: 1.15rem; }
.simple legend + * { clear: both; }
@media (max-width: 900px) {
  .simple { grid-template-columns: minmax(0, 1fr); }
  .simple .col { padding-inline: 0; }
  .simple .col + .col { border-left: 0; border-top: 1px solid var(--line); }
}
.simple .row2 { gap: 10px; }
.move { grid-template-columns: 3.4rem minmax(0, 1.25fr) minmax(0, 1fr) 28px; gap: 6px; }
.sign { height: 40px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--gold-soft); color: var(--gold); font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.move.is-out .sign { background: var(--rust); border-color: var(--rust); color: var(--paper); }
.move-err { grid-column: 2 / -1; }
@media (max-width: 560px) {
  .move { grid-template-columns: 3.4rem minmax(0, 1.25fr) minmax(0, 1fr) 28px; grid-template-areas: none; border-top: 0; padding-top: 0; }
  .move input[type="date"], .move .money, .move .icon-btn, .move-err { grid-area: auto; }
  .move-err { grid-column: 2 / -1; }
}
.moves { max-height: 330px; overflow-y: auto; padding: 2px; margin: -2px; }
.fc-fields { display: grid; gap: 12px; }
.fc-fields.is-off { opacity: 0.4; pointer-events: none; }
.privacy { margin-top: 12px; }
.errors { margin-top: 4px; }

/* Year by year */
#years { padding-top: 56px; }
#years h2 { margin-bottom: 14px; }
.yt-scroll { overflow-x: auto; }
/* Hidden screen-reader labels inside a scrolling table stay inside it (otherwise they widen the page on phones). */
[class*="yt-scroll"] { position: relative; }
.yt { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.95rem; border-top: 1px solid var(--ink); }
.yt th, .yt td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.yt th:first-child { text-align: left; }
.yt thead th { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.yt tbody th { font-weight: 600; }
.yt td.neg { color: var(--rust); }
.yt-note-inline { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.yt tr.is-fc { color: var(--muted); }
.yt tr.is-fc b { color: var(--gold); font-weight: 600; }
.yt tr.yt-split td { text-align: left; padding-top: 18px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; color: var(--gold); border-bottom-color: var(--ink); }
#yt-note { margin-top: 10px; }
@media (max-width: 480px) { .yt { font-size: 0.85rem; } .yt th, .yt td { padding-right: 8px; } }

/* v3.1: inputs beside the graph on desktop, right under it on phones. */
.hero-head { display: block; padding-block: 26px 6px; }
.hero-head h1 { font-size: var(--step-3); max-width: none; margin-top: 6px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px 40px; align-items: start; padding-top: 18px; }
.stage { position: sticky; top: 12px; display: grid; gap: 0; min-width: 0; }
.answer { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 18px; }
.answer .label { flex-basis: 100%; }
.answer .big { font-size: clamp(2.8rem, 2rem + 2.6vw, 4.2rem); }
.answer-line { padding-bottom: 6px; }
.answer .example-tag { flex-basis: 100%; }
.landscape { padding-top: 14px; }
.stats { margin-top: 22px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 18px; display: grid; gap: 4px; min-width: 0; }
.panel-head { display: grid; gap: 10px; padding-bottom: 12px; }
.panel-head h2 { font-size: 1.45rem; }
.panel-head .btn-row { flex-wrap: nowrap; }
.panel-head .inline-field { flex: 1; min-width: 0; }
.panel-head .inline-field select { width: 100%; }
.panel .simple { grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--ink); }
.panel .simple .col { padding: 14px 0; }
.panel .simple .col + .col { border-left: 0; border-top: 1px solid var(--line); }
.panel .simple .col:last-child { padding-bottom: 4px; }
.panel .simple legend { font-size: 1.05rem; }
.panel .move { grid-template-columns: 2.9rem minmax(0, 1.25fr) minmax(0, 1fr) 24px; }
.panel .move input[type="date"] { padding-inline: 6px; font-size: 0.92rem; }
.panel .icon-btn { width: 24px; }
.panel .moves { max-height: 236px; }
.panel .privacy { margin-top: 8px; }
.panel .errors { margin-top: 8px; }
@media (max-width: 960px) {
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .stage { display: contents; }
  .stage .answer { order: 1; }
  .stage .landscape { order: 2; }
  .panel { order: 3; margin-top: 20px; }
  .stage .stats { order: 4; margin-top: 28px; }
}

@media (max-width: 600px) {
  .hero-head { padding-block: 18px 0; }
  .hero-head h1 { font-size: 1.6rem; }
  .hero-head .eyebrow { display: none; }
  .answer .big { font-size: 2.9rem; }
  .answer-line { font-size: 0.85rem; flex-basis: 100%; padding-bottom: 0; }
  .answer .label { display: none; }
  .landscape { padding-top: 6px; }
  .legend-row .hint { display: none; }
  .panel { padding: 14px 14px 16px; margin-inline: -4px; }
  .panel .move input[type="date"] { font-size: 0.88rem; }
}

/* Second graph: what you put in vs. growth */
.bars-msg { font-size: 1.05rem; margin-bottom: 14px; max-width: 70ch; }
.bars-msg b { color: var(--gold); font-weight: 700; }
.bars-box .b-put { fill: var(--base-fill); }
.bars-box .b-grow { fill: var(--gold-area); }
.bars-box .b-loss { stroke: var(--rust); stroke-width: 2; }
.bars-box .bar { transition: opacity 0.12s; }
.bars-box .bar.is-fc { opacity: 0.5; }
.bars-box .bar.is-dim { opacity: 0.3; }
.legend-static { margin: 10px 0 26px; }
.legend-static span { display: inline-flex; align-items: center; gap: 7px; }
.sq { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.sq-put { background: var(--base-fill); }
.sq-grow { background: var(--gold-area); }
.sq-fc { background: var(--gold-area); opacity: 0.4; }

/* One content width everywhere: reading sections use the full width, heading left, text right. */
.prose, .disclaimer { max-width: none; }
@media (min-width: 900px) {
  .section.prose { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); column-gap: 48px; row-gap: 0; align-items: start; }
  .section.prose > h2 { grid-column: 1; grid-row: 1 / span 30; }
  .section.prose > :not(h2) { grid-column: 2; margin-bottom: 16px; }
}
@media (max-width: 480px) {
  .yt .wide, .yt-note-inline { display: none; }
  .yt { font-size: 0.82rem; }
  .yt th, .yt td { padding-right: 6px; }
  .yt th:last-child, .yt td:last-child { padding-right: 0; }
}
@media (max-width: 1200px) and (min-width: 961px) { .workspace { grid-template-columns: minmax(0, 1fr) 340px; gap: 28px 28px; } }
.opt { font-family: var(--font-body); font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius); padding: 1px 6px; margin-left: 6px; vertical-align: 2px; }



/* Why does my app show a different number? */
#app-vs-you { display: grid; gap: 14px; }
.avy-lede { font-size: 1.05rem; }
.avy-lede b { font-weight: 600; }
.avy-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; border-top: 1px solid var(--ink); }
.avy-card { display: grid; gap: 8px; align-content: start; padding: 16px 28px 0 0; min-width: 0; }
.avy-card + .avy-card { padding: 16px 0 0 28px; border-left: 1px solid var(--line); }
.avy-card h3 { font-size: 1.3rem; }
.avy-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; }
.avy-card .preset { padding: 5px 10px; font-size: 0.82rem; }
.chart-box.mini svg { max-height: 220px; }
.chart-box.mini .mini-gap { fill: var(--gold-area); fill-opacity: 0.22; }
.chart-box.mini .mini-note { fill: var(--muted); font-size: 11px; font-weight: 600; }
.avy-nums { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--line); }
.avy-nums > div { display: grid; gap: 2px; padding: 10px 12px 4px 0; }
.avy-nums > div + div { padding-left: 14px; border-left: 1px solid var(--line); }
.avy-nums .v { font-family: var(--font-display); font-size: 1.7rem; font-weight: 500; font-variant-numeric: lining-nums tabular-nums; line-height: 1.15; }
.avy-nums .v.is-lower { color: var(--rust); }
.avy-nums .v.is-higher { color: var(--gold); }
.avy-take { font-size: 1.05rem; max-width: 72ch; margin-top: 6px; }
.avy-take b { font-weight: 700; }
.avy-foot { max-width: 80ch; }
@media (max-width: 760px) {
  .avy-grid { grid-template-columns: minmax(0, 1fr); }
  .avy-card { padding-right: 0; }
  .avy-card + .avy-card { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); margin-top: 18px; }
}
.chart-box.mini .mini-loss { fill: var(--rust); fill-opacity: 0.16; }
.avy-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.avy-controls .legend-static { margin: 0 0 0 auto; }
@media (max-width: 760px) { .avy-controls .legend-static { margin-left: 0; flex-basis: 100%; } }

/* "Your past" folds closed until you open it */
.fold > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: ""; width: 9px; height: 9px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: rotate(45deg); margin: -4px 4px 0 0; grid-row: 1 / span 2; grid-column: 2; transition: transform 0.15s; }
.fold[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.fold > summary:hover .pf-title { color: var(--gold); }
.pf-title { font-family: var(--font-display); font-size: 1.05rem; }
.pf-sum { font-size: 0.85rem; color: var(--muted); grid-column: 1; }
.pf-body { display: grid; gap: 12px; padding-top: 12px; }
.pf-sub { font-family: var(--font-body); font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-top: 4px; }
@media (max-width: 960px) and (min-width: 600px) {
  .panel .simple { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "today ahead" "past ahead"; column-gap: 24px; }
  .panel .simple > .col:nth-child(1) { grid-area: today; }
  .panel .simple > .past-fold { grid-area: past; }
  .panel .simple > .col:nth-child(3) { grid-area: ahead; border-top: 0; border-left: 1px solid var(--line); padding-left: 24px; }
}
@media (max-width: 960px) and (min-width: 600px) {
  .panel .simple { grid-template-rows: auto 1fr; align-items: start; }
}
.fc-note { font-size: 0.85rem; color: var(--muted); max-width: 80ch; margin-top: 8px; }
.fc-note b { color: var(--ink); font-weight: 600; }
.chart-box text.tag-v { fill: var(--ink); }

/* Compact inputs: the panel should be no taller than the graph beside it */
.stage { position: static; }
.panel { padding: 14px 16px 12px; gap: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 10px; }
.panel-head h2 { font-size: 1.25rem; }
.panel-head .btn-row { gap: 4px; flex-wrap: nowrap; }
.panel-head .inline-field { flex: 0 1 auto; }
.panel-head .inline-field select { width: 8.6rem; padding: 6px 8px; font-size: 0.85rem; }
.panel-head .btn { padding: 6px 10px; font-size: 0.85rem; }
.panel .simple .col { padding: 10px 0; gap: 8px; }
.panel .simple legend { font-size: 1rem; margin-bottom: 2px; }
.panel input[type="text"], .panel input[type="date"], .panel select { padding: 7px 10px; }
.panel input[type="date"] { min-height: 38px; }
.panel .field { gap: 2px; }
.panel .field label, .panel .label { font-size: 0.76rem; }
.panel .preset { padding: 6px 10px; font-size: 0.85rem; }
.panel .sign { height: 36px; }
.panel .icon-btn { height: 32px; }
.panel .moves { gap: 6px; max-height: 360px; }
.crow { display: grid; grid-template-columns: 4rem minmax(0, 1fr); align-items: center; gap: 8px; }
.crow > .label, .crow > label { font-size: 0.76rem; font-weight: 600; color: var(--muted); }
.crow .hint { display: block; font-size: 0.76rem; margin-top: 3px; }
.fc-fields { gap: 8px; }
.pct-wide input { padding-right: 70px; }
.fc-elsewhere { font-size: 0.8rem; margin: 0 0 10px; }
.fc-elsewhere a, .answer-line a { color: inherit; }
.panel .privacy { margin-top: 6px; font-size: 0.78rem; }
.pf-body { gap: 8px; padding-top: 8px; }
.panel .money input { padding-left: calc(13px + var(--sym-w, 0.7em)); }
@media (min-width: 961px) { .workspace { align-items: stretch; } .panel { align-content: start; } }
.crow { grid-template-columns: 3.4rem minmax(0, 1fr); }
.panel .preset.mix { padding-inline: 9px; }
@media (max-width: 1200px) and (min-width: 961px) { .workspace { grid-template-columns: minmax(0, 1fr) 360px; } }

/* ===== Layout polish (2026-11-29): steady charts, fixed-width tooltips, related calculators =====
   Structural only: spacing and sizing. Colours and fonts come from the variables above. */

/* Tooltips keep one width wherever they sit, instead of squeezing and wrapping near the right edge. */
.tip, .rb-tip { width: max-content; max-width: min(300px, calc(100vw - 32px)); }
.tip .t-row > span:last-child, .tip .t-row > b:last-child { white-space: nowrap; }

/* Spacing for the answer above the chart; where the sentence sits is set at the end of this file. */
.workspace .answer, .pp-answer, .rr-answer { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; justify-items: start; gap: 2px; }
.workspace .answer-line, .pp-answer .answer-line, .rr-answer .answer-line { max-width: 62ch; min-height: 2.9em; line-height: 1.45; padding-bottom: 0; }
.workspace .stage .landscape { padding-top: 8px; }
/* "Example numbers" keeps its line when hidden, so loading or leaving the example doesn't shift the chart. */
.answer .example-tag[hidden], .pp-answer .example-tag[hidden], .rr-answer .example-tag[hidden] { display: block !important; visibility: hidden; }

/* Related calculators, added above the footer by js/site.js */
.related { padding-top: 64px; }
.related h2 { font-size: var(--step-2); margin-bottom: 14px; }
.related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; list-style: none; margin: 0; padding: 0; }
.related-card { display: grid; align-content: start; gap: 4px; height: 100%; padding: 14px 16px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; }
.related-card:hover { border-color: var(--ink); color: inherit; }
.related-card .rc-name { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; color: var(--gold); }
.related-card .rc-q { font-family: var(--font-display); font-size: 1.12rem; line-height: 1.25; }
.related-card .rc-line { font-size: 0.85rem; color: var(--muted); }
@media (max-width: 760px) { .related-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; } .related { padding-top: 48px; } }
.workspace .answer .label, .pp-answer .label, .rr-answer .label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* A tighter top, so the question, the answer, the main chart and the inputs fit on one screen.
   Classes are repeated to win over each page's own stylesheet, which loads after this one. */
.site-header .wrap { padding-block: 14px 10px; }
:is(.hero-head, .cc-head, .fd-head, .xp-head, .lt-head, .om-head, .rb-head, .pp-head, .fr-head, .rw-head, .rr-head, .sor-head).wrap.wrap { padding-block: 18px 2px; }
:is(.fd-head, .sor-head).wrap.wrap h1 { max-width: none; }
@media (max-width: 600px) {
  .site-header .wrap { padding-block: 12px 8px; }
  :is(.hero-head, .cc-head, .fd-head, .xp-head, .lt-head, .om-head, .rb-head, .pp-head, .fr-head, .rw-head, .rr-head, .sor-head).wrap.wrap { padding-block: 12px 0; }
}
/* Slimmer inputs on desktop (phones keep the bigger touch size). */
@media (min-width: 961px) {
  main form :is(input[type="text"], input[type="date"], select)[class], main form :is(input[type="text"], input[type="date"], select):not([class]) { padding-top: 7px; padding-bottom: 7px; line-height: 1.35; }
  main form input[type="date"]:not(#_) { min-height: 38px; }
}

/* ===== Almanac layer =====
   Everything that makes Haybird look like Haybird: kept together at the end so it wins over the
   base rules above. Page stylesheets use the same tokens, so colors and fonts follow automatically. */
body { background-color: var(--paper); }
::selection { background: var(--gold-soft); color: var(--ink); }
a { text-decoration-color: color-mix(in srgb, var(--ink) 35%, transparent); text-decoration-thickness: 1px; }
a:hover { color: var(--gold); text-decoration-color: var(--gold); }
h1, h2, h3 { font-weight: 400; letter-spacing: -0.005em; }
.hero-head h1, .home-hero h1 { letter-spacing: -0.015em; line-height: 1.06; }
.eyebrow, .calc-name { font-family: var(--font-display); font-style: italic; font-size: 0.98rem; letter-spacing: 0; text-transform: none; font-weight: 400; color: var(--muted); }
.foot-col h2, .lt-fig-h { font-family: var(--font-display); font-style: normal; font-size: 0.95rem; letter-spacing: 0; text-transform: none; font-weight: 400; color: var(--ink); }
.eyebrow .folio-no, .calc-no { font-style: normal; color: var(--ink); margin-right: 0.7em; padding-right: 0.7em; border-right: 1px solid var(--line); }
.label, .field label, .label-row label, .answer .label, .stat .label { letter-spacing: 0.01em; }

/* Masthead: wide brand in capitals, a double rule under it */
.site-header .wrap::after, .site-footer .wrap::before { height: 1px; background: var(--line); }
.brand { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; font-size: 1.12rem; gap: 10px; }
.brand svg { width: 31px; height: auto; }
.brand .brand-tag { font-family: var(--font-body); font-size: 0.62rem; font-weight: 600; letter-spacing: 0.2em; color: var(--muted); border-left: 1px solid var(--line); padding-left: 10px; margin-left: 2px; }
@media (max-width: 720px) { .brand .brand-tag { display: none; } }
.site-nav a { font-size: 0.88rem; font-weight: 500; color: var(--muted); }
.site-nav a:hover { color: var(--ink); }
.theme-toggle { border-color: var(--line); color: var(--muted); font-size: 0.84rem; font-weight: 500; padding: 4px 10px; }
.theme-toggle:hover { border-color: var(--ink); color: var(--ink); }
.site-footer .wrap::before { top: 0; }
.site-footer em { font-family: var(--font-display); }

/* The answer */
.big { letter-spacing: -0.03em; font-weight: 400; }
.big small { font-family: var(--font-display); font-style: normal; letter-spacing: 0; }
.answer .label { font-family: var(--font-display); font-style: normal; font-size: 0.98rem; color: var(--muted); font-weight: 400; letter-spacing: 0; text-transform: none; }

/* Panels: square, ruled in ink, no shadows */
.card { background: transparent; border: 1px solid var(--line); box-shadow: none; }
.card h3 { font-family: var(--font-display); }
.card h3 .step { color: var(--muted); }
.tip { border: 1px solid var(--line); background: var(--surface); box-shadow: 0 6px 18px color-mix(in srgb, var(--ink) 10%, transparent); }
.tip .t-date { font-weight: 700; }
.info-pop, .float-pill { box-shadow: 3px 3px 0 color-mix(in srgb, var(--ink) 20%, transparent); }
.float-pill a { background: var(--gold); }

/* Inputs as ledger lines */
input[type="text"], input[type="date"], select, textarea { background: transparent; border-color: color-mix(in srgb, var(--ink) 22%, transparent); }
input:hover, select:hover, textarea:hover { border-color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.btn, .preset, .seg, .theme-toggle, .icon-btn { border-radius: var(--radius); }
.btn { border-color: var(--line); background: transparent; }
.btn:hover, .preset:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-hay:hover { background: var(--gold); border-color: var(--gold); }
.btn-ghost, .btn-ghost:hover { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { color: var(--ink); }
.preset { border-color: color-mix(in srgb, var(--ink) 22%, transparent); background: transparent; color: var(--ink); }
.seg { border-color: color-mix(in srgb, var(--ink) 22%, transparent); }
.seg button { background: transparent; color: var(--ink); }
.seg button + button { border-left-color: color-mix(in srgb, var(--ink) 22%, transparent); }
.seg button[aria-pressed="true"], .seg button[aria-pressed="true"].in { background: var(--ink); color: var(--paper); }
.seg button[aria-pressed="true"].out { background: var(--rust); color: var(--paper); }
.switch input:checked { background: var(--ink); }

/* Figures in a row, separated by dotted rules */
.stats { border-top: 1px solid var(--line); border-bottom: 0; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat .label, .vs .label { font-family: var(--font-display); font-style: normal; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 0.95rem; color: var(--muted); }
.stat .v, .vs .v { font-weight: 400; }

/* Charts drawn like engraved figures */
.chart-box .baseline { stroke-width: 1.5; }
.chart-box .zone-label { font-family: var(--font-body); font-style: normal; font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 12px; }
.legend-row .hint, .foot-note { font-family: var(--font-body); font-style: normal; }
.chip-hay { border-top-width: 3px; }

/* Soft areas are hatched instead of tinted (patterns come from js/site.js) */
:root .calc-prev .p-gain, :root .chart-box .gap-good, :root .chart-box .save-area, :root .chart-box .xp-saved-area,
:root .chart-box .cc-saved-area, :root .chart-box .om-inv-area, :root .chart-box .pot-area, :root .chart-box .ess-area,
:root .chart-box .a-pot, :root .chart-box.mini .mini-gap, :root .ls-paths .ls-gap-up, :root .sor .chart-box .gap {
  fill: url(#hb-hatch-gain); fill-opacity: 1;
}
:root .calc-prev .p-loss, :root .chart-box .gap-bad, :root .chart-box .lost-area, :root .chart-box .drag-area,
:root .chart-box .cc-int-area, :root .chart-box.mini .mini-loss, :root .cr-chart .cr-hole, :root .curve-box .c-area,
:root .ls-paths .ls-gap-dn, :root .rates-box .r-short {
  fill: url(#hb-hatch-loss); fill-opacity: 1;
}
.hb-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Reading */
.section h2, .calc-group-head h2 { position: relative; }
.faq, .example-table table, .versus { border-top: 1px solid var(--line); }
.calc-group { border-top: 1px solid var(--line); }
.faq summary { font-size: 1.08rem; }
.formula { background: transparent; border: 1px solid var(--line); }
code { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.disclaimer { border-top: 1px solid var(--line); }

/* Home */
.home-hero h1 em { color: inherit; }
.calc-prev-box { background: transparent; border-color: var(--line); }
a.calc-card:hover .calc-prev-box { border-color: var(--ink); }
a.calc-card:hover .calc-q { color: var(--gold); }
.calc-no { color: var(--muted); font-weight: 600; }
.related-card { background: transparent; border-color: var(--line); }
.related-card .rc-name { font-family: var(--font-display); font-style: italic; color: var(--muted); font-weight: 400; letter-spacing: 0; text-transform: none; font-size: 0.95rem; }
.related-card:hover .rc-q { color: var(--gold); }

/* The big answer always stays on one line; js/site.js shrinks it to fit when it's too wide. */
.big, .fd-big, .sor-big { white-space: nowrap; }
@media (max-width: 400px) {
  .brand { letter-spacing: 0.03em; font-size: 1.02rem; gap: 8px; }
  .site-nav { gap: 12px; }
}

/* Share link (js/site.js) */
.btn.share-btn { gap: 5px; }
.btn.share-btn svg { flex: none; }
.shared-note { margin: 10px 0 0; padding: 8px 12px; border-left: 2px solid var(--gold); background: var(--surface); font-size: 0.85rem; color: var(--muted); }
.shared-note .linkish { font-size: inherit; }
@media (max-width: 420px) { .btn.share-btn .share-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }

/* Quiet (2026-11-29): the inputs panel is open, ruled on the left only, so the page reads as one sheet. */
:root body :is(.panel, .fi-panel, .fd-panel, .cc-panel, .om-panel, .lt-panel, .xp-panel, .rb-panel, .pp-panel, .rr-panel, .rw-panel, .fr-panel) {
  background: transparent; border: 0; border-left: 1px solid var(--line); border-radius: 0; box-shadow: none; padding-left: 28px; }
@media (max-width: 960px) {
  :root body :is(.panel, .fi-panel, .fd-panel, .cc-panel, .om-panel, .lt-panel, .xp-panel, .rb-panel, .pp-panel, .rr-panel, .rw-panel, .fr-panel) {
    border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-right: 0; margin-inline: 0; }
}

/* Inputs panels never grow wider than their column: between 961 and 1200px wide some came out a few pixels too wide
   and the page scrolled sideways. */
:root body :is(.panel, .fi-panel, .fd-panel, .cc-panel, .om-panel, .lt-panel, .xp-panel, .rb-panel, .pp-panel, .rr-panel, .rw-panel, .fr-panel) { grid-template-columns: minmax(0, 1fr); }
:root body :is(.panel, .fi-panel, .fd-panel, .cc-panel, .om-panel, .lt-panel, .xp-panel, .rb-panel, .pp-panel, .rr-panel, .rw-panel, .fr-panel) fieldset { min-width: 0; }
@media (max-width: 1200px) and (min-width: 961px) { .panel-head .btn-row { flex-wrap: wrap; } }

/* Answer bar: on phones, shows the answer at the bottom while you edit the numbers below the chart (js/answer-bar.js) */
.answer-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; align-items: baseline; gap: 12px;
  width: 100%; margin: 0; padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--paper); color: var(--ink); border: 0; border-top: 1px solid var(--ink); border-radius: 0;
  font: inherit; text-align: left; cursor: pointer; box-shadow: 0 -6px 18px color-mix(in srgb, var(--ink) 10%, transparent);
  transform: translateY(110%); visibility: hidden; transition: transform 0.22s ease, visibility 0s linear 0.22s; }
.answer-bar.is-on { transform: none; visibility: visible; transition: transform 0.22s ease, visibility 0s; }
.answer-bar .ab-label { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.answer-bar .ab-value { flex: none; font-family: var(--font-display); font-size: 1.3rem; line-height: 1.1; }
.answer-bar .ab-up { flex: none; align-self: center; color: var(--muted); }
html.has-answer-bar body { padding-bottom: 64px; }
@media (prefers-reduced-motion: reduce) { .answer-bar, .answer-bar.is-on { transition: none; } }
@media print { .answer-bar { display: none; } }

/* Charts: drag sideways to move through the points, scroll up and down as usual; keyboard focus ring (js/chart-touch.js) */
svg[data-hb-keys] { touch-action: pan-y; }
svg[data-hb-keys]:focus { outline: none; }
svg[data-hb-keys]:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

/* "Using your inflation (2.5%) from another calculator. Forget" (js/shared-settings.js) */
.saved-note { margin: 8px 0 0; font-size: 0.85rem; color: var(--muted); }
.saved-note .linkish { font-size: inherit; margin-left: 2px; }

/* Italic is kept for one job only: the small caption labels (calculator names on cards and pages). */
h1 em, h2 em { font-style: normal; color: inherit; }

/* Dark mode: native dropdown lists take their colors from the option, not the page (Windows Chrome showed white with pale text). */
select option, select optgroup { background-color: var(--paper); color: var(--ink); }

/* "Save image" under each chart (js/chart-tools.js) */
.save-row { display: flex; justify-content: flex-end; margin: 6px 0 0; }
.save-img { font: inherit; font-size: var(--step--1); color: var(--muted); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.save-img:hover { color: var(--gold); text-decoration-color: currentColor; }
.save-img:disabled { cursor: default; opacity: 0.7; }
@media print { .save-row { display: none; } }

/* a chart with nothing to draw yet */
.chart-empty { min-height: 260px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); padding: 24px; text-align: center; }
.chart-empty p { max-width: 36ch; color: var(--muted); }

/* wide screens: a little more room for the charts */
@media (min-width: 1320px) { .wrap { max-width: 1260px; } }

/* "Wider chart" (js/chart-tools.js): the inputs panel folds away, one line sums it up */
.save-row { gap: 18px; }
.is-chart-wide { grid-template-columns: minmax(0, 1fr) !important; }
.is-folded { display: none !important; }
.inputs-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: var(--step--1); color: var(--muted); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px 0; margin-bottom: 16px; }
.inputs-summary .is-label { color: var(--ink); font-weight: 600; }
.inputs-summary .is-edit { font: inherit; color: var(--gold); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 960px) { .wide-toggle, .inputs-summary { display: none !important; } }
/* The "Wider chart" glide (js/chart-tools.js, view transitions, 0.3s). The chart stretches to its new
   width while it cross-fades into the redrawn one; the blocks around it keep their real size (left-aligned,
   no stretching) and slide to their new places. The inputs fade out at the side and rise in under the
   chart (or the summary line fades in); the reverse going back. */
.hb-gliding::view-transition-group(*) { animation-duration: 0.3s; animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.hb-gliding::view-transition-image-pair(*) { overflow: clip; }
.hb-gliding::view-transition-old(*), .hb-gliding::view-transition-new(*) {
  width: 100%; height: 100%; object-fit: none; object-position: left top; animation-duration: 0.3s;
}
.hb-gliding::view-transition-old(hb-plot), .hb-gliding::view-transition-new(hb-plot) { object-fit: fill; }
.hb-gliding::view-transition-old(hb-panel-side), .hb-gliding::view-transition-old(hb-panel-under), .hb-gliding::view-transition-old(hb-summary) { animation: 0.12s ease-in both hb-fade-out; }
.hb-gliding::view-transition-new(hb-panel-side), .hb-gliding::view-transition-new(hb-panel-under), .hb-gliding::view-transition-new(hb-summary) { animation: 0.22s ease-out 0.1s both hb-rise-in; }
.hb-gliding::view-transition-new(hb-panel-side) { animation-name: hb-slide-in; }
@keyframes hb-fade-out { to { opacity: 0; } }
@keyframes hb-rise-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes hb-slide-in { from { opacity: 0; transform: translateX(18px); } }

/* The answer above the chart, the same on every calculator: the label on top, then the big
   number with its explaining sentence beside it. The sentence drops below the number on phones,
   and whenever the number is too wide to leave it room (about 17rem). This block decides the
   layout for every calculator, so page stylesheets don't need their own rules for it.
   (Markets pages keep their own, in markets/markets.css.) */
:is(.answer, .fd-answer, .pp-answer, .rr-answer, .xp-answer, .cc-answer, .om-answer, .rb-answer, .lt-answer, .fr-answer, .rw-answer):not(.mk-answer):has(> .big, > .fd-big) {
  display: flex !important; flex-wrap: wrap !important; align-items: flex-end !important; gap: 4px 22px !important;
}
:is(.answer, .fd-answer, .pp-answer, .rr-answer, .xp-answer, .cc-answer, .om-answer, .rb-answer, .lt-answer, .fr-answer, .rw-answer):not(.mk-answer):has(> .big, > .fd-big) > :not(.big, .fd-big, p) { flex: 0 0 100% !important; }
:is(.answer, .fd-answer, .pp-answer, .rr-answer, .xp-answer, .cc-answer, .om-answer, .rb-answer, .lt-answer, .fr-answer, .rw-answer):not(.mk-answer):has(> .big, > .fd-big) > :is(.big, .fd-big) { flex: none !important; }
:is(.answer, .fd-answer, .pp-answer, .rr-answer, .xp-answer, .cc-answer, .om-answer, .rb-answer, .lt-answer, .fr-answer, .rw-answer):not(.mk-answer):has(> .big, > .fd-big) > p {
  flex: 1 1 17rem !important; max-width: 56ch !important; min-height: 0 !important; margin: 0 !important; padding-bottom: 4px !important;
}
@media (max-width: 600px) {
  :is(.answer, .fd-answer, .pp-answer, .rr-answer, .xp-answer, .cc-answer, .om-answer, .rb-answer, .lt-answer, .fr-answer, .rw-answer):not(.mk-answer):has(> .big, > .fd-big) > p {
    flex-basis: 100% !important; max-width: none !important; min-height: 2.9em !important; padding-bottom: 0 !important;
  }
}
.stage-top { align-content: start; }
@media (max-width: 600px) { .stats:not(.has-fc) .stat .v { font-size: 1.15rem; overflow-wrap: normal; } }

/* Phones: charts reach into the page margin, so the plot gets the width (labels stay 6px from the edge). */
@media (max-width: 600px) {
  .chart-box:not(.mini), .curve-box, .fr-fall, .rw-fall, .rw-bars, .rb-chart, .rb-drift, .ladder-box, .mix-box, .rates-box { width: auto; margin-inline: -10px; }
}
/* Axis numbers drawn inside the plot (phones): a paper halo keeps them readable over gridlines and lines. */
.ax-in { pointer-events: none; paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; }
/* Phones: a thin arc joins the ends of two lines, curving into the right margin, with the gap's note just above the
   upper line (the plot keeps the full width). Green when the gap is good news. */
.chart-box .gap-arc { fill: none; stroke: var(--rust); stroke-width: 1.6; stroke-linecap: round; }
.chart-box .gap-arc.is-good { stroke: var(--gold); }
.chart-box text.arc-note { font-family: var(--font-body); font-size: 12.5px; font-weight: 600; fill: var(--rust); }
.chart-box text.arc-note.is-good { fill: var(--gold); }
.chart-box text.halo { paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }

/* Sliders beside typed boxes (js/sliders.js): drag to explore, type for an exact number. */
.slide-row { display: flex; align-items: center; gap: 14px; min-width: 0; }
.slide-row .slide-box { flex: 0 0 6.2rem; min-width: 0; }
.slide-row .slide-box.pct-wide, .slide-row .slide-box.slide-wide { flex-basis: 8.4rem; }
.slider { --p: 50%; flex: 1 1 auto; min-width: 0; height: 42px; margin: 0; padding: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; touch-action: pan-y; }
.slider:focus { outline: none; box-shadow: none; }
.slider::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(to right, var(--ink) var(--p), var(--line) var(--p)); }
.slider::-moz-range-track { height: 2px; background: var(--line); }
.slider::-moz-range-progress { height: 2px; background: var(--ink); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -8px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); box-shadow: 0 0 0 3px var(--paper); transition: transform 0.12s; }
.slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); box-shadow: 0 0 0 3px var(--paper); }
.slider:active::-webkit-slider-thumb { transform: scale(1.15); background: var(--ink); }
.slider:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--focus); outline-offset: 3px; }
.slider:focus-visible::-moz-range-thumb { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (pointer: coarse) { .slider::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -10px; } }

/* Theme toggle: the icon never shrinks; on phones the icon stands alone (the button keeps its aria-label) */
.theme-toggle svg { flex: none; width: 16px; height: 16px; }
@media (max-width: 560px) {
  .theme-toggle { justify-content: center; min-width: 36px; min-height: 34px; padding: 0 8px; }
  .theme-toggle svg { width: 18px; height: 18px; }
  .theme-toggle .tt-label { display: none; }
}

/* Slider pages: the sentence beside the big number keeps room for three lines, so the chart
   doesn't shift when a dragged value makes it wrap. It sits at the bottom, level with the number. */
body .answer > p.answer-line.steady { display: flex !important; flex-direction: column; justify-content: flex-end; min-height: calc(4.35em + 4px) !important; }
@media (max-width: 600px) { body .answer > p.answer-line.steady { justify-content: flex-start; min-height: 4.35em !important; } }

/* ---- Compact controls (js/compact-controls.js) ----
   Under the chart (phones, tablets, "Wider chart"): the main numbers as label + value + slider,
   two by two or in one row; the rest of the panel behind "More options". Same look as the
   compound interest calculator. Beside the chart the panel shows as usual and these stay hidden. */
.hbc { display: none; }
.hbc-on { border: 0 !important; border-radius: 0 !important; padding: 0 !important; background: none !important; box-shadow: none !important; }
.hbc-on > .hbc { display: block; border-top: 1px solid var(--ink); padding-top: 12px; margin-bottom: 0; }
.hbc-on:not(.hbc-open) > :not(.hbc) { display: none !important; }
.hbc-on .hbc-dup, .hbc-on .hbc-dup-g, .hbc-on .hbc-hide { display: none !important; }
.hbc-grid { --hbc-cols: 2; display: grid; grid-template-columns: repeat(var(--hbc-cols), minmax(0, 1fr)); gap: 2px 40px; }
.hbc .hbc-f { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; min-width: 0; margin: 0; }
.hbc .hbc-f[hidden] { display: none; }
.hbc .hbc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; min-width: 0; }
.hbc .hbc-l, .hbc .hbc-v { font-family: var(--font-body, inherit); font-size: 0.9rem; line-height: 1.5; font-weight: 600; letter-spacing: 0; text-transform: none; }
.hbc .hbc-l { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hbc .hbc-v { position: static; flex: none; display: inline-flex; align-items: baseline; color: var(--ink); border-bottom: 1px dotted var(--muted); cursor: text; font-variant-numeric: normal; }
.hbc .hbc-v:focus-within { border-bottom: 1px solid var(--ink); }
.hbc .hbc-v .hbc-sym, .hbc .hbc-v .hbc-u { position: static; transform: none; color: inherit; font: inherit; pointer-events: none; }
.hbc .hbc-v .hbc-u-w { margin-left: 0.25em; }
.hbc .hbc-f .hbc-v input[type=text], .hbc .hbc-f .hbc-v select {
  -webkit-appearance: none; appearance: none; box-shadow: none; line-height: inherit; height: auto; width: 4ch; min-width: 0; max-width: none; min-height: 0;
  border: 0; border-radius: 0; padding: 0; margin: 0; background: transparent; color: inherit; font: inherit; font-variant-numeric: normal; text-align: right; cursor: text;
}
.hbc .hbc-f .hbc-v select { cursor: pointer; text-align: right; text-align-last: right; }
.hbc .hbc-f .hbc-v input:focus, .hbc .hbc-f .hbc-v select:focus { outline: none; box-shadow: none; }
.hbc .hbc-f .hbc-v input[aria-invalid="true"] { color: var(--rust); }
.hbc .hbc-f input.slider { width: 100%; height: 34px; margin: 0; }
@media (pointer: coarse) { .hbc .hbc-f input.slider { height: 40px; touch-action: none; } }
.hbc .hbc-err { color: var(--rust); font-size: 0.8rem; line-height: 1.3; margin-top: -4px; }
.hbc .hbc-err:empty { display: none; }
.hbc .hbc-err:not(:empty) { padding-bottom: 4px; }
.hbc .hbc-more { display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; margin: 6px 0 0; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: none; font: inherit; font-size: 0.86rem; color: var(--muted); cursor: pointer; text-align: left; height: auto; min-height: 0; }
.hbc-open > .hbc .hbc-more { border-bottom: 0; }
.hbc .hbc-sum { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbc .hbc-more-l { flex: none; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.hbc-open > .hbc .hbc-sum { visibility: hidden; }
.hbc-open > .hbc .hbc-more-l::after { content: " \2212"; text-decoration: none; display: inline-block; margin-left: 4px; }
.hbc-open { padding-bottom: 4px; }
/* the panel's own slider for an amount whose box shares its line (presets, a select) */
.slide-row.hbc-pslide-own { margin-top: 2px; }
.slide-row.hbc-pslide-own .slider { height: 30px; }
@media (max-width: 600px) {
  .hbc-grid { column-gap: 20px; }
  .hbc .hbc-top { gap: 6px; }
  .hbc .hbc-l, .hbc .hbc-v { font-size: 0.82rem; }
}
.hbc-pgroup { align-items: start; }
.hbc-pgroup > * { align-self: start; align-content: start; }
