/* ==========================================================================
   Batatinhas — identidade visual do Batataverso
   Estilo "fofo caótico": formas redondas, contornos grossos, cores saturadas.
   Guia completo em docs/03-guia-visual.md
   ========================================================================== */

:root {
  /* Paleta oficial */
  --roxo: #7c5ce0;
  --roxo-escuro: #52439e;
  --roxo-overlay: rgba(40, 26, 90, 0.95);
  --amarelo: #ffd23f;
  --amarelo-claro: #ffe86b;
  --rosa: #ff6b9d;
  --rosa-claro: #ff8fa3;
  --verde-agua: #4ecdc4;
  --verde-agua-escuro: #12907e;
  --laranja: #ff8c42;
  --marrom: #5b3a1e;
  --batata: #f2c14e;
  --texto-suave: #cec3f5;

  /* Tipografia */
  --fonte-display: 'Baloo 2', system-ui, sans-serif;
  --fonte-texto: 'Nunito', system-ui, sans-serif;
}

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

html, body { min-height: 100%; }

body {
  font-family: var(--fonte-texto);
  color: #fff;
  background-color: var(--roxo);
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 14px, transparent 15px);
  background-size: 110px 110px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* Cada tela controla a própria largura (as cenas 3D são full-bleed) */
#app { padding: 16px; }

.tela { animation: aparecer 0.25s ease-out; }

h1, .titulo-marca, .jogo-titulo, .overlay-titulo, .btn {
  font-family: var(--fonte-display);
}

/* --------------------------------------------------------------------------
   Botões — "gordos", com sombra chapada que afunda ao apertar
   -------------------------------------------------------------------------- */

.btn {
  background: var(--amarelo);
  color: var(--marrom);
  border: 4px solid var(--marrom);
  border-radius: 999px;
  font-size: 1.4rem;
  font-weight: 800;
  padding: 0.6em 1.6em;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--marrom);
  transition: transform 0.06s, box-shadow 0.06s;
}

.btn:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--marrom);
}

.btn-grande { font-size: 1.9rem; padding: 0.6em 2.2em; }
.btn-medio { font-size: 1.1rem; }

.btn-fantasma {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  font-family: var(--fonte-texto);
  font-weight: 700;
  font-size: 1rem;
  padding: 0.7em 1.4em;
  cursor: pointer;
}

.btn-fantasma:active { transform: scale(0.95); }

/* --------------------------------------------------------------------------
   Cenas 3D (three.js) — o canvas ocupa o container; a UI fica em HTML por cima
   -------------------------------------------------------------------------- */

.canvas3d { display: block; }

