:root {
  color-scheme: light dark;
  --background: #f2f5fa; --surface: #ffffff;
  --card: rgba(255,255,255,.82); --card-border: rgba(255,255,255,.92);
  --text: #202b40; --text-muted: #58667b;
  --accent: #334ed1; --accent-text: #ffffff; --accent-soft: #e9edff;
  --chart-contrib: #899bd8; --chart-interest: #b4dfd0;
  --error: #b32c3d; --shadow: rgba(29,49,85,.065);
  --recess: #edf1f7; --line: #d8dfeb; --clear: transparent;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #101620; --surface: #1c2533;
    --card: rgba(28,37,51,.88); --card-border: rgba(174,194,223,.12);
    --text: #eef2fa; --text-muted: #a9b7cd;
    --accent: #b2c0ff; --accent-text: #16234a; --accent-soft: #2a3655;
    --chart-contrib: #7f96d1; --chart-interest: #7bbfa8;
    --error: #ff9fa9; --shadow: rgba(0,0,0,.2);
    --recess: #151d29; --line: #364257; --clear: transparent;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 100px; }
body { margin: 0; background: var(--background); color: var(--text); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-underline-offset: 4px; }
button, input, select { font: inherit; }
button, select, summary, .segmented label { cursor: pointer; }
button, input, select, summary { min-height: 44px; }
button { color: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible, .table-scroll:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 10px; }
.skip-link { position: fixed; z-index: 10; top: -80px; left: 16px; padding: 12px 18px; background: var(--surface); border-radius: 14px; }
.skip-link:focus { top: 12px; }
main, footer { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.help:empty { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.page-heading { margin: 28px 0 22px; }
h1 { margin: 0; font-size: clamp(30px,5vw,36px); line-height: 1.15; letter-spacing: -.045em; font-weight: 650; }
h2, h3, p { overflow-wrap: anywhere; }
h2 { font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
h3 { font-size: 14px; font-weight: 600; }
#mode-toggle { padding: 5px; display: flex; width: 100%; max-width: 340px; border: 1px solid var(--line); border-radius: 17px; background: var(--recess); margin-bottom: 20px; }
#mode-toggle button { flex: 1; border: 0; border-radius: 12px; background: var(--clear); color: var(--text-muted); font-size: 14px; font-weight: 600; }
#mode-toggle [aria-selected="true"] { background: var(--surface); box-shadow: 0 2px 6px var(--shadow); color: var(--text); }
.calculator-grid { display: contents; }
.input-card { margin-bottom: 16px; }
.card { min-width: 0; padding: 23px 20px; border-radius: 22px; border: 1px solid var(--card-border); background: var(--card); box-shadow: 0 8px 32px var(--shadow); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.card-heading h2, .card-heading h3 { margin: 0; }
.small { font-size: 11px; }
.muted, .help, .optional { color: var(--text-muted); }
.field { min-width: 0; margin-bottom: 20px; }
label, legend { font-size: 13px; font-weight: 600; }
.field > label { display: block; margin-bottom: 8px; }
.input-shell { position: relative; display: flex; align-items: center; gap: 8px; border-radius: 14px; background: var(--recess); border: 1px solid var(--clear); padding: 0 14px; }
.input-shell:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.input-shell:has([aria-invalid="true"]) { border-color: var(--error); }
.input-shell > span { color: var(--text-muted); font-size: 14px; }
input[type="text"] { color: var(--text); background: var(--clear); border: 0; width: 100%; min-width: 0; min-height: 48px; padding: 10px 0; font-size: 17px; outline: none; }
input.is-output { color: var(--accent); font-weight: 650; }
.input-shell:has(.is-output) { background: var(--accent-soft); }
input:disabled, fieldset:disabled { opacity: .65; }
select { width: 100%; min-height: 48px; padding: 10px 36px 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); }
select[aria-invalid="true"] { border-color: var(--error); }
.help, .error { font-size: 12px; line-height: 1.5; margin: 7px 0 0; }
.error { color: var(--error); font-weight: 550; }
.error:empty { display: none; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choice-field { padding: 0; margin: 0 0 20px; border: 0; min-width: 0; }
.choice-field legend { margin-bottom: 8px; padding: 0; }
.segmented { display: flex; border-radius: 14px; padding: 4px; gap: 4px; background: var(--recess); }
.segmented label { flex: 1; position: relative; text-align: center; min-width: 0; }
.segmented input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; left: 0; cursor: pointer; }
.segmented span { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 10px; padding: 6px 8px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 2px 6px var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.inflation-details { margin: 2px 0 20px; padding-top: 2px; border-top: 1px solid var(--line); }
.inflation-details summary { padding-block: 14px; font-size: 13px; font-weight: 550; }
.optional { font-size: 11px; font-weight: 400; margin-left: 5px; }
.inflation-details .field { margin-top: 8px; }
.primary-button { display: flex; width: 100%; justify-content: center; align-items: center; gap: 12px; min-height: 50px; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-text); font-size: 14px; font-weight: 600; }
#headline { margin: 18px 0 14px; padding: 18px 20px; border-radius: 18px; background: color-mix(in srgb, var(--accent) 9%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); transition: opacity 150ms; font-size: clamp(32px,4vw,44px); font-weight: 600; letter-spacing: -.045em; line-height: 1.12; }
.headline-figure { display: block; }
.headline-rest { display: block; margin-top: 6px; font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--text-muted); }
.is-stale #headline { opacity: .5; }
#inflation-line { font-size: 14px; color: var(--text-muted); margin-top: 12px; }
#result-note:empty { display: none; }
.pill { background: var(--recess); color: var(--text-muted); border-radius: 20px; padding: 4px 10px; font-size: 11px; }
.summary-grid { display: flex; flex-wrap: wrap; gap: 20px 32px; margin: 28px 0 36px; padding-top: 22px; border-top: 1px solid var(--line); }
.summary-grid dt { font-size: 12px; color: var(--text-muted); }
.summary-grid dd { font-size: 23px; font-weight: 550; letter-spacing: -.035em; margin: 4px 0 0; overflow-wrap: anywhere; }
.chart-section { position: relative; }
.chart-section .card-heading { margin-bottom: 14px; }
#chart { width: 100%; overflow: hidden; border-radius: 14px; }
#chart svg { display: block; width: 100%; height: auto; }
#chart text { font: 17px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; fill: var(--text-muted); }
.chart-contrib, .legend-contrib { fill: var(--chart-contrib); }
.chart-interest, .legend-interest { fill: var(--chart-interest); }
.chart-baseline { stroke: var(--line); }
.chart-hit { fill: var(--clear); }
.chart-hit:focus-visible { outline: none; stroke: var(--accent); stroke-width: 2; rx: 5; }
#chart-tip { font-size: 12px; margin: 12px 0 0; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); backdrop-filter: blur(16px); }
.calculation-note { font-size: 11px; color: var(--text-muted); line-height: 1.6; margin: 24px 0 0; }
.table-card { margin-top: 20px; }
.table-scroll { overflow-x: auto; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
caption { text-align: left; color: var(--text-muted); font-size: 12px; padding-bottom: 16px; }
th, td { text-align: right; padding: 12px 15px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { font-weight: 500; color: var(--text-muted); text-align: center; }
tbody th { font-weight: 500; }
tbody tr:last-child > * { border-bottom: 0; }
.exhausted { color: var(--error); }
.explanation-grid { display: grid; gap: 32px; padding: 50px 8px 42px; }
.explanation-grid h2 { margin: 10px 0; font-size: 17px; }
.explanation-grid p, .explanation-grid li { font-size: 13px; color: var(--text-muted); line-height: 1.8; }
.explanation-grid ol { padding-left: 18px; }
.explanation-grid li { padding-left: 5px; margin-bottom: 9px; }
.section-number { color: var(--text-muted); font-size: 11px; letter-spacing: .1em; }
footer { padding: 25px 8px 35px; border-top: 1px solid var(--line); font-size: 11px; color: var(--text-muted); }
footer p { margin: 0 0 8px; }
.copyright { font-size: 10px; }
.not-found { max-width: 620px; margin-block: 60px; }
@media (min-width: 600px) {
  main, footer { width: min(1120px, calc(100% - 64px)); }
  .card { padding: 30px; }
  .page-heading { margin-block: 32px; }
}
@media (min-width: 900px) {
  .calculator-grid { display: grid; align-items: start; grid-template-columns: minmax(330px,.85fr) minmax(0,1.3fr); gap: 24px; }
  .results-card { position: sticky; top: 24px; padding: 34px; }
  .explanation-grid { grid-template-columns: repeat(3,1fr); gap: 40px; padding-top: 60px; }
  .table-card { margin-top: 24px; }
  .table-card { max-width: 1000px; margin-inline: auto; }
  footer { display: flex; justify-content: space-between; gap: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
/* Phones: vertical rhythm about 30% tighter than desktop (Kevin, 2026-10-22, two rounds). */
@media (max-width: 599px) {
  .page-heading { margin: 20px 0 16px; }
  #mode-toggle { margin-bottom: 17px; }
  .card { padding: 17px 15px; }
  .card-heading { margin-bottom: 16px; }
  .results-card { padding-top: 13px; }
  .results-card > .card-heading { margin-bottom: 8px; }
  #headline { margin: 0 0 10px; padding: 11px 16px 12px; }
  .headline-rest { margin-top: 2px; }
  .field { margin-bottom: 14px; }
  .field > label, .choice-field legend { margin-bottom: 5px; }
  button, input, select, summary, .segmented span { min-height: 38px; }
  input[type="text"] { min-height: 38px; padding: 6px 0; }
  select { padding-block: 6px; }
  .primary-button { min-height: 44px; }
  #mode-toggle { padding: 4px; }
  .segmented { padding: 3px; }
  .inflation-details summary { padding-block: 8px; }
  .choice-field { margin-bottom: 14px; }
  .inflation-details { margin-bottom: 14px; }
  .summary-grid { margin: 20px 0 26px; padding-top: 16px; }
  .table-card { margin-top: 14px; }
  th, td { padding: 9px 7px; }
  thead th { white-space: normal; }
  .explanation-grid { gap: 23px; padding: 36px 8px 31px; }
  .explanation-grid li { margin-bottom: 7px; }
  footer { padding: 18px 8px 26px; }
}
