/* Retirement Calculator — minimal, fast, accessible */

:root {
  --bg: #ffffff;
  --bg-soft: #f7f9fc;
  --bg-alt: #f1f5f9;
  --fg: #0b1220;
  --fg-soft: #475569;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #16a34a;
  --primary-d: #15803d;
  --accent: #0ea5e9;
  --danger: #ef4444;
  --warn: #f59e0b;
  --shadow: 0 6px 24px rgba(15, 23, 42, .06);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --bg-soft: #0f1a30;
    --bg-alt: #111c33;
    --fg: #e2e8f0;
    --fg-soft: #cbd5e1;
    --muted: #94a3b8;
    --border: #1f2a44;
    --shadow: 0 6px 24px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  max-width: 100vw;
}

img, svg { max-width: 100%; display: block; }

a { color: var(--primary-d); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--primary); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 1000;
}
.skip-link:focus { left: 12px; top: 12px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-row { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 28px; height: 28px; }
.brand-name { font-size: 17px; letter-spacing: -0.01em; }
nav[aria-label="Primary"] { display: flex; gap: 22px; align-items: center; }
nav[aria-label="Primary"] a { color: var(--fg-soft); font-size: 15px; }
nav[aria-label="Primary"] a:hover { color: var(--fg); text-decoration: none; }
@media (max-width: 640px) {
  /* Header stops being sticky on phones to give the form room */
  .site-header { position: static; }
  /* Show nav as a horizontally scrollable strip rather than hiding everything */
  nav[aria-label="Primary"] {
    gap: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 60%;
  }
  nav[aria-label="Primary"]::-webkit-scrollbar { display: none; }
  nav[aria-label="Primary"] a { font-size: 13px; flex-shrink: 0; }
  /* Brand name shrinks slightly so the nav has room next to it */
  .brand-name { display: none; }
}

/* Hero */
.hero {
  padding: 56px 0 44px;
  background:
    radial-gradient(ellipse at top right, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    radial-gradient(ellipse at bottom left, color-mix(in srgb, var(--primary) 14%, transparent), transparent 60%),
    var(--bg);
}
.kicker {
  display: inline-block;
  font-size: 13px; font-weight: 600;
  color: var(--primary-d);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  padding: 6px 12px; border-radius: 999px; margin: 0 0 18px;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  font-weight: 800;
}
.grad {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: clamp(17px, 2vw, 20px); color: var(--fg-soft); max-width: 720px; margin: 0 0 28px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 22px; border-radius: 10px;
  font-weight: 600; font-size: 15px; cursor: pointer;
  border: 1px solid transparent; transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-soft); text-decoration: none; }

.trust { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 14px; }
.trust li { position: relative; padding-left: 14px; }
.trust li::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
  transform: translateY(-50%);
}

