body {
  font-family: "Trebuchet MS", sans-serif;
  text-align: center;
  background: #f5e9da;
  background-size: 200px;
  color: #3e2e1c;
}

h1 {
  margin-top: 20px;
}

#game-info {
  margin: 10px 0;
}

button {
  padding: 10px 20px;
  font-size: 1em;
  border: none;
  border-radius: 6px;
  background-color: #7ac68a;
  color: white;
  cursor: pointer;
  transition: background 0.3s;
}

button:hover {
  background-color: #68b279;
}

.game-board {
  width: 420px;
  margin: 20px auto;
  display: grid;
  grid-template-columns: repeat(4, 100px);
  grid-gap: 10px;
  justify-content: center;
}

.card {
  width: 100px;
  height: 100px;
  background-color: #d1c4a3;
  border-radius: 8px;
  cursor: pointer;
  perspective: 600px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s;
  transform-style: preserve-3d;
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  backface-visibility: hidden;
}

.hidden {
  display: none;
}

#restart-btn, #back-btn {
  margin-left: 8px;
}

.creature-img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.card-front {
  background-color: #fefaf3;
  display: flex;
  justify-content: center;
  align-items: center;
  transform: rotateY(180deg);
  border: 2px solid #c2b283;
}

.card-back {
  background: radial-gradient(circle at 30% 30%, #b7996d, #8b6f48);
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
}

/* ✨ Sparkle Animation Fix */
@keyframes sparkle {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.1); filter: brightness(1.4); }
  100% { transform: scale(1); filter: brightness(1); }
}

.card.matched .card-inner {
  animation: sparkle 0.4s ease;
}
