:root {
  --ink: #1d1a17;
  --ink-soft: #5d554d;
  --sand: #f4eee5;
  --cream: #fffaf3;
  --gold: #b08b50;
  --gold-dark: #856430;
  --terracotta: #a8654f;
  --line: #ded2c2;
  --white: #ffffff;
  --success: #396953;
  --danger: #a23f35;
  --shadow: 0 22px 60px rgba(40, 30, 20, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(145deg, #efe3d3 0%, #fbf7f1 42%, #eadcc9 100%);
  font-family: Montserrat, Avenir, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }

.page-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 10%, rgba(176,139,80,.18), transparent 28%),
    radial-gradient(circle at 90% 85%, rgba(168,101,79,.13), transparent 28%);
}

.brand-header {
  position: relative;
  z-index: 2;
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: #e7c78f;
  border: 1px solid rgba(176,139,80,.65);
  font-family: Georgia, serif; letter-spacing: .08em;
}
.brand strong { display: block; font-family: Georgia, serif; letter-spacing: .15em; font-size: 1.05rem; }
.brand small { display: block; color: var(--ink-soft); font-size: .72rem; letter-spacing: .08em; }
.save-state { color: var(--success); font-size: .78rem; opacity: 0; transition: opacity .25s ease; }
.save-state.visible { opacity: 1; }

.app-wrap { position: relative; z-index: 1; width: min(760px, calc(100% - 32px)); margin: 18px auto 48px; }
.progress-shell { margin-bottom: 14px; }
.progress-copy { display: flex; justify-content: space-between; color: var(--ink-soft); font-size: .78rem; font-weight: 700; }
.progress-track { height: 7px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: rgba(29,26,23,.1); }
.progress-track span { display: block; width: 16.66%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold-dark), #d6b574); transition: width .35s ease; }

#quizForm {
  background: rgba(255,250,243,.93);
  border: 1px solid rgba(176,139,80,.35);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(10px);
}
.step { display: none; min-height: 560px; padding: clamp(26px, 6vw, 54px); animation: stepIn .4s ease both; }
.step.active { display: block; }
@keyframes stepIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.eyebrow { margin-bottom: 10px; color: var(--terracotta); font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .17em; }
h1, h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 500; line-height: 1.08; }
h1 { max-width: 620px; font-size: clamp(2.25rem, 8vw, 4.35rem); }
h2 { font-size: clamp(2rem, 7vw, 3.45rem); }
.lead { max-width: 620px; margin: 18px 0 30px; color: var(--ink-soft); font-size: 1.04rem; }
.helper { margin: 14px 0 28px; color: var(--ink-soft); }

