:root {
  --pink-light: #ffcce6;
  --pink-medium: #ff99cc;
  --pink-dark: #ff66b3;
  --piggy-pink: #ffb6c1;
  --piggy-nose: #ff8fab;
  --yellow: #fffacd;
  --green-light: #d4edda;
  --green-dark: #b5ead7;
  --shadow: 5px 5px 15px rgba(0, 0, 0, 0.1);
}

/* 🌈 Fun & Playful Base Styles */
body {
  font-family: "Comic Neue", cursive;
  background: linear-gradient(135deg, var(--pink-light), var(--yellow));
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

.piggy-world {
  position: relative;
  width: 100%;
  max-width: 1000px;
  background-color: white;
  border-radius: 30px;
  padding: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ☁️ Floating Clouds */
.cloud {
  position: absolute;
  background: white;
  border-radius: 50%;
  opacity: 0.8;
  z-index: -1;
}

.cloud-1 {
  width: 100px;
  height: 60px;
  top: 10%;
  left: 5%;
  animation: float 8s infinite ease-in-out;
}

.cloud-2 {
  width: 150px;
  height: 90px;
  top: 25%;
  right: 10%;
  animation: float 10s infinite ease-in-out 2s;
}

.cloud-3 {
  width: 80px;
  height: 50px;
  bottom: 15%;
  left: 15%;
  animation: float 7s infinite ease-in-out 1s;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* 🎮 Game Container */
header {
  text-align: center;
  margin-bottom: 20px;
}

header h1 {
  font-family: "Baloo 2", cursive;
  color: var(--pink-dark);
  font-size: 3rem;
  margin: 0;
}

header p {
  color: var(--pink-medium);
  font-size: 1.2rem;
  margin: 5px 0 0;
}

/* 🐽 Players Section */
.players-container {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.player {
  flex: 1;
  transition: all 0.3s ease;
}

/* USED IN JS -----------------------------------*/
.player--active {
  transform: scale(1.05);
}

.player--active .player-card {
  background: var(--green-light);
  box-shadow: 0 0 20px rgba(255, 182, 193, 0.5);
}

.player--1 {
  transform: scale(1.05);
}

.player--1 .player-card {
  background: var(--green-light);
  box-shadow: 0 0 20px rgba(255, 182, 193, 0.5);
}
/* ------------------------------------------------ */

.player-card {
  background: white;
  border-radius: 20px;
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.player-name {
  font-family: "Baloo 2", cursive;
  color: var(--pink-dark);
  margin-bottom: 15px;
  font-size: 1.8rem;
}

.player-score {
  font-size: 4rem;
  font-weight: bold;
  color: var(--pink-dark);
  margin: 15px 0;
}

.current-box {
  background: var(--pink-medium);
  color: white;
  border-radius: 10px;
  padding: 10px;
  margin-top: 20px;
}

.current-box p {
  margin: 5px 0;
  font-weight: bold;
}

.current-score {
  font-size: 2rem;
}

/* 🎲 Game Controls */
.game-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 0 20px;
}

.btn {
  background: var(--pink-medium);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 12px 25px;
  font-family: "Baloo 2", cursive;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn:hover {
  background: var(--pink-dark);
  transform: translateY(-3px);
}

.btn:active {
  transform: translateY(1px);
}

.dice-container {
  position: relative;
  margin: 20px 0;
}

.dice {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.2));
}

.dice-shadow {
  position: absolute;
  bottom: -10px;
  left: 10%;
  width: 80%;
  height: 20px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  filter: blur(5px);
  z-index: -1;
}

/* 🐷 Adorable Piggy Avatars */
.piggy-avatar {
  width: 100px;
  height: 100px;
  margin: 0 auto 15px;
  position: relative;
}

.piggy-face {
  width: 80px;
  height: 80px;
  background: var(--piggy-pink);
  border-radius: 50%;
  position: relative;
  margin: 0 auto;
}

.piggy-ear {
  width: 30px;
  height: 30px;
  background: var(--piggy-pink);
  border-radius: 50%;
  position: absolute;
  top: -10px;
}

.piggy-ear-left {
  left: -10px;
  transform: rotate(-20deg);
}

.piggy-ear-right {
  right: -10px;
  transform: rotate(20deg);
}

.piggy-snout {
  width: 40px;
  height: 30px;
  background: var(--piggy-nose);
  border-radius: 50%;
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
}

.piggy-eye {
  width: 10px;
  height: 10px;
  background: black;
  border-radius: 50%;
  position: absolute;
  top: 30px;
}

.piggy-eye-left {
  left: 20px;
}

.piggy-eye-right {
  right: 20px;
}

/* 🏆 Winner Animation */
.player--winner .piggy-face {
  animation: celebrate 0.5s infinite alternate;
}

@keyframes celebrate {
  0% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(5deg);
  }
  50% {
    transform: rotate(0deg);
  }
  75% {
    transform: rotate(-5deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

/* 📱 Responsive Design */
@media (max-width: 768px) {
  .players-container {
    flex-direction: column;
  }

  .game-controls {
    flex-direction: row;
    flex-wrap: wrap;
    margin: 20px 0;
  }

  .btn {
    padding: 10px 15px;
    font-size: 1rem;
  }
}

/* 📜 Instructions Section */
.instructions {
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 15px;
  padding: 15px;
  box-shadow: var(--shadow);
}

.instructions details {
  cursor: pointer;
}

.instructions summary {
  font-family: "Baloo 2", cursive;
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--pink-dark);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.instructions ol {
  padding-left: 20px;
}

.instructions li {
  margin-bottom: 10px;
  line-height: 1.5;
}

.instructions strong {
  color: var(--pink-dark);
}

/* 👑 Winner Crown - Precise Positioning */
.player-crown {
  position: absolute;
  top: -20px; /* Adjust this value to position above player name */
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.8rem;
  color: gold;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
  z-index: 10;
  display: none;
  animation: glow 1.5s infinite alternate;
}

/* Make player-card a positioning context */
.player-card {
  position: relative;
  /* Keep all your existing styles */
}

/* Glow Animation */
@keyframes glow {
  0% {
    transform: translateX(-50%) scale(1);
    opacity: 0.8;
  }
  50% {
    transform: translateX(-50%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 0.8;
  }
}

/* 👑 Winner Effects */
.player--winner {
  position: relative;
}

/* Crown above player name */
.player-crown {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.8rem;
  color: gold;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
  z-index: 10;
  display: none;
  animation: glow 1.5s infinite alternate;
}

/* Winner symbol in corner */
.winner-symbol {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 2.5rem;
  color: gold;
  display: none;
  z-index: 10;
  animation: bounce 0.5s infinite alternate;
}

/* Combined animations */
@keyframes glow {
  0% {
    transform: translateX(-50%) scale(1);
    opacity: 0.8;
  }
  50% {
    transform: translateX(-50%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 0.8;
  }
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* Enhanced pig celebration */
.player--winner .piggy-face {
  animation: celebrate 0.5s infinite alternate, bounce 0.5s infinite alternate;
}
