/* Jogo da Memória: cartas que viram em 3D sobre um feltro azul; figuras de arte própria (Match-3 e Galáxia) */
.mm-placar-jogo { display: flex; gap: .8rem; justify-content: center; font: 600 .95rem var(--sans); }
.mm-placar-jogo span { padding: .3rem .8rem; border-radius: 999px; background: var(--papel); border: 1px solid var(--fio); transition: box-shadow .3s; }
.mm-placar-jogo span.vez { box-shadow: 0 0 0 3px #e0a43a; }
.mm-placar-jogo b { font-size: 1.15rem; margin-left: .3rem; }
.mm-grade { --colunas: 4; display: grid; grid-template-columns: repeat(var(--colunas), minmax(0, 1fr)); gap: clamp(6px, 1.4vw, 12px);
  width: min(620px, calc(var(--colunas) * 118px), 100%); padding: clamp(8px, 2vw, 16px); box-sizing: border-box; border-radius: 16px; margin: 0 auto;
  background: radial-gradient(ellipse at 50% 30%, #3d6fa8, #234a78 70%, #183659); box-shadow: inset 0 0 0 3px #5a3a24, inset 0 0 30px rgba(0,0,0,.35), 0 10px 24px rgba(0,0,0,.2); }
.mm-carta { display: block; aspect-ratio: 3 / 4; padding: 0; border: 0; background: none; cursor: pointer; perspective: 600px; }
.mm-carta:disabled { cursor: default; }
.mm-dentro { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.3,.7,.3,1); }
.mm-carta.aberta .mm-dentro { transform: rotateY(180deg); }
.mm-verso, .mm-frente { position: absolute; inset: 0; border-radius: 10px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: grid; place-items: center; box-shadow: 0 3px 6px rgba(0,0,0,.35); }
.mm-verso { background: repeating-linear-gradient(45deg, #b5402f 0 8px, #9a3324 8px 16px); border: 4px solid #fbf3e1; box-sizing: border-box; }
.mm-verso::after { content: "?"; font: 800 clamp(1.2rem, 5vw, 2.2rem) Georgia, serif; color: #fbf3e1; opacity: .9; }
.mm-frente { transform: rotateY(180deg); background: #fffaf0; border: 3px solid #e4d6b8; box-sizing: border-box; }
.mm-frente svg { width: 76%; height: 76%; }
.mm-carta:hover:not(:disabled):not(.aberta) .mm-verso { filter: brightness(1.1); }
.mm-carta.feita .mm-frente { opacity: .55; border-color: #6fbf73; }
.mm-carta.dica .mm-verso, .mm-carta.dica .mm-frente { box-shadow: 0 0 0 4px #ffe08a, 0 0 18px rgba(255,224,138,.9); }
.mm-placar { grid-template-columns: repeat(3, 1fr); }
.mm-placar b { font-size: 1.3rem; }
.mm-jogadas { width: min(620px, 100%); }
.mm-jogadas h2 { font-size: 1rem; margin: .3rem 0 .2rem; }
.mm-lista { list-style: none; margin: 0; padding: 0; max-height: 180px; overflow-y: auto; font: .82rem var(--sans); border: 1px solid var(--fio); border-radius: 10px; background: var(--papel); }
.mm-lista li { padding: .22rem .6rem; border-bottom: 1px solid var(--fio); }
.mm-lista li.pc { background: var(--papel-2); }
.mm-legenda { font: .74rem var(--sans); opacity: .8; margin: .3rem 0 0; }
@media (prefers-reduced-motion: reduce) { .mm-dentro { transition: none; } }

/* mini do tutorial */
.xz-mini.mm-mini { display: grid; width: 220px; height: auto; aspect-ratio: auto; border: 0; grid-template-columns: repeat(4, 1fr); grid-template-rows: auto; gap: 6px; padding: 10px; border-radius: 12px; background: #234a78; place-items: stretch; }
.mm-mini .mm-carta { cursor: default; }
.mm-mini .mm-verso::after { font-size: 1rem; }

/* tela cheia: a grade cresce até as linhas de cartas (3:4) caberem na altura que sobra, guardando embaixo o lugar da Dica
   (--mm-reserva), que aparece ali sem empurrar a página */
body.tc { --mm-reserva: 70px; }
body.tc .mm-grade { width: min(100%, calc(var(--colunas) * 150px), calc((var(--tc-alto, 700px) - 136px - var(--mm-reserva)) * var(--colunas) * .75 / var(--linhas, 4))); }
body.tc .xz-centro:has(.mm-grade) { position: relative; padding-bottom: var(--mm-reserva); box-sizing: border-box; }
body.tc .xz-centro:has(.mm-grade) > .xz-dica-texto { position: absolute; left: 50%; top: calc(100% - var(--mm-reserva) + .45rem); transform: translateX(-50%);
  width: min(620px, 100%); max-width: none; margin: 0; box-sizing: border-box; padding: .45rem .8rem; font-size: .92rem; line-height: 1.35; }
@media (max-width: 700px) {
  body.tc { --mm-reserva: 96px; }
  body.tc .xz-centro:has(.mm-grade) > .xz-dica-texto { font-size: .82rem; padding: .35rem .6rem; line-height: 1.3; }
}
