:root {
  --ink: #081437;
  --muted: #506083;
  --teal: #008b90;
  --teal-dark: #007177;
  --teal-soft: #e8f7f6;
  --blue: #1c69e8;
  --blue-soft: #ecf4ff;
  --purple: #7a42d8;
  --purple-soft: #f2ecff;
  --gray-soft: #f3f5f9;
  --surface: #ffffff;
  --line: #d9e1ee;
  --line-strong: #c6d0df;
  --shadow: 0 16px 38px rgba(20, 36, 70, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  background: #fbfcff;
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 10px 36px;
  border-bottom: 1px solid rgba(217, 225, 238, 0.78);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #4f5c76;
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
}

.brand strong {
  color: var(--teal);
}

.brand-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 7px;
  background: var(--teal);
  color: white;
  font-size: 15px;
}

.main-nav {
  display: flex;
  gap: 34px;
  color: #1c2744;
  font-weight: 700;
}

.main-nav a {
  color: inherit;
}

.main-nav a:hover {
  color: var(--teal);
}

.page-shell {
  width: min(1410px, calc(100vw - 64px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.hero {
  margin: 0 0 24px 6px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(38px, 4.7vw, 56px);
  line-height: 1.02;
  letter-spacing: 0;
}

.hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.98fr) minmax(560px, 1fr);
  gap: 18px;
  align-items: stretch;
}

.assumptions-panel,
.results-panel,
.support-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.assumptions-panel,
.results-panel {
  padding: 22px;
}

h2,
h3,
p {
  margin-top: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: 18px;
  line-height: 1.25;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(260px, 0.9fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 9px;
  color: #172141;
  font-weight: 700;
}

.field-row small,
.panel-heading small {
  display: inline-grid;
  width: 14px;
  height: 14px;
  margin-left: 7px;
  place-items: center;
  border: 1px solid #8292b3;
  border-radius: 50%;
  color: #7180a0;
  font-size: 9px;
  font-style: normal;
}

.input-unit,
.money-input {
  display: grid;
  grid-template-columns: minmax(132px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.money-input {
  grid-template-columns: 42px minmax(132px, 1fr);
  max-width: 220px;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fbfcff;
}

.money-input strong {
  display: grid;
  height: 38px;
  place-items: center;
  border-right: 1px solid var(--line);
  color: var(--ink);
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fbfcff;
  color: var(--ink);
  font-weight: 700;
}

.money-input input {
  border: 0;
  border-radius: 0;
}

.input-unit em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 600;
  white-space: nowrap;
}

.panel-note {
  margin: 14px 0 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.action-row {
  display: grid;
  grid-template-columns: minmax(180px, 230px) minmax(150px, 200px);
  gap: 12px;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 7px;
  font-weight: 800;
}

.primary-button {
  border: 0;
  background: var(--teal);
  color: white;
  box-shadow: 0 12px 24px rgba(0, 139, 144, 0.2);
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  border: 1px solid #7382a3;
  background: white;
  color: #263350;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
}

.panel-heading > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.hero-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 24px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid #9bd5d2;
  border-radius: 7px;
  background: linear-gradient(90deg, rgba(235, 250, 249, 0.9), rgba(255, 255, 255, 0.96));
}

.hero-result p,
.years-box span {
  margin: 0 0 8px;
  color: #162341;
  font-size: 13px;
  font-weight: 700;
}

.hero-result strong {
  color: var(--teal);
  font-size: clamp(38px, 4vw, 52px);
  line-height: 1;
  letter-spacing: 0;
}

.years-box {
  padding-left: 30px;
  border-left: 1px solid var(--line-strong);
}

.years-box strong {
  display: block;
  font-size: 30px;
}

.years-box em {
  color: #233250;
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-grid article {
  min-height: 148px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

.metric-icon,
.support-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 900;
}

.metric-icon.teal,
.support-icon.teal {
  background: var(--teal-soft);
  color: var(--teal);
}

.metric-icon.blue,
.support-icon.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.metric-icon.purple,
.support-icon.purple {
  background: var(--purple-soft);
  color: var(--purple);
}

.metric-icon.gray,
.support-icon.gray {
  background: var(--gray-soft);
  color: #6b7284;
}

.metric-grid p {
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-grid strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 18px;
}

.metric-grid em {
  color: var(--muted);
  font-style: normal;
  font-weight: 700;
}

.chart-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

#projection-chart {
  width: 100%;
  height: 220px;
  overflow: visible;
}

.grid-lines line {
  stroke: #dfe6f1;
  stroke-dasharray: 3 4;
}

.axis-labels text,
.age-labels text {
  fill: #5c6987;
  font-size: 12px;
  font-weight: 700;
}

.area-path {
  fill: rgba(0, 139, 144, 0.12);
}

.line-path {
  fill: none;
  stroke: var(--teal);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

#final-point {
  fill: var(--teal);
  stroke: white;
  stroke-width: 3;
}

.assumption-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.support-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.support-card {
  min-height: 248px;
  padding: 18px;
}

.detail-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-panel h2 {
  margin-bottom: 10px;
}

.detail-panel p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.detail-panel p:last-child {
  margin-bottom: 0;
}

.support-card h2 {
  margin: 8px 0 10px;
  font-size: 17px;
}

.support-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.support-card ol,
.support-card ul {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 10px 0 18px;
  list-style: none;
}

.support-card li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.support-card ol li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
}

.support-card ol span {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  font-size: 11px;
  font-weight: 900;
}

.example-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0;
  margin: 12px 0 18px;
}

.example-list span,
.example-list strong {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.example-list span {
  color: var(--muted);
}

.faq-card {
  display: block;
}

.faq-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #fbfcff;
  color: #19233f;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}

.faq-item:first-of-type {
  margin-top: 10px;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.faq-item:nth-last-of-type(1) {
  border-bottom: 1px solid var(--line);
  border-bottom-right-radius: 6px;
  border-bottom-left-radius: 6px;
}

.faq-answer {
  display: none;
  padding: 9px 10px;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.faq-answer.is-open {
  display: block;
}

.footer-note {
  max-width: 820px;
  margin: 20px auto 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(18px);
  padding: 12px 14px;
  border-radius: 7px;
  background: #07142f;
  color: white;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  pointer-events: none;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1180px) {
  .calculator-grid,
  .support-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 10px 16px;
  }

  .main-nav {
    width: 100%;
    gap: 14px;
    overflow-x: auto;
    font-size: 13px;
  }

  .page-shell {
    width: min(100% - 24px, 640px);
    padding-top: 18px;
  }

  .hero {
    margin-left: 0;
  }

  .field-row,
  .hero-result,
  .metric-grid,
  .action-row {
    grid-template-columns: 1fr;
  }

  .years-box {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line-strong);
    padding-top: 14px;
  }

  .assumptions-panel,
  .results-panel,
  .support-card {
    padding: 16px;
  }

  .input-unit,
  .money-input {
    max-width: none;
  }
}