.cena-fundo {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* --------------------------------------------------------------------------
   Tela inicial — o Batataverso 3D atrás, título em cima, botões embaixo
   -------------------------------------------------------------------------- */

.tela-inicio { position: relative; }

.inicio-conteudo {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  gap: 0.6rem;
  padding: 4vh 0 3vh;
  pointer-events: none; /* o meio da tela deixa os toques chegarem à cena */
}

.inicio-conteudo button { pointer-events: auto; }

.inicio-topo, .inicio-base {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.titulo-marca {
  font-size: 3.2rem;
  font-weight: 800;
  color: var(--amarelo);
  line-height: 1;
  text-shadow: 0 4px 0 var(--roxo-escuro);
}

.subtitulo { color: var(--texto-suave); font-size: 1.05rem; }

.inicio-status { display: flex; gap: 10px; margin: 0.6rem 0; flex-wrap: wrap; justify-content: center; }

.pilula {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.9rem;
  color: var(--texto-suave);
}

.pilula strong { color: var(--amarelo); }

.inicio-botoes { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 0.4rem; }

.inicio-botoes-linha { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.rodape { margin-top: 1.4rem; font-size: 0.8rem; color: rgba(255, 255, 255, 0.4); }

/* --------------------------------------------------------------------------
   Casca comum dos jogos e da coleção
   -------------------------------------------------------------------------- */

.jogo {
  background: rgba(0, 0, 0, 0.16);
  border-radius: 20px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.jogo--fritilda { background: var(--verde-agua-escuro); }

.jogo-hud { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.hud-bloco { min-width: 80px; display: flex; flex-direction: column; }
.hud-direita { text-align: right; align-items: flex-end; }
.hud-rotulo { font-size: 0.75rem; color: var(--texto-suave); }
.hud-valor { font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.hud-amarelo { color: var(--amarelo); }

.hud-centro { text-align: center; display: flex; flex-direction: column; }
.jogo-titulo { font-size: 1.3rem; font-weight: 800; color: var(--amarelo); line-height: 1.2; }
.jogo-instrucao { font-size: 0.75rem; color: var(--texto-suave); }

.barra {
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 99px;
  margin-top: 12px;
  overflow: hidden;
}

.barra-preenchida { height: 100%; width: 0%; background: var(--amarelo); border-radius: 99px; }

.jogo-palco {
  height: 320px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  touch-action: none; /* toques frenéticos não podem rolar a página */
  border-radius: 14px;
}

.jogo-acao { text-align: center; padding: 6px 0; }

/* --------------------------------------------------------------------------
   Modo tela cheia dos mini-jogos: a cena 3D toma o viewport inteiro,
   como na tela inicial; HUD e botão flutuam por cima.
   -------------------------------------------------------------------------- */

.jogo--cheio {
  position: fixed;
  inset: 0;
  z-index: 1;
  padding: 0;
  border-radius: 0;
  background: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

/* Scrim no topo: garante a leitura do HUD sobre o céu claro da cena */
.jogo--cheio::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 140px;
  background: linear-gradient(rgba(30, 16, 70, 0.4), transparent);
  pointer-events: none;
  z-index: 1;
}

.jogo--cheio .jogo-palco {
  position: absolute;
  inset: 0;
  height: auto;
  border-radius: 0;
}

.jogo-topo {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 16px 0;
  pointer-events: none; /* toques no topo vazam para o palco */
}

.jogo--cheio .jogo-acao {
  position: relative;
  z-index: 2;
  padding: 0 0 max(3.5vh, 16px);
  pointer-events: none;
}

.jogo--cheio .jogo-acao .btn { pointer-events: auto; }

.jogo--cheio .overlay { border-radius: 0; }

/* Com o resultado aberto, os botões de ação saem de cena */
.jogo--cheio:has(.overlay) .jogo-acao,
.jogo--cheio:has(.overlay) .coral-botoes { visibility: hidden; }

/* --------------------------------------------------------------------------
   Transição de fim de fase: "FIM!" estoura e a íris de desenho animado
   fecha sobre o jogo e reabre já no Show das Batatinhas (js/telas/jogo.js)
   -------------------------------------------------------------------------- */

.cortina-fase {
  position: absolute;
  inset: 0;
  z-index: 6; /* acima do jogo E da festa; o resultado só chega depois */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
}

/* O "furo" da íris: círculo transparente cujo box-shadow gigante pinta o
   resto da tela de escuro; animar o TAMANHO do furo fecha/abre a íris */
.cortina-furo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 250vmax;
  height: 250vmax;
  border-radius: 50%;
  box-shadow: 0 0 0 250vmax #241452;
  animation: iris-fecha 0.6s ease-in 1.6s forwards; /* espera o confete brilhar */
}

.cortina-furo.cortina-abre { animation: iris-abre 0.7s ease-out forwards; }

@keyframes iris-fecha { to { width: 0; height: 0; } }
@keyframes iris-abre {
  from { width: 0; height: 0; }
  to   { width: 250vmax; height: 250vmax; }
}

/* A íris do TUTORIAL para a partida mora na casca da tela (fora do jogo, que
   reescreve o próprio innerHTML ao montar), então precisa se fixar sozinha */
.cortina-fase--tela { position: fixed; }

/* E fecha na hora: a criança já apertou "BORA JOGAR!" — ela quer jogar, não
   assistir. Sem confete e sem a espera do aviso de fim de fase. */
.cortina-fase--rapida .cortina-furo { animation: iris-fecha 0.45s ease-in forwards; }

/* ...mas a íris rápida também tem que ABRIR. A regra de cima tem a MESMA
   especificidade (0,2,0) da .cortina-furo.cortina-abre lá em cima e vem depois
   no arquivo, então venceria o desempate por ordem e prenderia a tela no escuro:
   a partida montava embaixo e ninguém via. Esta regra (0,3,0) desempata na
   especificidade, e não na ordem — mover os blocos deste arquivo não a quebra. */
.cortina-fase--rapida .cortina-furo.cortina-abre { animation: iris-abre 0.7s ease-out forwards; }

.cortina-fim {
  position: relative;
  font-family: var(--fonte-display);
  font-size: clamp(2.4rem, 13vw, 4.5rem);
  font-weight: 800;
  color: var(--amarelo);
  text-shadow: 0 5px 0 var(--marrom);
  animation: fim-estoura 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both,
             fim-some 0.3s ease-in 1.55s forwards;
}

/* Confete em HTML da finalização: estoura do centro e cai girando */
.cortina-confete {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 13px;
  height: 13px;
  border-radius: 3px;
  animation: confete-voa 1.6s ease-out forwards;
}

@keyframes confete-voa {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  70%  { opacity: 1; }
  to   { transform: translate(var(--dx), var(--dy)) rotate(var(--giro)); opacity: 0; }
}

@keyframes fim-estoura {
  from { transform: scale(0) rotate(-12deg); opacity: 0; }
  to   { transform: scale(1) rotate(-4deg); opacity: 1; }
}

@keyframes fim-some {
  to { transform: scale(1.4) rotate(-4deg); opacity: 0; }
}

/* --------------------------------------------------------------------------
   Show das Batatinhas — festa de fim de fase (js/telas/festa.js)
   -------------------------------------------------------------------------- */

.festa {
  position: absolute;
  inset: 0;
  z-index: 4; /* acima do jogo, abaixo do overlay de resultado */
  overflow: hidden;
  animation: aparecer 0.25s ease-out;
}

.festa-palco {
  position: absolute;
  inset: 0;
  cursor: pointer;
  touch-action: none; /* toques de confete não podem rolar a página */
}

.festa-topo {
  position: absolute;
  top: max(4vh, 18px);
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}

.festa-sub {
  font-size: 1rem;
  font-weight: 800;
  color: var(--amarelo-claro);
  letter-spacing: 0.12em;
}

.festa-titulo {
  font-family: var(--fonte-display);
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  font-weight: 800;
  color: var(--amarelo);
  text-shadow: 0 3px 0 rgba(40, 20, 80, 0.55);
  line-height: 1.1;
}

.festa-acao {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(3.5vh, 16px);
  text-align: center;
  z-index: 2;
}

/* Telão sing-along: a linha cantada agora, para todo mundo cantar junto */
.festa-letra {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(max(3.5vh, 16px) + 62px);
  text-align: center;
  pointer-events: none;
  z-index: 2;
}

.festa-letra-atual {
  display: inline-block;
  font-family: var(--fonte-display);
  font-size: clamp(1.1rem, 4.2vw, 1.7rem);
  font-weight: 800;
  color: #fff;
  background: rgba(30, 16, 70, 0.72);
  border-radius: 999px;
  padding: 8px 22px;
  max-width: 100%;
}

.festa-letra-proxima {
  margin-top: 6px;
  font-size: clamp(0.8rem, 3vw, 1rem);
  font-weight: 700;
  color: var(--texto-suave);
  opacity: 0.75;
}

.festa-letra-pulso { animation: letra-entra 0.35s ease-out; }

@keyframes letra-entra {
  from { transform: translateY(10px) scale(0.92); opacity: 0.2; }
  to   { transform: none; opacity: 1; }
}

/* Notinhas musicais que sobem enquanto as batatas cantam */
.festa-nota {
  position: absolute;
  font-size: 1.7rem;
  font-weight: 800;
  pointer-events: none;
  animation: nota-sobe 2.4s ease-out forwards;
}

@keyframes nota-sobe {
  from { opacity: 0; transform: translateY(14px) rotate(-10deg) scale(0.8); }
  18%  { opacity: 1; }
  to   { opacity: 0; transform: translateY(-110px) rotate(12deg) scale(1.15); }
}

/* Durante a festa ou o descanso, HUD, botões e o palco do jogo saem de cena
   (o canvas do jogo continua vivo embaixo — escondê-lo evita compor duas
   cenas 3D por quadro, que engasga o show em máquinas modestas) */
.jogo--cheio:has(.festa) .jogo-topo,
.jogo--cheio:has(.festa) .jogo-acao,
.jogo--cheio:has(.festa) .jogo-palco,
.jogo--cheio:has(.festa) .coral-botoes,
.jogo--cheio:has(.festa) .descanso,
.jogo--cheio:has(.descanso) .jogo-topo,
.jogo--cheio:has(.descanso) .jogo-acao,
.jogo--cheio:has(.descanso) .jogo-palco,
.jogo--cheio:has(.descanso) .coral-botoes { visibility: hidden; }

/* --------------------------------------------------------------------------
   Descanso pós-jogo — o anfitrião relaxa e o resultado mora aqui
   (js/telas/descanso.js)
   -------------------------------------------------------------------------- */

.descanso {
  position: absolute;
  inset: 0;
  z-index: 3; /* abaixo da festa (4): o show abre por cima do descanso */
  overflow: hidden;
  animation: aparecer 0.25s ease-out;
}

.descanso-palco {
  position: absolute;
  inset: 0;
  cursor: pointer;
  touch-action: none;
}

/* Menu no topo: sempre à mão, sem tapar o herói nem a caixa de fala */
.descanso-menu {
  position: absolute;
  top: max(2.5vh, 12px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 12px;
  z-index: 2;
  pointer-events: none;
}

.descanso-menu button { pointer-events: auto; }

/* --------------------------------------------------------------------------
   Caixa de diálogo do anfitrião — estilo RPG de bolso: retrato à esquerda,
   plaquinha de nome sobre a borda, fala digitada e o botão da festa dentro
   -------------------------------------------------------------------------- */

.dialogo {
  position: absolute;
  left: 50%;
  bottom: max(3vh, 14px);
  transform: translateX(-50%);
  width: min(680px, calc(100vw - 24px));
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fff6e0;
  border: 4px solid var(--marrom);
  border-radius: 20px;
  box-shadow: 0 6px 0 var(--marrom);
  padding: 16px 16px 14px;
  color: var(--marrom);
  cursor: pointer;
  z-index: 2;
  animation: aparecer 0.25s ease-out;
}

.dialogo-nome {
  position: absolute;
  top: -16px;
  left: 18px;
  background: var(--amarelo);
  border: 3px solid var(--marrom);
  border-radius: 999px;
  padding: 2px 14px;
  font-family: var(--fonte-display);
  font-size: 0.95rem;
  font-weight: 800;
}

.dialogo-retrato {
  flex-shrink: 0;
  width: clamp(64px, 16vw, 92px);
  background: rgba(124, 92, 224, 0.18);
  border: 3px solid var(--marrom);
  border-radius: 14px;
  overflow: hidden;
}

.dialogo-retrato img { display: block; width: 100%; }

.dialogo-corpo { flex: 1; min-width: 0; }

.dialogo-texto {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.45;
  min-height: 4.35em; /* reserva as ~3 linhas: a caixa não cresce enquanto digita */
}

.dialogo-acoes {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  visibility: hidden; /* aparece quando a fala termina */
}

.dialogo-acoes-visivel { visibility: visible; animation: pop-acoes 0.25s ease-out; }

.pilula-clara {
  background: rgba(91, 58, 30, 0.12);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.85rem;
  font-weight: 700;
}

@keyframes pop-acoes {
  0% { transform: scale(0.6); }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* --------------------------------------------------------------------------
   Tutorial — o anfitrião demonstra o jogo antes da partida (js/telas/tutorial.js)
   Mesma moldura do descanso: cena 3D inteira, menu no topo, caixa de fala
   embaixo. Vem ANTES do jogo existir, então se fixa na tela por conta própria.
   -------------------------------------------------------------------------- */

.tutorial {
  position: fixed;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  animation: aparecer 0.25s ease-out;
}

.tutorial-palco {
  position: absolute;
  inset: 0;
  cursor: pointer;
  touch-action: none;
}

/* Camada para o que a demonstração precisar desenhar em HTML por cima da cena
   (os botões coloridos do coral, por exemplo). É uma VITRINE: não se toca. */
.tutorial-extra {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.tutorial-menu {
  position: absolute;
  top: max(2.5vh, 12px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 12px;
  z-index: 2;
  pointer-events: none;
}

.tutorial-menu button { pointer-events: auto; }

/* Selo de aula: diz à criança (e ao adulto) que isto ainda não vale ponto */
.tutorial-selo {
  background: var(--amarelo);
  color: var(--marrom);
  border: 3px solid var(--marrom);
  border-radius: 999px;
  padding: 5px 16px;
  font-family: var(--fonte-display);
  font-size: 0.95rem;
  font-weight: 800;
  box-shadow: 0 4px 0 var(--marrom);
}

/* --------------------------------------------------------------------------
   A mãozinha das demonstrações (js/tres/demo.js): o dedo que ensina o gesto
   por cima da cena 3D. Toque, toque repetido, segurar e arrastar — todos com
   o mesmo vocabulário visual dos botões (redondo, contorno grosso, sombra
   chapada), para ler como "isto aqui é a sua mão", nunca como interface.
   -------------------------------------------------------------------------- */

.demo-gestos {
  position: absolute;
  inset: 0;
  /* ACIMA da .tutorial-extra (z-index 1): o dedo aperta os botões do coral, e
     empatado em 1 ele perdia por ordem de árvore e era recortado por eles — a
     ondinha do toque saía cortada ao meio justo no quadro que ensina o gesto.
     Continua ABAIXO da caixa de fala, que também é 2 e vem depois na árvore. */
  z-index: 2;
  pointer-events: none; /* é uma demonstração: o dedo de verdade passa reto */
  overflow: hidden;
}

.demo-mao,
.demo-onda,
.demo-rastro {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
}

.demo-mao {
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px; /* o transform posiciona o CENTRO do dedo */
  transition: opacity 0.25s;
}

.demo-mao--sumida { opacity: 0; }

.demo-mao-ponta,
.demo-mao-halo {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.demo-mao-ponta {
  background: #fff6e0;
  border: 4px solid var(--marrom);
  box-shadow: 0 5px 0 rgba(91, 58, 30, 0.55);
  transition: transform 0.09s ease-out, box-shadow 0.09s ease-out;
}

/* Dedo encostado: afunda igualzinho ao :active dos botões do jogo */
.demo-mao--apertada .demo-mao-ponta {
  transform: translateY(4px) scale(0.78);
  box-shadow: 0 1px 0 rgba(91, 58, 30, 0.55);
}

/* Halo: só acende enquanto o dedo está SEGURANDO — é o que diferencia,
   à primeira vista, "toca" de "segura" (o gesto de metade dos jogos) */
.demo-mao-halo {
  border: 4px solid var(--amarelo);
  opacity: 0;
  transform: scale(1);
}

.demo-mao--apertada .demo-mao-halo {
  opacity: 1;
  animation: demo-pulso 0.9s ease-out infinite;
}

@keyframes demo-pulso {
  from { transform: scale(0.9); opacity: 0.9; }
  to   { transform: scale(2.1); opacity: 0; }
}

/* Ondinha do toque: sai de baixo do dedo e se abre, como o ripple de um botão */
.demo-onda {
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border: 4px solid #fff6e0;
  animation: demo-onda 0.5s ease-out forwards;
}

@keyframes demo-onda {
  from { opacity: 0.85; }
  to   { opacity: 0; scale: 2.4; }
}

/* Rastro do arraste: o caminho que o dedo percorreu, apagando atrás dele */
.demo-rastro {
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  background: rgba(255, 246, 224, 0.75);
  animation: demo-rastro 0.55s ease-out forwards;
}

@keyframes demo-rastro {
  from { opacity: 0.75; }
  to   { opacity: 0; scale: 0.3; }
}

/* Respeita quem pediu menos movimento: o dedo para de pulsar e de deixar
   rastro, mas a demonstração 3D continua — é ela que ensina o jogo */
@media (prefers-reduced-motion: reduce) {
  .demo-mao--apertada .demo-mao-halo { animation: none; opacity: 0.8; }
  .demo-onda, .demo-rastro { animation-duration: 0.01s; }
}

/* --------------------------------------------------------------------------
   Overlay de resultado / modal de saco
   -------------------------------------------------------------------------- */

.overlay {
  position: absolute;
  inset: 0;
  background: var(--roxo-overlay);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-align: center;
  padding: 20px;
  border-radius: 20px;
  animation: aparecer 0.2s ease-out;
  overflow: hidden;
  z-index: 5;
}

.jogo--fritilda .overlay { background: rgba(8, 74, 64, 0.95); }

/* Modal que precisa ficar sempre no centro da TELA (revelação de saco) */
.overlay-fixo {
  position: fixed;
  border-radius: 0;
  z-index: 50;
}

.escondido { display: none; }

.overlay-sub { font-size: 1rem; color: var(--texto-suave); }
.overlay-pontos { font-family: var(--fonte-display); font-size: 2.6rem; font-weight: 800; color: var(--amarelo); line-height: 1.1; }
.overlay-titulo { font-size: 1.5rem; font-weight: 800; }
.overlay-frase { font-size: 0.9rem; color: var(--texto-suave); max-width: 380px; }
.overlay-pure { font-size: 1.1rem; font-weight: 800; color: var(--amarelo); }
.overlay-botoes { display: flex; gap: 10px; margin-top: 0.8rem; flex-wrap: wrap; justify-content: center; }

/* --------------------------------------------------------------------------
   Coleção — vitrine viva em 3D; a cartela e o modal flutuam por cima
   -------------------------------------------------------------------------- */

.tela-colecao { position: relative; }

.cena-vitrine {
  touch-action: none; /* girar o personagem não pode rolar a página */
  cursor: pointer;
}

/* Toques atravessam o conteúdo até a cena; só os controles seguram */
.colecao-conteudo { pointer-events: none; }
.colecao-conteudo button,
.colecao-conteudo .overlay,
.colecao-conteudo .cartela-painel { pointer-events: auto; }

/* No zoom, os botões principais dão lugar ao painel do personagem */
.colecao--focada .colecao-acoes { display: none; }

/* O foco usa a caixa de diálogo padrão (.dialogo). Ela declara display
   próprio, então o .escondido genérico perderia o conflito — reafirma aqui */
.dialogo.escondido { display: none; }

.colecao-conteudo .dialogo { pointer-events: auto; }

.dialogo-dica {
  display: block;
  font-size: 0.72rem;
  color: rgba(91, 58, 30, 0.55);
  margin-top: 5px;
  text-align: right;
}

.cartela-painel {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--roxo-overlay);
  padding: 18px min(4vw, 28px) 24px;
  overflow-y: auto;
}

.cartela-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 940px;
  margin: 0 auto 14px;
}

.cartela-titulo {
  font-family: var(--fonte-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--amarelo);
}

.colecao-conteudo,
.selecao-conteudo {
  position: relative;
  z-index: 1;
  max-width: 940px;
  margin: 0 auto;
  min-height: calc(100vh - 32px);
}

/* --------------------------------------------------------------------------
   Tela de escolha de mini-jogo — carrossel 3D de anfitriões
   A cena gira por arrasto no fundo; a interface flutua por cima.
   -------------------------------------------------------------------------- */

.cena-carrossel {
  touch-action: none; /* o swipe do carrossel não pode rolar a página */
  cursor: grab;
}

.cena-carrossel:active { cursor: grabbing; }

.selecao-conteudo {
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* HUD e menu no TOPO; o diálogo é absoluto na base */
  gap: 4px;
  pointer-events: none; /* arrasto atravessa até a cena */
}

.selecao-conteudo button,
.selecao-conteudo .dialogo { pointer-events: auto; }

.carrossel-seta {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 4px solid var(--marrom);
  background: var(--amarelo);
  color: var(--marrom);
  font-family: var(--fonte-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--marrom);
}

.carrossel-seta:active { transform: translateY(-50%) translateY(4px); box-shadow: 0 1px 0 var(--marrom); }
.carrossel-seta--esq { left: max(2vw, 10px); }
.carrossel-seta--dir { right: max(2vw, 10px); }

/* A seleção usa a MESMA caixa de diálogo do descanso (.dialogo): o
   anfitrião da frente apresenta o próprio jogo e o JOGAR! mora dentro.
   Só a fala é mais curta — o texto reserva menos linhas. */
.dialogo-texto-curto { min-height: 2.9em; }

.dialogo-pulso { animation: aparecer 0.25s ease-out; }

/* --------------------------------------------------------------------------
   Velocímetro de carro do Turbo Corrida: meia-lua com zonas coloridas
   (verde-água = seguro pra curva, amarelo = limite, vermelho = vai rodar)
   e agulha que acompanha a velocidade
   -------------------------------------------------------------------------- */

.velocimetro {
  position: absolute;
  left: max(2.5vw, 14px);
  bottom: max(3vh, 16px);
  width: 148px;
  height: 78px;
  z-index: 2;
  pointer-events: none;
}

.velocimetro-mostrador {
  position: absolute;
  inset: 0;
  border: 4px solid var(--marrom);
  border-bottom-width: 6px;
  border-radius: 148px 148px 8px 8px;
  /* zonas: 0–59° verde-água, 59–79° amarelo, 79–180° vermelho
     (LIMITE_CURVA = 7 de 16 ≈ 79°) */
  background: conic-gradient(from 270deg at 50% 100%,
    #4ecdc4 0deg 59deg, #ffd23f 59deg 79deg, #e84d4d 79deg 180deg);
  box-shadow: 0 5px 0 var(--marrom);
}

.velocimetro--perigo .velocimetro-mostrador { animation: velocimetro-alerta 0.4s infinite; }

.velocimetro-agulha {
  position: absolute;
  left: calc(50% - 3px);
  bottom: 4px;
  width: 6px;
  height: 60px;
  background: var(--marrom);
  border-radius: 3px;
  transform-origin: 50% 100%;
  transition: transform 0.08s linear;
}

.velocimetro-pino {
  position: absolute;
  left: calc(50% - 10px);
  bottom: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--amarelo);
  border: 4px solid var(--marrom);
}

@keyframes velocimetro-alerta {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}

/* --------------------------------------------------------------------------
   Botões coloridos do Coral do Purezinho
   -------------------------------------------------------------------------- */

.coral-botoes {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 0 0 max(3.5vh, 16px);
}

.btn-coral {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid var(--marrom);
  box-shadow: 0 6px 0 var(--marrom);
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.06s, filter 0.06s;
}

.btn-coral:active,
.btn-coral-cantando {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--marrom);
  filter: brightness(1.25);
}

.colecao-acoes { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 16px 0 20px; }

/* Festas do vilarejo: botõezinhos quadrados no rodapé do Batataverso, um
   por festa desbloqueada — tocar transforma o cenário no show do jogo.
   SEMPRE em 1 linha: quando não cabe (celular), a fileira vira um
   carrossel de scroll horizontal (barra escondida, snap por botão). */
.festas-vilarejo {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  width: max-content;           /* cabendo, a fileira se centraliza sozinha */
  max-width: 94vw;              /* não cabendo, vira carrossel */
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 8px 2px;             /* respiro para o pulinho e a sombra */
  z-index: 5;
  /* A barra precisa capturar o toque (o .colecao-conteudo é pointer-events:
     none): sem isso, arrastar nos vãos vazava para o canvas e ORBITAVA a
     câmera em vez de rolar a fileira. pan-x diz ao navegador que o gesto
     aqui é rolagem horizontal. */
  pointer-events: auto;
  touch-action: pan-x;
}
.festas-vilarejo::-webkit-scrollbar { display: none; }
.festas-vilarejo.escondido { display: none; }
.colecao--focada .festas-vilarejo { display: none; }

/* Telão sing-along da festa no vilarejo: flutua acima dos botõezinhos */
.vilarejo-letra {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 96px;
  z-index: 5;
}
.colecao--focada .vilarejo-letra { display: none; }

.festa-botao {
  position: relative;
  flex: 0 0 auto;
  scroll-snap-align: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 3px solid var(--marrom);
  border-radius: 16px;
  background: var(--amarelo-claro);
  box-shadow: 0 4px 0 var(--marrom);
  overflow: hidden;
  cursor: pointer;
}
.festa-botao:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--marrom); }
.festa-botao img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.festa-botao-nota {
  position: absolute;
  right: 2px;
  bottom: 1px;
  font-size: 0.85rem;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35));
}
.festa-botao--tocando {
  border-color: var(--amarelo);
  animation: festa-botao-danca 0.9s ease-in-out infinite;
}
@keyframes festa-botao-danca {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-4px) rotate(3deg); }
}
@media (max-width: 540px) {
  .festa-botao { width: 46px; height: 46px; border-radius: 13px; }
}

.grade {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  max-width: 880px; /* 5 colunas no desktop: álbum de 10 fecha em 2 fileiras */
  margin: 0 auto;
}

.card-personagem {
  position: relative;
  background: rgba(30, 16, 70, 0.35);
  border-radius: 14px;
  padding: 10px 8px;
  text-align: center;
}

.card-bloqueado {
  background: rgba(0, 0, 0, 0.15);
  border: 2px dashed rgba(255, 255, 255, 0.35);
}

.card-retrato { width: clamp(70px, 62%, 104px); margin: 0 auto; }
.card-retrato img { display: block; width: 100%; }

.card-misterio { position: relative; }

.card-interrogacao {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--fonte-display);
  font-size: 2.1rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.75);
  pointer-events: none;
}
.card-nome { font-size: 0.82rem; font-weight: 800; margin-top: 4px; }
.card-nome-bloqueado { color: rgba(255, 255, 255, 0.55); }

