.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}
@media (max-width: 500px) {
  .memory-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.memory-card {
  aspect-ratio: 1;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  cursor: pointer;
}
.memory-card.flip {
  transform: rotateY(180deg);
}
.front,
.back {
  width: 100%;
  height: 100%;
  position: absolute;
  border-radius: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  backface-visibility: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
.front {
  transform: rotateY(180deg);
  background: white;
  border: 2px solid white;
  overflow: hidden;
}
.front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.back {
  background: linear-gradient(135deg, #ff9a9e, #ff6b6b);
  color: white;
  font-size: 2rem;
}