/* ============================================================
   Diagnóstico Dyg · design B "Blue Pop"
   Mais solto, cara de marketing: azul full-bleed na capa,
   sticker com tilt, sombra dura, barra de blocos, marquee.
   Fundos por etapa: intro/fim-1 = azul · perguntas/fim-2 = paper
   ============================================================ */

@font-face {
  font-family: 'Geist';
  src: url("assets/fonts/Geist[wght].ttf") format("truetype-variations");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url("assets/fonts/GeistMono[wght].ttf") format("truetype-variations");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --azul: #1F7FFF;
  --azul-hover: #4A9CFF;
  --azul-press: #0A5BD9;
  --noite: #062B66;          /* sombra dura sobre azul */
  --tinta: #0A0A0A;
  --paper: #FAFAF7;
  --branco: #FFFFFF;
  --prata: #B4BAC4;
  --erro: #E5484D;
  --sombra-pop: #DCE9FF;     /* sombra dura sobre paper */
  --borda: rgba(10, 10, 10, 0.85);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { height: 100%; }

body {
  min-height: 100vh;
  min-height: 100svh;
  font-family: 'Geist', system-ui, sans-serif;
  background: var(--azul);
  color: var(--branco);
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  transition: background 0.55s ease, color 0.55s ease;
}

.mono { font-family: 'Geist Mono', ui-monospace, monospace; }

::selection { background: var(--tinta); color: var(--branco); }

/* ---------- fundos por etapa ---------- */
body[data-stage="q"],
body[data-stage="fim2"] {
  background: var(--paper);
  color: var(--tinta);
}
body[data-stage="q"] ::selection,
body[data-stage="fim2"] ::selection { background: var(--azul); color: var(--branco); }

/* grade pontilhada sutil nas telas paper */
body[data-stage="q"]::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(31, 127, 255, 0.14) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
  z-index: 0;
}

/* ---------- grain ---------- */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

/* ---------- formas flutuantes (fundos azuis) ---------- */
.deco { position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0; transition: opacity 0.55s ease; }
body[data-stage="intro"] .deco,
body[data-stage="fim1"] .deco { opacity: 1; }

.fx {
  position: absolute;
  color: rgba(255, 255, 255, 0.2);
  font-weight: 700;
  line-height: 1;
  user-select: none;
  animation: flutua 14s ease-in-out infinite alternate;
}
.fx-circulo {
  width: 130px; height: 130px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  top: 12%; left: 6%;
  animation-duration: 17s;
}
.fx-anel {
  width: 46px; height: 46px;
  border: 8px solid rgba(6, 43, 102, 0.28);
  border-radius: 50%;
  bottom: 22%; left: 14%;
  animation-duration: 12s; animation-delay: -4s;
}
.fx-cruz  { font-size: 84px; top: 16%; right: 10%; animation-duration: 15s; animation-delay: -6s; }
.fx-ast   { font-size: 120px; bottom: 14%; right: 7%; color: rgba(6, 43, 102, 0.30); animation-duration: 19s; animation-delay: -2s; }
.fx-seta  { font-size: 56px; top: 55%; left: 4%; animation-duration: 13s; animation-delay: -8s; }

@keyframes flutua {
  from { transform: translateY(-14px) rotate(-4deg); }
  to   { transform: translateY(16px) rotate(5deg); }
}

/* ---------- header ---------- */
.head {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(16px, 3vw, 26px) clamp(18px, 4vw, 40px);
}
.logos { display: inline-flex; }
.logos img { display: block; height: 30px; width: auto; }
/* sobre azul, o ponto azul da logo some: força a versão 100% branca */
.logos .logo-w { filter: brightness(0) invert(1); }
.logos .logo-k { display: none; }
body[data-stage="q"] .logos .logo-w, body[data-stage="fim2"] .logos .logo-w { display: none; }
body[data-stage="q"] .logos .logo-k, body[data-stage="fim2"] .logos .logo-k { display: block; }

.chip-head {
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--azul);
  background: var(--branco);
  border: 2px solid var(--tinta);
  border-radius: 999px;
  padding: 7px 14px;
  transform: rotate(2deg);
  box-shadow: 3px 3px 0 var(--noite);
}
body[data-stage="q"] .chip-head, body[data-stage="fim2"] .chip-head { display: none; }