.pilula-raridade {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 9px;
  margin-top: 5px;
}

.card-contagem {
  position: absolute;
  top: 6px;
  right: 8px;
  background: var(--amarelo);
  color: var(--marrom);
  font-size: 0.68rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 7px;
}

.aviso {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.82rem;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 6;
}

.aviso-visivel { opacity: 1; }

/* A revelação toma a TELA INTEIRA: o personagem novo é um evento —
   cena 3D de fundo a fundo, informações flutuando na base */
.revelacao-cena {
  position: absolute;
  inset: 0;
}

/* As informações da revelação moram na caixa de diálogo padrão (.dialogo) */

.selo-novo {
  display: inline-block;
  background: var(--amarelo);
  color: var(--marrom);
  font-size: 0.85rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 4px 14px;
  margin-top: 8px;
}


/* --------------------------------------------------------------------------
   Tela de conta — os únicos formulários do jogo (entrar / criar conta).
   Cartão centralizado sobre o fundo de bolinhas; inputs "gordos" como os
   botões, com foco bem visível para dedinhos e teclados.
   -------------------------------------------------------------------------- */

.tela-conta {
  min-height: calc(100vh - 32px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4vh;
}

.conta-cartao {
  width: min(420px, 100%);
  background: var(--roxo-overlay);
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-radius: 24px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  text-align: center;
}

.conta-cartao > .btn-fantasma { align-self: flex-start; }

.conta-titulo {
  font-size: 2rem;
  color: var(--amarelo);
  text-shadow: 0 3px 0 var(--roxo-escuro);
  line-height: 1;
}

.conta-texto { color: var(--texto-suave); font-size: 1rem; line-height: 1.45; }

.conta-texto strong { color: #fff; }

.conta-dica { color: var(--amarelo-claro); font-size: 0.9rem; font-weight: 700; }

.conta-perfil { display: flex; flex-direction: column; gap: 8px; align-items: center; }

/* Abas entrar/criar: uma pílula dividida ao meio */
.conta-abas {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}

.conta-aba {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--texto-suave);
  font-family: var(--fonte-texto);
  font-weight: 800;
  font-size: 1rem;
  padding: 0.55em 0;
  border-radius: 999px;
  cursor: pointer;
}

.conta-aba-ativa { background: var(--amarelo); color: var(--marrom); }

.tela-conta form { display: flex; flex-direction: column; gap: 12px; }

/* display:flex acima venceria o atributo hidden (troca de abas) sem isto */
.tela-conta form[hidden] { display: none; }

.campo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  color: var(--texto-suave);
  font-size: 0.9rem;
  font-weight: 700;
}

