:root {
  --walnut: #24160E;
  --brown: #613B23;
  --bronze: #D2995F;
  --ivory: #F4EEE1;
  --paper: #FBF8F2;
  --line: #D8CDBD;
  --muted: #776B61;
  --white: #FFFFFF;
  --shadow: 0 24px 70px rgba(36, 22, 14, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--walnut);
  background:
    radial-gradient(circle at 0 0, rgba(210, 153, 95, 0.12), transparent 28rem),
    linear-gradient(180deg, #FAF6EE 0%, #F2ECE1 100%);
  font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 30px;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--walnut);
  text-decoration: none;
}

.brand-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.brand-copy strong {
  display: block;
  font-size: 19px;
  line-height: 0.92;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.brand-copy sup {
  margin-left: 2px;
  font-size: 8px;
  vertical-align: top;
}

.brand-copy small {
  display: block;
  margin-top: 7px;
  color: var(--brown);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.test-badge {
  padding: 9px 12px;
  border: 1px solid rgba(97, 59, 35, 0.18);
  border-radius: 999px;
  color: var(--brown);
  background: rgba(244, 238, 225, 0.86);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.hero {
  max-width: 780px;
  padding: 70px 0 42px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--brown);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(42px, 6vw, 74px);
  line-height: 0.98;
  letter-spacing: -0.055em;
  font-weight: 800;
}

.hero-copy {
  max-width: 660px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.calculator {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(380px, 0.97fr);
  gap: 22px;
  align-items: stretch;
}

.controls-card,
.result-card {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.controls-card {
  padding: 34px;
  border: 1px solid rgba(97, 59, 35, 0.08);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

.control-group {
  display: grid;
  gap: 18px;
}

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

.control-heading label {
  font-size: 15px;
  font-weight: 700;
}

.money-input-wrap {
  position: relative;
  width: 190px;
}

.money-input {
  width: 100%;
  height: 48px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  color: var(--walnut);
  background: var(--paper);
  font-size: 17px;
  font-weight: 700;
  text-align: right;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  -moz-appearance: textfield;
}

.money-input::-webkit-outer-spin-button,
.money-input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.money-input:focus {
  border-color: var(--bronze);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(210, 153, 95, 0.14);
}

.money-input-wrap span {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: var(--brown);
  font-size: 15px;
  font-weight: 700;
  pointer-events: none;
}

.down-row {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: -7px;
}

.down-row strong {
  color: var(--brown);
  font-size: 24px;
  line-height: 1;
}

.down-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.plan-options {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.plan-options legend {
  margin-bottom: 12px;
  padding: 0;
  font-size: 15px;
  font-weight: 700;
}

.plan-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.plan-choice:has(input:checked) {
  border-color: var(--bronze);
  background: rgba(210, 153, 95, 0.1);
  box-shadow: 0 0 0 3px rgba(210, 153, 95, 0.1);
}

.plan-choice input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brown);
  flex: 0 0 auto;
}

.plan-choice input:focus-visible {
  outline: 2px solid var(--bronze);
  outline-offset: 3px;
}

.plan-choice span {
  display: grid;
  gap: 4px;
}

.plan-choice strong {
  font-size: 13px;
}

.plan-choice small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.divider {
  height: 1px;
  margin: 30px 0;
  background: linear-gradient(90deg, transparent, var(--line) 8%, var(--line) 92%, transparent);
}

.range {
  --fill: 0%;
  width: 100%;
  height: 28px;
  margin: 2px 0 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--bronze) 0 var(--fill), #DDD4C7 var(--fill) 100%);
}

.range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #DDD4C7;
}

.range::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--bronze);
}

.range::-webkit-slider-thumb {
  width: 26px;
  height: 26px;
  margin-top: -10px;
  border: 4px solid var(--white);
  border-radius: 50%;
  background: var(--brown);
  box-shadow: 0 3px 12px rgba(36, 22, 14, 0.24);
  appearance: none;
  -webkit-appearance: none;
}

.range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 4px solid var(--white);
  border-radius: 50%;
  background: var(--brown);
  box-shadow: 0 3px 12px rgba(36, 22, 14, 0.24);
}

.range:focus-visible {
  outline: 2px solid var(--bronze);
  outline-offset: 6px;
  border-radius: 999px;
}

.range-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: -12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.payment-heading {
  align-items: flex-end;
}

.payment-count {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--brown);
}

.payment-count strong {
  font-size: 34px;
  line-height: 1;
}

.payment-count span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.payment-scale {
  font-variant-numeric: tabular-nums;
}

.result-card {
  position: relative;
  overflow: hidden;
  padding: 34px;
  color: var(--ivory);
  background:
    radial-gradient(circle at 100% 0, rgba(210, 153, 95, 0.18), transparent 19rem),
    var(--walnut);
}