/* barra de progresso em blocos */
.prog { display: inline-flex; align-items: center; gap: 5px; }
.prog[hidden] { display: none; }
.seg {
  width: clamp(16px, 4.4vw, 34px);
  height: 10px;
  border-radius: 3px;
  background: rgba(10, 10, 10, 0.12);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.seg.on { background: var(--azul); }
.seg.atual { background: var(--azul); box-shadow: 2px 2px 0 rgba(10, 10, 10, 0.8); }
.prog-n { font-size: 12px; font-weight: 600; margin-left: 6px; color: rgba(10, 10, 10, 0.55); }

/* ---------- palco / telas ---------- */
.palco {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: clamp(10px, 2.5vh, 40px) clamp(18px, 4vw, 40px) clamp(70px, 9vh, 110px);
}
#form { display: contents; }
#form[hidden] { display: none; }

.tela {
  grid-area: 1 / 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  opacity: 0;
  visibility: hidden;
  transform: translateY(30px) rotate(0.5deg);
  transition: opacity 0.45s ease, transform 0.45s ease, visibility 0s linear 0.45s;
  pointer-events: none;
}
.tela.is-on {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.45s ease 0.1s, transform 0.45s ease 0.1s, visibility 0s;
  pointer-events: auto;
}
.tela.saiu { transform: translateY(-22px) rotate(-0.4deg); }

#hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* número gigante da etapa, atrás do cartão */
.tela-q::before {
  content: attr(data-num);
  position: absolute;
  right: -0.06em;
  bottom: -0.14em;
  font-size: clamp(150px, 26vw, 320px);
  font-weight: 900;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 2px rgba(31, 127, 255, 0.22);
  pointer-events: none;
  z-index: 0;
}

/* ---------- sticker + intro ---------- */
.sticker {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--branco);
  background: var(--tinta);
  padding: 9px 16px;
  border-radius: 8px;
  transform: rotate(-2deg);
  box-shadow: 4px 4px 0 rgba(255, 255, 255, 0.28);
  margin-bottom: clamp(22px, 4vh, 34px);
  animation: carimbo 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) 0.15s backwards;
}
.sticker-azul {
  background: var(--azul);
  box-shadow: 4px 4px 0 var(--sombra-pop);
}
@keyframes carimbo {
  from { transform: rotate(-8deg) scale(1.3); opacity: 0; }
  to   { transform: rotate(-2deg) scale(1); opacity: 1; }
}

.intro-h1 {
  font-size: clamp(38px, 7.2vw, 78px);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.03em;
  max-width: 15ch;
}
.hl {
  display: inline-block;
  font-style: normal;
  color: var(--azul);
  background: var(--branco);
  padding: 0.02em 0.16em;
  border-radius: 0.14em;
  transform: rotate(-1.4deg);
  box-shadow: 5px 5px 0 var(--noite);
}
.intro-sub {
  margin-top: clamp(20px, 3.4vh, 30px);
  font-size: clamp(16px, 1.9vw, 19px);
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.92);
  max-width: 56ch;
}
.intro-acao {
  margin-top: clamp(28px, 5vh, 44px);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.intro-lgpd {
  margin-top: clamp(20px, 3.4vh, 30px);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.55);
}

/* ---------- botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--branco);
  background: var(--azul);
  border: 2px solid var(--borda);
  border-radius: 12px;
  padding: 16px 28px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 5px 5px 0 var(--borda);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { background: var(--azul-hover); transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--borda); }
.btn:active { background: var(--azul-press); transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--borda); }
.btn:focus-visible { outline: 3px solid var(--tinta); outline-offset: 3px; }
.seta { display: inline-block; transition: transform 0.15s ease; }
.btn:hover .seta { transform: translateX(4px); }

/* botão sobre fundo azul: branco */
.btn-intro {
  font-size: clamp(17px, 2vw, 19px);
  padding: 18px 32px;
  color: var(--azul);
  background: var(--branco);
  border-color: var(--tinta);
  box-shadow: 6px 6px 0 var(--noite);
}
.btn-intro:hover { background: var(--branco); color: var(--azul-press); transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--noite); }
.btn-intro:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--noite); }
.btn-intro:focus-visible { outline: 3px solid var(--branco); outline-offset: 3px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--azul-press);
  background: transparent;
  border: 2px dashed rgba(31, 127, 255, 0.55);
  border-radius: 12px;
  padding: 15px 22px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn-ghost:hover { border-color: var(--azul); background: rgba(31, 127, 255, 0.07); }
.btn-ghost:focus-visible { outline: 3px solid var(--azul); outline-offset: 3px; }

.hint { font-size: 11px; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.6); }
body[data-stage="q"] .hint { color: rgba(10, 10, 10, 0.45); }

/* ---------- cartão da pergunta ---------- */
.cartao {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 660px;
  background: var(--branco);
  border: 2px solid var(--borda);
  border-radius: 20px;
  box-shadow: 10px 10px 0 var(--sombra-pop);
  padding: clamp(22px, 4.5vw, 44px);
}
.cartao-fat { max-width: 780px; }

.cartao-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: clamp(18px, 3.4vh, 28px);
}
.passo {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--azul);
  background: rgba(31, 127, 255, 0.10);
  border-radius: 999px;
  padding: 6px 12px;
  transform: rotate(1.6deg);
}
.volta {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(10, 10, 10, 0.45);
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  transition: color 0.15s ease;
}
.volta:hover { color: var(--azul); }
.volta:focus-visible { outline: 2px solid var(--azul); outline-offset: 3px; border-radius: 4px; }

.perg {
  display: block;
  font-size: clamp(24px, 3.6vw, 34px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--tinta);
}
.perg-nome { color: var(--azul); }

