.memory-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.memory-header {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 10px;
  font-weight: bold;
}

.mode-select {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: center;
}

.mode-select label {
  font-size: 0.9rem;
}

#gameMode,
#startGameBtn {
  font-size: 0.9rem;
  padding: 4px 10px;
}

.game-stats {
  margin-top: 8px;
  font-size: 1rem;
}

/* Grid Size Dropdown */
#gridSize,
#themeSelect {
  font-size: 0.9rem;
  padding: 4px 10px;
  border: 1px solid #666;
  border-radius: 6px;
  background-color: #fff;
  cursor: pointer;
}

#gridSize:focus,
#themeSelect:focus {
  outline: none;
  border-color: #333;
}

.mode-select label {
  font-size: 0.9rem;
  margin-right: 4px;
}

.cardboard {
  display: grid;
  grid-template-columns: repeat(6, 120px);
  justify-content: center;
  gap: 12px;
  margin-top: 15px;
  min-height: 270px;
  padding: 15px;
  border: 3px solid #555;
  border-radius: 10px;
  background: #fafafa;
  box-sizing: border-box;
}

.card {
  width: 120px;
  height: 120px;
  perspective: 800px;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  cursor: pointer;
}

.card-face {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 8px;
  border: 3px solid #444;
  background-color: #ccc;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* background-size: 100% 100%; */
  background-repeat: no-repeat;
  background-position: center;
  box-sizing: border-box;
}

.card-back {
  background-image: url("/static/images/games/memoryGame/backpic.png");
  background-size: cover;
}

.card-front {
  transform: rotateY(180deg);
  background-size: contain;
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card.matched .card-inner {
  /* filter: brightness(1.08);
  box-shadow: 0 0 0 4px rgba(34, 139, 34, 0.85) inset; */
  transform: rotateY(180deg);
}

.card.matched .card-front {
  background-color: #ffdae6 !important; /* soft pink */
  border: 4px solid #28a745 !important; /* strong green border */
  box-shadow: 0 0 10px rgba(40, 167, 69, 0.6); /* green glow */
}

.card.matched .card-back {
  opacity: 0; /* ensure back never shows */
}
