:root {
  --white: #FFFFFF;
  --ivory: #FAF7F2;
  --blush: #E8B4B8;
  --blush-deep: #d99aa0;
  --gold: #C9A96A;
  --charcoal: #3E3A39;
  --charcoal-soft: #6b6461;
  --sage: #A3B899;
  --rose: #C97B7B;
  --rose-bg: #f6e4e4;
  --shadow: 0 10px 40px rgba(62, 58, 57, 0.08);
  --shadow-sm: 0 4px 18px rgba(62, 58, 57, 0.06);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--charcoal);
  background: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .serif { font-family: 'Playfair Display', Georgia, serif; font-weight: 600; }

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

.wrap { max-width: 780px; margin: 0 auto; padding: 0 22px; }

/* ---------- Header ---------- */
header.hero {
  text-align: center;
  padding: 54px 22px 30px;
  background: linear-gradient(180deg, var(--white) 0%, var(--ivory) 100%);
}
.monogram { margin: 0 auto 18px; display: block; }
header.hero h1 {
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  line-height: 1.15;
  margin: 0 0 12px;
  font-weight: 700;
}
header.hero p.sub {
  margin: 0 auto;
  max-width: 540px;
  color: var(--charcoal-soft);
  font-size: 1.05rem;
}

.divider {
  width: 120px; height: 22px; margin: 20px auto; display: block;
}

/* ---------- Card / Calculator ---------- */
.card {
  background: var(--white);
  border: 1px solid #efe6da;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 26px;
}

section { padding: 26px 0; }
section.tool { padding-top: 6px; }

.field { margin-bottom: 20px; }
.field > label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 7px;
}
.field .hint { display: block; font-weight: 400; color: var(--charcoal-soft); font-size: 0.82rem; margin-top: 2px; }

.input-money { position: relative; }
.input-money::before {
  content: "$";
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: var(--charcoal-soft); font-weight: 500;
}
.input-money input[type="text"] { padding-left: 30px; }

input[type="number"], input[type="text"], input[type="date"], select {
  width: 100%;
  padding: 13px 15px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--charcoal);
  background: var(--ivory);
  border: 1px solid #e7ddce;
  border-radius: 12px;
  transition: border-color .18s, box-shadow .18s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--blush);
  box-shadow: 0 0 0 3px rgba(232,180,184,.28);
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 540px) { .two-col { grid-template-columns: 1fr; } }

/* Toggle */
.toggle-group { display: flex; gap: 8px; background: var(--ivory); padding: 5px; border-radius: 12px; border: 1px solid #e7ddce; }
.toggle-group button {
  flex: 1; padding: 11px; border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 0.92rem; font-weight: 600; color: var(--charcoal-soft);
  border-radius: 8px; transition: background .18s, color .18s;
}
.toggle-group button.active { background: var(--white); color: var(--charcoal); box-shadow: var(--shadow-sm); }

#financeOpts { margin-top: 18px; display: none; }
#financeOpts.show { display: block; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 6px;
  background: linear-gradient(90deg, var(--blush), var(--gold));
  outline: none; margin-top: 8px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--white); border: 3px solid var(--blush-deep);
  box-shadow: var(--shadow-sm); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--white); border: 3px solid var(--blush-deep); cursor: pointer;
}
.slider-val { font-weight: 600; color: var(--charcoal); }

.btn {
  display: inline-block; width: 100%;
  padding: 15px 22px; margin-top: 6px;
  font-family: inherit; font-size: 1.05rem; font-weight: 600;
  color: var(--white); background: var(--blush);
  border: none; border-radius: 12px; cursor: pointer;
  transition: background .18s, transform .08s;
}
.btn:hover { background: var(--blush-deep); }
.btn:active { transform: translateY(1px); }

/* ---------- Result ---------- */
#result { display: none; margin-top: 26px; }
#result.show { display: block; animation: fade .5s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.result-card { text-align: center; background: linear-gradient(180deg, var(--white), var(--ivory)); }
.result-label { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; color: var(--charcoal-soft); font-weight: 600; }
.the-number {
  font-family: 'Playfair Display', serif; font-weight: 700;
  font-size: clamp(2.8rem, 11vw, 4.6rem);
  color: var(--gold); line-height: 1.05; margin: 6px 0 4px;
}
.number-note { color: var(--charcoal-soft); font-size: .95rem; margin-top: 0; }

/* Warning banner */
.warning {
  display: none; align-items: flex-start; gap: 12px;
  background: var(--rose-bg); border: 1px solid #eccaca;
  color: #8f4f4f; border-radius: 12px; padding: 14px 16px; margin: 20px 0 0;
  text-align: left; font-size: .92rem;
}
.warning.show { display: flex; }
.warning svg { flex-shrink: 0; margin-top: 2px; }

/* Gauge */
.gauge-box { margin: 28px 0 8px; text-align: center; }
.gauge-track { position: relative; height: 12px; background: var(--ivory); border: 1px solid #e7ddce; border-radius: 20px; overflow: hidden; margin: 12px 0 8px; }
.gauge-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--sage), var(--gold)); border-radius: 20px; transition: width .8s cubic-bezier(.2,.7,.3,1); }
.gauge-avg { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--charcoal); }
.gauge-legend { display: flex; justify-content: space-between; font-size: .8rem; color: var(--charcoal-soft); }
.gauge-sentence { margin-top: 12px; font-size: 1rem; }
.gauge-sentence b { color: var(--charcoal); }

