/* Par Mágico — visual próprio do jogo (o comum está em base.css). */
:root { --tema: #9cc8f2; --tema-escuro: #2f6aa8; --galinheiro: #4a90d9; --carta: #fffdf7; }

/* 1. escolher: em cima, quantas figuras e a mágica; embaixo, como brincar */
.pm-menu { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 1fr); gap: 10px; }
.pm-opcao {
  min-width: var(--alvo); min-height: var(--alvo); border: 0; border-radius: var(--raio); background: var(--branco);
  box-shadow: var(--sombra); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 4px;
}
.pm-opcao:active { transform: translateY(3px); }
.pm-opcao.escolhida { background: var(--amarelo); outline: 4px solid var(--azul); outline-offset: -4px; }
.pm-opcao:disabled { opacity: 0.5; }
.pm-menu { --pm-icone: clamp(44px, 9vh, 96px); }
.pm-icone { height: var(--pm-icone); display: flex; align-items: center; justify-content: center; font-size: clamp(34px, 7vh, 64px); line-height: 1; }
.pm-icone img { height: var(--pm-icone); width: auto; }
.pm-rotulo { font-size: clamp(16px, 2vw, 24px); font-weight: bold; color: var(--azul); line-height: 1.1; }
.pm-sub { font-size: clamp(12px, 1.4vw, 16px); color: #50606f; line-height: 1.1; }
.pm-minicarta {
  position: relative; display: block; width: var(--pm-icone); height: var(--pm-icone); border-radius: 50%; background: var(--carta);
  box-shadow: inset 0 0 0 3px var(--galinheiro), 0 0 0 2px var(--amarelo);
}
.pm-minicarta i { position: absolute; border-radius: 50%; }

/* 2. a mesa: duas cartas redondas e a coluna do lado */
.pm-mesa { align-items: safe center; justify-content: safe center; overflow: auto; }
.pm-carta {
  position: relative; flex: 0 0 auto; border-radius: 50%; background: var(--carta);
  box-shadow: inset 0 0 0 5px var(--galinheiro), 0 0 0 3px var(--amarelo), 0 6px 0 3px rgba(0, 0, 0, 0.12);
}
.pm-fig {
  position: absolute; padding: 0; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.pm-fig svg { width: 90%; height: 90%; overflow: visible; pointer-events: none; }
.pm-fig.balanca { animation: pm-balanca 0.45s ease-in-out; }
.pm-fig.achou {
  background: rgba(255, 213, 79, 0.45); box-shadow: 0 0 0 5px var(--amarelo), 0 0 18px 8px rgba(255, 213, 79, 0.8);
  animation: pm-brilha 0.7s ease-in-out 2; z-index: 2;
}
.pm-fig.dica { box-shadow: 0 0 0 4px var(--galinheiro); animation: pm-pisca 1.8s ease-in-out infinite; }

.pm-lateral { flex: 0 0 auto; align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 4px; min-height: 0; }
.pm-gema { flex: 0 0 auto; height: 30%; max-height: 150px; }
.pm-gema img { height: 100%; width: auto; }
.pm-gema.procurando { animation: pm-procura 2.4s ease-in-out infinite; }
.pm-relogio {
  flex: 0 0 auto; padding: 2px 10px; border-radius: 999px; background: var(--branco); color: var(--azul);
  font-size: clamp(18px, 2.4vw, 28px); font-weight: bold; font-variant-numeric: tabular-nums;
}
.pm-pilhas { flex: 0 1 auto; min-height: 0; display: flex; align-items: flex-end; justify-content: center; gap: 6px; padding: 4px 6px; border-radius: 16px; background: rgba(255, 253, 247, 0.75); }
.pm-pilha { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; }
.pm-torre { display: flex; flex-direction: column-reverse; align-items: center; }
.pm-mini {
  display: block; width: clamp(36px, 4.4vw, 58px); height: clamp(12px, 1.5vw, 19px); margin-top: -5px; border-radius: 50%; background: var(--carta);
  border: 2px solid var(--galinheiro); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}
.pm-mini[data-dono="gemalino"] { background: #ffe9a8; }
.pm-dono { height: 34px; display: grid; place-items: center; font-size: 24px; line-height: 1; }
.pm-dono img { height: 34px; width: auto; }

/* 3. o fim da partida */
.pm-fim { align-items: center; justify-content: center; gap: 2vw; }
.pm-fim-gemalino { flex: 0 0 auto; height: 74%; max-height: 380px; }
.pm-fim-amigo { flex: 0 0 auto; height: 46%; max-height: 240px; }
.pm-fim-gemalino img, .pm-fim-amigo img { height: 100%; width: auto; }
.pm-fim-meio {
  flex: 0 1 460px; min-width: 0; max-height: 100%; overflow: auto; background: var(--branco); border-radius: var(--raio); box-shadow: var(--sombra);
  padding: clamp(8px, 2vh, 22px) 16px; text-align: center;
}
.pm-fim-titulo { margin: 0 0 4px; color: var(--azul); font-size: clamp(22px, 3.2vw, 38px); }
.pm-fim-frase { margin: 0 0 10px; font-size: clamp(15px, 1.9vw, 21px); line-height: 1.25; }
.pm-fim-botoes { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.pm-fim .pm-pilhas { flex: 0 0 auto; align-self: center; }
.pm-fim .botao-acao { min-width: 140px; padding: 0 18px; }

/* 4. a mágica por trás */
.pm-magica { align-items: center; gap: 12px; }
.pm-desenho { flex: 0 0 auto; height: 100%; max-height: 520px; aspect-ratio: 300 / 270; background: var(--branco); border-radius: var(--raio); box-shadow: var(--sombra); }
.pm-desenho svg { width: 100%; height: 100%; display: block; }
.pm-desenho.com-destaque .pm-rua, .pm-desenho.com-destaque .pm-placa, .pm-desenho.com-destaque .pm-ponto { opacity: 0.22; }
.pm-desenho.com-destaque .aceso { opacity: 1; }
.pm-placa.aceso { transform: scale(1.5); transform-box: fill-box; transform-origin: center; }
.pm-ponto.aceso { fill: var(--amarelo); }
.pm-magica-painel { flex: 1 1 0; min-width: 0; align-self: stretch; max-height: 100%; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.pm-magica-linha { flex: 0 0 auto; }
.pm-magica-texto { flex: 0 1 auto; min-height: 0; overflow: auto; background: var(--branco); border-radius: var(--raio); box-shadow: var(--sombra); padding: 8px 14px; }
.pm-magica-texto p { margin: 0 0 4px; font-size: clamp(14px, 1.7vw, 21px); line-height: 1.28; }
.pm-magica-linha { display: flex; align-items: center; gap: 10px; }
.pm-magica-texto[hidden], .pm-magica-par[hidden], .pm-magica-ler[hidden] { display: none; }
.pm-magica-par { flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 8px; }
.pm-cartinha {
  position: relative; flex: 0 0 auto; border-radius: 50%; background: var(--carta);
  box-shadow: inset 0 0 0 4px var(--galinheiro), 0 0 0 4px var(--amarelo), var(--sombra);
}
.pm-cartinha-fig { position: absolute; display: grid; place-items: center; border-radius: 50%; }
.pm-cartinha-fig svg { width: 88%; height: 88%; }
.pm-cartinha-fig.achou { background: rgba(255, 213, 79, 0.5); box-shadow: 0 0 0 4px var(--amarelo), 0 0 14px 6px rgba(255, 213, 79, 0.8); }
.pm-magica-ler { flex: 0 0 auto; font-size: 34px; }
.pm-magica-mostrar { flex: 1 1 auto; }
.pm-magica-pais { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.pm-magica-pais .pm-desenho { height: 230px; box-shadow: none; border: 2px solid var(--tema); }
.pm-magica-pais .pm-magica-texto { flex: 1 1 280px; box-shadow: none; padding: 0; }
.pm-magica-pais .pm-magica-texto p { font-size: 16px; }

@keyframes pm-balanca { 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
@keyframes pm-brilha { 50% { transform: scale(1.1); } }
@keyframes pm-pisca { 50% { opacity: 0.35; } }
@keyframes pm-procura { 50% { transform: translateY(-5px) rotate(-3deg); } }

/* celular deitado (pouca altura) */
@media (max-height: 460px) {
  .pm-menu { gap: 6px; }
  .pm-opcao { gap: 1px; }
  .pm-fim-titulo { font-size: 22px; }
  .pm-fim-frase { font-size: 15px; margin-bottom: 6px; }
  .pm-dono, .pm-dono img { height: 26px; font-size: 19px; }
}
/* dentro do navegador do celular sobra ainda menos altura: o fim mostra só o essencial */
@media (max-height: 340px), (max-width: 700px) {
  .pm-fim-amigo, .pm-fim .pm-pilhas { display: none; }
  .pm-menu { --pm-icone: 40px; }
  .pm-icone { font-size: 30px; }
  .pm-sub { display: none; }
}
