/**
 * Página do Desafio.
 *
 * Claro, com o cabeçalho do site: o quiz é parte do Idoso Seguro, não um lugar
 * à parte. A mensagem do golpe aparece dentro de um aparelho — o mesmo do
 * #roteiro da home, com o CSS trazido para cá — e o painel da pergunta pousa
 * sobre ele.
 *
 * O selo da letra fica neutro até a pessoa responder. Cor antes da escolha
 * seria dica: verde num lugar diz "é essa" mesmo sem querer.
 *
 * Jost (SIL OFL) e RemixIcon (Apache 2.0) são a fonte e os ícones, os mesmos
 * que o Quitzo usa e que são livres.
 */

:root {
  --verde: #1b7f4d;
  --verde-claro: #eaf3ee;
  --verde-vivo: #27ae60;
  --ambar: #b45309;
  --ambar-claro: #fdf3e7;
  --tinta: #18181b;
  --tinta-2: #55555f;
  --tinta-3: #77777f;
  --papel: #ffffff;
  --linha: #e4e4e7;
  --chao: #f4f7f5;

  --sombra: 0 1px 2px rgb(16 24 32 / 5%), 0 12px 28px -14px rgb(16 24 32 / 22%);
  --sombra-alta: 0 2px 4px rgb(16 24 32 / 6%), 0 26px 48px -22px rgb(16 24 32 / 30%);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  /* Padding, não margem no cabeçalho: a margem do primeiro filho colapsa para
     fora do corpo e some 12px da conta da altura. */
  padding-top: 0.75rem;
  min-height: 100svh;
  font-family: Jost, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--tinta);
  background: var(--chao);
  overflow-x: hidden;
}
h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* Lavagem verde bem de leve, como no desenho. */
.fundo {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60rem 40rem at 92% 4%, rgb(39 174 96 / 9%), transparent 62%),
    radial-gradient(52rem 38rem at 4% 96%, rgb(39 174 96 / 7%), transparent 62%);
}

