/* =========================================================
   Finance cockpit UI
   A full replacement stylesheet for the static Taiwan finance tools.
   ========================================================= */

:root {
  --bg: #f4f6f8;
  --bg-grid: rgba(17, 24, 39, 0.045);
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --surface-strong: #edf2f7;
  --ink: #131a2a;
  --ink-soft: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #d9e2ec;
  --line-soft: #e8eef5;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --accent-soft: #e4f4f1;
  --amber: #c47b20;
  --amber-soft: #fff4df;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --danger: #c24135;
  --danger-soft: #fff0ed;
  --success: #0f766e;
  --radius: 8px;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 5px 18px rgba(15, 23, 42, 0.06);
  --max: 1180px;
  --max-wide: 1240px;
  --nav-h: 64px;
  --font: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 118, 110, 0.035) 0, transparent 240px),
    var(--bg);
  background-size: 32px 32px, auto, auto;
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.65;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::selection {
  background: rgba(15, 118, 110, 0.18);
}

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

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.skip-nav {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 999;
  transform: translateY(-160%);
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  padding: 9px 12px;
  text-decoration: none;
}

.skip-nav:focus {
  transform: translateY(0);
}

.container {
  width: min(100% - 40px, var(--max));
  margin: 0 auto;
}

.fire-page .container {
  width: min(100% - 40px, var(--max-wide));
}

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.nav-inner {
  width: min(100% - 40px, var(--max));
  height: var(--nav-h);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 850;
  font-size: 18px;
  text-decoration: none;
  white-space: nowrap;
}

.nav-brand::before {
  content: "AI";
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.nav-brand span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

.nav-links a:hover {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--ink);
}

.nav-links a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 0;
}

.nav-toggle::before {
  content: "\2630";
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

/* Home */
.hero,
.tool-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.home-page .hero {
  width: min(100% - 40px, var(--max));
  margin: 26px auto 0;
  padding: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.7fr);
  gap: 28px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.home-page .hero::before,
.tool-header::before,
.calc-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--accent), var(--amber));
}

.hero-content,
.tool-header-inner {
  min-width: 0;
}

.hero-badge,
.tool-eyebrow,
.section-head span,
.tool-card-tag,
.feynman-card span {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #b8ddd8;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.home-page .hero h1,
.tool-header h1 {
  margin: 14px 0 10px;
  color: var(--ink);
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.18;
  font-weight: 950;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.home-page .hero h1 .accent {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(196, 123, 32, 0.45);
  text-decoration-thickness: 0.22em;
  text-underline-offset: -0.08em;
}

.home-page .hero p,
.tool-header p,
.section-head p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

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

.hero-cta,
.hero-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 850;
  text-decoration: none;
}

.hero-cta {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.18);
}

.hero-link {
  background: var(--surface-soft);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.hero-cta:hover,
.hero-link:hover,
.tool-card:hover,
.preset-btn:hover {
  transform: translateY(-1px);
}

.hero-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.hero-proof span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 700;
}

.hero-visual {
  margin: 0;
  justify-self: end;
  width: min(100%, 330px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--amber-soft);
  overflow: hidden;
}

.hero-visual img {
  display: block;
  width: 100%;
  height: 230px;
  object-fit: cover;
}

