/* Add Google Fonts for a cartoon look */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&display=swap');

/* Reset body margin and padding */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Fredoka One', 'Baloo 2', Arial, sans-serif;
  background: #f9e7fe;
  /* Cartoon polka-dot pattern */
  background-image: radial-gradient(circle at 20px 20px, #ffe066 8px, transparent 9px),
    radial-gradient(circle at 60px 60px, #ffb6b9 7px, transparent 8px),
    radial-gradient(circle at 100px 100px, #b5ead7 6px, transparent 7px);
  background-size: 120px 120px;
}

#header {
  width: 100%;
  height: 10vh;
  min-height: 64px;
  background: #fffbe7;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  font-size: 2rem;
  border-bottom: 6px solid #ffe066;
  position: relative;
  z-index: 2;
  box-shadow: 0 4px 16px #ffe06655;
  outline: 4px solid #7c4dff;
  outline-offset: -8px;
}

#colorName {
  font-size: 2.5rem;
  font-weight: bold;
  letter-spacing: 2.5px;
  color: #7c4dff;
  text-shadow: 2px 3px 0 #fff176, 0 2px 12px #fff17644, 2px 2px 0 #2222;
}

#scoreLives {
  font-size: 1.5rem;
  color: #43a047;
  font-weight: bold;
  text-shadow: 1px 2px 0 #fff176;
}

#gameArea {
  position: relative;
  width: 100vw;
  height: 90vh;
  overflow: hidden;
  background: transparent;
}

.colorShape {
  position: absolute;
  width: 18vw;
  height: 18vw;
  min-width: 70px;
  min-height: 70px;
  max-width: 130px;
  max-height: 130px;
  border-radius: 50%;
  border: 7px solid #fffbe7;
  box-shadow: 0 8px 32px #2222, 0 0 0 8px #ffe066;
  outline: 4px solid #7c4dff;
  outline-offset: 0px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(.68,-0.55,.27,1.55), box-shadow 0.18s;
  will-change: transform;
  animation: bounceIn 0.5s cubic-bezier(.68,-0.55,.27,1.55);
}
.colorShape:active, .colorShape:focus {
  transform: scale(0.88) rotate(-8deg);
  box-shadow: 0 2px 8px #2228, 0 0 0 8px #ffe066;
  filter: brightness(1.13) saturate(1.3);
  animation: wobble 0.2s;
}
@keyframes bounceIn {
  0% { transform: scale(0.5); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
@keyframes wobble {
  0% { transform: scale(0.95) rotate(-4deg); }
  50% { transform: scale(1.05) rotate(8deg); }
  100% { transform: scale(0.88) rotate(-8deg); }
}

.overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(255, 224, 102, 0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  font-family: 'Fredoka One', 'Baloo 2', Arial, sans-serif;
  outline: 5px solid #7c4dff;
  outline-offset: -10px;
  box-shadow: 0 8px 32px #7c4dff33;
}

.hidden { display: none; }

#gameOverBox {
  background: #fffbe7;
  padding: 2.5rem 2rem 2rem 2rem;
  border-radius: 2rem;
  text-align: center;
  min-width: 260px;
  box-shadow: 0 8px 32px #ffb6b955;
  border: 5px solid #ffb6b9;
  outline: 4px solid #7c4dff;
  outline-offset: 0px;
}
#gameOverBox h1 {
  margin-bottom: 1.2rem;
  font-size: 2.7rem;
  color: #e74c3c;
  text-shadow: 2px 3px 0 #fff176, 0 2px 12px #fff17644, 2px 2px 0 #2222;
}
#gameOverBox p {
  font-size: 1.5rem;
  color: #7c4dff;
  margin-bottom: 1.2rem;
}
#playAgainBtn, #startBtn {
  margin-top: 1.2rem;
  padding: 1.1rem 2.7rem;
  font-size: 1.5rem;
  border: 4px solid #7c4dff;
  border-radius: 1.2rem;
  background: linear-gradient(90deg, #ffb6b9 60%, #ffe066 100%);
  color: #7c4dff;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, transform 0.13s;
  box-shadow: 0 4px 16px #ffb6b955;
  letter-spacing: 1.5px;
}
#playAgainBtn:hover, #startBtn:hover {
  background: linear-gradient(90deg, #ffe066 60%, #ffb6b9 100%);
  color: #e74c3c;
  transform: scale(1.09);
}

#startButton {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.2rem;
  color: #333;
  cursor: pointer;
  user-select: none;
  padding: 1.2rem 2.5rem;
  background: #fffbe7;
  border: 3px solid #ffe066;
  border-radius: 0.7rem;
  box-shadow: 0 2px 8px #ffe06655;
  transition: all 0.2s ease;
}
#startButton:hover {
  background: #fffde7;
  transform: translate(-50%, -50%) scale(1.07);
}

/* Responsive tweaks for mobile */
@media (max-width: 600px) {
  #header {
    font-size: 1.2rem;
    min-height: 48px;
    padding: 0 0.7rem;
  }
  #colorName {
    font-size: 1.5rem;
  }
  #scoreLives {
    font-size: 1.1rem;
  }
  .colorShape {
    min-width: 48px;
    min-height: 48px;
    max-width: 80px;
    max-height: 80px;
    border-width: 5px;
    outline-width: 3px;
  }
  #gameOverBox {
    min-width: 160px;
    padding: 1.2rem 0.7rem 1rem 0.7rem;
    border-width: 3px;
    outline-width: 2px;
  }
  #gameOverBox h1 {
    font-size: 1.5rem;
  }
  #playAgainBtn, #startBtn {
    font-size: 1.1rem;
    padding: 0.7rem 1.2rem;
    border-width: 3px;
  }
}
