/* Web primeiro: uma tela, uma pergunta, zero instrucao antes de jogar.
   Paleta do app: tinta roxo-uva, polo A menta, polo B morango. A cor carrega
   qual lado e qual; a forca da resposta tem cor propria (verde/amarelo/branco),
   que e a mesma da trilha e do compartilhamento.

   Escalas (usar so estes valores):
   espaco  4 8 12 16 24 32
   tipo    13 15 17 24 32 48
   raio    12 (chip) 14 (campo) 16 (botao) 22 (cartao, entrada)
   borda   1.5 (divisoria, chip) 2.5 (tudo que e clicavel ou adesivo)
   Cor de TEXTO usa as variantes -txt: menta e morango puros tem contraste
   2.4:1 no fundo e falham na leitura; ficam para preenchimento. */

@font-face { font-family: Baloo; src: url(/fonts/baloo-Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Baloo; src: url(/fonts/baloo-SemiBold.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Baloo; src: url(/fonts/baloo-ExtraBold.woff2) format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --bg: #FFF3F5;
  --paper: #FFFFFF;
  --ink: #46283C;
  --ink-soft: #80617A;
  --line: #EAD7E0;
  --mint: #3FB3A7;
  --mint-soft: #DDF3F0;
  --mint-txt: #197068;
  --berry: #FF6F8E;
  --berry-soft: #FFE4EA;
  --berry-txt: #C23A5E;
  --sun: #FFC94D;
  --cream: #EFE2C9;
  --forte: #34C77B;
  --media: #FFC94D;
  --fraca: #FFFFFF;
  --max: 460px;
  --dial: min(80vw, 340px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: Baloo, ui-rounded, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { display: block; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 8px; }

#app {
  max-width: var(--max);
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 16px 0;
}

/* ---------- topo */
.topo { display: flex; align-items: center; gap: 4px; min-height: 56px; }
.logo { flex: 1; margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.4px; line-height: 1; }
.logo span { font-size: 15px; font-weight: 600; color: var(--ink-soft); letter-spacing: 0; margin-left: 4px; }
nav { display: flex; align-items: center; gap: 4px; }
.ic { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; }
.ic:hover, .link:hover { background: rgba(70, 40, 60, .06); }
.ic svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.ic svg .cheio { fill: var(--ink); }
.link { min-width: 44px; height: 32px; margin: 0 4px; padding: 0 10px; font-weight: 800; font-size: 13px; letter-spacing: .5px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper); }

/* ---------- categoria e trilha */
.cat { margin: 4px 0 0; text-align: center; font-size: 17px; font-weight: 600; line-height: 1.3; }
.cat b { font-weight: 800; }
.trilha { display: flex; justify-content: center; gap: 6px; margin: 12px 0 0; height: 16px; align-items: center; }
.trilha i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); flex: none; transition: transform .25s; }
.trilha i:not([class]) { width: 6px; height: 6px; margin: 0 4px; border: 0; background: var(--line); }
.trilha i.f { background: var(--forte); }
.trilha i.m { background: var(--media); }
.trilha i.w { background: var(--fraca); }
.trilha i.ok { background: var(--sun); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--sun); }
.trilha i.novo { animation: pula .4s; }
@keyframes pula { 50% { transform: scale(1.4); } }

/* ---------- palco (mostrador ou resultado) */
.palco { flex: none; display: flex; flex-direction: column; align-items: center; padding: 16px 0 0; }
/* sem pergunta feita: o mostrador ocupa o centro da tela em vez de deixar um
   vazio entre ele e o campo */
