:root {
  color-scheme: light;
  --ink: #211916;
  --muted: #6f625c;
  --paper: #fffdf9;
  --canvas: #f6f0e9;
  --line: #e4d8cf;
  --brand: #8b3e2f;
  --brand-dark: #692c23;
  --brand-soft: #f5e1d8;
  --gold: #c58b43;
  --success: #32684a;
  --danger: #a23333;
  --shadow: 0 20px 60px rgba(64, 38, 27, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 12% 5%, #fff7ef 0, transparent 34%), var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.site-header {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wordmark { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; font-weight: 760; letter-spacing: -0.02em; }
.mark { width: 36px; height: 36px; border-radius: 50% 50% 48% 52%; display: grid; place-items: center; color: white; background: linear-gradient(145deg, var(--brand), #b8674f); font-family: Georgia, serif; font-size: 21px; }
.prototype-badge { color: var(--brand-dark); background: var(--brand-soft); border: 1px solid #eac8b9; border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

main { width: min(1120px, calc(100% - 40px)); margin: 12px auto 64px; }
.hero { padding: 70px 70px 56px; border: 1px solid rgba(116, 69, 48, 0.13); border-radius: 32px; background: linear-gradient(145deg, rgba(255,255,255,.94), rgba(255,249,241,.92)); box-shadow: var(--shadow); text-align: center; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%; right: -140px; top: -180px; background: rgba(197, 139, 67, .12); }
.eyebrow { margin: 0 0 10px; color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 820px; margin: 0 auto; font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: clamp(44px, 7vw, 74px); line-height: .99; letter-spacing: -.045em; }
.hero-copy { max-width: 700px; margin: 26px auto 0; color: var(--muted); font-size: 18px; line-height: 1.65; }
.walkthrough { max-width: 850px; margin: 40px auto 26px; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.72); text-align: left; }
.walkthrough > div { min-width: 0; padding: 20px; display: grid; grid-template-columns: 32px 1fr; gap: 3px 10px; }
.walkthrough > div + div { border-left: 1px solid var(--line); }
.walkthrough span { grid-row: span 2; width: 30px; height: 30px; border: 1px solid #ddb99f; color: var(--brand); border-radius: 50%; display: grid; place-items: center; font-weight: 800; }
.walkthrough strong { font-size: 14px; }
.walkthrough small { color: var(--muted); line-height: 1.35; }
.privacy-note { margin: 0 auto 26px; max-width: 720px; color: var(--muted); font-size: 13px; }

.button { border: 0; border-radius: 12px; min-height: 48px; padding: 12px 18px; font-weight: 750; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--brand); box-shadow: 0 8px 20px rgba(139,62,47,.2); }
.button-primary:hover { background: var(--brand-dark); }
.button-secondary { background: var(--brand-soft); color: var(--brand-dark); }
.button-ghost { color: var(--ink); background: transparent; border: 1px solid var(--line); }
.text-button { border: 0; background: transparent; color: var(--brand); padding: 10px 8px; font-weight: 750; text-decoration: underline; text-underline-offset: 4px; }
.hero-action { min-width: 230px; }
.hero > .text-button { display: block; margin: 7px auto 0; }

.saved-panel, .workspace { margin-top: 26px; background: var(--paper); border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 14px 44px rgba(64,38,27,.08); }
.saved-panel { padding: 28px 32px; }
.saved-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.saved-card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: white; }
.saved-card strong { display: block; margin-bottom: 5px; }
.saved-card p { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.saved-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.load-template { color: var(--brand); background: var(--brand-soft); border: 0; border-radius: 9px; padding: 8px 11px; font-weight: 750; }
.delete-template { color: var(--muted); background: transparent; border: 0; padding: 8px; }

.workspace { overflow: hidden; }
.progress { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 24px 30px; background: #fbf7f2; border-bottom: 1px solid var(--line); }
.progress-item { display: flex; align-items: center; gap: 8px; color: #9a8e87; font-size: 13px; font-weight: 750; white-space: nowrap; }
.progress-item span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #e9dfd7; color: #81736b; }
.progress-item.active { color: var(--brand-dark); }
.progress-item.active span { color: white; background: var(--brand); }
.progress-item.complete span { color: white; background: var(--success); }
.progress-line { width: 72px; height: 1px; background: var(--line); }
.step { padding: 46px 56px 52px; }
.section-heading, .result-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 28px; }
.section-heading.compact { align-items: center; margin-bottom: 18px; }
.section-heading h2, .result-heading h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: clamp(30px, 4vw, 44px); letter-spacing: -.03em; }
.section-heading.compact h2 { font-size: 26px; }
.section-heading h3 { margin: 0; }

label { display: grid; gap: 8px; color: #473b35; font-size: 13px; font-weight: 750; }
input, select { width: 100%; min-width: 0; border: 1px solid #d9ccc3; border-radius: 11px; padding: 13px 12px; color: var(--ink); background: #fff; outline: none; }
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(139,62,47,.11); }
input::placeholder { color: #b2a69f; }
.field-help { min-height: 32px; color: var(--muted); font-size: 12px; line-height: 1.35; font-weight: 450; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.identity-fields { margin-bottom: 34px; }
.product-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-top: 25px; border-top: 1px solid var(--line); }
.product-heading h3 { margin-bottom: 5px; }
.product-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.product-list { display: grid; gap: 12px; margin-top: 16px; }
.product-row { border: 1px solid var(--line); border-radius: 16px; padding: 15px; background: #fcfaf7; }
.product-row-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.product-number { color: var(--brand); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.remove-product { border: 0; background: transparent; color: var(--muted); font-size: 12px; text-decoration: underline; }
.product-fields { display: grid; grid-template-columns: 1.35fr repeat(3, .8fr) .65fr; gap: 10px; align-items: end; }
.cost-fields { margin-top: 18px; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 62px; }
.input-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; font-weight: 650; }
.step-actions { display: flex; justify-content: flex-end; margin-top: 34px; }
.split-actions { justify-content: space-between; align-items: center; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.wide-field { grid-column: 1 / -1; }
.form-error { margin: 22px 56px 0; padding: 13px 16px; border: 1px solid #e7baba; border-radius: 12px; color: var(--danger); background: #fff2f2; font-size: 14px; }
.sample-notice { margin: 18px; padding: 12px 18px; border-radius: 12px; color: var(--brand-dark); background: var(--brand-soft); font-size: 13px; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.result-currency { color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 750; }
.price-hero { border-radius: 22px; padding: 30px; text-align: center; background: linear-gradient(145deg, var(--brand-dark), #9e4b38); color: white; }
.price-label { display: block; opacity: .75; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 750; }
.price-hero > strong { display: block; margin: 6px 0 2px; font-family: Georgia, serif; font-size: clamp(58px, 9vw, 88px); line-height: 1; font-weight: 500; }
.price-hero p { margin: 0 0 9px; font-size: 16px; }
.price-hero small { opacity: .76; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 16px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.metric-grid > div { padding: 18px; background: white; }
.metric-grid > div + div { border-left: 1px solid var(--line); }
.metric-grid span, .margin-summary span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.metric-grid strong { font-size: 19px; }
.margin-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.margin-summary > div { padding: 18px; border-radius: 16px; background: #eef5ef; }
.margin-summary strong { color: var(--success); font-size: 22px; }
.breakdown { margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.breakdown summary { padding: 16px 18px; font-weight: 750; cursor: pointer; }
.breakdown[open] summary { border-bottom: 1px solid var(--line); }
#calculation-details { padding: 16px 18px; color: var(--muted); font-size: 14px; line-height: 1.65; }
#calculation-details p { margin-bottom: 8px; }
.local-save { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 24px; padding: 20px; border-radius: 16px; background: var(--brand-soft); }
.local-save p { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.result-actions { margin-top: 20px; }

footer { max-width: 900px; margin: 0 auto; padding: 0 24px 45px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.6; }

.cost-guide { max-width: 900px; margin: 42px auto 0; padding: 30px clamp(18px, 4vw, 40px); border: 1px solid var(--line); border-radius: 24px; background: var(--paper); }
.cost-guide h2 { font-family: Georgia, serif; font-size: 30px; font-weight: 500; line-height: 1.2; }
.cost-guide dt { font-weight: 750; margin-top: 24px; }
.cost-guide dd { margin: 8px 0 0; color: var(--muted); line-height: 1.7; font-size: 14px; }

@media (max-width: 760px) {
  .site-header { padding: 18px 20px; }
  .wordmark span:last-child { font-size: 14px; }
  .prototype-badge { font-size: 10px; }
  main { width: min(100% - 24px, 1120px); margin-top: 0; }
  .hero { padding: 46px 20px 36px; border-radius: 24px; }
  h1 { font-size: 46px; }
  .hero-copy { font-size: 16px; }
  .walkthrough { grid-template-columns: 1fr; }
  .walkthrough > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .saved-panel { padding: 24px 18px; border-radius: 22px; }
  .saved-list { grid-template-columns: 1fr; }
  .workspace { border-radius: 22px; }
  .progress { gap: 4px; padding: 18px 12px; justify-content: space-between; }
  .progress-item { font-size: 0; gap: 0; }
  .progress-item span { font-size: 12px; }
  .progress-line { flex: 1; max-width: 56px; }
  .step { padding: 32px 18px 36px; }
  .section-heading, .result-heading { display: block; }
  .section-heading .text-button { padding-left: 0; margin-top: 9px; }
  .two-column, .field-grid, .margin-summary { grid-template-columns: 1fr; }
  .wide-field { grid-column: auto; }
  .product-heading { align-items: flex-start; }
  .product-heading .button { min-height: 42px; padding: 9px 11px; white-space: nowrap; }
  .product-fields { grid-template-columns: 1fr 1fr; }
  .product-name-field { grid-column: 1 / -1; }
  .cost-fields { margin-top: 14px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .metric-grid > div:nth-child(4) { border-top: 1px solid var(--line); }
  .local-save { align-items: stretch; flex-direction: column; }
  .split-actions { align-items: stretch; flex-direction: column-reverse; gap: 8px; }
  .split-actions .button, .split-actions .text-button { width: 100%; }
  .form-error { margin: 18px 18px 0; }
}

@media (max-width: 410px) {
  .product-fields { grid-template-columns: 1fr; }
  .product-name-field { grid-column: auto; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-grid > div + div { border-left: 0; border-top: 1px solid var(--line); }
  h1 { font-size: 41px; }
}
