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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
    sans-serif;
  background: linear-gradient(135deg, hsl(259, 100%, 65%), hsl(262, 83%, 58%));
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  color: hsl(210, 40%, 98%);
}

.game-container {
  max-width: 64rem;
  width: 100%;
  background: linear-gradient(
    135deg,
    hsl(210, 40%, 98%, 0.1),
    hsl(210, 40%, 98%, 0.05)
  );
  backdrop-filter: blur(10px);
  border: 1px solid hsl(210, 40%, 98%, 0.18);
  box-shadow: 0 8px 32px hsl(220, 25%, 8%, 0.37);
  border-radius: 1.5rem;
  padding: 2rem;
  text-align: center;
}

.title {
  font-size: 3rem;
  font-weight: bold;
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stats-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stat-card {
  background: hsl(220, 25%, 10%, 0.2);
  backdrop-filter: blur(4px);
  border-radius: 0.75rem;
  padding: 1rem;
  min-width: 120px;
}

.stat-value {
  font-size: 1.875rem;
  font-weight: bold;
  color: hsl(210, 40%, 98%);
}

.stat-label {
  font-size: 0.875rem;
  color: hsl(215, 20.2%, 65.1%);
}

.light-display {
  font-size: 2.25rem;
  font-weight: bold;
  margin-bottom: 2rem;
  padding: 1.5rem 2rem;
  border-radius: 1rem;
  border: 2px solid transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: hsl(220, 25%, 10%);
}

.light-green {
  background: linear-gradient(135deg, hsl(142, 71%, 45%), hsl(142, 71%, 35%));
  box-shadow: 0 0 30px hsl(142, 71%, 45%, 0.4);
  animation: pulse-green 2s infinite;
}

.light-red {
  background: linear-gradient(135deg, hsl(0, 72%, 51%), hsl(0, 72%, 41%));
  box-shadow: 0 0 30px hsl(0, 72%, 51%, 0.4);
  animation: pulse-red 2s infinite;
}

.game-over {
  background: linear-gradient(135deg, hsl(0, 72%, 51%), hsl(0, 72%, 41%));
  animation: shake 0.5s ease-in-out;
}

@keyframes pulse-green {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 20px hsl(142, 71%, 45%, 0.5);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 30px hsl(142, 71%, 45%, 0.8);
  }
}

@keyframes pulse-red {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 20px hsl(0, 72%, 51%, 0.5);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 30px hsl(0, 72%, 51%, 0.8);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

@keyframes countdown-pulse {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.game-button {
  background: linear-gradient(135deg, hsl(0, 72%, 51%), hsl(0, 72%, 51%, 0.8));
  color: white;
  border: none;
  padding: 1rem 2rem;
  font-size: 1.25rem;
  border-radius: 9999px;
  margin-bottom: 2rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px hsl(0, 72%, 51%, 0.3);
  font-weight: 500;
}

.game-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px hsl(0, 72%, 51%, 0.4);
}

.game-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.webcam-container {
  position: relative;
  display: inline-block;
  margin-bottom: 2rem;
}

.webcam-video {
  border-radius: 1rem;
  border: 4px solid hsl(210, 40%, 98%, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  background: hsl(220, 25%, 10%, 0.1);
  max-width: 100%;
  height: auto;
}

.movement-indicator {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
}

.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown-circle {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 3.75rem;
  font-weight: bold;
  border-radius: 50%;
  width: 6rem;
  height: 6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: countdown-pulse 1s ease-in-out;
}

.status-display {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.5rem;
  background: hsl(220, 25%, 10%, 0.1);
  border-radius: 0.75rem;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.debug-container {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.debug-item {
  background: rgba(0, 0, 0, 0.3);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
}

.fallback-message {
  background: rgba(255, 255, 0, 0.1);
  border: 2px solid #ffd700;
  border-radius: 1rem;
  padding: 1.5rem;
  margin: 2rem 0;
  color: #ffd700;
}

@media (max-width: 768px) {
  .title {
    font-size: 2rem;
  }

  .light-display {
    font-size: 1.5rem;
    padding: 1rem;
  }

  .stats-container {
    gap: 0.5rem;
  }
}
