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

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Segoe UI', Arial, sans-serif;
  overflow: hidden;
  transition: transform 0.1s ease;
  position: relative;
}

/* Animated background */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.3) 0%, transparent 50%);
  animation: backgroundShift 10s ease-in-out infinite;
  z-index: -1;
}

@keyframes backgroundShift {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.1) rotate(1deg); }
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 1rem;
  width: 100%;
  max-width: 600px;
}

/* Screen shake effect */
body.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Confetti styles */
.confetti {
  position: fixed;
  width: 8px;
  height: 8px;
  background: #ff5c5c;
  animation: confettiFall 3s linear forwards;
  z-index: 1001;
  pointer-events: none;
  border-radius: 50%;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg) scale(0);
    opacity: 1;
  }
  10% {
    transform: translateY(-90vh) rotate(72deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg) scale(0);
    opacity: 0;
  }
}

.btn {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  padding: clamp(1rem, 3vw, 2rem) clamp(2rem, 6vw, 4rem);
  border: none;
  border-radius: 20px;
  background: linear-gradient(45deg, #ff5c5c, #ff8c00);
  color: #fff;
  cursor: pointer;
  box-shadow: 
    0 10px 30px rgba(0,0,0,0.3),
    0 0 0 0 rgba(255, 92, 92, 0.7);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1000;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  overflow: hidden;
  min-width: 200px;
  max-width: 90vw;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:active {
  transform: scale(0.95);
  box-shadow: 
    0 5px 15px rgba(0,0,0,0.4),
    0 0 0 0 rgba(255, 92, 92, 0.7);
}

/* Button personality styles */
.btn.happy {
  animation: bounce 0.6s ease-in-out;
  background: linear-gradient(45deg, #4caf50, #8bc34a);
  box-shadow: 0 10px 30px rgba(76, 175, 80, 0.4);
}

.btn.sad {
  animation: droop 0.6s ease-in-out;
  background: linear-gradient(45deg, #4a90e2, #2196f3);
  transform: scale(0.95);
  box-shadow: 0 10px 30px rgba(74, 144, 226, 0.4);
}

.btn.angry {
  animation: shake 0.5s ease-in-out;
  background: linear-gradient(45deg, #ff1f1f, #ff5722);
  box-shadow: 0 10px 30px rgba(255, 31, 31, 0.4);
}

.btn.excited {
  animation: pulse 0.5s ease-in-out infinite;
  background: linear-gradient(45deg, #ff8c00, #ff9800);
  box-shadow: 0 10px 30px rgba(255, 140, 0, 0.4);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

@keyframes droop {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(0.9) rotate(-2deg); }
  100% { transform: scale(0.95) rotate(0deg); }
}

/* Game mode styles */
.btn.game-mode {
  background: linear-gradient(45deg, #ff5c5c, #ff8c00, #ff5c5c);
  background-size: 200% 200%;
  animation: gradientShift 2s ease infinite, float 3s ease-in-out infinite;
  box-shadow: 0 10px 30px rgba(255, 92, 92, 0.4);
}

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

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

.message {
  color: #fff;
  font-size: clamp(1rem, 3vw, 1.5rem);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  background: rgba(0, 0, 0, 0.8);
  padding: 1rem 2rem;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  max-width: 90vw;
  word-wrap: break-word;
}

.message.visible {
  opacity: 1;
  animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
  0% { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Stats display */
.stats {
  display: flex;
  gap: 2rem;
  color: #fff;
  font-size: clamp(0.8rem, 2.5vw, 1rem);
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 998;
}

.press-count, .mood-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Evolution phase styles */
.btn.evolving {
  animation: pulse 0.5s ease-in-out, glow 0.5s ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 10px 30px rgba(255, 92, 92, 0.4); }
  50% { box-shadow: 0 10px 30px rgba(255, 92, 92, 0.8), 0 0 20px rgba(255, 92, 92, 0.6); }
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .container {
    gap: 1.5rem;
    padding: 0.5rem;
  }
  
  .btn {
    min-width: 150px;
    padding: 1rem 2rem;
  }
  
  .stats {
    flex-direction: column;
    gap: 0.5rem;
    bottom: 10px;
    padding: 0.5rem;
  }
  
  .message {
    top: 10px;
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .btn {
    font-size: 1.2rem;
    padding: 0.8rem 1.5rem;
    min-width: 120px;
  }
  
  .stats {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .btn:hover::before {
    left: -100%;
  }
  
  .btn:active::before {
    left: 100%;
  }
}
