.game-intro {
  max-width: 500px;
  margin: 20px auto 0;
  text-align: center;
  font-family: "Nunito", sans-serif;
}
.game-intro h1 {
  font-family: "Fredoka One", cursive;
  color: #4f46e5;
  font-size: 2.5rem;
  margin-bottom: 5px;
}
.game-intro p {
  color: #4b5563;
  font-size: 1.1rem;
}
.game-container {
  max-width: 600px;
  margin: 20px auto 40px;
  background: #ffffff;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  text-align: center;
  position: relative;
}
.stats {
  display: flex;
  justify-content: center;
  font-family: "Fredoka One", cursive;
  font-size: 1.4rem;
  color: #4f46e5;
  margin-bottom: 20px;
}
.difficulty-picker {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}
.difficulty-picker button {
  font-family: "Nunito", sans-serif;
  border: none;
  background: #f3f4f6;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
}
.difficulty-picker button.active {
  background: #4f46e5;
  color: white;
}
.memory-grid {
  display: grid;
  gap: 12px;
  margin: 20px auto;
  max-width: 500px;
}
.grid-easy {
  grid-template-columns: repeat(4, 1fr);
}
.grid-medium {
  grid-template-columns: repeat(4, 1fr);
}
.grid-hard {
  grid-template-columns: repeat(6, 1fr);
}
.memory-card {
  aspect-ratio: 1/1;
  position: relative;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.memory-card.flipped {
  transform: rotateY(180deg);
}
.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  pointer-events: none;
}
.card-back {
  background: #4f46e5;
  color: white;
  font-family: "Fredoka One", cursive;
  font-size: 2rem;
}
.card-front {
  background: #fff;
  transform: rotateY(180deg);
  border: 3px solid #4f46e5;
  font-size: 2.5rem;
}
.grid-hard .card-front {
  font-size: 1.8rem;
}
#restart-btn,
#game-over button {
  background: #4f46e5;
  color: white;
  border: none;
  padding: 10px 25px;
  font-size: 1.1rem;
  border-radius: 50px;
  cursor: pointer;
  font-family: "Fredoka One", cursive;
  margin-top: 10px;
}
#game-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.98);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  border-radius: 20px;
}
#new-record-badge {
  background: #9333ea;
  color: white;
  padding: 8px 20px;
  border-radius: 12px;
  font-family: "Fredoka One", cursive;
  margin-bottom: 15px;
}
.reset-scores-container {
  margin-top: 25px;
  border-top: 1px dashed #e5e7eb;
  padding-top: 15px;
}
#reset-memory-btn {
  background: transparent;
  color: #111827;
  border: 1px solid #111827;
  padding: 5px 15px;
  font-size: 0.8rem;
  border-radius: 20px;
  cursor: pointer;
  font-family: "Nunito", sans-serif;
  transition: all 0.2s;
}
#reset-memory-btn:hover {
  color: #ef4444;
  border-color: #fca5a5;
  background: #fef2f2;
}
.how-to-play {
  max-width: 600px;
  margin: 40px auto;
  padding: 20px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  font-family: "Nunito", sans-serif;
}
.how-to-play h2 {
  font-family: "Fredoka One", cursive;
  color: #4f46e5;
  margin-bottom: 20px;
}
.instructions-grid {
  display: grid;
  gap: 15px;
  text-align: left;
}
.step {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px;
  background: #f9fafb;
  border-radius: 12px;
}
.step-number {
  background: #4f46e5;
  color: white;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: "Fredoka One", cursive;
  flex-shrink: 0;
}
.hidden {
  display: none !important;
}
@media (max-width: 500px) {
  .memory-grid {
    gap: 8px;
  }
  .card-front {
    font-size: 1.8rem;
  }
  .grid-hard .card-front {
    font-size: 1.2rem;
  }
}
