/* Cartões da seção Jogos, janela do jogo e peças de cada joguinho */
.jogos { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.jogo {
  font: inherit;
  text-align: left;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: var(--papel);
  border-radius: var(--raio);
  overflow: hidden;
  box-shadow: var(--sombra);
  display: flex;
  flex-direction: column;
  color: var(--texto);
  transition: transform .2s ease;
}
.jogo:hover { transform: translateY(-4px); }
.jogo-palco {
  height: 96px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--cor-personagem, var(--roxo));
  border-bottom: 8px solid var(--grama);
}
.jogo-palco img { height: 76px; width: auto; margin-bottom: -4px; border-radius: 50% 50% 0 0; }
.jogo-texto { padding: 10px 12px 6px; display: flex; flex-direction: column; gap: 4px; }
.jogo-texto strong { font-family: var(--fonte-titulo); font-weight: 400; font-size: 1.12rem; color: var(--roxo-escuro); line-height: 1.1; }
.jogo-texto span { font-size: .82rem; color: var(--texto-suave); line-height: 1.4; }
.jogo-jogar {
  margin: auto 12px 12px;
  align-self: flex-start;
  font-family: var(--fonte-titulo);
  color: var(--papel);
  background: var(--roxo);
  border-radius: 999px;
  padding: 4px 16px;
}

/* Janela */
.janela {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  border: 0;
  border-radius: 0;
  background: var(--papel);
  color: var(--texto);
  box-shadow: 0 20px 60px rgba(30, 10, 60, .35);
  overflow: auto;
}
.janela::backdrop { background: rgba(61, 15, 112, .55); }
.janela-topo {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px 18px;
  background: var(--roxo);
}
.janela-topo h2 { color: var(--papel); font-size: 1.5rem; }
.janela-botoes { display: flex; gap: 8px; }
.janela-fechar {
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 800;
  background: var(--papel);
  color: var(--roxo);
  cursor: pointer;
}
.janela-area { position: relative; padding: 14px 14px 18px; display: flex; flex-direction: column; gap: 14px; min-height: 320px; }

