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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.game-wrapper {
  max-width: 900px;
  width: 100%;
}

.game-header {
  background: rgba(255, 255, 255, 0.95);
  padding: 1rem 1.5rem;
  border-radius: 15px 15px 0 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game-header h1 {
  font-size: 1.8rem;
  color: #e53e3e;
  margin: 0;
}

.back-btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 8px;
  background: #48bb78;
  color: white;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.back-btn:hover {
  background: #38a169;
  transform: translateY(-2px);
}

.game-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 0 0 15px 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.game-ui {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(229, 62, 62, 0.1);
}

.stat {
  text-align: center;
}

.label {
  display: block;
  font-size: 0.85rem;
  color: #666;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.value {
  display: block;
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
}

.value.combo {
  color: #f6ad55;
}

.value.lives {
  font-size: 1.2rem;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 450px;
  background: #1a202c;
  cursor: crosshair;
}

.legend {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 1rem;
  background: rgba(229, 62, 62, 0.1);
}

.legend-item {
  font-weight: 600;
  font-size: 0.9rem;
}

.legend-item.bad {
  color: #e53e3e;
}

.legend-item.good {
  color: #48bb78;
}

.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.game-overlay.hidden {
  display: none;
}

.overlay-content {
  background: white;
  padding: 2rem;
  border-radius: 15px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  animation: slideUp 0.4s ease;
}

.overlay-content h2 {
  color: #e53e3e;
  margin-bottom: 1rem;
  font-size: 2rem;
}

.overlay-content p {
  color: #666;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.instructions {
  background: rgba(229, 62, 62, 0.1);
  padding: 1rem;
  border-radius: 10px;
  margin: 1rem 0;
  text-align: left;
}

.instructions h3 {
  color: #e53e3e;
  margin-bottom: 0.5rem;
}

.instructions p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.game-btn {
  padding: 0.8rem 2rem;
  border: none;
  border-radius: 10px;
  background: #e53e3e;
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0.5rem;
}

.game-btn:hover {
  background: #c53030;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(229, 62, 62, 0.4);
}

.final-stats {
  background: rgba(229, 62, 62, 0.1);
  padding: 1.5rem;
  border-radius: 10px;
  margin: 1rem 0;
}

.final-stats p {
  font-size: 1.1rem;
  color: #333;
  margin: 0.5rem 0;
}

.final-stats span {
  color: #e53e3e;
  font-weight: bold;
  font-size: 1.3rem;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .game-ui {
    grid-template-columns: repeat(2, 1fr);
  }

  .legend {
    flex-direction: column;
    gap: 0.5rem;
  }
}