.resp {
  width: 100%;
  margin-top: clamp(18px, 3vh, 26px);
  font-family: 'Geist', system-ui, sans-serif;
  font-size: clamp(17px, 2vw, 20px);
  font-weight: 500;
  color: var(--tinta);
  background: var(--paper);
  border: 2px solid rgba(10, 10, 10, 0.16);
  border-radius: 12px;
  padding: 16px 18px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.resp.mono { font-family: 'Geist Mono', ui-monospace, monospace; }
.resp::placeholder { color: rgba(10, 10, 10, 0.30); }
.resp:focus { outline: none; border-color: var(--azul); box-shadow: 4px 4px 0 var(--sombra-pop); }

.micro { margin-top: 12px; font-size: 12px; letter-spacing: 0.04em; color: rgba(10, 10, 10, 0.45); }
.erro { margin-top: 12px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--erro); }

.acao {
  margin-top: clamp(22px, 3.6vh, 32px);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- cards de faturamento ---------- */
.cards {
  margin-top: clamp(18px, 3vh, 26px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.card {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--tinta);
  background: var(--paper);
  border: 2px solid rgba(10, 10, 10, 0.16);
  border-radius: 12px;
  padding: 13px 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.card:hover { border-color: var(--azul); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--sombra-pop); }
.card:focus-visible { outline: 3px solid var(--azul); outline-offset: 2px; }
.card[aria-checked="true"] { background: var(--azul); border-color: var(--borda); color: var(--branco); box-shadow: 5px 5px 0 var(--sombra-pop); }
.card-k {
  flex: none;
  width: 26px; height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--azul);
  background: rgba(31, 127, 255, 0.10);
  border-radius: 7px;
}
.card[aria-checked="true"] .card-k { color: var(--branco); background: rgba(255, 255, 255, 0.18); }
.hint-teclas { margin-top: 14px; }

/* ---------- fechamentos ---------- */
.tela-fim { max-width: 640px; }
.fim-h {
  font-size: clamp(40px, 6.6vw, 68px);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.02;
}
.fim-p {
  margin-top: clamp(18px, 3vh, 26px);
  font-size: clamp(16px, 1.9vw, 18px);
  line-height: 1.7;
}
.tela-fim-azul .fim-p { color: rgba(255, 255, 255, 0.92); }
.tela-fim-paper .fim-h { color: var(--tinta); }
.tela-fim-paper .fim-p { color: rgba(10, 10, 10, 0.75); }
.fim-tag {
  margin-top: clamp(26px, 4.4vh, 38px);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.55);
}
.tela-fim-paper .fim-tag { color: rgba(10, 10, 10, 0.40); }

/* ---------- marquee ---------- */
.marquee {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 8;
  overflow: hidden;
  border-top: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(6, 43, 102, 0.18);
  padding: 12px 0;
  display: none;
}
body[data-stage="intro"] .marquee,
body[data-stage="fim1"] .marquee { display: block; }
.marquee-trilho {
  display: flex;
  width: max-content;
  animation: roda 30s linear infinite;
}
.marquee-trilho span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.66);
  white-space: nowrap;
}
@keyframes roda {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- footer ---------- */
.pe {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 8;
  text-align: center;
  padding: 14px;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: rgba(10, 10, 10, 0.35);
  display: none;
}
body[data-stage="q"] .pe, body[data-stage="fim2"] .pe { display: block; }

/* ---------- tremida no erro ---------- */
.treme { animation: treme 0.4s ease; }
@keyframes treme {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}

/* ---------- nojs ---------- */
.nojs {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: var(--azul);
  color: var(--branco);
  font-size: 18px;
  text-align: center;
  padding: 24px;
}

/* ---------- mobile ---------- */
@media (max-width: 679px) {
  .palco { padding-bottom: 84px; }

  /* pergunta no terço superior: teclado virtual não cobre o input */
  .tela-q { justify-content: flex-start; padding-top: clamp(8px, 4vh, 36px); }

  .cartao { padding: 20px 18px 24px; border-radius: 16px; box-shadow: 6px 6px 0 var(--sombra-pop); }
  .tela-q::before { font-size: 42vw; right: -0.04em; bottom: -0.1em; -webkit-text-stroke-width: 1.5px; }

  .cards { grid-template-columns: 1fr; gap: 8px; }
  .card { font-size: 14px; padding: 12px 13px; }

  .acao .btn, .acao .btn-ghost { width: 100%; }
  .intro-acao .btn-intro { width: 100%; }
  .acao .hint { display: none; }
  .hint-teclas { display: none; }
  .so-desk { display: none; }

  .fx-circulo { width: 80px; height: 80px; }
  .fx-cruz { font-size: 54px; }
  .fx-ast { font-size: 76px; }
  .fx-seta { display: none; }

  .chip-head { font-size: 9px; padding: 6px 10px; }
  .seg { height: 8px; }
  .prog-n { display: none; }

  .marquee-trilho span { font-size: 10px; }
}

@media (pointer: coarse) {
  .btn, .btn-ghost, .card { min-height: 52px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx, .marquee-trilho, .sticker { animation: none; }
  .tela, .btn, .card, .seg { transition-duration: 0.01s; }
}