/* Calculator */
.calc { padding: 44px 0; background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.calc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.calc-head h2 { margin: 0; font-size: 28px; letter-spacing: -0.01em; }

.mode-toggle { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.mode-toggle button {
  background: transparent; border: 0; padding: 8px 16px; border-radius: 999px;
  font-size: 14px; color: var(--fg-soft); cursor: pointer; font-weight: 600;
}
.mode-toggle button.active { background: var(--primary); color: #fff; }

.calc-form {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  max-width: 100%;
  overflow: hidden;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 600; color: var(--fg-soft); }
.field input {
  height: 44px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
  font-size: 15px; color: var(--fg); font-variant-numeric: tabular-nums;
  transition: border-color .15s ease, box-shadow .15s ease;
  width: 100%;
  min-width: 0;
}
.field input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.field small { color: var(--muted); font-size: 12px; }
.field.hidden { display: none; }
.field.field-invalid input { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 14%, transparent); }
.field.field-invalid input:focus { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }
.field-error { color: var(--danger); font-size: 12px; font-weight: 600; }

.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* Advanced settings — collapsible block of secondary inputs */
.advanced {
  margin-top: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 0;
}
.advanced > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
  border-radius: 12px;
  user-select: none;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before {
  content: "+";
  display: inline-block;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary-d);
  text-align: center; line-height: 18px;
  font-weight: 800;
  margin-right: 8px;
  transition: transform .15s ease;
}
.advanced[open] > summary::before { content: "−"; }
.advanced > summary small { color: var(--muted); font-weight: 500; font-size: 12px; }
.advanced > summary:hover { background: var(--bg-soft); }
.advanced > .grid { padding: 6px 16px 16px; }

/* Lifestyle presets */
.lifestyle-row {
  border: 0;
  padding: 0;
  margin: 0 0 18px;
}
.lifestyle-row legend {
  font-size: 13px; font-weight: 600; color: var(--fg-soft);
  padding: 0; margin-bottom: 10px;
}
.presets {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.preset {
  flex: 1 1 140px; min-width: 140px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px; font-weight: 600;
  color: var(--fg);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  text-align: left;
  transition: border-color .12s ease, background .12s ease, transform .06s ease;
}
.preset span {
  font-size: 11px; font-weight: 500; color: var(--muted);
  letter-spacing: .01em;
}
.preset:hover { border-color: var(--primary); transform: translateY(-1px); }
.preset.active {
  background: color-mix(in srgb, var(--primary) 10%, var(--bg));
  border-color: var(--primary);
  color: var(--primary-d);
}
.preset.active span { color: var(--primary-d); }
@media (prefers-color-scheme: dark) {
  .preset.active { color: #86efac; }
  .preset.active span { color: #86efac; }
}

/* Results */
.results { margin-top: 28px; }
.result-headline {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex; gap: 14px; align-items: flex-start;
  box-shadow: var(--shadow);
}
.result-headline .dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--muted);
  margin-top: 8px; flex-shrink: 0;
}
.result-headline.ok .dot { background: var(--primary); }
.result-headline.warn .dot { background: var(--warn); }
.result-headline.bad .dot { background: var(--danger); }
.result-headline h3 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.01em; }
.result-headline p { margin: 0; color: var(--muted); font-size: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 16px; }
.cards-secondary { margin-top: 12px; }
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card.highlight { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--bg)); }
.card.subtle {
  background: color-mix(in srgb, var(--bg-alt) 60%, var(--bg));
  padding: 14px 16px;
}
.card.subtle .card-value { font-size: 19px; }
.card.subtle.warn-card {
  border-color: color-mix(in srgb, var(--warn) 50%, var(--border));
  background: color-mix(in srgb, var(--warn) 8%, var(--bg));
}
.card-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.card-value { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Inflation projection banner */
.inflation-banner {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--warn) 12%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--warn) 50%, var(--border));
  border-radius: 12px;
  color: var(--fg);
  font-size: 14px;
}
.inflation-banner.hidden { display: none; }
.ib-icon {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--warn) 25%, transparent);
  color: var(--warn);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 13px;
}
.inflation-banner p { margin: 0; line-height: 1.5; }
.inflation-banner strong { color: var(--warn); font-weight: 800; }
.ib-arrow { color: var(--muted); margin: 0 4px; }

/* Magic Year banner */
.magic-year-banner {
  margin-top: 18px;
  border-left: 4px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 8%, var(--bg));
  padding: 14px 18px;
  border-radius: 8px;
}
.magic-year-banner.hidden { display: none; }
.my-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--warn);
  margin-bottom: 6px;
}
.magic-year-banner p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--fg); }
.magic-year-banner strong { color: var(--warn); }
.magic-year-banner p strong:first-child { color: var(--fg); font-weight: 800; }

/* Chart head */
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-sub { color: var(--muted); font-size: 13px; }
.legend-flat .sw-dashed {
  display: inline-block; width: 18px; height: 0;
  border-top: 2px dashed var(--muted);
  margin-right: 6px; vertical-align: middle;
  background: transparent !important;
}

