/* Identidade Rede Aleluia, tema claro (fundo branco). Tokens de site-redealeluia/src/styles/tokens.css. */
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('./fonts/hanken-grotesk-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --branco: #FFFFFF; /* fundo, pills, painel, barra de digitacao e rodape */
  --roxo-050: #F5F1FA; /* hover */
  --roxo-100: #EDE8F5; /* bolha do bot */
  --roxo-200: #BFA8D5; /* barra de rolagem */
  --roxo-600: #51336D; /* bolha do ouvinte, links e foco */
  --dourado-500: #C8A548; /* acento/CTA, sempre com texto escuro */
  --dourado-400: #DDBE63;
  --tinta: #1F1937; /* texto sobre dourado */
  --texto: #1F1937;
  --texto-2: #4A4165;
  --texto-3: #6A6088;
  --erro: #E5484D;
  --linha: #E9E6F0;
  --linha-forte: #D8D2E6;
  --sombra: 0 8px 24px rgba(42, 26, 59, 0.12);
  --raio: 12px;
  --pill: 999px;
  --font-sans: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Menlo, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--branco);
  color: var(--texto);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  caret-color: var(--roxo-600);
}
::selection { background: var(--dourado-500); color: var(--tinta); }

/* Cabecalho curto com a logo */
.topo {
  flex: none;
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  border-bottom: 1px solid var(--linha);
  background: var(--branco);
}
.logo { display: block; height: 28px; width: auto; }

/* Area rolavel da conversa */
main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px max(var(--gutter), env(safe-area-inset-right)) 20px max(var(--gutter), env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--roxo-200) transparent;
}
.aviso { margin: 0 0 4px; font-size: 13px; line-height: 1.45; color: var(--texto-2); }
.aviso a {
  color: var(--roxo-600);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  white-space: nowrap;
}

#mensagens { display: flex; flex-direction: column; gap: 6px; }
.bolha {
  max-width: 85%;
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--raio);
  font-size: 16px;
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
  animation: entra 0.32s var(--ease) both;
}
.bolha.bot { align-self: flex-start; background: var(--roxo-100); border-bottom-left-radius: 4px; }
.bolha a { color: var(--roxo-600); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.bolha.ouvinte { align-self: flex-end; background: var(--roxo-600); color: var(--branco); border-bottom-right-radius: 4px; }
/* troca de quem fala ganha mais respiro que mensagens seguidas */
.bolha.bot + .bolha.ouvinte, .bolha.ouvinte + .bolha.bot { margin-top: 10px; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } }

#digitando {
  align-self: flex-start;
  font-size: 13px;
  color: var(--texto-3);
  padding: 2px 4px;
  animation: pulsa 1.6s ease-in-out infinite;
}
@keyframes pulsa { 50% { opacity: 0.45; } }

#confirmacao {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 16px;
  background: var(--branco);
  border: 1px solid var(--dourado-500);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  animation: entra 0.32s var(--ease) both;
}
#resumo { grid-column: 1 / -1; margin: 0 0 4px; white-space: pre-line; overflow-wrap: anywhere; }

#atalhos { display: flex; flex-wrap: wrap; gap: 8px; }
/* atributo hidden precisa vencer o display forcado acima, senao o JS nao consegue esconder */
#confirmacao[hidden], #atalhos[hidden], #digitando[hidden] { display: none; }

/* Botoes: dourado com texto escuro por padrao (CTA) */
button {
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--pill);
  background: var(--dourado-500);
  color: var(--tinta);
  font: 600 15px/1.2 var(--font-sans);
  cursor: pointer;
  transition: background-color 0.16s, border-color 0.16s, transform 0.16s var(--ease);
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
:focus-visible { outline: 2px solid var(--roxo-600); outline-offset: 2px; }

#atalhos button {
  background: var(--branco);
  color: var(--texto);
  border: 1px solid var(--linha-forte);
  font-weight: 500;
  padding: 10px 16px;
}
#atalhos button:active { border-color: var(--dourado-500); }

#btn-corrigir { background: transparent; color: var(--texto); border: 1px solid var(--linha-forte); }

@media (hover: hover) {
  button:hover:not(:disabled) { background: var(--dourado-400); }
  #atalhos button:hover:not(:disabled) { background: var(--roxo-050); border-color: var(--dourado-500); }
  #btn-corrigir:hover:not(:disabled) { background: var(--roxo-050); }
  #btn-fechar:hover { background: transparent; color: var(--texto); }
}

/* Barra de digitacao fixa no rodape */
#form {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 10px max(var(--gutter), env(safe-area-inset-right)) 8px max(var(--gutter), env(safe-area-inset-left));
  background: var(--branco);
  border-top: 1px solid var(--linha);
}
#entrada {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--linha-forte);
  border-radius: var(--raio);
  background: var(--branco);
  color: var(--texto);
  font: 400 16px/1.4 var(--font-sans);
}
#entrada::placeholder { color: var(--texto-3); opacity: 1; }
#entrada:focus-visible { outline-offset: 0; border-color: transparent; }
#entrada:disabled { opacity: 0.6; }

footer {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 max(8px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  background: var(--branco);
  font-size: 12px;
  color: var(--texto-3);
}
footer strong { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.08em; color: var(--texto-2); font-variant-numeric: tabular-nums; }
#btn-fechar {
  background: transparent;
  color: var(--texto-2);
  font-weight: 500;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: var(--raio);
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* fora da tela, mas com tamanho real: container de 0px atrapalha o desafio (Ruling E-5) */
#turnstile-container { position: fixed; left: -9999px; top: 0; width: 300px; height: 65px; }

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