:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #251a28;
  background: #802b77;
  font-synthesis: none;
  --accent: #802b77;
  --muted: #685a6b;
  --border: #e7dce8;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, #28102e76, transparent 75%),
    linear-gradient(46deg, #bc883b 0%, #b86753 32%, #802b77 76%);
}

.shell {
  width: min(1120px, calc(100% - 72px));
  margin-inline: auto;
}

.masthead {
  background: #fff;
  border-bottom: 1px solid #fff4;
}

.masthead-inner {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand { display: block; }

.brand-link {
  color: #64215d;
  font-size: .9rem;
  font-weight: 650;
  text-decoration: none;
}

.brand-link:hover { text-decoration: underline; }
.brand-link span { margin-inline-start: .25em; }

main { padding-block: clamp(42px, 7vw, 100px) 68px; }

h1 {
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 4rem);
  line-height: 1.07;
  letter-spacing: -.055em;
  color: #fff;
}

.intro {
  color: #fff;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  margin: 16px 0 34px;
  line-height: 1.5;
}

.calculator {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.09fr);
  gap: 20px;
  align-items: stretch;
}

.card {
  padding: clamp(24px, 3.2vw, 42px);
  border-radius: 22px;
  box-shadow: 0 18px 48px #29132523;
}

.parameters { background: #fff; }
.results { background: #fff9f4; }

h2 {
  margin: 0 0 30px;
  font-size: clamp(1.25rem, 2.6vw, 1.65rem);
  letter-spacing: -.035em;
  line-height: 1.2;
}

.field-label,
legend {
  display: block;
  margin: 0 0 10px;
  padding: 0;
  font-size: .94rem;
  font-weight: 650;
}

input[type="text"] {
  width: 100%;
  min-height: 52px;
  padding: 12px 15px;
  border: 1px solid #aa96ad;
  border-radius: 10px;
  background: #fff;
  color: inherit;
  font: inherit;
}

input::placeholder { color: #756979; }
input[aria-invalid="true"] { border-color: #aa263e; }

:where(input, a, .option):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.field-error {
  margin: 8px 0 0;
  color: #9e1735;
  font-size: .875rem;
  line-height: 1.4;
}

fieldset {
  min-width: 0;
  margin: 24px 0 0;
  padding: 0;
  border: 0;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.option + .option { margin-top: 8px; }
.option:hover { border-color: #aa96ad; }

.option:has(input:checked) {
  border-color: var(--accent);
  background: #f9eff8;
}

.option input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.breakdown,
.breakdown dd { margin: 0; }

.line-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding-block: 13px;
  border-bottom: 1px solid #e8dad5;
}

.line-item:first-child { padding-top: 0; }

.line-item dd {
  font-size: 1.125rem;
  font-weight: 650;
}

.breakdown dd {
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.total {
  margin-top: 22px;
  padding: 18px 22px 20px;
  border-radius: 13px;
  background: linear-gradient(120deg, #4b1f47, #702661);
  color: #fff;
}

.total dt { color: #f4e3ef; font-size: .94rem; }

.total dd {
  margin-top: 4px;
  font-size: clamp(1.65rem, 3.7vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -.045em;
  line-height: 1.15;
}

.result-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .shell { width: calc(100% - 36px); }
  .masthead-inner { min-height: 72px; }
  .calculator { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .intro { margin-bottom: 25px; }
}

@media (max-width: 360px) {
  .card { padding: 20px; }
  h1 { font-size: 2rem; }
}