/* Step-up vs flat comparison */
.flat-compare {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--bg-alt);
  border-radius: 10px;
}
.flat-compare.hidden { display: none; }
.fc-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.fc-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-bottom: 4px; }
.fc-value { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fc-value.with { color: #f59e0b; }
.fc-value.flat { color: var(--muted); }
.fc-value.delta { color: #22c55e; }

/* Phase cards — '01 The Build' and '02 The Harvest' */
.phase-card {
  margin-top: 22px;
  padding: 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.phase-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.phase-num {
  flex-shrink: 0;
  font-size: 52px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  color: color-mix(in srgb, var(--accent) 30%, transparent);
  min-width: 64px;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.phase-build .phase-num { color: color-mix(in srgb, var(--primary) 30%, transparent); }
.phase-harvest .phase-num { color: color-mix(in srgb, var(--accent) 30%, transparent); }
.phase-meta { flex: 1; min-width: 0; }
.phase-title { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.01em; }
.phase-sub { margin: 0; color: var(--muted); font-size: 14px; }
.phase-body { display: flex; flex-direction: column; gap: 14px; }
.phase-body .chart-wrap,
.phase-body .magic-year-banner,
.phase-body .flat-compare { margin-top: 0; }
.phase-body .chart-wrap {
  background: var(--bg-alt);
  border-color: transparent;
  box-shadow: none;
}

/* Harvest body bits (now nested inside phase-card) */
.harvest-row { padding: 16px 18px; background: var(--bg-alt); border-radius: 12px; }
.harvest-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.harvest-amount { font-size: 30px; font-weight: 900; letter-spacing: -0.01em; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.harvest-period { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.harvest-calc { font-size: 13px; color: var(--muted); margin-top: 6px; }
.harvest-note { font-size: 13px; color: var(--fg-soft); margin: 0; line-height: 1.6; }
.harvest-note code { background: var(--bg-alt); padding: 1px 6px; border-radius: 4px; font-size: 12px; }

/* Breakdown */
.breakdown {
  margin-top: 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.breakdown h4 { margin: 0 0 6px; font-size: 16px; }
.breakdown-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.bd-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.bd-row-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; gap: 12px;
}
.bd-name { display: flex; align-items: center; gap: 8px; color: var(--fg); }
.bd-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.bd-pct { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 6px; }
.bd-bar {
  height: 6px; background: var(--bg-alt); border-radius: 999px; overflow: hidden; margin-top: 4px;
}
.bd-fill { height: 100%; border-radius: 999px; transition: width .25s ease; }

.chart-wrap {
  margin-top: 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.chart-wrap h4 { margin: 0 0 12px; font-size: 16px; }
#chart { width: 100%; height: auto; max-height: 360px; cursor: crosshair; }

/* Floating chart tooltip — appended to <body> for positioning */
.rc-chart-tip {
  position: absolute;
  z-index: 100;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .14);
  font-size: 13px;
  color: var(--fg);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .12s ease;
  min-width: 180px;
  max-width: calc(100vw - 24px);
}
.rc-chart-tip.visible { opacity: 1; transform: translateY(0); }
.rc-chart-tip .tip-age { font-weight: 800; font-size: 14px; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.rc-chart-tip .tip-phase {
  font-size: 11px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
}
.rc-chart-tip .tip-row {
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 12.5px; padding: 2px 0; font-variant-numeric: tabular-nums;
}
.rc-chart-tip .tip-row span { color: var(--muted); }
.rc-chart-tip .tip-row strong { font-weight: 700; }
.rc-chart-tip .tip-flat strong { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* Content sections */
.content { padding: 56px 0; }
.content.alt { background: var(--bg-alt); }
.content h2 { margin: 0 0 20px; font-size: clamp(24px, 3vw, 34px); letter-spacing: -0.01em; }
.content h3 { margin: 0 0 8px; font-size: 18px; }
.content p { margin: 0 0 14px; color: var(--fg-soft); max-width: 760px; }
.content.disclaimer p { color: var(--muted); font-size: 14px; }

.steps { padding-left: 20px; max-width: 800px; }
.steps li { margin-bottom: 14px; color: var(--fg-soft); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }

details {
  border-top: 1px solid var(--border);
  padding: 16px 0;
}
details:last-of-type { border-bottom: 1px solid var(--border); }
details summary {
  font-weight: 600; font-size: 17px; cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: "+"; font-size: 22px; color: var(--muted); flex-shrink: 0;
  transition: transform .15s ease;
}
details[open] summary::after { content: "−"; }
details p { margin-top: 12px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 36px 0 28px;
  background: var(--bg-soft);
  font-size: 14px;
  color: var(--fg-soft);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}
.footer-block p { margin: 0 0 8px; }
.footer-title {
  font-weight: 700;
  color: var(--fg);
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 10px !important;
}
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.footer-links a { color: var(--fg-soft); }
.footer-links a:hover { color: var(--primary-d); }
.muted { color: var(--muted); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   RESPONSIVE — mobile-first tuning for tablets and phones
   ============================================================ */

/* Tablet: <= 900px */
@media (max-width: 900px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 44px 0 36px; }
  .calc { padding: 32px 0; }
  .content { padding: 44px 0; }
  .calc-form { padding: 18px; }
  .grid { gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .cards { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
}

/* Phone: <= 640px */
@media (max-width: 640px) {
  body { font-size: 15px; }
  .wrap { padding: 0 14px; }

  /* Tighter hero */
  .hero { padding: 32px 0 28px; }
  .hero h1 { font-size: clamp(26px, 8vw, 38px); margin-bottom: 14px; }
  .lede { font-size: 15px; margin-bottom: 22px; }
  .kicker { font-size: 12px; margin-bottom: 14px; }
  .hero-cta { flex-direction: column; align-items: stretch; gap: 10px; }
  .hero-cta .btn { width: 100%; }
  .trust { gap: 8px 14px; font-size: 13px; margin-top: 16px; }
  .trust li { width: 100%; }

  /* Header brand keeps logo visible, name hidden if very tight */
  .header-row { height: 56px; }
  .brand-name { font-size: 15px; }

  /* Calculator block */
  .calc { padding: 24px 0; }
  .calc-head h2 { font-size: 22px; }
  .calc-head { gap: 10px; margin-bottom: 16px; flex-direction: column; align-items: flex-start; }
  .mode-toggle { width: 100%; }
  .mode-toggle button { flex: 1; padding: 10px 12px; font-size: 13px; }
  .calc-form { padding: 14px; border-radius: 12px; }

  /* Form: 2 columns on phones (auto-fit minmax 140 → fits at 360px+) */
  .grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 10px; }
  .field input { height: 42px; font-size: 14px; }
  .field span { font-size: 12px; }
  .field small { font-size: 11px; }

  /* Lifestyle presets: horizontal scroll on phones, snap to each chip */
  .lifestyle-row { margin-bottom: 14px; max-width: 100%; }
  .lifestyle-row legend { font-size: 12px; margin-bottom: 8px; }
  .presets {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
    /* No negative margins — they were extending past the form edge on
       small viewports. The chips just scroll inside the row instead. */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
  }
  .presets::-webkit-scrollbar { display: none; }
  .preset {
    flex: 0 0 auto;
    min-width: 138px;
    scroll-snap-align: start;
    padding: 9px 12px;
    font-size: 13px;
  }
  .preset span { font-size: 10.5px; }

  /* Actions: full-width primary, ghost beside */
  .actions { flex-direction: column; gap: 8px; }
  .actions .btn { width: 100%; height: 46px; }

  /* Results */
  .result-headline { padding: 16px 16px; gap: 10px; border-radius: 12px; }
  .result-headline h3 { font-size: 17px; }
  .result-headline p { font-size: 13px; }

  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { padding: 12px 14px; border-radius: 12px; }
  .card-label { font-size: 10.5px; letter-spacing: 0.03em; }
  .card-value { font-size: 18px; }
  .card-sub { font-size: 11px; }

  .cards-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card.subtle { padding: 11px 13px; }
  .card.subtle .card-value { font-size: 16px; }

  /* The 'Cost of starting late' card spans full width on mobile for emphasis */
  .card.subtle.warn-card { grid-column: 1 / -1; }

  /* Required-SIP highlight card spans full width too */
  .card.highlight { grid-column: 1 / -1; }

  /* Breakdown */
  .breakdown { padding: 16px 14px; border-radius: 12px; }
  .breakdown h4 { font-size: 15px; }
  .breakdown-sub { font-size: 12px; }
  .bd-row-head { font-size: 13px; flex-wrap: wrap; gap: 6px; }
  .bd-name { flex: 1 1 60%; min-width: 0; }
  .bd-amt { text-align: right; }

  /* Chart */
  .chart-wrap { padding: 14px 12px; border-radius: 12px; }
  .chart-wrap h4 { font-size: 15px; }
  #chart { max-height: 280px; }
  .legend { gap: 10px 14px; font-size: 12px; }

  /* Inflation banner */
  .inflation-banner { padding: 10px 12px; gap: 10px; font-size: 13px; }
  .ib-icon { width: 24px; height: 24px; font-size: 11px; }

  /* Magic Year banner */
  .magic-year-banner { padding: 12px 14px; }
  .magic-year-banner p { font-size: 14px; }

  /* Flat compare */
  .flat-compare { padding: 12px; }
  .fc-row { grid-template-columns: 1fr; gap: 10px; }
  .fc-value { font-size: 16px; }

  /* Phase cards — number drops above the title row on phones */
  .phase-card { padding: 16px; border-radius: 12px; }
  .phase-head { gap: 12px; padding-bottom: 12px; margin-bottom: 12px; }
  .phase-num { font-size: 36px; min-width: 48px; }
  .phase-title { font-size: 18px; }
  .phase-sub { font-size: 13px; }

  /* Harvest pieces */
  .harvest-row { padding: 12px 14px; }
  .harvest-amount { font-size: 22px; }
  .harvest-period { font-size: 13px; }
  .harvest-calc { font-size: 12px; }
  .harvest-note { font-size: 12.5px; }

  /* Content */
  .content { padding: 36px 0; }
  .content h2 { font-size: 22px; margin-bottom: 16px; }
  .content h3 { font-size: 16px; }
  .content p { font-size: 15px; }
  .grid-2 { grid-template-columns: 1fr; gap: 16px; }
  .steps { padding-left: 18px; }
  .steps li { font-size: 14px; }

  /* FAQ */
  details { padding: 14px 0; }
  details summary { font-size: 15px; gap: 12px; }
  details summary::after { font-size: 20px; }
  details p { font-size: 14px; }

  /* Footer */
  .site-footer { padding: 28px 0 22px; font-size: 13px; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
}

/* Very small phones: <= 380px */
@media (max-width: 380px) {
  .wrap { padding: 0 12px; }
  .hero h1 { font-size: 24px; }
  .grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .cards-secondary { grid-template-columns: 1fr; }
  .card.subtle.warn-card { grid-column: auto; }
  .card.highlight { grid-column: auto; }
  .preset { min-width: 130px; }
  .calc-form { padding: 12px; }
  #chart { max-height: 240px; }
  .card-value { font-size: 17px; }
  .card.subtle .card-value { font-size: 15px; }

  /* Phase head: stack number ABOVE title on tiny screens */
  .phase-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .phase-num { font-size: 30px; min-width: 0; }

  /* Inflation banner: stack icon above text */
  .inflation-banner { flex-direction: column; align-items: flex-start; }

  /* Harvest amount tames down further */
  .harvest-amount { font-size: 20px; }
}

/* Landscape phones: keep chart breathable */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 480px) {
  .hero { padding: 24px 0 20px; }
  #chart { max-height: 220px; }
}

/* Very wide screens — keep things readable, don't stretch endlessly */
@media (min-width: 1400px) {
  .wrap { max-width: 1200px; }
}
