.memory {
  text-align: center;
  font-family: sans-serif;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 70px);
  gap: 10px;
  justify-content: center;
  margin: 15px 0;
}

/* Card */
.card {
  width: 70px;
  height: 90px;
  perspective: 1000px;
  cursor: pointer;
}

/* Inner flip */
.inner {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.4s;
  transform-style: preserve-3d;
}

/* Flip state */
.card.flipped .inner {
  transform: rotateY(180deg);
}

/* Faces */
.front, .back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 10px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 28px;
  backface-visibility: hidden;
}

/* Front */
.front {
  background: #333;
  color: white;
}

/* Back */
.back {
  background: #f5f5f5;
  transform: rotateY(180deg);
}

/* Win text */
.win {
  margin-top: 10px;
  font-size: 20px;
  color: green;
}

/* Restart */
.restart {
  margin-top: 10px;
  padding: 8px 14px;
  border: none;
  background: #333;
  color: white;
  border-radius: 6px;
  cursor: pointer;
}