:root {
  color-scheme: light;
  --navy: #0d1b2a;
  --navy-soft: #1a2d45;
  --gold: #b48716;
  --gold-light: #f1d080;
  --green: #207a56;
  --red: #b42318;
  --purple: #5145a8;
  --blue: #175f8f;
  --text: #0d1b2a;
  --text-secondary: #3d4b5d;
  --text-muted: #596579;
  --border: #c8c1b5;
  --border-light: #e5dfd6;
  --background: #f8f6f1;
  --card: #ffffff;
  --focus: #b48716;
  --shadow: 0 1px 3px rgb(13 27 42 / 8%), 0 5px 20px rgb(13 27 42 / 5%);
  --radius: 12px;
  --heading: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --body: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --text: #f2ede4;
  --text-secondary: #c8c1b7;
  --text-muted: #aaa59d;
  --border: #4b4b49;
  --border-light: #2a3542;
  --background: #07101c;
  --card: #0c1927;
  --green: #70d0a7;
  --red: #ff8d85;
  --blue: #79b9e6;
  --purple: #aaa1ff;
  --focus: #f1d080;
  --shadow: 0 2px 14px rgb(0 0 0 / 35%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

button,
input[type="range"],
select,
summary {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

a {
  color: var(--blue);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 52px 0 46px;
  background: radial-gradient(circle at 85% 10%, rgb(201 168 76 / 14%), transparent 28%), var(--navy);
  color: #fff;
}

.hero-inner,
.container {
  width: min(920px, calc(100% - 40px));
  margin-inline: auto;
}

.hero-inner {
  position: relative;
}

.header-actions {
  position: absolute;
  top: -18px;
  right: 0;
  display: flex;
  gap: 9px;
}

.round-button {
  display: inline-flex;
  min-width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: 999px;
  background: rgb(255 255 255 / 8%);
  color: #fff;
  font-weight: 700;
}

.round-button:hover {
  border-color: var(--gold-light);
  background: rgb(201 168 76 / 18%);
}

.language-button {
  padding-inline: 12px;
}

.theme-sun,
[data-theme="dark"] .theme-moon {
  display: none;
}

[data-theme="dark"] .theme-sun {
  display: inline;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 16px;
  padding: 5px 12px;
  border: 1px solid rgb(241 208 128 / 35%);
  border-radius: 999px;
  background: rgb(201 168 76 / 13%);
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-family: var(--heading);
  font-size: clamp(2rem, 7vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: -.035em;
}

h1 em {
  color: var(--gold-light);
  font-style: normal;
}

.hero-description {
  max-width: 650px;
  margin-bottom: 0;
  color: rgb(255 255 255 / 75%);
}

.container {
  padding-block: 34px 72px;
}

.warning {
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid #e5b852;
  border-radius: var(--radius);
  background: #fff7dd;
  color: #713f00;
}

[data-theme="dark"] .warning {
  border-color: #8f6b20;
  background: #2b230e;
  color: #f6d989;
}

.information-card,
.card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.information-card {
  margin-bottom: 30px;
  overflow: hidden;
}

.information-card summary {
  padding: 15px 18px;
  color: var(--text);
  font-weight: 750;
}

.information-card summary::marker {
  color: var(--gold);
}

.information-body {
  padding: 0 18px 18px;
  color: var(--text-secondary);
}

.information-body p:last-child {
  margin-bottom: 0;
}

section {
  margin-bottom: 30px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-number {
  display: inline-grid;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

[data-theme="dark"] .section-number {
  border: 1px solid rgb(241 208 128 / 45%);
  background: rgb(201 168 76 / 14%);
  color: var(--gold-light);
}

.section-heading h2 {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.scenario-card {
  padding: 20px;
}

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

.scenario-button {
  display: flex;
  min-height: 106px;
  flex-direction: column;
  gap: 7px;
  padding: 15px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  text-align: left;
}

.scenario-button:hover,
.scenario-button.is-active {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 8%, var(--card));
}

.scenario-name {
  font-weight: 800;
}

.scenario-description {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.scenario-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--background);
  color: var(--text-secondary);
  font-size: 13px;
}

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

.control-card {
  padding: 18px 20px;
}

.control-card.emphasized,
.retirement-control {
  border-color: color-mix(in srgb, var(--purple) 35%, var(--border-light));
}

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

.control-heading label {
  color: var(--text-secondary);
  font-weight: 650;
}

output {
  color: var(--text);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  appearance: none;
  border-radius: 999px;
  background: var(--border);
}

input[type="range"]::-webkit-slider-thumb {
  width: 21px;
  height: 21px;
  appearance: none;
  border: 3px solid var(--card);
  border-radius: 50%;
  background: var(--navy-soft);
  box-shadow: 0 0 0 2px var(--navy-soft);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid var(--card);
  border-radius: 50%;
  background: var(--navy-soft);
  box-shadow: 0 0 0 2px var(--navy-soft);
}

[data-theme="dark"] input[type="range"]::-webkit-slider-thumb,
[data-theme="dark"] input[type="range"]::-moz-range-thumb {
  background: var(--gold-light);
  box-shadow: 0 0 0 2px var(--gold-light);
}

input[type="number"],
select {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
}

input[type="number"] {
  width: 92px;
  padding: 7px 9px;
  font-family: var(--mono);
  text-align: center;
}

select {
  width: 100%;
  padding: 8px 10px;
}

input:invalid {
  border-color: var(--red);
}

.hint {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.import-note {
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--green) 45%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--green) 10%, var(--card));
  color: var(--green);
  font-size: 12px;
}

.form-error {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: color-mix(in srgb, var(--red) 8%, var(--card));
  color: var(--red);
  font-weight: 700;
}

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

.result-card {
  min-width: 0;
  padding: 18px;
}

.result-card.primary {
  grid-column: span 2;
  background: var(--navy);
  color: #fff;
}

.result-card.income {
  background: color-mix(in srgb, var(--green) 12%, var(--card));
  border-color: color-mix(in srgb, var(--green) 35%, var(--border-light));
}

.result-label {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.primary .result-label,
.primary .result-note {
  color: rgb(255 255 255 / 68%);
}

.result-value {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 850;
  line-height: 1.1;
}

.primary .result-value {
  color: var(--gold-light);
}

.result-note {
  margin: 7px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.chart-card {
  padding: 20px;
}

.chart-title {
  margin-bottom: 3px;
  font-size: 17px;
}

.chart-subtitle {
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 12px;
}

.chart-wrapper {
  position: relative;
  height: 260px;
}

.chart-large {
  height: 340px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.chart-grid section {
  margin: 0;
}

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

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 12px;
}

caption {
  padding: 12px 14px;
  color: var(--text-secondary);
  font-weight: 700;
  text-align: left;
}

th,
td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--border-light);
  text-align: right;
  white-space: nowrap;
}

th {
  background: var(--background);
  color: var(--text-secondary);
  font-size: 11px;
}

th:first-child,
th:nth-child(2),
td:first-child,
td:nth-child(2) {
  text-align: left;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--blue) 6%, var(--card));
}

.phase-retirement {
  color: var(--purple);
  font-weight: 700;
}

.methodology {
  margin-top: 30px;
}

footer {
  padding: 24px 20px;
  background: var(--navy);
  color: rgb(255 255 255 / 68%);
  font-size: 12px;
  text-align: center;
}

noscript {
  display: block;
  padding: 16px;
  background: #fff1f0;
  color: #7a1711;
  text-align: center;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 600px) {
  .hero-inner,
  .container {
    width: min(100% - 28px, 920px);
  }

  .hero {
    padding-top: 76px;
  }

  .header-actions {
    top: -56px;
  }

  .scenario-grid,
  .control-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .result-card.primary {
    grid-column: auto;
  }

  .scenario-button {
    min-height: auto;
  }

  .chart-card {
    padding: 16px;
  }

  .chart-wrapper,
  .chart-large {
    height: 270px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