/* Affordability band meter */
.income-box { margin: 28px 0 8px; text-align: center; }
.income-box.hide { display: none; }
.band-bar { position: relative; display: flex; height: 12px; border-radius: 20px; overflow: hidden; margin: 12px 0 6px; border: 1px solid #e7ddce; }
.band { flex: 1; }
.band-comfortable { background: var(--sage); }
.band-moderate    { background: var(--gold); }
.band-stretch     { background: #d9a58f; }
.band-aggressive  { background: var(--rose); }
.band-marker {
  position: absolute; top: -5px; bottom: -5px; left: 0; width: 3px;
  background: var(--charcoal); border-radius: 3px;
  transition: left .8s cubic-bezier(.2,.7,.3,1);
}
.band-marker::after {
  content: ""; position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid var(--charcoal);
}
.band-legend { display: flex; font-size: .72rem; color: var(--charcoal-soft); }
.band-legend span { flex: 1; text-align: center; }
.band-sentence { margin-top: 14px; font-size: 1rem; }
.band-sentence b { color: var(--charcoal); }
.band-sentence .band-pill {
  display: inline-block; padding: 2px 12px; border-radius: 20px;
  font-weight: 600; font-size: .9rem; color: var(--white);
}
.band-guideline { margin: 6px auto 0; max-width: 460px; font-size: .78rem; color: var(--charcoal-soft); }

/* Donut + breakdown */
.breakdown { display: grid; grid-template-columns: 200px 1fr; gap: 26px; align-items: center; margin-top: 22px; }
@media (max-width: 540px) { .breakdown { grid-template-columns: 1fr; justify-items: center; } }
.donut-wrap { position: relative; width: 200px; height: 200px; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.donut-center .dc-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--charcoal-soft); }
.donut-center .dc-num { font-family: 'Playfair Display', serif; font-size: 1.35rem; color: var(--charcoal); }
.legend { width: 100%; }
.legend-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: .92rem; border-bottom: 1px dashed #eee4d6; }
.legend-row:last-child { border-bottom: none; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.legend-name { flex: 1; }
.legend-amt { font-weight: 600; }
.legend-pct { color: var(--charcoal-soft); font-size: .82rem; width: 42px; text-align: right; }

/* Summary / share */
.share-box { margin-top: 24px; }
.summary-text {
  width: 100%; min-height: 120px; resize: vertical;
  font-family: inherit; font-size: .9rem; color: var(--charcoal);
  background: var(--ivory); border: 1px solid #e7ddce; border-radius: 12px; padding: 14px;
}
.share-actions { display: flex; gap: 12px; margin-top: 12px; }
.btn-secondary {
  flex: 1; padding: 12px; font-family: inherit; font-size: .92rem; font-weight: 600;
  color: var(--charcoal); background: var(--white); border: 1px solid var(--gold);
  border-radius: 10px; cursor: pointer; transition: background .18s;
}
.btn-secondary:hover { background: var(--ivory); }
.copied-flash { color: var(--sage); font-weight: 600; font-size: .85rem; opacity: 0; transition: opacity .3s; }
.copied-flash.show { opacity: 1; }

/* ---------- Ad slots ---------- */
.ad-slot {
  margin: 30px auto; max-width: 728px; min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ivory); border: 1px dashed #e2d6c2; border-radius: 12px;
  color: #c3b59c; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
}

/* ---------- Content ---------- */
.content h2 { font-size: 1.7rem; margin: 0 0 6px; }
.content section { border-top: 1px solid #f0e8dc; }
.content section:first-child { border-top: none; }
.content p { color: #4a4644; }

table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .95rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid #efe6da; }
th { background: var(--ivory); font-family: 'Playfair Display', serif; font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }

.tips { list-style: none; padding: 0; margin: 12px 0; }
.tips li { padding: 12px 0 12px 34px; position: relative; border-bottom: 1px solid #f4ede2; }
.tips li:last-child { border-bottom: none; }
.tips li::before {
  content: ""; position: absolute; left: 4px; top: 17px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--blush); box-shadow: 0 0 0 4px rgba(232,180,184,.2);
}
.tips b { color: var(--charcoal); }

details {
  border: 1px solid #efe6da; border-radius: 12px; padding: 4px 18px; margin-bottom: 12px;
  background: var(--white); box-shadow: var(--shadow-sm);
}
details summary {
  cursor: pointer; font-weight: 600; padding: 14px 0; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; font-size: 1.4rem; color: var(--gold); font-family: serif; }
details[open] summary::after { content: "–"; }
details p { margin: 0 0 16px; color: #4a4644; }

footer {
  text-align: center; padding: 40px 22px; margin-top: 20px;
  background: var(--ivory); color: var(--charcoal-soft); font-size: .85rem;
}
footer .disclaimer { max-width: 560px; margin: 0 auto 14px; font-size: .8rem; }
footer a { color: var(--gold); }
