/* ==========================================================================
   Memory Match board styles
   File: css/memory.css
   Purpose: Standalone styles for the Memory Match board so cards always
   render correctly.
   ========================================================================== */

.mm-board-wrap {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
}

.mm-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.mm-card {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  min-height: 90px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mm-card:disabled {
  cursor: default;
}

.mm-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

.mm-face {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
}

.mm-face-front {
  z-index: 2;
  background:
    linear-gradient(
      135deg,
      rgba(139, 92, 246, 0.28),
      rgba(6, 182, 212, 0.18)
    ),
    #1E2536;
  border: 1px solid rgba(139, 92, 246, 0.45);
}

.mm-face-front svg {
  width: 38px;
  height: 38px;
  color: rgba(255, 255, 255, 0.75);
}

.mm-face-back {
  display: none;
  z-index: 1;
  background:
    radial-gradient(
      circle at top,
      rgba(139, 92, 246, 0.18),
      transparent 42%
    ),
    #151A25;
  border: 1px solid rgba(139, 92, 246, 0.42);
}

.mm-symbol {
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  line-height: 1;
  color: #ffffff;
}

.mm-card.is-flipped .mm-face-front {
  display: none;
}

.mm-card.is-flipped .mm-face-back {
  display: flex;
  animation: mmFaceShow 0.22s ease;
}

.mm-card.is-matched .mm-face-back {
  border-color: rgba(16, 185, 129, 0.65);
  box-shadow: 0 0 22px rgba(16, 185, 129, 0.18);
}

.mm-card.is-hint .mm-face-front {
  border-color: rgba(251, 191, 36, 0.75);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.22);
}

.mm-card.is-wrong .mm-face-back {
  border-color: rgba(239, 68, 68, 0.65);
  animation: mmShakeFlat 0.38s ease;
}

@keyframes mmFaceShow {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes mmShakeFlat {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-3px);
  }
}

@media (max-width: 560px) {
  .mm-board {
    gap: 0.5rem;
  }

  .mm-face {
    border-radius: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mm-card.is-flipped .mm-face-back,
  .mm-card.is-wrong .mm-face-back {
    animation: none;
  }
}

/* ==========================================================================
   Fix card height
   The card wrappers are spans (inline). They must be block-level so
   width/height apply and the card faces get real size.
   ========================================================================== */

.mm-card {
  display: block;
}

.mm-card-inner {
  display: block;
}