.pular { position: absolute; left: -9999px; padding: 0.75rem 1.25rem; border-radius: 100px; background: var(--tinta); color: #fff; text-decoration: none; }
.pular:focus { left: 1rem; top: 1rem; z-index: 30; }
:focus-visible { outline: 3px solid var(--verde); outline-offset: 3px; }

/* ── cabeçalho do site ───────────────────────────────────────────────────── */
.cabecalho {
  display: flex;
  align-items: center;
  gap: 2rem;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.875rem 1.75rem;
  border-radius: 100px;
  background: var(--papel);
  box-shadow: var(--sombra);
}
.cabecalho-logo img { height: 40px; width: auto; }
.cabecalho-menu { display: flex; gap: 1.75rem; }
.cabecalho-menu a { color: var(--tinta-2); text-decoration: none; font-size: 1.0625rem; }
.cabecalho-menu a:hover { color: var(--tinta); }

/* ── barra de andamento ──────────────────────────────────────────────────── */
.barra {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem 1.75rem 0.5rem;
}
.barra-sair {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.5rem 0.9rem 0.5rem 0;
  color: var(--tinta);
  text-decoration: none;
  font-size: 1.0625rem;
}
.barra-sair i { font-size: 1.375rem; }
.barra-sair:hover { color: var(--verde); }

.andamento { justify-self: center; width: min(24rem, 40vw); text-align: center; }
.andamento-texto { font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
.andamento-trilho {
  height: 8px;
  margin-top: 0.5rem;
  border-radius: 100px;
  background: rgb(24 24 27 / 10%);
  overflow: hidden;
}
.andamento-barra {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 100px;
  background: var(--verde-vivo);
  transition: width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.barra-lema { justify-self: end; text-align: right; font-size: 0.9375rem; line-height: 1.35; color: var(--tinta-3); }

/* ── telas ───────────────────────────────────────────────────────────────── */
main { position: relative; }
.tela { max-width: 1440px; margin: 0 auto; padding: 1rem 1.75rem 2rem; }
.tela[hidden] { display: none; }

.tela.is-entrando { animation: quiz-entra 0.45s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
@keyframes quiz-entra { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
/* A tela da pergunta tem a altura exata da janela: deslocá-la faria a página
   crescer e piscar uma barra de rolagem. Ela entra só com opacidade. */
.tela-pergunta.is-entrando { animation-name: quiz-aparece; }
@keyframes quiz-aparece { from { opacity: 0; } to { opacity: 1; } }

/* ── capa e fecho ────────────────────────────────────────────────────────── */
.tela-capa, .tela-fecho {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100svh - 15rem);
  text-align: center;
}
.capa-olho { margin-bottom: 0.75rem; font-size: 1.125rem; color: var(--verde); }
.capa-titulo {
  max-width: 20ch;
  font-size: clamp(2.25rem, 6.5vw, 5rem);
  font-weight: 700;
  line-height: 1.06;
  text-wrap: balance;
}
.capa-resumo { max-width: 46ch; margin-top: 1.25rem; font-size: 1.25rem; line-height: 1.6; color: var(--tinta-2); }
.capa-nota { margin-top: 1.5rem; font-size: 1rem; color: var(--tinta-3); }
.botao-grande { margin-top: 2.5rem; }

.fecho-titulo { max-width: 20ch; font-size: clamp(1.875rem, 4.5vw, 2.75rem); font-weight: 600; line-height: 1.15; text-wrap: balance; }
.fecho-regras { display: grid; gap: 0.75rem; width: 100%; max-width: 44rem; margin-top: 2rem; text-align: left; }
.fecho-regras li {
  display: flex; gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  background: var(--papel);
  box-shadow: var(--sombra);
  font-size: 1.0625rem; line-height: 1.45;
}
.fecho-regras i { flex: none; color: var(--verde); font-size: 1.25rem; }
.fecho-acoes { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin-top: 2.5rem; }

/* ── a tela da pergunta cabe na janela ────────────────────────────────────── */
.tela-pergunta {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 1rem;
  height: calc(100svh - var(--altura-fixa, 190px));
  padding-block: 0.5rem 1rem;
}
.palco {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr);
  align-items: center;
  gap: 2.5rem;
  min-height: 0;
}

/* ── cena: aparelho + painel ─────────────────────────────────────────────── */
.palco-cena { position: relative; display: grid; justify-items: center; align-content: center; min-height: 0; height: 100%; }

/* O painel pousa sobre a base do aparelho, como no desenho. */
.painel {
  position: relative;
  z-index: 2;
  width: min(30rem, 100%);
  margin-top: -3.5rem;
  padding: 1.25rem 1.5rem 1.5rem;
  border-radius: 22px;
  background: var(--papel);
  box-shadow: var(--sombra-alta);
  text-align: center;
}
.painel-rotulo { color: var(--verde); font-size: 1.0625rem; font-weight: 500; }
.painel-titulo { margin-top: 0.15rem; font-size: clamp(1.5rem, 2.1vw, 2rem); font-weight: 700; line-height: 1.2; text-wrap: balance; }
.painel-apoio { margin-top: 0.35rem; color: var(--tinta-3); font-size: 1.0625rem; }
.painel-pergunta[hidden], .painel-retorno[hidden] { display: none; }

.retorno-cabeca { display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-size: 1.125rem; font-weight: 600; }
.retorno-cabeca i { font-size: 1.375rem; }
.painel.is-segura .retorno-cabeca { color: var(--verde); }
.painel.is-perdida .retorno-cabeca { color: var(--ambar); }
.retorno-texto { margin-top: 0.4rem; color: var(--tinta-2); font-size: 1.0625rem; line-height: 1.5; }

/* ── opções ──────────────────────────────────────────────────────────────── */
.opcoes { display: grid; gap: 1rem; align-content: center; width: 100%; min-height: 0; }

.opcao {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  min-height: 88px;
  padding: 0.9rem 1.25rem;
  border: 2px solid transparent;
  border-radius: 18px;
  background: var(--papel);
  box-shadow: var(--sombra);
  color: var(--tinta);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease-in-out, box-shadow 0.2s, border-color 0.2s;
}
.opcao:hover:not(:disabled) { box-shadow: var(--sombra-alta); }
.opcao:active:not(:disabled) { transform: scale(0.985); }
.opcao:disabled { cursor: default; }

/* Neutro até responder: cor antes da escolha seria dica. */
.opcao-letra {
  flex: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #eef0f2;
  color: var(--tinta-2);
  font-size: 1.375rem;
  font-weight: 600;
  transition: background-color 0.25s, color 0.25s;
}
.opcao-texto { font-size: 1.1875rem; font-weight: 500; line-height: 1.35; }

.opcao-marca { flex: none; display: none; align-items: center; gap: 0.35rem; margin-left: auto; font-size: 0.9375rem; font-weight: 500; }
.opcao-marca i { font-size: 1.25rem; }

.opcao.is-segura { border-color: var(--verde); background: var(--verde-claro); }
.opcao.is-segura .opcao-letra { background: var(--verde); color: #fff; }
.opcao.is-segura .opcao-marca { display: flex; color: var(--verde); }

.opcao.is-perdida { border-color: var(--ambar); background: var(--ambar-claro); }
.opcao.is-perdida .opcao-letra { background: var(--ambar); color: #fff; }
.opcao.is-perdida .opcao-marca { display: flex; color: var(--ambar); }

.opcao.is-escolhida .opcao-texto { text-decoration: underline; text-underline-offset: 4px; }
.opcao.is-apagada { opacity: 0.5; box-shadow: none; }

/* ── rodapé ──────────────────────────────────────────────────────────────── */
.rodape {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
}
/* Colunas fixas: escondida, a regra saía da grade e o botão do meio escorregava
   para a esquerda. */
.regra { grid-column: 1; }
.rodape-acoes { grid-column: 2; }
.rodape-lema { grid-column: 3; }

.regra {
  justify-self: start;
  display: flex;
  gap: 0.7rem;
  max-width: 26rem;
  padding: 0.85rem 1.1rem;
  border-radius: 16px;
  background: var(--verde-claro);
  font-size: 0.9375rem;
  line-height: 1.45;
}
.regra[hidden] { display: none; }
.regra > i { flex: none; color: var(--verde); font-size: 1.25rem; }
.regra b { display: block; color: var(--verde); font-weight: 600; }
.regra > span > span { color: var(--tinta-2); }

.rodape-acoes { justify-self: center; display: flex; align-items: center; gap: 1rem; }
.rodape-lema {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-align: left;
  font-size: 0.9375rem;
  line-height: 1.35;
  color: var(--tinta-3);
}
.rodape-lema i { font-size: 1.5rem; color: var(--verde); }

/* ── botões ──────────────────────────────────────────────────────────────── */
.botao {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 56px;
  padding: 0.9rem 2rem;
  border: 2px solid transparent;
  border-radius: 100px;
  background: var(--tinta);
  color: #fff;
  font: inherit;
  font-size: 1.125rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.25s, transform 0.15s;
}
.botao:hover:not(:disabled) { background: var(--verde); }
.botao:active:not(:disabled) { transform: scale(0.97); }
.botao i { font-size: 1.25rem; }
.botao:disabled { background: #c8ccd0; color: #fff; cursor: not-allowed; }

.botao-vazado { background: transparent; border-color: var(--linha); color: var(--tinta); }
.botao-vazado:hover { background: var(--papel); border-color: var(--tinta-3); }
.botao-vazado[hidden] { display: none; }

/* ═══ aparelho — trazido do #roteiro da home ═════════════════════════════════
 * O mesmo desenho, com duas diferenças: sem a barra de status, que aqui não
 * conta nada, e a conversa rolando por dentro quando a mensagem é comprida —
 * assim o aparelho nunca empurra as opções para fora da tela.
 */
.nx-fone {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 320px;
  min-height: 0;
  max-height: 100%;
  padding: 10px 10px 4.5rem;
  background: #0b0f16;
  border-radius: 44px;
  box-shadow: 0 0 0 2px #2a3140, 0 40px 80px -40px rgb(11 15 22 / 45%);
}
.nx-fone_ilha {
  position: absolute;
  top: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: 82px; height: 24px;
  background: #0b0f16;
  border-radius: 99px;
}
.nx-fone_topo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 34px 14px 12px;
  background: #fff;
  border-radius: 36px 36px 0 0;
  border-bottom: 1px solid #e8ebf0;
}
.nx-fone_voltar { color: #6a7382; display: grid; place-items: center; }
.nx-fone_voltar svg { width: 1.05rem; height: 1.05rem; }
.nx-fone_foto {
  flex: none;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #dfe3ea;
  color: #9aa3b2;
  overflow: hidden;
}
.nx-fone_foto svg { width: 26px; height: 26px; }
.nx-fone_nome { flex: 1; min-width: 0; color: #18181b; font-size: 1rem; line-height: 1.15; }
.nx-fone_nome small { display: block; font-size: 0.8125rem; color: #71717a; }
.nx-fone_mais { color: #8a93a2; }
.nx-fone_mais svg { width: 1.1rem; height: 1.1rem; }

.nx-fone_selo { padding: 7px 14px; background: #f6f7f9; color: #8a8a93; font-size: 0.75rem; text-align: center; }
.nx-fone_conversa {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 12px 14px;
  background: #ece5dd;
}
.nx-bolha {
  max-width: 88%;
  margin-bottom: 8px;
  padding: 8px 11px;
  border-radius: 12px;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: #18181b;
}
.nx-bolha:last-child { margin-bottom: 0; }
.nx-bolha.is-dele { background: #fff; border-top-left-radius: 3px; }
.nx-bolha.is-sua { margin-left: auto; background: #d9fdd3; border-top-right-radius: 3px; }
.nx-bolha time { display: block; margin-top: 2px; color: #8a8a93; font-size: 0.6875rem; text-align: right; }

.nx-fone_campo {
  position: absolute;
  left: 10px; right: 10px; bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 16px;
  background: #f6f7f9;
  border-radius: 0 0 36px 36px;
  color: #9aa3b2;
}
.nx-fone_add { font-size: 1.25rem; line-height: 1; }
.nx-fone_input { flex: 1; font-size: 0.875rem; }
.nx-fone_mic svg { width: 1.1rem; height: 1.1rem; }

/* ── empilhado ───────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .palco { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; gap: 1rem; align-content: start; }
  .nx-fone { max-width: 260px; }
}

@media (max-width: 991px) {
  .cabecalho { padding: 0.7rem 1.1rem; gap: 1rem; }
  .cabecalho-logo img { height: 32px; }
  .cabecalho-menu { display: none; }
  .barra { grid-template-columns: auto 1fr; padding: 0.75rem 1.1rem 0.25rem; }
  .barra-sair span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .andamento { justify-self: stretch; width: auto; }
  .barra-lema { display: none; }
  .tela { padding-inline: 1.1rem; }

  /* No empilhado o conteúdo flui: esticar a cena para preencher deixava um vão
     grande entre o retorno e a opção. Se passar do que cabe, quem rola é o
     palco — os botões, que ficam fora dele, não saem da tela. */
  /* Duas faixas: a cena fica com o que sobrar e rola por dentro; as opções têm
     tamanho próprio e não saem da tela. O minmax(0, 1fr) é o que impede a faixa
     de crescer além do contêiner — sem o zero, ela estica com o conteúdo e
     empurra as opções para fora. */
  /* Uma faixa para a cena e outra para as opções, e a cena esticada dentro da
     dela. Com o "align-items: center" da regra base ela ficava centrada e
     transbordava metade para cada lado: a mensagem saía cortada em cima e o
     painel montava sobre a primeira opção.
     O palco rola quando nem assim couber — num telefone de 640px a mensagem, a
     pergunta e três opções não cabem juntas com corpo de texto legível, e aí é
     melhor rolar do que espremer. Os botões ficam fora do palco e não saem. */
  .palco {
    grid-template-rows: minmax(0, 1fr) auto auto;
    align-items: stretch;
    justify-items: center;
    gap: 0.75rem;
    /* Se nem com a conversa encolhida couber tudo, o palco rola. Os botões
       ficam fora dele e continuam na tela. */
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .palco > * { width: 100%; }
  /* A cena deixa de ser caixa: com display:contents, a mensagem e o painel
     viram itens diretos do palco. Assim a pergunta ganha faixa própria e nunca
     é cortada — antes ela ficava dentro da área que rola e sumia embaixo da
     mensagem. Quem encolhe e rola é só a conversa. */
  .palco-cena { display: contents; }
  /* Piso na conversa: espremida a uma linha ela deixa de contar a situação, que
     é o que a pergunta pede para julgar. */
  .nx-fone { min-height: 13rem; overflow: hidden; }

  /* A moldura do aparelho sai. Quem está lendo já está num celular: desenhar
     outro em volta gasta 190px de altura para mostrar 100px de mensagem, e a
     mensagem é o que importa. Fica o cabeçalho do contato e a conversa, que é
     o que identifica o canal. */
  .nx-fone {
    max-width: none;
    max-height: none;
    padding: 0;
    background: var(--papel);
    border-radius: 18px;
    box-shadow: var(--sombra);
  }
  .nx-fone_ilha, .nx-fone_campo { display: none; }
  .nx-fone_topo { padding: 0.75rem 1rem; border-radius: 18px 18px 0 0; }
  .nx-fone_nome { font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nx-fone_conversa { max-height: 30svh; border-radius: 0 0 18px 18px; }

  /* O espaço entre a mensagem e a pergunta é o gap do palco; a margem do
     desktop, que faz o painel pousar sobre o aparelho, aqui cobriria a última
     linha da mensagem. */
  .painel { margin-top: 0; padding: 1rem 1.15rem 1.15rem; width: 100%; }

  /* Respondida, a mensagem sai: ela já foi lida, e o espaço dela é o de que o
     retorno precisa. Sem isso o texto do retorno chega cortado no meio. */
  .tela-pergunta.is-respondido .nx-fone { display: none; }
  .tela-pergunta.is-respondido .painel { margin-top: 0; }
  /* Some também a opção que não foi escolhida nem era a segura: é a que menos
     ajuda depois de respondido, e é o que faz o retorno caber inteiro. */
  .tela-pergunta.is-respondido .opcao.is-apagada { display: none; }
  .painel-titulo { font-size: 1.375rem; }
  .painel-apoio { font-size: 1rem; }

  .opcao { min-height: 72px; padding: 0.7rem 0.9rem; gap: 0.75rem; }
  .opcao-letra { width: 46px; height: 46px; font-size: 1.125rem; }
  .opcao-texto { font-size: 1.0625rem; }
  .opcao-marca span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

  .rodape { grid-template-columns: 1fr; gap: 0.75rem; }
  .regra, .rodape-acoes, .rodape-lema { grid-column: 1; }
  .regra { justify-self: stretch; max-width: none; }
  .rodape-acoes { justify-self: stretch; }
  .rodape-acoes .botao { flex: 1; }
  .rodape-lema { display: none; }
  .botao { min-height: 52px; padding: 0.8rem 1.25rem; font-size: 1.0625rem; }
}

@media (max-width: 560px) {
  .painel-titulo { font-size: 1.25rem; }
  .nx-fone_conversa { max-height: 26svh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tela.is-entrando { animation: none; }
  .opcao, .botao, .andamento-barra, .opcao-letra { transition: none; }
}