.jogo-placar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.jogo-instrucao { font-weight: 800; color: var(--roxo-escuro); }
.jogo-pontos {
  font-family: var(--fonte-titulo);
  font-weight: 400;
  color: var(--papel);
  background: var(--vermelho-fala);
  padding: 2px 12px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.jogo-fim {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: rgba(255, 255, 255, .94);
}
.jogo-fim p { margin: 0; font-family: var(--fonte-titulo); font-size: 1.6rem; color: var(--roxo-escuro); max-width: 24ch; }
.jogo-fim .botao { border: 0; cursor: pointer; }

/* Memória */
.memoria-mesa { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.memoria-carta {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  padding: 8px;
  border-radius: 14px;
  cursor: pointer;
  background: var(--lilas);
  display: grid;
  place-items: center;
}
.memoria-carta img { max-height: 100%; width: auto; visibility: hidden; }
.memoria-verso {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: var(--roxo) url("../imagens/logo.webp") center / 70% auto no-repeat;
  box-shadow: inset 0 0 0 6px var(--papel);
}
.memoria-carta.aberta { background: var(--papel); box-shadow: inset 0 0 0 3px var(--grama); cursor: default; }
.memoria-carta.aberta img { visibility: visible; }
.memoria-carta.aberta .memoria-verso { display: none; }

/* Quem disse, Sombra e Conta */
.quem-balao {
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: clamp(1.4rem, 4vw, 2rem);
  color: var(--vermelho-fala);
  padding: 20px;
  background: var(--lilas);
  border-radius: var(--raio);
}
.opcoes-personagens { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.opcao-personagem {
  font: inherit;
  font-weight: 800;
  color: var(--roxo-escuro);
  border: 3px solid transparent;
  border-radius: 14px;
  background: var(--lilas);
  cursor: pointer;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.opcao-personagem img { height: 80px; width: auto; }
.opcoes-nomes { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.opcao-nome {
  font-family: var(--fonte-titulo);
  font-size: 1.25rem;
  color: var(--roxo-escuro);
  border: 3px solid transparent;
  border-radius: 999px;
  background: var(--lilas);
  cursor: pointer;
  padding: 8px 20px;
  min-width: 56px;
}
.certo { border-color: var(--grama) !important; background: var(--verde-claro) !important; }
.errado { border-color: var(--vermelho-fala) !important; background: var(--rosa-claro) !important; }
.janela button:disabled { cursor: default; }
.sombra-palco { display: grid; place-items: center; height: 200px; background: var(--lilas); border-radius: var(--raio); }
.sombra { height: 170px; width: auto; filter: brightness(0) opacity(.85); transition: filter .4s ease; }
.sombra.revelada { filter: none; }
.conta-campo {
  min-height: 170px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--papel);
  border-radius: var(--raio);
  border: 2px solid var(--lilas);
  border-bottom: 12px solid var(--grama);
}
.conta-campo img { height: 74px; width: auto; }

/* Cadê a Raphila e Minhocas */
.buracos, .terra { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.buraco, .cova {
  height: 96px;
  border: 0;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 50% 50% 16px 16px / 30% 30% 16px 16px;
}
.buraco { background: linear-gradient(var(--ceu-claro) 72%, var(--grama) 72%); }
.buraco img { height: 96px; width: auto; animation: subir .2s ease-out; }
.cova { background: radial-gradient(ellipse at 50% 85%, var(--terra) 0 30%, transparent 31%), linear-gradient(var(--verde-claro), #9fd88a); }
.cova img { height: 70px; width: auto; animation: subir .2s ease-out; }
.minhocas-topo { display: flex; justify-content: center; }
.minhocas-topo img { height: 70px; width: auto; }
@keyframes subir { from { transform: translateY(60%); } to { transform: none; } }

/* Galinha e Pula */
.ceu-jogo, .pista {
  position: relative;
  height: 320px;
  overflow: hidden;
  touch-action: none;
  background: linear-gradient(var(--ceu-claro) 85%, var(--grama) 85%);
  border-radius: var(--raio);
}
.heroi { position: absolute; left: 0; bottom: 6%; height: 84px; width: auto; }
.cai { position: absolute; top: 0; width: 48px; height: 48px; }
.controles { display: flex; justify-content: center; gap: 16px; }
.controle {
  width: 64px;
  height: 52px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.3rem;
  background: var(--roxo);
  color: var(--papel);
  touch-action: none;
}
.pista { height: 240px; cursor: pointer; }
.corredora { position: absolute; left: 24px; bottom: 12%; height: 80px; width: auto; }
.pedra {
  position: absolute;
  left: 0;
  bottom: 12%;
  width: 34px;
  height: 26px;
  background: var(--pedra);
  border: 3px solid var(--contorno);
  border-radius: 50% 50% 8px 8px;
}

@media (min-width: 560px) {
  .janela {
    width: min(680px, calc(100vw - 24px));
    height: auto;
    max-height: calc(100dvh - 24px);
    margin: auto;
    padding: 0;
    border-radius: var(--raio);
  }
  .janela-topo { padding: 12px 16px 12px 22px; }
  .janela-area { padding: 16px 20px 22px; }
  .opcoes-personagens { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .buraco, .cova { height: 120px; }
}
@media (min-width: 960px) {
  .jogos { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .jogo-palco { height: 120px; }
  .jogo-palco img { height: 96px; }
  .jogo-texto { padding: 14px 16px 6px; }
  .jogo-texto strong { font-size: 1.3rem; }
  .jogo-texto span { font-size: .9rem; }
  .jogo-jogar { margin: auto 16px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .jogo, .sombra { transition: none; }
  .jogo:hover { transform: none; }
  .buraco img, .cova img { animation: none; }
}
