:root {
  color-scheme: light;
  --bg: #fbf6ec;
  --card: #ffffff;
  --ink: #2a2018;
  --muted: #6b5e52;
  --line: #e4d8c5;
  --brand: #9e2a2b;
  --brand-dark: #7d1f20;
  --brand-tint: #faeaea;
  --gold: #f2b632;
  --ok: #1f7a3f;
  --wa: #128c4a;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.shell { max-width: 620px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 16px; }

/* ---------- Cabecera y progreso ---------- */
.top { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 0 8px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--brand); font-weight: 700; letter-spacing: .01em; font-size: 16px; }
.count { margin-left: auto; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.back {
  width: 44px; height: 44px; margin-left: -10px; border: 0; border-radius: 50%; background: transparent; color: var(--ink);
  display: grid; place-items: center; cursor: pointer;
}
.back:hover { background: rgba(0,0,0,.05); }
.back[hidden] { display: none; }
.progress { height: 6px; background: #eadfcb; border-radius: 99px; overflow: hidden; }
.progress[hidden] { display: none; }
.progress i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width .35s ease; }

/* ---------- Contenido ---------- */
.main { flex: 1; padding: 22px 0 8px; outline: none; }
.screen { animation: in .22s ease both; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } .progress i { transition: none; } }

.eyebrow { display: inline-block; padding: 4px 10px; border-radius: 99px; background: var(--brand-tint); color: var(--brand-dark); font-weight: 600; font-size: 14px; margin: 0 0 14px; }
h1 { font-size: 30px; line-height: 1.15; margin: 0 0 12px; letter-spacing: -.01em; }
h2.q { font-size: 23px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -.005em; outline: none; }
.hint { margin: 0 0 16px; color: var(--muted); font-size: 15px; }
.lead { color: var(--muted); margin: 0 0 22px; }
.section-tag { color: var(--brand); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 8px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }

/* ---------- Opciones ---------- */
.options { display: grid; gap: 10px; margin: 16px 0 0; }
.hint + .options { margin-top: 0; }
.opt { position: relative; display: block; }
.opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.opt span.box {
  display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 12px 16px;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  transition: border-color .12s, background .12s, transform .06s;
}
.opt span.mark {
  flex: none; width: 24px; height: 24px; border: 2px solid #c9baa2; border-radius: 50%; background: #fff; display: grid; place-items: center;
}
.opt.multi span.mark { border-radius: 7px; }
.opt span.mark svg { width: 15px; height: 15px; opacity: 0; color: #fff; }
.opt:hover span.box { border-color: #cdb999; }
.opt input:checked + span.box { border-color: var(--brand); background: var(--brand-tint); }
.opt input:checked + span.box .mark { background: var(--brand); border-color: var(--brand); }
.opt input:checked + span.box .mark svg { opacity: 1; }
.opt input:active + span.box { transform: scale(.985); }
.opt input:focus-visible + span.box { outline: 3px solid var(--gold); outline-offset: 2px; }
.opt input:disabled { cursor: not-allowed; }
.opt input:disabled + span.box { opacity: .45; }

select.big {
  width: 100%; min-height: 58px; padding: 12px 44px 12px 16px; margin-top: 16px; font: inherit; color: var(--ink);
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath d='M5 9l7 7 7-7' fill='none' stroke='%236b5e52' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 16px center;
  border: 2px solid var(--line); border-radius: var(--radius); appearance: none; -webkit-appearance: none;
}
select.big:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-color: var(--brand); }

/* ---------- Botones ---------- */
.actions { position: sticky; bottom: 0; margin: 18px -16px 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, rgba(251,246,236,0)); }
.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px; width: 100%; min-height: 54px; padding: 12px 20px;
  border: 0; border-radius: 14px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 3px 0 var(--brand-dark); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--brand-dark); }
.btn-primary:disabled { background: #cfc3b1; box-shadow: none; color: #fff; cursor: not-allowed; }
.btn-wa { background: var(--wa); color: #fff; box-shadow: 0 3px 0 #0c6b38; }
.btn-ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.linklike { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

.fine { font-size: 13.5px; color: var(--muted); margin: 14px 0 0; }
.fine a, .fine .linklike { color: var(--brand-dark); }

/* ---------- Gracias ---------- */
.done-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; margin: 4px 0 16px; }
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 16px 0 0; }
.card h3 { margin: 0 0 4px; font-size: 18px; }
.card p { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.stack { display: grid; gap: 10px; }
.field { width: 100%; min-height: 54px; padding: 12px 14px; font: inherit; border: 2px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); }
.field:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-color: var(--brand); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--brand); }
.msg { min-height: 1.4em; font-size: 14.5px; margin: 8px 0 0; }
.msg:empty { min-height: 0; margin: 0; }
.msg.err { color: #b3261e; }
.msg.ok { color: var(--ok); font-weight: 600; }

.spinner { width: 42px; height: 42px; border: 5px solid #eadfcb; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { text-align: center; }

/* ---------- Pie y diálogo ---------- */
.foot { padding: 18px 0 calc(22px + env(safe-area-inset-bottom)); text-align: center; font-size: 13px; color: var(--muted); display: flex; gap: 8px; justify-content: center; }
.foot a { color: inherit; }
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: 86dvh; color: var(--ink); }
dialog::backdrop { background: rgba(30, 20, 10, .55); }
dialog form { padding: 22px; display: grid; gap: 12px; }
dialog h2 { margin: 0; font-size: 21px; }
#privacy-body { overflow: auto; max-height: 52dvh; font-size: 15px; }
#privacy-body p { margin: 0 0 10px; }

@media (min-width: 640px) {
  .main { padding-top: 40px; }
  h1 { font-size: 36px; }
  h2.q { font-size: 26px; }
  .actions { position: static; margin: 20px 0 0; padding: 0; background: none; }
}
