.game-page {
  display: flex;
  justify-content: center;
  padding: 20px;
}

.game-card {
  position: relative;
  width: 100%;
  max-width: 1000px;
  background: #1a1a1a;
  border-radius: 18px;
  padding: 30px 20px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.game-card h2 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.game-card p {
  color: #bdbdbd;
}

.difficulty-buttons {
  margin: 24px 0 16px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.level-btn,
#restartBtn {
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: #ffffff;
  color: #000000;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s ease;
}

.level-btn:hover,
#restartBtn:hover {
  background: #d9d9d9;
  transform: translateY(-2px);
}

.level-btn.active {
  background: #bfbfbf;
}

.game-info {
  margin: 8px 0 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.game-info span {
  background: #111111;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
}

.memory-grid {
  display: grid;
  gap: 12px;
  justify-content: center;
  margin-top: 10px;
}

.memory-card {
  width: 100%;
  max-width: 110px;
  min-width: 55px;
  aspect-ratio: 1 / 1;
  perspective: 1000px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

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

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


.memory-card-front,
.memory-card-back {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  font-weight: 700;
  border: 2px solid #3a3a3a;
}

.memory-card-front {
  background: #2b2b2b;
}

.memory-card-back {
  background: #ffffff;
  color: #000000;
  transform: rotateY(180deg);
  font-size: 2rem;
  border: 2px solid #ffffff;
}

.memory-card.matched .memory-card-back {
  background: #bfbfbf;
  border: 2px solid #d9d9d9;
}


  


.memory-card:hover {
  transform: translateY(-2px);
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 8, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  z-index: 20;
  padding: 20px;
}

.overlay-card {
  width: 100%;
  max-width: 320px;
  background: linear-gradient(180deg, #1f1f1f 0%, #141414 100%);
  border: 1px solid #2f2f2f;
  border-radius: 16px;
  padding: 24px 18px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.overlay-card h3 {
  margin-bottom: 10px;
  color: #ffffff;
  font-size: 1.4rem;
}

.overlay-card p {
  color: #d0d0d0;
  margin-bottom: 12px;
}

.primary-btn {
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: #ffffff;
  color: #000000;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s ease;
}

.primary-btn:hover {
  background: #d9d9d9;
  transform: translateY(-2px);
}

.hidden {
  display: none !important;
}


@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .memory-card {
    max-width: 90px;
    font-size: 1.6rem;
  }
}

@media (max-width: 600px) {
  .game-card {
    padding: 24px 14px;
  }

  .memory-card {
    max-width: 72px;
    font-size: 1.3rem;
    border-radius: 12px;
  }

  .difficulty-buttons,
  .game-info {
    gap: 10px;
  }
}

@media (max-width: 420px) {
  .memory-card {
    max-width: 64px;
    min-width: 48px;
    font-size: 1.1rem;
  }

  .memory-card-back {
    font-size: 1.1rem;
  }
  
  .game-info {
    flex-direction: column;
  }
}