:root {
  --azul-950: #082f55;
  --azul-900: #0b416f;
  --azul-800: #115c96;
  --azul-500: #258bdd;
  --azul-100: #dceefd;
  --azul-50: #f1f7fc;
  --branco: #ffffff;
  --tinta: #193d5b;
  --suave: #5a7084;
  --linha: #d8e5ef;
  --foco: #f3b63f;
  --erro: #b3261e;
  --ok: #17663a;
  --raio: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--tinta);
  background: var(--azul-50);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

:focus-visible { outline: 3px solid var(--foco); outline-offset: 3px; border-radius: 6px; }

.topo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px max(20px, env(safe-area-inset-left)) 14px max(20px, env(safe-area-inset-right));
  background: var(--branco);
  border-bottom: 1px solid var(--linha);
}
.topo img { display: block; width: 58px; height: 48px; object-fit: contain; }
.topo strong { display: block; font-size: 1.05rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--azul-900); }
.topo span { display: block; font-size: 0.8rem; color: var(--suave); }

main {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 20px 32px;
}

.abertura { padding: 20px 0 8px; }
.abertura h1 { margin: 0 0 6px; font-size: 1.7rem; line-height: 1.2; color: var(--azul-950); text-wrap: balance; }
.abertura p { margin: 0; color: var(--suave); }
.centro { text-align: center; }

/* Campos de texto */
.campo { margin-top: 18px; }
.campo label { display: block; margin-bottom: 6px; font-weight: 650; }
.campo small { font-weight: 400; color: var(--suave); font-size: 0.85rem; }
.campo input,
.campo textarea {
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  color: inherit;
  background: var(--branco);
  border: 1.5px solid var(--linha);
  border-radius: 12px;
  appearance: none;
}
.campo textarea { resize: vertical; min-height: 110px; }
.campo input:focus,
.campo textarea:focus { outline: none; border-color: var(--azul-500); box-shadow: 0 0 0 3px var(--azul-100); }
::placeholder { color: #8ea1b1; }

/* Cartão de cada setor */
.setor {
  margin: 18px 0 0;
  padding: 16px 14px 14px;
  background: var(--branco);
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  min-width: 0;
}
.setor legend { float: left; width: 100%; padding: 0; margin-bottom: 12px; font-weight: 650; }
.opcoes { clear: both; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

.opcao { position: relative; }
.opcao input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.opcao span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 2px 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--suave);
  background: var(--azul-50);
  border: 2px solid transparent;
  border-radius: 12px;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.opcao span::before { content: attr(data-emoji); font-size: 1.9rem; line-height: 1.15; filter: grayscale(0.35); }
.opcao input:checked + span {
  color: var(--azul-950);
  background: var(--azul-100);
  border-color: var(--azul-800);
  transform: scale(1.04);
}
.opcao input:checked + span::before { filter: none; }
.opcao input:focus-visible + span { outline: 3px solid var(--foco); outline-offset: 2px; }
/* Depois de escolher, as outras opções recuam para a escolhida se destacar */
.setor.respondido .opcao input:not(:checked) + span { opacity: 0.55; }

/* "Não passei por este setor": ocupa a linha inteira, abaixo das notas, visual mais discreto */
.opcao.pular { grid-column: 1 / -1; }
.opcao.pular span {
  flex-direction: row;
  justify-content: center;
  gap: 8px;
  padding: 9px 10px;
  font-weight: 600;
  background: transparent;
  border: 2px dashed var(--linha);
}
.opcao.pular span::before { font-size: 1.15rem; line-height: 1; filter: grayscale(0.6); }
.opcao.pular input:checked + span { background: var(--azul-50); border-style: solid; transform: none; }

/* Setor sem resposta ao tentar enviar */
.setor.pendente { border-color: var(--erro); box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.12); }
.aviso-setor {
  display: none;
  margin: 12px 0 0;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--erro);
  background: rgba(179, 38, 30, 0.07);
  border-radius: 10px;
}
.setor.pendente .aviso-setor { display: block; }

.isca { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.erro {
  margin: 16px 0 0;
  padding: 12px 14px;
  color: var(--erro);
  background: #fdecea;
  border-radius: 12px;
  font-weight: 600;
}

.botao {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 16px 20px;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  text-align: center;
  text-decoration: none;
  color: var(--branco);
  background: var(--azul-800);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.botao:hover { background: var(--azul-900); }
.botao:active { transform: translateY(1px); }
.botao[disabled] { opacity: 0.6; cursor: progress; }

.privacidade { margin: 12px 0 0; font-size: 0.85rem; text-align: center; color: var(--suave); }

/* Agradecimento */
#obrigado:focus { outline: none; }
.selo {
  width: 64px;
  height: 64px;
  margin: 12px auto 14px;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--branco);
  background: var(--ok);
  border-radius: 50%;
}

.google {
  margin-top: 22px;
  padding: 22px 18px 20px;
  text-align: center;
  background: var(--branco);
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  box-shadow: 0 12px 32px rgba(8, 47, 85, 0.08);
}
.google h2 { margin: 4px 0 6px; font-size: 1.25rem; line-height: 1.25; color: var(--azul-950); text-wrap: balance; }
.google p { margin: 0; color: var(--suave); }
.estrelas { font-size: 1.6rem; letter-spacing: 4px; color: #f2a900; }
.nota { margin-top: 12px !important; font-size: 0.88rem; }
.nota.ok { color: var(--ok); font-weight: 600; }

.link {
  display: block;
  margin: 22px auto 0;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--suave);
  text-decoration: underline;
  background: none;
  border: 0;
  cursor: pointer;
}

.rodape {
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  font-size: 0.78rem;
  text-align: center;
  color: var(--suave);
}

@media (max-width: 359px) {
  .opcoes { gap: 5px; }
  .opcao span { font-size: 0.74rem; }
  .opcao span::before { font-size: 1.6rem; }
}

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