:root {
  color-scheme: dark;
  --bg: #0b0c0e;
  --surface: #111316;
  --surface-raised: #16191d;
  --surface-soft: #1b1f24;
  --text: #f3f4ef;
  --muted: #9ca39f;
  --subtle: #717873;
  --line: #2a2f34;
  --line-strong: #3a4248;
  --accent: #b8f34a;
  --accent-dark: #11180a;
  --danger: #ff8b82;
  --positive: #b8f34a;
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --gutter: clamp(18px, 4vw, 48px);
  --content: 1160px;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select {
  font: inherit;
}

a {
  color: inherit;
}

.page-shell {
  width: min(100%, calc(var(--content) + (var(--gutter) * 2)));
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left), env(safe-area-inset-right));
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  transform: translateY(-160%);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #101508;
  font-weight: 750;
  text-decoration: none;
}

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

.site-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner,
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.header-inner {
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 720;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--accent);
  font-size: 13px;
}

.brand-muted,
.privacy-note {
  color: var(--muted);
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 650;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(184, 243, 74, 0.08);
}

.intro {
  max-width: 820px;
  padding-block: clamp(64px, 11vw, 124px) clamp(38px, 7vw, 72px);
}

.eyebrow,
.step-label {
  margin: 0 0 18px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, h3, p {
  overflow-wrap: break-word;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(42px, 6.5vw, 78px);
  font-weight: 680;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.intro-copy {
  max-width: 640px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 2.3vw, 22px);
  letter-spacing: -0.015em;
  line-height: 1.5;
}

.calculator {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

.input-panel,
.result-panel {
  min-width: 0;
  padding: clamp(24px, 4vw, 48px);
}

.result-panel {
  outline: none;
  background: var(--surface-raised);
  border-left: 1px solid var(--line);
}

.result-panel:focus-visible {
  box-shadow: inset 0 0 0 3px var(--accent);
}

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

.panel-heading h3 {
  margin: 0;
  font-size: clamp(23px, 3vw, 30px);
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.step-label {
  margin-bottom: 9px;
  color: var(--subtle);
  font-size: 10px;
}

.text-button {
  min-width: 48px;
  min-height: 48px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.text-button:hover {
  color: var(--text);
}

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

.field {
  min-width: 0;
}

.field-wide,
.currency-field {
  grid-column: 1 / -1;
}

.currency-field {
  margin-bottom: 22px;
}

.field label,
.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.field label,
.label-row label {
  margin-bottom: 9px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.field label span,
.label-row > span {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 650;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  background: #0e1012;
  color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input {
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 650;
}

select {
  padding: 12px 40px 12px 14px;
  font-size: 15px;
  font-weight: 620;
}

input:hover,
select:hover {
  border-color: var(--line-strong);
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(184, 243, 74, 0.72);
  outline-offset: 3px;
}

input:focus-visible,
select:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(184, 243, 74, 0.08);
  outline: none;
}

input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-hint,
.field-error {
  margin: 8px 2px 0;
  font-size: 11px;
  line-height: 1.45;
}

.field-hint {
  color: var(--subtle);
}

.field-error {
  min-height: 0;
  color: var(--danger);
  font-weight: 650;
}

.field-error:empty {
  display: none;
}

.optional-field {
  padding-top: 3px;
}

.form-status {
  min-height: 22px;
  margin-top: 21px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.form-status--error {
  color: var(--danger);
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 56px;
  padding: 14px 18px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 780;
  letter-spacing: -0.01em;
  transition: background-color 150ms ease, transform 150ms ease;
}

.primary-button:hover {
  background: #c9ff62;
}

.primary-button:active {
  transform: translateY(1px);
}

.primary-button span {
  font-size: 22px;
  line-height: 1;
}

.persistence-copy,
.rounding-note {
  margin: 13px 0 0;
  color: var(--subtle);
  font-size: 11px;
  line-height: 1.5;
}

.result-heading {
  margin-bottom: clamp(44px, 7vw, 72px);
}

.result-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.result-state span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--subtle);
}

.result-state--complete {
  border-color: rgba(184, 243, 74, 0.25);
  color: var(--text);
}

.result-state--complete span {
  background: var(--accent);
}

.result-state--error {
  border-color: rgba(255, 139, 130, 0.28);
  color: var(--danger);
}

.result-state--error span {
  background: var(--danger);
}

.hero-result {
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.hero-value {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  color: var(--muted);
}

.hero-value strong {
  min-width: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: clamp(54px, 8vw, 86px);
  font-weight: 540;
  letter-spacing: -0.075em;
  line-height: 0.9;
  overflow-wrap: anywhere;
}

.hero-value span {
  font-size: clamp(16px, 2vw, 21px);
  font-weight: 620;
}

.hero-result > p:last-child {
  max-width: 520px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

.metric {
  min-width: 0;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.metric:nth-child(odd) {
  padding-right: 18px;
  border-right: 1px solid var(--line);
}

.metric:nth-child(even) {
  padding-left: 18px;
}

.metric dt {
  margin-bottom: 8px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 680;
}

.metric dd {
  margin: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: clamp(15px, 2.4vw, 19px);
  font-weight: 650;
  overflow-wrap: anywhere;
}

.projection {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #111316;
}

.projection-heading,
.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.projection-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.projection-heading p strong {
  color: var(--text);
}

.projection-heading > span {
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.positive {
  color: var(--positive);
}

.negative {
  color: var(--danger);
}

.projection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.projection-grid div {
  min-width: 0;
}

.projection-grid span,
.progress-label {
  color: var(--subtle);
  font-size: 10px;
  font-weight: 700;
}

.projection-grid strong {
  display: block;
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.progress-label {
  margin-top: 22px;
}

progress {
  width: 100%;
  height: 6px;
  margin-top: 9px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-soft);
  color: var(--accent);
}

progress::-webkit-progress-bar {
  background: var(--surface-soft);
}

progress::-webkit-progress-value {
  background: var(--accent);
}

progress::-moz-progress-bar {
  background: var(--accent);
}

.ad-slot {
  display: grid;
  width: 100%;
  min-height: 118px;
  margin-block: clamp(52px, 8vw, 88px);
  place-items: center;
  border: 1px dashed #282c30;
  border-radius: var(--radius-sm);
  color: #5d635f;
  background: #0d0f11;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ad-slot--secondary {
  min-height: 96px;
}

.method-section,
.guidance-section,
.faq-section {
  padding-block: clamp(54px, 8vw, 96px);
  border-top: 1px solid var(--line);
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(180px, 0.5fr) minmax(0, 1.5fr);
  align-items: start;
  gap: 40px;
  margin-bottom: 54px;
}

.section-heading h2 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(32px, 5vw, 54px);
  font-weight: 650;
  letter-spacing: -0.05em;
  line-height: 1.03;
}

.method-grid,
.guidance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.method-grid article,
.guidance-grid > div {
  min-width: 0;
  padding: 0 clamp(20px, 3vw, 34px);
  border-left: 1px solid var(--line);
}

.method-grid article:first-child,
.guidance-grid > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.method-grid article:last-child,
.guidance-grid > div:last-child {
  padding-right: 0;
}

.method-grid article > span {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
}

.method-grid h3,
.guidance-grid h3 {
  margin: 22px 0 11px;
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -0.025em;
}

.method-grid p,
.guidance-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.method-grid code {
  display: block;
  margin-top: 22px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: normal;
}

.compact-heading {
  margin-bottom: 46px;
}

.guidance-grid h3 {
  margin-top: 0;
}

.faq-section {
  padding-bottom: 0;
}

.faq-list {
  border-top: 1px solid var(--line);
}

details {
  border-bottom: 1px solid var(--line);
}

summary {
  position: relative;
  padding: 23px 54px 23px 0;
  cursor: pointer;
  list-style: none;
  font-size: clamp(16px, 2vw, 19px);
  font-weight: 650;
  letter-spacing: -0.02em;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  position: absolute;
  top: 19px;
  right: 4px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 400;
}

details[open] summary::after {
  content: "−";
}

details p {
  max-width: 780px;
  margin: -5px 0 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.site-footer {
  padding-block: 28px max(28px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.footer-inner p {
  margin: 0;
  color: var(--subtle);
  font-size: 11px;
}

.footer-inner a {
  color: var(--muted);
  font-weight: 700;
  text-underline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.not-found {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding-block: 60px;
  text-align: center;
}

.not-found-content {
  max-width: 620px;
}

.not-found-code {
  margin: 0 0 18px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.not-found h1 {
  font-size: clamp(42px, 8vw, 76px);
}

.not-found-copy {
  margin: 24px auto 30px;
  color: var(--muted);
  font-size: 18px;
}

.home-link {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-dark);
  font-weight: 780;
  text-decoration: none;
}

@media (max-width: 860px) {
  .calculator {
    grid-template-columns: 1fr;
  }

  .result-panel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .method-grid,
  .guidance-grid {
    grid-template-columns: 1fr;
  }

  .method-grid article,
  .guidance-grid > div {
    padding: 28px 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .method-grid article:first-child,
  .guidance-grid > div:first-child {
    padding-top: 0;
    border-top: 0;
  }

  .method-grid h3 {
    margin-top: 14px;
  }
}

@media (max-width: 620px) {
  :root {
    --gutter: 18px;
    --radius-lg: 20px;
  }

  .header-inner {
    min-height: 64px;
  }

  .intro {
    padding-block: 58px 38px;
  }

  h1 {
    font-size: clamp(38px, 12.2vw, 54px);
    line-height: 1;
  }

  .intro-copy {
    margin-top: 22px;
    font-size: 17px;
  }

  .input-panel,
  .result-panel {
    padding: 24px 19px;
  }

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

  .field-wide {
    grid-column: auto;
  }

  .result-heading {
    margin-bottom: 44px;
  }

  .hero-result {
    padding-bottom: 24px;
  }

  .hero-value {
    gap: 9px;
  }

  .hero-value strong {
    font-size: clamp(48px, 17vw, 70px);
  }

  .metric:nth-child(odd) {
    padding-right: 12px;
  }

  .metric:nth-child(even) {
    padding-left: 12px;
  }

  .metric dd {
    font-size: 14px;
  }

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

  .section-heading {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 38px;
  }

  .section-heading h2 {
    font-size: 34px;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 360px) {
  .page-shell {
    padding-inline: max(14px, env(safe-area-inset-left), env(safe-area-inset-right));
  }

  .brand-muted {
    display: none;
  }

  .input-panel,
  .result-panel {
    padding-inline: 16px;
  }

  .panel-heading {
    gap: 12px;
  }

  .panel-heading h3 {
    font-size: 22px;
  }

  .result-state {
    padding-inline: 8px;
    font-size: 10px;
  }

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

  .metric:nth-child(odd),
  .metric:nth-child(even) {
    padding-inline: 0;
    border-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .status-dot,
  .result-state span {
    forced-color-adjust: none;
  }
}