.form-grid { display: grid; gap: 16px; }
.two-cols { grid-template-columns: repeat(2, minmax(0,1fr)); }
.three-cols { grid-template-columns: repeat(3, minmax(0,1fr)); }
.field { display: block; margin-top: 17px; }
.conditional-field { padding: 16px; border: 1px solid rgba(176,139,80,.4); border-radius: 16px; background: #fff8eb; animation: stepIn .28s ease both; }
.field > span, legend { display: block; margin-bottom: 8px; font-size: .84rem; font-weight: 800; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 15px; color: var(--ink); background: var(--white); outline: none;
  transition: border .2s ease, box-shadow .2s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(176,139,80,.14); }
textarea { resize: vertical; min-height: 112px; }
fieldset { min-width: 0; margin: 24px 0 0; padding: 0; border: 0; }

.choice-grid { display: grid; gap: 12px; }
.choice {
  position: relative; min-height: 132px; padding: 20px 16px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end;
  border: 1px solid var(--line); border-radius: 18px; background: var(--white); cursor: pointer;
  transition: transform .2s ease, border .2s ease, box-shadow .2s ease;
}
.choice:hover { transform: translateY(-2px); border-color: var(--gold); }
.choice:has(input:checked) { border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(176,139,80,.16); background: #fff9ed; }
.choice input, .check-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-dot { position: absolute; top: 16px; right: 16px; width: 22px; height: 22px; border: 2px solid #cbbda9; border-radius: 50%; }
.choice:has(input:checked) .choice-dot { border: 6px solid var(--gold-dark); }
.choice strong, .check-card strong { font-size: .96rem; }
.choice small, .check-card small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: .76rem; }
.choice.compact { min-height: 88px; justify-content: center; }
.choice.timing { min-height: 112px; }

.check-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.check-card {
  position: relative; min-height: 104px; display: flex; align-items: center; gap: 14px;
  padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); cursor: pointer;
  transition: transform .2s ease, border .2s ease, box-shadow .2s ease;
}
.check-card:hover { transform: translateY(-2px); border-color: var(--gold); }
.check-card:has(input:checked) { border-color: var(--gold-dark); background: #fff9ed; box-shadow: 0 0 0 3px rgba(176,139,80,.16); }
.check-icon { flex: 0 0 46px; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--ink); color: #e7c78f; font-weight: 900; font-size: .73rem; letter-spacing: .05em; }
.check-card i { position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border: 2px solid #cbbda9; border-radius: 6px; }
.check-card:has(input:checked) i { border-color: var(--gold-dark); background: var(--gold-dark); }
.check-card:has(input:checked) i::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.check-none, .consent { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; color: var(--ink-soft); font-size: .84rem; cursor: pointer; }
.check-none input, .consent input { flex: 0 0 20px; width: 20px; height: 20px; accent-color: var(--gold-dark); }

.error-box { min-height: 22px; margin-top: 14px; color: var(--danger); font-size: .82rem; font-weight: 700; }
.form-nav { display: flex; justify-content: space-between; gap: 12px; padding: 18px clamp(24px,5vw,50px); border-top: 1px solid var(--line); background: rgba(245,238,229,.68); }
.button { min-height: 50px; border: 0; border-radius: 14px; padding: 13px 22px; font-weight: 800; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(1px); }
.button-primary { color: white; background: var(--ink); box-shadow: 0 9px 22px rgba(29,26,23,.18); }
.button-secondary { color: var(--ink); background: linear-gradient(135deg, #dabb80, var(--gold)); }
.button-ghost { color: var(--ink); background: transparent; border: 1px solid var(--line); }
.button:disabled { opacity: .42; cursor: not-allowed; transform: none; }

.summary-step { text-align: center; }
.success-badge { display: inline-flex; padding: 7px 12px; margin-bottom: 12px; border-radius: 999px; color: var(--success); background: rgba(57,105,83,.1); font-size: .75rem; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
.summary-card { margin: 24px 0; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: white; text-align: left; }
.summary-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.summary-head strong { font-family: Georgia, serif; font-size: 1.2rem; }
.reference { color: var(--gold-dark); font-size: .78rem; font-weight: 900; }
.summary-list { display: grid; gap: 11px; margin: 18px 0 0; }
.summary-row { display: grid; grid-template-columns: 160px 1fr; gap: 12px; font-size: .86rem; }
.summary-row dt { color: var(--ink-soft); }
.summary-row dd { margin: 0; font-weight: 750; overflow-wrap: anywhere; }
.action-stack { display: grid; gap: 10px; }
.portfolio-block { margin: 24px 0; padding: 20px; border-radius: 20px; color: white; background: var(--ink); text-align: left; box-shadow: 0 18px 42px rgba(29,26,23,.18); }
.portfolio-block > span { display: block; margin-bottom: 13px; color: #ead7b4; font-family: Georgia, serif; font-size: 1.08rem; text-align: center; }
.portfolio-links { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
.portfolio-button { position: relative; overflow: hidden; min-height: 92px; padding: 18px; display: flex; flex-direction: column; justify-content: flex-end; border: 1px solid rgba(255,255,255,.22); border-radius: 16px; color: white; text-decoration: none; transition: transform .2s ease, box-shadow .2s ease; }
.portfolio-button::before { content: ""; position: absolute; inset: 0; opacity: .82; }
.portfolio-button.renovation::before { background: linear-gradient(135deg, #9f633f, #5e3927); }
.portfolio-button.furnishing::before { background: linear-gradient(135deg, #c5a365, #7e6032); }
.portfolio-button > * { position: relative; z-index: 1; }
.portfolio-button small { opacity: .84; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; }
.portfolio-button strong { margin-top: 2px; font-family: Georgia, serif; font-size: 1.45rem; }
.portfolio-button:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(0,0,0,.25); }
.fine-print { color: var(--ink-soft); font-size: .76rem; }
.text-button { border: 0; background: none; color: var(--terracotta); text-decoration: underline; cursor: pointer; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 12px 18px; border-radius: 12px; color: white; background: var(--ink); opacity: 0; pointer-events: none; transition: all .25s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 700px) {
  .brand-header { width: min(100% - 24px, 760px); padding-top: 14px; }
  .brand-mark { width: 42px; height: 42px; }
  .save-state { display: none; }
  .app-wrap { width: min(100% - 20px, 760px); margin-top: 8px; }
  #quizForm { border-radius: 22px; }
  .step { min-height: 540px; padding: 28px 20px; }
  .two-cols, .three-cols, .check-grid { grid-template-columns: 1fr; }
  .portfolio-links { grid-template-columns: 1fr; }
  .choice { min-height: 96px; }
  .summary-row { grid-template-columns: 1fr; gap: 2px; }
  .form-nav { position: sticky; bottom: 0; z-index: 5; padding: 12px 16px; }
  .form-nav .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
