* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@keyframes rainbow-bg {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes star-twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

body {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  background: linear-gradient(
    135deg,
    #667eea 0%,
    #764ba2 25%,
    #f093fb 50%,
    #4facfe 75%,
    #00f2fe 100%
  );
  background-size: 400% 400%;
  animation: rainbow-bg 15s ease infinite;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  overflow: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20% 30%, white, transparent),
    radial-gradient(2px 2px at 60% 70%, white, transparent),
    radial-gradient(1px 1px at 50% 50%, white, transparent),
    radial-gradient(1px 1px at 80% 10%, white, transparent),
    radial-gradient(2px 2px at 90% 60%, white, transparent),
    radial-gradient(1px 1px at 33% 80%, white, transparent),
    radial-gradient(2px 2px at 70% 40%, white, transparent);
  background-size: 200% 200%;
  animation: star-twinkle 3s ease-in-out infinite;
  pointer-events: none;
}

.game-container {
  background: rgba(255, 255, 255, 0.95);
  border: 8px solid #ff6b9d;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 
    0 0 0 4px #feca57,
    0 0 0 8px #48dbfb,
    0 0 0 12px #ff9ff3,
    0 20px 40px rgba(0, 0, 0, 0.3);
  max-width: 900px;
  width: 100%;
  position: relative;
}

.game-container::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  background: linear-gradient(
    45deg,
    #ff6b9d,
    #feca57,
    #48dbfb,
    #ff9ff3,
    #ff6b9d
  );
  background-size: 300% 300%;
  animation: rainbow-bg 3s ease infinite;
  border-radius: 24px;
  z-index: -1;
  filter: blur(8px);
}

.header {
  text-align: center;
  margin-bottom: 25px;
}

h1 {
  background: linear-gradient(
    90deg,
    #ff6b9d,
    #feca57,
    #48dbfb,
    #ff9ff3,
    #ff6b9d
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: rainbow-bg 3s linear infinite;
  font-size: 2em;
  text-shadow: 
    4px 4px 0 rgba(255, 107, 157, 0.3),
    2px 2px 0 rgba(254, 202, 87, 0.3);
  margin-bottom: 20px;
  letter-spacing: 4px;
}

.score-board {
  display: flex;
  justify-content: space-around;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  border-radius: 12px;
  border: 4px solid #ff9ff3;
  box-shadow: 
    0 4px 0 #ff6b9d,
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

.score, .high-score {
  color: #fff;
  font-size: 0.9em;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.score span, .high-score span {
  color: #feca57;
  display: block;
  margin-top: 8px;
  font-size: 1.3em;
  text-shadow: 
    2px 2px 0 #ff6b9d,
    0 0 10px #feca57;
}

#gameCanvas {
  display: block;
  margin: 0 auto;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  border: 6px solid #ff9ff3;
  border-radius: 12px;
  box-shadow: 
    0 0 0 3px #feca57,
    0 0 0 6px #48dbfb,
    inset 0 0 50px rgba(255, 255, 255, 0.1);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.controls {
  text-align: center;
  margin-top: 25px;
  color: #667eea;
  font-size: 0.7em;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.controls p {
  margin: 8px 0;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(102, 126, 234, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: rgba(255, 255, 255, 0.98);
  padding: 50px;
  border-radius: 20px;
  border: 8px solid #ff6b9d;
  box-shadow: 
    0 0 0 4px #feca57,
    0 0 0 8px #48dbfb,
    0 20px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 600px;
  width: 90%;
  animation: modalSlideIn 0.5s ease-out;
}

@keyframes modalSlideIn {
  from { 
    transform: translateY(-100px);
    opacity: 0;
  }
  to { 
    transform: translateY(0);
    opacity: 1;
  }
}

.modal h2 {
  background: linear-gradient(
    90deg,
    #ff6b9d,
    #feca57,
    #48dbfb,
    #ff9ff3,
    #ff6b9d
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: rainbow-bg 3s linear infinite;
  font-size: 2.5em;
  margin-bottom: 30px;
  text-shadow: 
    4px 4px 0 rgba(255, 107, 157, 0.2),
    2px 2px 0 rgba(254, 202, 87, 0.2);
}

.modal p {
  color: #667eea;
  font-size: 1em;
  margin: 15px 0;
}

.modal #finalScore {
  color: #ff6b9d;
  font-size: 1.5em;
  text-shadow: 2px 2px 0 #feca57;
}

.breed-selection {
  margin: 30px 0;
}

.breed-selection h3 {
  color: #667eea;
  font-size: 1.2em;
  margin-bottom: 25px;
  text-shadow: 2px 2px 0 rgba(72, 219, 251, 0.3);
}

.breed-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.breed-option {
  background: #fff;
  border: 4px solid #48dbfb;
  border-radius: 12px;
  padding: 20px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: 0 4px 0 #ff9ff3;
}

.breed-option:hover {
  border-color: #feca57;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #ff6b9d;
}

.breed-option:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #ff6b9d;
}

.breed-option.selected {
  border-color: #ff6b9d;
  box-shadow: 
    0 4px 0 #feca57,
    0 0 20px rgba(255, 107, 157, 0.5);
  background: linear-gradient(135deg, #fff 0%, #fff5f8 100%);
}

.breed-preview {
  width: 60px;
  height: 60px;
  margin: 0 auto 15px;
  position: relative;
}

.breed-name {
  color: #667eea;
  font-size: 0.7em;
  margin-top: 10px;
}

.start-button {
  background: linear-gradient(135deg, #ff6b9d 0%, #ff9ff3 100%);
  color: #fff;
  border: none;
  padding: 20px 50px;
  font-size: 1.2em;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 
    0 6px 0 #feca57,
    0 10px 20px rgba(255, 107, 157, 0.4);
  transition: all 0.2s ease;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.start-button:hover {
  background: linear-gradient(135deg, #ff9ff3 0%, #ff6b9d 100%);
  transform: translateY(-2px);
  box-shadow: 
    0 8px 0 #feca57,
    0 12px 24px rgba(255, 107, 157, 0.5);
}

.start-button:active {
  transform: translateY(4px);
  box-shadow: 
    0 2px 0 #feca57,
    0 4px 8px rgba(255, 107, 157, 0.3);
}

.hidden {
  display: none;
}

@media (max-width: 600px) {
  h1 {
    font-size: 1.3em;
  }
  
  .score-board {
    flex-direction: column;
    gap: 15px;
  }
  
  .breed-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .modal {
    padding: 30px 20px;
  }
  
  .modal h2 {
    font-size: 1.8em;
  }
  
  .start-button {
    padding: 15px 30px;
    font-size: 1em;
  }
}
