:root {
  --yellow: #ffd500;
  --yellow-soft: #fff3a6;
  --red: #dd1d21;
  --red-dark: #b8151a;
  --ink: #1b1a17;
  --ink-2: #4a463d;
  --line: #e3dcc6;
  --paper: #fbf8ef;
  --white: #fff;
  --ok: #1d6b3a;

  --radius: 14px;
  --gutter: clamp(18px, 5vw, 32px);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.125rem/1.55 var(--font); /* 18px: leitura confortável para 50+ */
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
h1, h2, legend { font-family: var(--font-display); letter-spacing: -0.02em; margin: 0; }
h1:focus, h2:focus, legend:focus { outline: none; }

/* ---------- cabeçalho ---------- */
.top {
  background: var(--yellow);
  padding: 12px var(--gutter);
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 4px solid var(--red);
}
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em;
}
.brand img { width: auto; height: 40px; }

main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }
.screen { padding: 28px 0 40px; animation: rise .35s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- botões ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 58px; padding: 0 28px; border-radius: 12px;
  font: 800 1.125rem/1 var(--font); letter-spacing: -0.005em;
  transition: transform .08s ease, background-color .15s ease, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--red); color: var(--white); box-shadow: 0 3px 0 var(--red-dark); }
.btn-primary:hover { background: #e8262a; }
.btn-primary:disabled { background: #d8d2bd; color: #7d7767; box-shadow: none; cursor: not-allowed; }
.btn-primary[aria-busy="true"] { opacity: .8; cursor: progress; }

/* ---------- intro ---------- */
.hero { display: grid; gap: 36px; }
.eyebrow {
  margin: 0 0 14px; font-size: .8rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--red);
}
h1 { font-size: clamp(2.1rem, 8.4vw, 3.6rem); line-height: 1.04; font-weight: 800; }
h1 em { font-style: normal; background: var(--yellow); padding: 0 .12em; border-radius: 6px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.lead { margin: 18px 0 26px; color: var(--ink-2); max-width: 34em; }
.fine { margin: 14px 0 0; font-size: .95rem; color: var(--ink-2); }
.hero .btn { width: 100%; }

/* ---------- vale ---------- */
.ticket {
  --notch: 15px;
  position: relative; width: min(100%, 380px); justify-self: center;
  background: var(--yellow); color: var(--ink);
  padding: 20px 24px 18px;
  transform: rotate(-2deg);
  -webkit-mask:
    radial-gradient(circle var(--notch) at 0 62%, #0000 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% 62%, #0000 97%, #000) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle var(--notch) at 0 62%, #0000 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% 62%, #0000 97%, #000) right / 51% 100% no-repeat;
  filter: drop-shadow(0 10px 0 rgba(27, 26, 23, .1));
}
.ticket::before { /* faixa vermelha */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 8px; background: var(--red);
}
.ticket-top { display: flex; justify-content: space-between; margin-top: 8px; font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.ticket-no { font-variant-numeric: tabular-nums; opacity: .6; }
.ticket-value { display: flex; align-items: baseline; gap: 6px; margin-top: 14px; font: 900 5.6rem/0.9 var(--font-display); letter-spacing: -0.05em; }
.ticket-value small { font-size: 1.9rem; letter-spacing: 0; font-weight: 800; }
.ticket-sub { font-weight: 700; font-size: 1.15rem; margin-top: 4px; }
.ticket-perf { margin: 18px -24px 12px; border-top: 3px dashed rgba(27, 26, 23, .35); }
.ticket-foot { display: flex; justify-content: space-between; gap: 12px; font-size: .82rem; font-weight: 700; }

/* ---------- passos ---------- */
.steps { list-style: none; margin: 44px 0 0; padding: 0; display: grid; gap: 0; border-top: 2px solid var(--ink); }
.steps li { display: flex; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.steps b {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 50%; background: var(--ink); color: var(--yellow); font-weight: 800; font-size: 1rem;
}
.steps strong { display: block; line-height: 1.25; }
.steps span { display: block; margin-top: 2px; color: var(--ink-2); font-size: 1rem; line-height: 1.45; }

.note {
  margin: 28px 0 0; padding: 16px 18px; border-left: 5px solid var(--red);
  background: var(--white); font-size: 1rem; line-height: 1.5; border-radius: 0 10px 10px 0;
}
.note a { white-space: nowrap; font-weight: 700; }

/* ---------- pesquisa ---------- */
.screen[data-screen="quiz"], .screen[data-screen="form"] { max-width: 640px; margin: 0 auto; }
.quiz-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.back {
  appearance: none; background: none; border: 0; cursor: pointer; font: 700 1rem var(--font); color: var(--ink);
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px 0 0;
}
.count { margin: 0; font-weight: 700; font-size: .98rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.progress { display: flex; gap: 6px; margin-bottom: 26px; }
.progress i { flex: 1; height: 8px; border-radius: 4px; background: var(--line); transition: background-color .25s; }
.progress i.on { background: var(--red); }
.progress-full { display: block; height: 8px; border-radius: 4px; background: var(--red); }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font-size: clamp(1.5rem, 5.6vw, 2rem); line-height: 1.18; font-weight: 800; margin-bottom: 20px; float: left; width: 100%; }
legend + * { clear: both; }
h2 { font-size: clamp(1.7rem, 6vw, 2.3rem); line-height: 1.12; font-weight: 800; }

.options { display: grid; gap: 10px; padding-bottom: 110px; }
.opt { display: block; position: relative; cursor: pointer; }
.opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.opt span {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 14px 18px;
  background: var(--white); border: 2px solid var(--line); border-radius: var(--radius);
  font-weight: 600; line-height: 1.25; transition: border-color .12s, background-color .12s;
}
.opt span::before { /* marcador */
  content: ""; flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #b9b199; background: var(--white); transition: all .12s;
}
.opt:hover span { border-color: #c9bf9f; }
.opt input:checked + span { border-color: var(--ink); background: var(--yellow-soft); }
.opt input:checked + span::before {
  border-color: var(--ink); background: var(--ink);
  box-shadow: inset 0 0 0 5px var(--yellow-soft);
}
.opt input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }

/* barra de ação fixa: o botão fica sempre ao alcance do polegar */
.actionbar {
  position: sticky; bottom: 0; z-index: 5;
  margin: 0 calc(var(--gutter) * -1); padding: 14px var(--gutter);
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--paper) 72%, rgba(251, 248, 239, 0));
}
.actionbar .btn { width: 100%; }
.screen[data-screen="quiz"] .actionbar { margin-top: -96px; padding-top: 30px; }

/* ---------- formulário ---------- */
#lead-form { margin-top: 6px; }
.field { margin: 0 0 20px; }
.field > label, .chips legend {
  display: block; font-weight: 700; font-size: 1rem; margin-bottom: 6px;
  font-family: var(--font); letter-spacing: 0; float: none; line-height: 1.3;
}
.field input[type="text"], .field input[type="tel"], .field input[type="email"] {
  width: 100%; min-height: 58px; padding: 0 16px; font: 500 1.125rem var(--font); color: var(--ink);
  background: var(--white); border: 2px solid #cfc7ad; border-radius: 12px; appearance: none;
  transition: border-color .12s, box-shadow .12s;
}
.field input::placeholder { color: #8d8672; }
.field input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px var(--yellow); }
.field.invalid input[type="text"], .field.invalid input[type="tel"], .field.invalid input[type="email"] { border-color: var(--red); }
.hint { margin: 6px 0 0; font-size: .92rem; color: var(--ink-2); }
.err { margin: 6px 0 0; font-size: .95rem; font-weight: 600; color: var(--red-dark); }
.err:empty { display: none; }
.err-form { margin-bottom: 8px; font-size: 1rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips legend { flex: 0 0 100%; margin-bottom: 2px; padding: 0; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: 50px; padding: 0 18px; font-weight: 700;
  background: var(--white); border: 2px solid #cfc7ad; border-radius: 999px; transition: all .12s;
}
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--yellow); }
.chip input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }
.chips .err { flex: 0 0 100%; }

.check { display: flex; gap: 14px; align-items: flex-start; cursor: pointer; font-size: 1rem; line-height: 1.5; }
.check input { position: absolute; opacity: 0; width: 28px; height: 28px; margin: 0; cursor: pointer; }
.check .box {
  flex: none; width: 28px; height: 28px; margin-top: 1px; border: 2px solid #8d8672; border-radius: 7px; background: var(--white);
  display: grid; place-items: center; transition: all .12s;
}
.check input:checked + .box { background: var(--ink); border-color: var(--ink); }
.check input:checked + .box::after {
  content: ""; width: 7px; height: 13px; margin-top: -2px; border: solid var(--yellow); border-width: 0 3px 3px 0; transform: rotate(45deg);
}
.check input:focus-visible + .box { outline: 3px solid var(--ink); outline-offset: 2px; }
.field.invalid .check .box { border-color: var(--red); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- conclusão ---------- */
.screen[data-screen="done"] { max-width: 600px; margin: 0 auto; padding-top: 44px; }
.done-mark { margin-bottom: 18px; }
.done-mark svg { animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.protocol {
  display: grid; gap: 2px; margin: 8px 0 26px; padding: 18px 20px;
  border: 2px dashed var(--ink); border-radius: var(--radius); background: var(--yellow);
}
.protocol span { font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.protocol strong { font: 900 2.2rem/1.1 var(--font-display); letter-spacing: .06em; font-variant-numeric: tabular-nums; user-select: all; }
.protocol small { font-size: .95rem; }
.next { margin: 0; padding: 0 0 0 1.2em; display: grid; gap: 10px; }
.next li::marker { color: var(--red); font-weight: 800; }

/* ---------- rodapé / páginas de texto ---------- */
.foot { padding: 20px var(--gutter); padding-bottom: max(20px, env(safe-area-inset-bottom)); text-align: center; font-size: .92rem; color: var(--ink-2); border-top: 1px solid var(--line); }
.foot p { margin: 0; }
.doc { max-width: 700px; margin: 0 auto; padding: 32px 0 48px; }
.doc h1 { font-size: clamp(1.8rem, 6vw, 2.5rem); margin-bottom: 8px; }
.doc h2 { font-size: 1.3rem; margin: 30px 0 8px; }
.doc p, .doc li { color: var(--ink); }
.doc ul { padding-left: 1.2em; }
.doc .meta { color: var(--ink-2); font-size: .95rem; margin: 0 0 24px; }

/* ---------- telas maiores ---------- */
@media (min-width: 820px) {
  .screen { padding-top: 56px; }
  .hero { grid-template-columns: 1.15fr .85fr; align-items: center; gap: 64px; }
  .hero .btn { width: auto; min-width: 280px; }
  .ticket { width: 100%; max-width: 400px; }
  .steps { grid-template-columns: repeat(3, 1fr); border-top: 2px solid var(--ink); gap: 28px; margin-top: 64px; }
  .steps li { border-bottom: 0; padding: 22px 0 0; }
  .note { max-width: 720px; }
  .actionbar { position: static; margin: 8px 0 0; padding: 0; background: none; }
  .actionbar .btn { width: auto; min-width: 280px; }
  .screen[data-screen="quiz"] .actionbar { margin-top: 8px; padding-top: 0; }
  .options { padding-bottom: 20px; }
}

/* celulares estreitos / telas baixas */
@media (max-width: 360px) {
  body { font-size: 1.0625rem; }
  .ticket-value { font-size: 4.6rem; }
  .btn { padding: 0 18px; }
}
@media (max-height: 640px) and (orientation: landscape) {
  .actionbar { position: static; background: none; margin: 0; padding: 0; }
  .options { padding-bottom: 16px; }
  .screen[data-screen="quiz"] .actionbar { margin-top: 8px; padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