.hero-visual figcaption,
.feynman-story figcaption {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.section {
  padding: 46px 0 10px;
}

.section-head {
  margin-bottom: 20px;
}

.section-head h2 {
  margin: 10px 0 8px;
  color: var(--ink);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.25;
  font-weight: 900;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.tool-card {
  display: flex;
  min-height: 240px;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.tool-card:hover {
  border-color: #9bd1c9;
  box-shadow: var(--shadow);
}

.tool-card-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 44px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.tool-card h3 {
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.35;
}

.tool-card p {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.tool-card-arrow {
  color: var(--accent);
  font-weight: 850;
  font-size: 14px;
}

.ad-slot {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 88px;
  margin: 24px 0;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--faint);
  font-size: 13px;
}

.ad-rect {
  min-height: 180px;
}

.feynman-section {
  padding: 36px 0 10px;
}

.feynman-story {
  margin: 0 0 18px;
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.feynman-story img {
  width: 100%;
  height: 230px;
  object-fit: cover;
}

.feynman-story figcaption {
  display: flex;
  align-items: center;
  font-size: 15px;
}

.feynman-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.feynman-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.feynman-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  margin-bottom: 12px;
}

.feynman-card h3 {
  margin: 10px 0 6px;
  font-size: 18px;
  line-height: 1.35;
}

.feynman-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* Tool headers */
.tool-header {
  position: relative;
  padding: 30px 20px 24px;
  overflow: hidden;
}

.tool-header-inner,
.tool-header:not(.fire-hero) {
  width: min(100% - 40px, var(--max));
  margin: 0 auto;
}

.tool-header:not(.fire-hero) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 22px;
  align-items: center;
}

.tool-header:not(.fire-hero) h1 {
  grid-column: 1;
  grid-row: 1;
}

.tool-header:not(.fire-hero) p {
  grid-column: 1;
  grid-row: 2;
}

.tool-header:not(.fire-hero) .tool-header-img {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
}

.fire-page .tool-header-inner {
  width: min(100% - 40px, var(--max-wide));
}

.tool-header h1 {
  max-width: 820px;
  font-size: clamp(29px, 3.4vw, 40px);
}

.tool-header-img {
  display: block;
  width: 180px;
  height: 116px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.fire-page .tool-header-img {
  display: none;
}

.tool-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tool-flow span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

/* Calculators */
.calc-wrap {
  display: grid;
  grid-template-columns: minmax(330px, 0.92fr) minmax(420px, 1.08fr);
  gap: 16px;
  align-items: start;
  margin: 26px 0 34px;
}

.fire-page .calc-wrap {
  grid-template-columns: minmax(300px, 0.95fr) minmax(300px, 0.92fr) minmax(370px, 1.13fr);
}

.calc-panel {
  position: relative;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.result-panel {
  grid-column: auto;
}

@media (min-width: 1181px) {
  .fire-page .result-panel {
    position: sticky;
    top: 82px;
  }
}

.calc-panel h2,
.chart-box h3,
.table-box h3,
.family-inline h3,
.family-summary-card h3 {
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
  font-weight: 900;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label,
.lifestyle-row label,
.input-wrap label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 850;
}

.help,
.builder-help,
.preset-desc,
.value-sub,
.res-sub,
.res-breakdown {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.input-wrap {
  position: relative;
}

.input-wrap input,
.input-wrap select,
.lifestyle-row select {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
}

.input-wrap input.has-suffix {
  padding-right: 54px;
}

.input-suffix {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 800;
  pointer-events: none;
}

.input-wrap input:focus,
.input-wrap select:focus,
.lifestyle-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(72px, auto);
  gap: 12px;
  align-items: center;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.range-value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 34px;
  color: var(--accent);
  font-weight: 900;
  white-space: nowrap;
}

.mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.mode-toggle button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  cursor: pointer;
}

.mode-toggle button.active {
  background: var(--accent);
  color: #fff;
}

.couple-only {
  display: none !important;
}

body.mode-couple .single-only {
  display: none !important;
}

body.mode-couple .couple-only {
  display: inline !important;
}

body.mode-couple div.couple-only,
body.mode-couple .form-group.couple-only,
body.mode-couple .family-inline,
body.mode-couple .family-summary-card {
  display: block !important;
}

.lifestyle-builder,
.lifestyle-result,
.family-inline,
.family-summary-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.lifestyle-builder h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.35;
}

.builder-help {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #fde7be;
  border-radius: 8px;
  background: var(--amber-soft);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.preset-btn {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 3px 10px;
  min-height: 98px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.preset-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.2);
}

.preset-emoji {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 18px;
}

.preset-name {
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
}

.preset-desc {
  min-width: 0;
}

.lifestyle-options {
  display: grid;
  gap: 10px;
}

.lifestyle-row {
  min-width: 0;
}

.lifestyle-result {
  margin-top: 14px;
  background: #fff;
}

.res-row,
.summary-row,
.summary-total,
.family-inline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.res-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.res-value,
.summary-total strong,
.family-inline-head > strong {
  color: var(--accent);
  font-size: 23px;
  line-height: 1.15;
  font-weight: 950;
  white-space: nowrap;
}

.res-breakdown {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}

.retirement-tiers,
.result-grid,
.family-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.tier-item,
.result-cell,
.family-breakdown-grid > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.tier-item span,
.result-cell .label,
.family-breakdown-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tier-item strong,
.result-cell .value,
.family-breakdown-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.family-inline {
  margin-top: 14px;
  background: var(--blue-soft);
  border-color: #c7d7fe;
}

.family-inline-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.family-main-row {
  margin-top: 12px;
}

.family-advanced {
  margin-top: 12px;
}

.family-advanced summary {
  color: var(--blue);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.family-options {
  margin-top: 12px;
}

.family-summary-card {
  margin: 14px 0;
  background: var(--blue-soft);
  border-color: #c7d7fe;
}

.summary-row {
  padding: 8px 0;
  border-bottom: 1px solid rgba(37, 99, 235, 0.13);
}

.summary-row span,
.summary-total span {
  color: var(--muted);
  font-size: 13px;
}

.summary-row strong {
  color: var(--ink);
  white-space: nowrap;
}

.summary-total {
  padding-top: 12px;
}

.result-hero {
  padding: 20px;
  border: 1px solid var(--accent-dark);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 48%),
    var(--accent);
  color: #fff;
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.2);
}

.result-hero .label,
.result-hero .value-sub {
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 800;
}

.result-hero .value {
  margin: 8px 0 2px;
  color: #fff;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.12;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.result-cell .value.success,
.success {
  color: var(--success);
}

.result-cell .value.danger,
.danger {
  color: var(--danger);
}

.chart-box {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.chart-canvas-wrap {
  height: 360px;
  min-height: 360px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
}

.fire-page .chart-canvas-wrap {
  height: 390px;
  min-height: 390px;
}

.chart-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

#riskWarning {
  border-radius: 8px !important;
  border-left-color: var(--amber) !important;
  color: #794400;
}

/* Tables and content */
.table-box,
.content-section {
  margin: 26px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.content-section {
  max-width: 940px;
  overflow-x: auto;
}

.table-box {
  overflow-x: auto;
}

.home-page .content-section {
  max-width: none;
}

.content-section h2,
.content-section h3 {
  color: var(--ink);
  line-height: 1.35;
}

.content-section h2 {
  margin: 0 0 16px;
  font-size: 26px;
}

.content-section h3 {
  margin: 24px 0 9px;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
  font-size: 18px;
}

.content-section p,
.content-section li {
  color: var(--ink-soft);
  font-size: 15.5px;
}

.content-section code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.content-section ul,
.content-section ol {
  padding-left: 1.35rem;
}

.callout {
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid #fde0aa;
  border-radius: 8px;
  background: var(--amber-soft);
  color: var(--ink-soft);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  overflow: hidden;
  border-radius: 8px;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  font-size: 14px;
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
}

.data-table th {
  background: var(--surface-strong);
  color: var(--ink-soft);
  font-weight: 900;
}

.data-table tbody tr:hover {
  background: var(--surface-soft);
}

/* Footer */
.footer {
  margin-top: 54px;
  padding: 34px 0 26px;
  background: #121827;
  color: #cbd5e1;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(140px, 0.6fr));
  gap: 24px;
}

.footer h4 {
  margin: 0 0 10px;
  color: #fff;
  font-size: 15px;
}

.footer p,
.footer li,
.footer a {
  color: #cbd5e1;
  font-size: 14px;
}

.footer ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer li + li {
  margin-top: 8px;
}

.footer a {
  text-decoration: none;
}

.footer a:hover {
  color: #fff;
}

.footer-bottom {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(203, 213, 225, 0.18);
}

.disclaimer {
  max-width: 900px;
}

/* Motion */
@media (prefers-reduced-motion: no-preference) {
  .hero,
  .tool-header,
  .calc-panel,
  .tool-card,
  .feynman-card,
  .table-box,
  .content-section {
    animation: ui-rise 0.36s ease both;
  }

  .calc-panel:nth-child(2),
  .tool-card:nth-child(2),
  .feynman-card:nth-child(2) {
    animation-delay: 0.04s;
  }

  .calc-panel:nth-child(3),
  .tool-card:nth-child(3),
  .feynman-card:nth-child(3) {
    animation-delay: 0.08s;
  }
}

@keyframes ui-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

/* Responsive */
@media (max-width: 1180px) {
  .fire-page .calc-wrap,
  .calc-wrap {
    grid-template-columns: 1fr;
  }

  .fire-page .result-panel {
    position: static;
  }

  .tools-grid,
  .feynman-grid {
    grid-template-columns: 1fr;
  }

  .tool-card {
    min-height: 0;
  }
}

@media (max-width: 900px) {
  .home-page .hero,
  .tool-header:not(.fire-hero),
  .feynman-story {
    grid-template-columns: 1fr;
  }

  .hero-visual,
  .tool-header-img {
    justify-self: start;
  }

  .hero-visual {
    width: 100%;
  }

  .hero-visual img,
  .feynman-story img {
    height: 210px;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  :root {
    --nav-h: 60px;
  }

  .container,
  .fire-page .container,
  .nav-inner,
  .home-page .hero,
  .tool-header-inner,
  .tool-header:not(.fire-hero),
  .fire-page .tool-header-inner {
    width: min(100% - 28px, var(--max));
  }

  .nav-toggle {
    display: inline-grid;
    place-items: center;
  }

  .nav-links {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: var(--nav-h);
    padding: 10px 14px 14px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    box-shadow: var(--shadow);
  }

  .nav-links.open {
    display: grid;
  }

  .nav-links a {
    width: 100%;
    justify-content: flex-start;
  }

  .home-page .hero {
    margin-top: 16px;
    padding: 22px;
  }

  .tool-header {
    padding: 24px 0 20px;
  }

  .home-page .hero h1,
  .tool-header h1 {
    font-size: 27px;
    line-height: 1.25;
  }

  .hero-visual {
    display: none;
  }

  .preset-grid,
  .retirement-tiers,
  .result-grid,
  .family-breakdown-grid {
    grid-template-columns: 1fr;
  }

  .res-row,
  .summary-row,
  .summary-total,
  .family-inline-head {
    display: grid;
  }

  .res-value,
  .summary-total strong,
  .family-inline-head > strong {
    white-space: normal;
  }

  .chart-canvas-wrap,
  .fire-page .chart-canvas-wrap {
    height: 300px;
    min-height: 300px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  body {
    background-size: 24px 24px, auto, auto;
  }

  .container,
  .fire-page .container,
  .nav-inner,
  .home-page .hero,
  .tool-header-inner,
  .tool-header:not(.fire-hero),
  .fire-page .tool-header-inner {
    width: min(100% - 22px, var(--max));
  }

  .hero-actions {
    display: grid;
  }

  .hero-visual {
    display: none;
  }

  .hero-proof,
  .tool-flow {
    display: grid;
  }

  .calc-panel,
  .table-box,
  .content-section {
    padding: 16px;
  }

  .preset-btn {
    min-height: 88px;
  }

  .result-hero {
    padding: 16px;
  }

  .result-hero .value {
    font-size: 28px;
  }
}