#app.vazio .palco { flex: 1; justify-content: center; padding-bottom: 24px; }
#app.vazio .historico { display: none; }
.mostrador { width: var(--dial); }
.polos { display: flex; justify-content: space-between; gap: 16px; width: var(--dial); margin-top: 4px; font-weight: 800; font-size: 17px; line-height: 1.15; }
.polos span { max-width: 45%; overflow-wrap: anywhere; }
.polos span:first-child { color: var(--mint-txt); }
.polos span:last-child { color: var(--berry-txt); text-align: right; }
.polos.vazio span { color: var(--ink-soft); opacity: .6; }
.leitura { font-weight: 800; font-size: 24px; line-height: 1.1; margin-top: 12px; min-height: 27px; text-align: center; }
.leitura.anima { opacity: 0; animation: surge .25s .55s forwards; }
.leitura.incerta { color: var(--ink-soft); }
.leitura .a { color: var(--mint-txt); }
.leitura .b { color: var(--berry-txt); }
.dica { color: var(--ink-soft); font-size: 15px; text-align: center; margin: 16px auto 0; line-height: 1.4; max-width: 30ch; }
.dica:empty { display: none; }
.dica b { color: var(--ink); }
.pensando .ponteiro { transform-box: view-box; transform-origin: 216px 218px; animation: balanca .9s ease-in-out infinite alternate; }
@keyframes balanca { from { transform: rotate(60deg); } to { transform: rotate(120deg); } }
@keyframes surge { to { opacity: 1; } }

