/* 🎮 Memory Battle Styles */
body {
  margin: 0;
  font-family: "Poppins", sans-serif;
  background: radial-gradient(circle at top, #fff8b0, #ffe082);
  color: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
}

h1 {
  margin: 20px 0 10px;
  font-size: 2.3em;
  color: #ff9800;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

#playerInput {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff8d2;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 0 25px #ffd54f;
  text-align: center;
  z-index: 50;
}

#playerInput .row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

#playerInput input,
#playerInput select {
  margin: 10px;
  padding: 10px;
  font-size: 1em;
  width: 220px;
  border-radius: 8px;
  border: 2px solid #ffd54f;
  text-align: center;
}

#playerInput button {
  background: #ffca28;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}

#playerInput button:hover {
  background: #ffb300;
}

#playerNames {
  display: flex;
  gap: 60px;
  margin-top: 10px;
  font-weight: bold;
  font-size: 1.2em;
  flex-wrap: wrap;
  justify-content: center;
  text-align: center;
}

.player-label {
  background: #fff2b2;
  border-radius: 10px;
  padding: 8px 16px;
  border: 2px solid #ffd54f;
}

.active-player {
  background: #ffeb3b;
  box-shadow: 0 0 10px #ffca28;
}

#timer {
  font-weight: bold;
  margin-top: 8px;
  color: #6b4e00;
  text-align: center;
}

#controls {
  margin-top: 8px;
  text-align: center;
}

button.action {
  background: #ffca28;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: bold;
  cursor: pointer;
}

button.action:hover {
  background: #ffb300;
}

#game-board {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  justify-content: center;
}

.card {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  background: #ffe066;
  border: 3px solid #ffca28;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2em;
  color: transparent;
  cursor: pointer;
  transition: transform 0.25s, background 0.25s;
}

.flipped {
  background: #fffbe3;
  color: #000;
  transform: scale(1.05);
}

.matched {
  background: #bdbdbd;
  color: #555;
  transform: scale(0.9);
  cursor: default;
}

#fireworks {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

#winnerText {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3em;
  font-weight: bold;
  color: #ff5722;
  text-shadow: 2px 2px 10px #000;
  z-index: 25;
  opacity: 0;
  transition: opacity 0.6s;
}

/* 🔊 Buttons */
#audioToggle {
  position: fixed;
  top: 10px;
  right: 10px;
  border: none;
  border-radius: 8px;
  background: #ffca28;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: bold;
  z-index: 100;
}

/* 🏠 Back Button */
#backHome {
  position: fixed;
  top: 10px;
  left: 10px;
  background: #ffca28;
  color: #000;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: bold;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: background 0.2s;
  z-index: 100;
}

#backHome:hover {
  background: #ffb300;
  text-decoration: none;
  color: #000;
}

/* 🎉 Confetti */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  top: 0;
  animation: fall 3s linear forwards;
  z-index: 30;
}

@keyframes fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* 📱 Mobile Responsive */
@media (max-width: 600px) {
  h1 {
    font-size: 1.8em;
    margin-top: 15px;
  }

  .card {
    width: 65px;
    height: 65px;
    font-size: 1.5em;
  }

  #playerInput {
    width: 90%;
    padding: 20px;
  }

  #playerInput input,
  #playerInput select {
    width: 100%;
  }

  #playerNames {
    gap: 25px;
    font-size: 1em;
  }

  #timer {
    margin-top: 5px;
  }

  button.action {
    padding: 6px 12px;
    font-size: 0.9em;
  }
}
