/* Forest Friends: the 4 x 4 memory cards (frame in ../game.css). */
.game { width: min(100%, 550px, calc((100svh - 240px) * 600 / 760 + 30px)); }
@media (max-width: 520px) { .game { width: 100%; } }
.board { background: #24603a; cursor: default; }
.forest__pairs { margin-left: auto; }

.forest__card {
  position: absolute; padding: 0; margin: 0; border: 0; background: none; cursor: pointer;
  perspective: 800px; -webkit-tap-highlight-color: transparent;
}
.forest__card:disabled { cursor: default; }
.forest__card:focus-visible { outline: 4px solid var(--sun); outline-offset: 3px; border-radius: 10px; }
.forest__flip { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .35s ease; }
.forest__card.is-up .forest__flip { transform: rotateY(180deg); }
.forest__face {
  position: absolute; inset: 0; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 3px solid var(--ink); border-radius: 9px; overflow: hidden;
}
.forest__face img { position: static; width: 100%; height: 100%; object-fit: contain; }
.forest__back { background: #2f7a40; }
.forest__back img { width: 100%; height: 100%; object-fit: cover; }
.forest__front { background: #fff8e6; transform: rotateY(180deg); }
.forest__front img { width: 80%; height: 80%; }
.forest__card.is-matched .forest__front { background: #e3f4e9; border-color: var(--green); }
.forest__card.is-matched .forest__flip { animation: forest-pop .4s ease .3s; }
@keyframes forest-pop { 50% { transform: rotateY(180deg) scale(1.08); } }

@media (prefers-reduced-motion: reduce) {
  .forest__flip { transition: none; }
  .forest__card.is-matched .forest__flip { animation: none; }
}