.result-card::after {
  content: "";
  position: absolute;
  right: -50px;
  bottom: -76px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(210, 153, 95, 0.14);
  border-radius: 50%;
  box-shadow:
    0 0 0 32px rgba(210, 153, 95, 0.035),
    0 0 0 64px rgba(210, 153, 95, 0.025);
  pointer-events: none;
}

.result-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.result-kicker {
  margin: 0 0 6px;
  color: var(--bronze);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-card h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.result-status {
  padding: 7px 9px;
  border: 1px solid rgba(244, 238, 225, 0.14);
  border-radius: 999px;
  color: rgba(244, 238, 225, 0.62);
  font-size: 9px;
  font-weight: 600;
}

.monthly-block {
  position: relative;
  z-index: 1;
  margin: 34px 0 28px;
  padding: 24px;
  border: 1px solid rgba(244, 238, 225, 0.12);
  border-radius: var(--radius-lg);
  background: rgba(244, 238, 225, 0.06);
}

.monthly-block > span {
  color: rgba(244, 238, 225, 0.65);
  font-size: 12px;
  font-weight: 500;
}

.monthly-value {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 8px;
}

.monthly-value strong {
  font-size: clamp(36px, 5vw, 50px);
  line-height: 1;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
}

.monthly-value small {
  color: var(--bronze);
  font-size: 16px;
  font-weight: 700;
}

.breakdown {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0;
  margin: 0;
}

.breakdown > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(244, 238, 225, 0.1);
}

.breakdown dt {
  color: rgba(244, 238, 225, 0.62);
  font-size: 11px;
  line-height: 1.4;
}

.breakdown dd {
  margin: 0;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.breakdown .breakdown-total {
  margin-top: 5px;
  border-bottom: 0;
}

.breakdown-total dt {
  color: var(--ivory);
  font-size: 13px;
  font-weight: 700;
}

.breakdown-total dd {
  color: var(--bronze);
  font-size: 20px;
  font-weight: 800;
}

.copy-button {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 56px;
  margin-top: 24px;
  border: 0;
  border-radius: 16px;
  color: var(--walnut);
  background: var(--bronze);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(210, 153, 95, 0.2);
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.copy-button:hover {
  filter: brightness(1.05);
  box-shadow: 0 14px 34px rgba(210, 153, 95, 0.28);
}

.copy-button:active {
  transform: translateY(1px) scale(0.995);
}

.copy-button.is-copied {
  background: var(--ivory);
}

.copy-icon {
  margin-right: 7px;
  font-size: 17px;
}

.test-note {
  position: relative;
  z-index: 1;
  margin: 13px 12px 0;
  color: rgba(244, 238, 225, 0.45);
  font-size: 9px;
  line-height: 1.55;
  text-align: center;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 4px 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

@media (max-width: 880px) {
  .page-shell {
    width: min(720px, calc(100% - 24px));
    padding-top: 14px;
  }

  .hero {
    padding: 46px 2px 30px;
  }

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

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

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 18px, 520px);
    padding-bottom: 18px;
  }

  .topbar {
    min-height: 62px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 56px;
    height: 56px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .brand-copy small {
    margin-top: 5px;
    font-size: 5.5px;
  }

  .test-badge {
    padding: 7px 9px;
    font-size: 8px;
  }

  .hero {
    padding: 34px 2px 24px;
  }

  .eyebrow {
    font-size: 9px;
  }

  .hero h1 {
    font-size: clamp(39px, 12.5vw, 58px);
  }

  .hero-copy {
    margin-top: 16px;
    font-size: 13px;
    line-height: 1.55;
  }

  .controls-card,
  .result-card {
    border-radius: 22px;
  }

  .controls-card {
    padding: 22px 18px;
  }

  .control-group {
    gap: 16px;
  }

  .control-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .money-input-wrap {
    width: 100%;
  }

  .money-input {
    height: 52px;
    padding-left: 16px;
    font-size: 20px;
    text-align: left;
  }

  .money-input-wrap span {
    font-size: 17px;
  }

  .down-row {
    margin-top: -4px;
  }

  .divider {
    margin: 24px 0;
  }

  .payment-heading {
    flex-direction: row;
    align-items: flex-end;
  }

  .payment-count strong {
    font-size: 31px;
  }

  .result-card {
    padding: 24px 20px;
  }

  .result-card h2 {
    font-size: 22px;
  }

  .result-status {
    display: none;
  }

  .monthly-block {
    margin: 26px 0 20px;
    padding: 20px 18px;
  }

  .monthly-value {
    gap: 8px;
  }

  .monthly-value strong {
    font-size: clamp(34px, 11vw, 46px);
  }

  .breakdown > div {
    padding: 12px 0;
  }

  .breakdown dt {
    max-width: 52%;
    font-size: 10px;
  }

  .breakdown dd {
    font-size: 13px;
  }

  .breakdown-total dt {
    font-size: 12px;
  }

  .breakdown-total dd {
    font-size: 18px;
  }

  footer {
    flex-direction: column;
    gap: 5px;
    padding-left: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
