:root {
  --bg: #f6f0e6;
  --bg-soft: #fffaf5;
  --paper: rgba(255, 251, 245, 0.88);
  --paper-strong: #fffdf9;
  --line: #e8dbc8;
  --line-strong: #d9c5aa;
  --ink: #27312d;
  --muted: #6f746d;
  --accent: #1d4a3d;
  --accent-soft: #2d6655;
  --accent-ink: #f8f1e7;
  --glow: #d8c0a2;
  --chip: #efe4d1;
  --danger-bg: #f8e3df;
  --danger-text: #8c3f2f;
  --shadow: 0 22px 40px rgba(37, 33, 24, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-display: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-body: "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.65), transparent 32%),
    linear-gradient(180deg, #f3ebdd 0%, #f9f4ec 42%, #fdfaf6 100%);
}

body {
  padding: 28px;
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  max-width: 1440px;
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 24px;
  margin-bottom: 24px;
}

.hero-copy,
.hero-panel,
.controls-panel,
.results-panel {
  border: 1px solid rgba(217, 197, 170, 0.72);
  background: var(--paper);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-copy {
  border-radius: var(--radius-xl);
  padding: 28px;
}

.eyebrow,
.panel-kicker,
.section-kicker,
.result-eyebrow {
  margin: 0 0 8px;
  color: #7e6647;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1.04;
}

.hero-text {
  margin: 16px 0 0;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.7;
}

.hero-panel {
  border-radius: var(--radius-xl);
  padding: 22px 22px 24px;
  background: linear-gradient(155deg, rgba(255, 248, 239, 0.96), rgba(249, 237, 218, 0.88));
}

.hero-kpi {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.hero-kpi-label {
  color: #775f44;
  font-size: 13px;
}

.hero-kpi strong {
  font-family: var(--font-display);
  font-size: 36px;
}

.hero-panel p {
  margin: 0;
  color: #5d5b54;
  line-height: 1.65;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 1.04fr) minmax(380px, 0.96fr);
  gap: 24px;
  align-items: start;
}

.controls-panel,
.results-panel {
  border-radius: var(--radius-xl);
  padding: 24px;
}

.controls-panel {
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(252, 246, 238, 0.94));
}

.results-panel {
  position: sticky;
  top: 28px;
  background:
    linear-gradient(180deg, rgba(24, 58, 49, 0.98), rgba(19, 48, 40, 0.98)),
    linear-gradient(145deg, rgba(43, 87, 71, 0.2), transparent);
  color: var(--accent-ink);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.panel-heading h2,
.card-head h3,
.result-card-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
}

.mode-switch {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(239, 228, 209, 0.88);
}

.mode-chip {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  color: #6a5a46;
  background: transparent;
  cursor: pointer;
  transition: 180ms ease;
}

.mode-chip.active {
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(28, 69, 58, 0.24);
}

.calculator-form {
  display: grid;
  gap: 18px;
}

.form-card,
.result-card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(224, 209, 189, 0.88);
  background: var(--paper-strong);
}

.form-card {
  padding: 18px;
}

.card-head,
.result-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.field-grid {
  display: grid;
  gap: 14px;
}

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

.field-grid.single {
  grid-template-columns: 1fr;
}

.field.full-width {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.toggle span {
  color: #5e615b;
  font-size: 14px;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  color: var(--ink);
  background: linear-gradient(180deg, #fffdfa, #f8f1e7);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: #b89259;
  box-shadow: 0 0 0 4px rgba(193, 154, 95, 0.14);
}

.toggle {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: #584d41;
  font-size: 14px;
}

.field-hint,
.footer-note {
  margin: 12px 0 0;
  color: #706a60;
  font-size: 13px;
  line-height: 1.65;
}

.retirement-helper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(245, 236, 222, 0.84), rgba(255, 250, 244, 0.95));
  border: 1px dashed var(--line-strong);
}

.retirement-helper h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
}

.retirement-helper .field-hint {
  margin-top: 6px;
}

.helper-actions {
  display: grid;
  gap: 10px;
  align-content: center;
}

.ghost-button {
  border: 1px solid rgba(29, 74, 61, 0.18);
  border-radius: 999px;
  padding: 11px 14px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: 160ms ease;
}

.ghost-button:hover {
  border-color: rgba(29, 74, 61, 0.32);
  background: rgba(255, 255, 255, 0.94);
}

.ghost-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

.result-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 24px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(245, 207, 140, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.result-total {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: clamp(42px, 5vw, 68px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.result-badge {
  padding: 10px 14px;
  border-radius: 999px;
  color: #f2e2c4;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.metric-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-card span {
  font-size: 13px;
  color: rgba(248, 241, 231, 0.74);
}

.metric-card strong {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: -0.03em;
}

.result-sections {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.result-card {
  padding: 18px;
  color: #f8f1e7;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.warning-card {
  background: linear-gradient(180deg, rgba(255, 231, 196, 0.08), rgba(255, 255, 255, 0.05));
}

.detail-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

.detail-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.detail-row dt {
  color: rgba(248, 241, 231, 0.72);
  font-size: 14px;
}

.detail-row dd {
  margin: 0;
  text-align: right;
  font-size: 16px;
  font-weight: 600;
}

.warning-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: rgba(248, 241, 231, 0.82);
  line-height: 1.65;
}

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

.scenario-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.scenario-card.active {
  background: linear-gradient(180deg, rgba(247, 212, 154, 0.16), rgba(255, 255, 255, 0.06));
  border-color: rgba(247, 212, 154, 0.34);
}

.scenario-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.scenario-card strong {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: -0.03em;
}

.scenario-note {
  color: rgba(248, 241, 231, 0.72);
  font-size: 13px;
}

.error-banner {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  color: var(--danger-text);
  background: var(--danger-bg);
}

@media (max-width: 1120px) {
  body {
    padding: 18px;
  }

  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .results-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  body {
    padding: 12px;
  }

  .results-panel {
    order: -1;
  }

  .hero-copy,
  .hero-panel,
  .controls-panel,
  .results-panel {
    border-radius: 22px;
  }

  .panel-heading,
  .card-head {
    flex-direction: column;
  }

  .field-grid.two-col,
  .metric-grid,
  .scenario-grid {
    grid-template-columns: 1fr;
  }

  .controls-panel,
  .results-panel {
    padding: 18px;
  }

  .result-hero {
    padding: 18px;
  }

  .result-total {
    font-size: 44px;
  }

  .mode-switch {
    width: 100%;
    justify-content: space-between;
  }

  .retirement-helper {
    grid-template-columns: 1fr;
  }

  .mode-chip {
    flex: 1;
  }
}