/* O body desliga a seleção de texto (jogo de toques); nos campos ela volta */
.campo input {
  user-select: text;
  -webkit-user-select: text;
  background: #fff;
  color: var(--marrom);
  border: 3px solid var(--roxo-escuro);
  border-radius: 14px;
  padding: 0.55em 0.8em;
  font-family: var(--fonte-texto);
  font-weight: 700;
  font-size: 1rem; /* 16px+: evita o zoom automático do iOS ao focar */
}

.campo input:focus {
  outline: 3px solid var(--amarelo);
  outline-offset: 1px;
}

.tela-conta form .btn { align-self: center; }

.tela-conta button:disabled { opacity: 0.55; cursor: wait; }

.conta-aviso {
  background: var(--rosa);
  color: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.95rem;
  font-weight: 700;
}

.conta-aviso-ok { background: var(--verde-agua-escuro); }

.link-suave {
  background: none;
  border: none;
  color: var(--texto-suave);
  font-family: var(--fonte-texto);
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
  align-self: center;
}

/* "ou" entre os formulários e o Google, com linhinhas dos lados */
.conta-ou {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--texto-suave);
  font-size: 0.85rem;
}

.conta-ou::before, .conta-ou::after {
  content: '';
  flex: 1;
  border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  color: #3c4043;
  border: 3px solid var(--roxo-escuro);
  border-radius: 999px;
  font-family: var(--fonte-texto);
  font-weight: 800;
  font-size: 1rem;
  padding: 0.6em 1.4em;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--roxo-escuro);
  transition: transform 0.06s, box-shadow 0.06s;
}

.btn-google:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--roxo-escuro);
}

/* --------------------------------------------------------------------------
   Animações
   -------------------------------------------------------------------------- */

/* Só opacidade: um transform aqui faria os filhos position:fixed
   (cenas 3D em tela cheia) serem posicionados errado durante a entrada */
@keyframes aparecer {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
