:root {
  --bg: #f6f3ee;
  --bg-2: #efe9e0;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #0e2340;
  --ink-2: #3c4a5e;
  --muted: #6b7686;
  --line: #e4ddd2;
  --line-2: #d6cdbf;
  --accent: #ef5d3a;
  --accent-2: #ff8a5c;
  --accent-soft: #fde6de;
  --navy: #0e2340;
  --ok: #0f9d74;
  --ok-soft: #dcf4ec;
  --warn: #c2410c;
  --shadow-sm: 0 1px 2px rgba(14, 35, 64, .06), 0 1px 1px rgba(14, 35, 64, .04);
  --shadow: 0 1px 2px rgba(14, 35, 64, .05), 0 8px 24px -8px rgba(14, 35, 64, .14);
  --shadow-lg: 0 2px 4px rgba(14, 35, 64, .05), 0 24px 48px -16px rgba(14, 35, 64, .22);
  --radius: 18px;
  --radius-sm: 12px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --blob-a: rgba(239, 93, 58, .20);
  --blob-b: rgba(14, 35, 64, .12);
  --blob-c: rgba(15, 157, 116, .12);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1422;
    --bg-2: #0f1a2c;
    --surface: #121f33;
    --surface-2: #16243a;
    --ink: #eef2f8;
    --ink-2: #c3ccd9;
    --muted: #8e9bb0;
    --line: #22324b;
    --line-2: #2d3f5c;
    --accent: #ff7452;
    --accent-2: #ff9a73;
    --accent-soft: rgba(255, 116, 82, .14);
    --ok: #34d399;
    --ok-soft: rgba(52, 211, 153, .14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 48px -16px rgba(0, 0, 0, .6);
    --blob-a: rgba(255, 116, 82, .14);
    --blob-b: rgba(99, 140, 220, .12);
    --blob-c: rgba(52, 211, 153, .08);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* Fundo */
.bg-deco { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); }
.b1 { width: 520px; height: 520px; background: var(--blob-a); top: -180px; right: -140px; }
.b2 { width: 460px; height: 460px; background: var(--blob-b); bottom: -200px; left: -160px; }
.b3 { width: 320px; height: 320px; background: var(--blob-c); top: 40%; left: 55%; }

main { flex: 1; width: 100%; max-width: 820px; margin: 0 auto; padding: 0 16px 48px; }
.screen { animation: fadeUp .45s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Tipografia */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.02em; line-height: 1.08; margin: 0; }
h1 { font-size: clamp(44px, 9vw, 76px); }
h1 em { font-style: italic; color: var(--accent); font-weight: 500; }
h2 { font-size: clamp(30px, 5.5vw, 42px); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 600; color: var(--accent); margin: 0 0 14px; }
.lead { font-size: 18px; color: var(--ink-2); max-width: 560px; margin: 20px 0 0; }
.lead.small { font-size: 17px; margin: 14px auto 0; }
.muted { color: var(--muted); }
.tiny { font-size: 13px; }
.center { text-align: center; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 999px; padding: 12px 22px; font-weight: 600; font-size: 15px;
  cursor: pointer; transition: transform .15s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 20px -8px rgba(239, 93, 58, .7); }
.btn-primary:hover { box-shadow: 0 12px 28px -8px rgba(239, 93, 58, .85); transform: translateY(-1px); }
.btn-primary[disabled] { opacity: .6; cursor: progress; transform: none; }
.btn-lg { padding: 16px 28px; font-size: 16px; }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--line-2); }

