:root {
  color-scheme: light;
  --paper: #f4f6f3;
  --surface: #ffffff;
  --ink: #17201b;
  --muted: #677069;
  --line: #d9dfda;
  --accent: #176849;
  --accent-soft: #e5f0ea;
  --result: #173d30;
  --result-muted: #b8cbc2;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

.site-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 246, 243, 0.96);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-family: Georgia, serif;
  font-size: 18px;
}

.header-actions,
.save-status {
  display: flex;
  align-items: center;
}

.header-actions {
  gap: 18px;
}

.save-status {
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2a9a69;
}

.save-status.saving .status-dot {
  background: #d69f33;
}

.reset-button {
  padding: 6px 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 600;
}

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

.calculator-shell {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
}

.input-pane {
  padding: clamp(46px, 6vw, 82px) clamp(28px, 7vw, 104px) 54px;
  background: var(--surface);
}

.intro,
#comparison-form,
.input-note {
  width: min(100%, 650px);
  margin-inline: auto;
}

.eyebrow,
.result-kicker {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--accent);
}

h1 {
  max-width: 580px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 5vw, 64px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: 0;
}

.intro > p:last-child {
  max-width: 560px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
}

#comparison-form {
  margin-top: 52px;
}

.form-section {
  margin: 0;
  padding: 0 0 40px;
  border: 0;
}

.form-section + .form-section {
  padding-top: 38px;
  border-top: 1px solid var(--line);
}

legend {
  width: 100%;
  margin: 0 0 18px;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(23, 104, 73, 0.28);
  outline-offset: 2px;
}

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

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.field > small {
  margin-top: -3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.money-input,
.suffix-input {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
  font-size: 16px;
}

.money-input:focus-within,
.suffix-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 104, 73, 0.1);
}

.money-input input,
.suffix-input input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 17px;
  font-weight: 650;
}

input[type="number"] {
  appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
}

.range-field {
  padding: 20px 2px 26px;
}

input[type="range"] {
  width: 100%;
  height: 4px;
  margin: 8px 0 0;
  border-radius: 2px;
  appearance: none;
  background: linear-gradient(to right, var(--accent) 0 30%, var(--line) 30% 100%);
}

input[type="range"]::-webkit-slider-thumb {
  width: 19px;
  height: 19px;
  border: 4px solid var(--surface);
  border-radius: 50%;
  appearance: none;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 4px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}

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

.range-meta strong {
  color: var(--accent);
  font-size: 12px;
}

.calculated-cost {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.calculated-cost strong {
  color: var(--ink);
}

.input-note {
  margin-top: 0;
  color: var(--muted);
  font-size: 12px;
}

.result-pane {
  padding: clamp(46px, 6vw, 82px) clamp(28px, 5.5vw, 82px);
  color: #fff;
  background: var(--result);
}

.result-inner {
  width: min(100%, 590px);
  margin-inline: auto;
}

.result-kicker {
  color: var(--result-muted);
}

.outcome {
  display: grid;
  gap: 4px;
}

.outcome > span {
  color: var(--result-muted);
  font-size: 16px;
}

.outcome strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(44px, 5vw, 66px);
  font-weight: 400;
  line-height: 1.05;
}

.payment-context {
  margin: 12px 0 0;
  color: var(--result-muted);
  font-size: 14px;
}

.comparison-chart {
  display: grid;
  gap: 18px;
  margin-top: 40px;
  padding: 24px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.chart-row {
  display: grid;
  grid-template-columns: 115px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.chart-label {
  display: grid;
}

.chart-label span {
  color: var(--result-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.chart-label strong {
  font-size: 17px;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.11);
}

.bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 2px;
  transition: width 240ms ease;
}

.buy-bar {
  background: #79c49f;
}

.rent-bar {
  background: #e4b778;
}

.headline-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
  padding: 25px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.headline-metrics > div + div {
  padding-left: 28px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.headline-metrics span,
.result-row span,
.guide-grid span {
  display: block;
  color: var(--result-muted);
  font-size: 12px;
}

.headline-metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 23px;
}

.headline-metrics small {
  color: var(--result-muted);
  font-size: 11px;
}

.result-list {
  padding: 18px 0;
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
}

.result-row strong {
  font-size: 15px;
}

.breakdown {
  margin-top: 30px;
}

.breakdown .section-heading > span {
  color: var(--result-muted);
}

.breakdown .result-list {
  margin-top: 12px;
  padding: 7px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.cost-summary {
  margin-top: 28px;
  padding: 24px;
  border-radius: var(--radius);
  color: var(--ink);
  background: #eef4f0;
}

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

.section-heading h2 {
  margin: 0;
  font-size: 15px;
}

.section-heading > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.cost-grid span {
  display: block;
  min-height: 32px;
  color: var(--muted);
  font-size: 11px;
}

.cost-grid strong {
  display: block;
  font-size: 17px;
}

.notice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  margin-top: 22px;
  color: var(--result-muted);
  font-size: 11px;
}

.notice strong {
  color: #fff;
}

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

  .result-pane {
    min-height: auto;
  }

}

@media (max-width: 600px) {
  .site-header {
    min-height: 62px;
    padding-inline: 18px;
  }

  .brand > span:last-child {
    font-size: 14px;
  }

  .save-status {
    width: 8px;
    overflow: hidden;
    white-space: nowrap;
  }

  .header-actions {
    gap: 14px;
  }

  .input-pane,
  .result-pane {
    padding: 38px 20px 42px;
  }

  h1 {
    font-size: 42px;
  }

  #comparison-form {
    margin-top: 38px;
  }

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

  .field-grid + .range-field {
    padding-top: 15px;
  }

  .headline-metrics,
  .cost-grid {
    grid-template-columns: 1fr 1fr;
  }

  .headline-metrics > div + div {
    padding-left: 18px;
  }

  .cost-summary {
    padding: 20px;
  }

  .chart-row {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 12px;
  }

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

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