/* resultado */
.resultado { width: 100%; text-align: center; padding: 8px 0 0; animation: surge .3s both; opacity: 0; }
.topo-res { display: flex; align-items: center; justify-content: center; gap: 8px; }
.topo-res .mascote { width: 56px; height: 44px; }
.topo-res .rotulo { margin: 0; font-size: 17px; font-weight: 600; color: var(--ink-soft); }
.palavra {
  display: inline-block; margin: 16px 0 0; padding: 4px 24px; background: var(--sun); border: 2.5px solid var(--ink);
  border-radius: 16px; box-shadow: 0 5px 0 var(--ink); font-weight: 800; font-size: 32px; line-height: 1.2; transform: rotate(-2deg);
}
.placar { margin: 24px 0 0; line-height: 1; }
.placar b { font-size: 48px; font-weight: 800; }
.placar span { font-size: 24px; font-weight: 800; color: var(--ink-soft); }
.placar em { display: block; margin-top: 4px; font-style: normal; font-size: 15px; color: var(--ink-soft); }
.acoes { display: flex; gap: 12px; justify-content: center; margin: 24px 0 0; }
.botao {
  min-height: 48px; border: 2.5px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); background: var(--paper);
  padding: 8px 20px; font-weight: 800; font-size: 17px; transition: transform .08s, box-shadow .08s;
}
.botao.sol { background: var(--sun); padding: 8px 32px; }
.botao:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.meta { margin: 24px 0 0; color: var(--ink-soft); font-size: 15px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.meta p { margin: 0; }
.meta .nw { white-space: nowrap; }
.meta p:empty { display: none; }
.idiomas-fim { display: flex; justify-content: center; gap: 16px; margin: 16px 0 0; }
.idiomas-fim a { color: var(--ink-soft); font-size: 13px; font-weight: 600; text-decoration: none; border-bottom: 1.5px dotted var(--ink-soft); }

/* ---------- historico */
.historico { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 24px 0 0; padding: 0; }
.palco:has(.resultado) + .historico { margin-top: 32px; }
.historico li { display: grid; grid-template-columns: 1fr minmax(80px, 1.1fr) 1fr 40px; align-items: center; gap: 12px; min-height: 44px; border-top: 1.5px solid var(--line); font-size: 15px; font-weight: 600; }
.historico li:first-child { border-top: 0; }
.historico .pa { color: var(--mint-txt); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.historico .pb { color: var(--berry-txt); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.historico .pct { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.barra { position: relative; height: 8px; margin: 0 7px; border-radius: 4px; background: linear-gradient(90deg, var(--mint-soft), #F6EEDC, var(--berry-soft)); }
.barra i { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: var(--sun); border: 2px solid var(--ink); transform: translate(-50%, -50%); }
.barra.incerta i { background: var(--paper); }

/* ---------- rodape e entrada */
.rodape { flex: none; padding: 12px 0 calc(16px + env(safe-area-inset-bottom)); }
.sugestoes {
  display: flex; gap: 8px; overflow-x: auto; padding: 0 0 12px; scrollbar-width: none;
  /* a borda esmaecida avisa que a faixa rola */
  mask-image: linear-gradient(to right, #000 85%, transparent);
  -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
}
.sugestoes::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 36px; background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px; padding: 4px 14px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.chip:hover { border-color: var(--ink-soft); }
.chip i { font-style: normal; color: var(--ink-soft); font-weight: 400; margin: 0 2px; }
.entrada { display: flex; align-items: center; gap: 8px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 22px; box-shadow: 0 4px 0 var(--ink); padding: 6px; }
.pre { color: var(--ink-soft); font-size: 15px; white-space: nowrap; padding-left: 6px; }
.campo { flex: 1; min-width: 0; height: 44px; border: 0; border-radius: 14px; padding: 0 6px; font-size: 17px; font-weight: 800; text-align: center; outline: none; }
.campo.a { background: var(--mint-soft); color: var(--mint-txt); }
.campo.b { background: var(--berry-soft); color: var(--berry-txt); }
.campo::placeholder { color: currentColor; opacity: .45; font-weight: 600; }
.campo:focus { box-shadow: inset 0 0 0 2px currentColor; }
.enviar { flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--sun); border: 2.5px solid var(--ink); font-weight: 800; font-size: 22px; line-height: 1; }
.enviar:disabled, .campo:disabled { opacity: .4; }
.rodape.fim { display: none; }

/* ---------- aviso */
.aviso {
  position: fixed; left: 50%; top: calc(112px + env(safe-area-inset-top)); transform: translate(-50%, -8px);
  max-width: min(92vw, 420px); background: var(--ink); color: #fff; font-weight: 600; font-size: 15px;
  padding: 8px 16px; border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; text-align: center; z-index: 10;
}
.aviso.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- modal (ajuda, numeros, idioma) */
dialog { border: 0; padding: 0; background: transparent; max-width: min(92vw, 400px); width: 100%; }
dialog::backdrop { background: rgba(70, 40, 60, .35); }
.cartao { background: var(--paper); border: 2.5px solid var(--ink); border-radius: 22px; box-shadow: 0 6px 0 var(--ink); padding: 24px; max-height: 86dvh; overflow-y: auto; }
.cartao h2 { margin: 0 0 16px; font-size: 24px; font-weight: 800; line-height: 1.1; }
.cartao p { margin: 8px 0; font-size: 15px; line-height: 1.45; }
.cartao .suave { color: var(--ink-soft); font-size: 15px; }
.cartao .acoes { margin-top: 24px; }
.cartao .acoes .botao { flex: 1; padding: 8px 12px; }
.passos { margin: 0; padding: 0 0 0 20px; font-size: 15px; line-height: 1.45; }
.passos li { margin: 0 0 12px; padding-left: 4px; }
.passos li::marker { font-weight: 800; }
.legenda { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 16px 0 0; padding: 12px; background: var(--bg); border-radius: 12px; font-size: 13px; line-height: 1.25; }
.legenda span { display: flex; align-items: center; gap: 8px; }
.legenda i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); flex: none; }
.numeros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 16px; text-align: center; }
.numeros b { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; }
.numeros span { font-size: 13px; color: var(--ink-soft); }
.dist { margin: 0; }
.dist div { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0; }
.dist div span { width: 20px; text-align: right; color: var(--ink-soft); }
.dist div i { height: 18px; background: var(--line); border-radius: 4px; min-width: 20px; font-style: normal; font-size: 13px; line-height: 18px; text-align: right; padding-right: 6px; font-weight: 800; }
.dist div i.hoje { background: var(--sun); }
.idiomas { display: flex; flex-direction: column; gap: 12px; }
.mascote .olho { transform-box: fill-box; transform-origin: center; animation: pisca 4.6s infinite; }
@keyframes pisca { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.12); } }

/* celular baixo (360x640 e parecidos): encolhe o mostrador antes do resto */
@media (max-height: 700px) {
  :root { --dial: min(70vw, 280px); }
  .palco { padding-top: 8px; }
  .historico { margin-top: 16px; }
  .leitura { font-size: 22px; margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .resultado, .leitura.anima { opacity: 1; } }