/* Tela inicial */
.screen-welcome { padding-top: clamp(40px, 9vh, 96px); }
.facts { list-style: none; display: flex; gap: 12px; padding: 0; margin: 32px 0; flex-wrap: wrap; }
.facts li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; box-shadow: var(--shadow-sm); display: flex; align-items: baseline; gap: 8px; }
.facts strong { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.facts span { color: var(--muted); font-size: 14px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.start-card { display: grid; gap: 16px; padding: 28px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
input[type=text], input[type=email], input[type=tel], input[type=password] {
  width: 100%; border: 1.5px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 13px 14px; font-size: 16px; transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.form-error { color: var(--warn); font-size: 14px; margin: 0; min-height: 0; }
.form-error:empty { display: none; }
.resume-note { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.start-card .btn { justify-self: start; }

.rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 28px 0 0; }
.rule { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); }
.rule p { margin: 0; }
.rule-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; font-size: 14px; }
.byline { margin: 40px 0 0; font-size: 14px; color: var(--ink-2); }
.byline span { color: var(--muted); font-size: 13px; }

/* Barra superior */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 820px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--navy); color: #fff; font-family: var(--serif); font-size: 13px; display: grid; place-items: center; letter-spacing: 0; }
@media (prefers-color-scheme: dark) { .brand-mark { background: var(--accent); } }
.steps { flex: 1; min-width: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.steps > :first-child { margin-left: auto; }
.steps > :last-child { margin-right: auto; }
.steps::-webkit-scrollbar { display: none; }
.step-chip { border: 0; background: transparent; padding: 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.step-chip .num { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--bg-2); border: 1px solid var(--line); }
.step-chip.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.step-chip.active .num { background: var(--accent); color: #fff; border-color: var(--accent); }
.step-chip.complete .num { background: var(--ok); color: #fff; border-color: var(--ok); }
.counter { font-size: 13px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress { height: 3px; background: var(--line); }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s cubic-bezier(.2, .7, .2, 1); }

/* Seção */
.section-head { padding: 40px 0 22px; }
.section-head h2 { margin-top: 2px; }
.section-head .muted { margin: 12px 0 0; font-size: 16px; }
.part-tag { display: inline-flex; align-items: center; gap: 8px; }

/* Pergunta */
.q-list { display: grid; gap: 16px; }
.q {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 20px;
  box-shadow: var(--shadow-sm); transition: border-color .2s, box-shadow .25s, transform .25s; scroll-margin-top: 90px;
}
.q.answered { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.q.flash { box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); border-color: var(--accent); }
.q-top { display: flex; gap: 14px; align-items: flex-start; }
.q-num { font-family: var(--serif); font-weight: 600; font-size: 15px; min-width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-2); color: var(--ink-2); flex-shrink: 0; transition: background .2s, color .2s; }
.q.answered .q-num { background: var(--ok); color: #fff; }
.q-text { font-size: 17px; font-weight: 500; margin: 4px 0 0; white-space: pre-line; }
.q-text .blank { display: inline-block; min-width: 64px; border-bottom: 2px solid var(--line-2); margin: 0 2px; transform: translateY(-3px); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 0 48px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt label {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: 15px;
  transition: border-color .15s, background .15s, transform .12s; min-height: 50px; -webkit-tap-highlight-color: transparent;
}
.opt label:hover { border-color: var(--line-2); background: var(--surface); }
.opt label:active { transform: scale(.99); }
.opt .letter { width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--line-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); flex-shrink: 0; transition: all .15s; text-transform: uppercase; }
.opt input:checked + label { border-color: var(--accent); background: var(--accent-soft); }
.opt input:checked + label .letter { background: var(--accent); border-color: var(--accent); color: #fff; }
.opt input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Escrita */
.w-area {
  width: 100%; margin: 16px 0 0; min-height: 150px; resize: vertical; border: 1.5px solid var(--line); background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 14px 16px; font-size: 16px; line-height: 1.6; transition: border-color .15s, box-shadow .15s, background .15s;
}
.w-area:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.w-meta { display: flex; justify-content: space-between; margin: 8px 2px 0; font-size: 13px; color: var(--muted); }
.w-meta .good { color: var(--ok); font-weight: 600; }

/* Navegação */
.nav-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 28px 0 0; }
.nav-row .spacer { flex: 1; }
.part-status { font-size: 14px; color: var(--muted); text-align: center; }

/* Revisão */
#review .card + .card { margin-top: 16px; }
.review-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; }
.rv { height: 46px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 14px; cursor: pointer; display: grid; place-items: center; color: var(--muted); transition: transform .12s; }
.rv:hover { transform: translateY(-1px); }
.rv.on { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }
.rv.off { border-color: var(--accent); color: var(--accent); border-style: dashed; }
.review-legend { display: flex; gap: 18px; margin: 16px 0 0; font-size: 13px; color: var(--muted); }
.review-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px dashed var(--accent); display: inline-block; }
.dot.on { background: var(--ok); border: 0; }
.rw-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.rw-item:last-child { border-bottom: 0; }
.rw-item p { margin: 0; font-size: 15px; }
.rw-item .pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.no { background: var(--accent-soft); color: var(--accent); }
.rw-title { font-family: var(--serif); font-size: 20px; margin: 0 0 4px; }

/* Concluído */
.screen-done { padding-top: clamp(40px, 10vh, 110px); }
.done-card { text-align: center; padding: 48px 28px; max-width: 620px; margin: 0 auto; }
.done-check svg { width: 76px; height: 76px; stroke-width: 2.5; margin: 0 auto 18px; display: block; }
.done-check circle { stroke: var(--ok); stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .7s .1s ease forwards; fill: var(--ok-soft); }
.done-check path { stroke: var(--ok); stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .45s .7s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
#newTest { margin-top: 18px; }
.linkish { background: none; border: 0; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px; }
.linkish:hover { color: var(--accent); }
#doneMeta { margin: 22px 0 4px; font-size: 14px; }

/* Rodapé / toast */
.foot { text-align: center; padding: 24px 16px 32px; font-size: 12px; color: var(--muted); }
.foot p { margin: 0 auto; max-width: 560px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .3s; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); z-index: 50; }
@media (prefers-color-scheme: dark) { .toast { background: #eef2f8; color: #0b1422; } }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Responsivo */
@media (max-width: 960px) {
  .step-chip .lbl { display: none; }
  .step-chip.active .lbl { display: inline; }
}
@media (max-width: 720px) {
  .rules { grid-template-columns: 1fr; }
  .brand-text { display: none; }
  .opts { grid-template-columns: 1fr; margin-left: 0; }
  .review-grid { grid-template-columns: repeat(8, 1fr); }
}
@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
  .start-card { padding: 20px; }
  .start-card .btn { justify-self: stretch; }
  .q { padding: 18px 16px 16px; }
  .q-text { font-size: 16px; }
  .facts li { padding: 10px 14px; }
  .review-grid { grid-template-columns: repeat(6, 1fr); }
  .nav-row .btn-lg { padding: 14px 20px; }
  .card { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
