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

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a1a3e 0%, #0a0a1a 100%);
  font-family: 'Segoe UI', Tahoma, sans-serif;
  color: #e0e8ff;
}

.game-wrapper {
  position: relative;
  border: 2px solid #4a6cf7;
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(74, 108, 247, 0.4);
  overflow: hidden;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(10, 15, 40, 0.95);
  border-bottom: 1px solid #4a6cf7;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.label {
  font-size: 0.85rem;
  color: #8899cc;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#score {
  font-size: 1.4rem;
  font-weight: bold;
  color: #ffd700;
  min-width: 40px;
}

#level {
  font-size: 1.4rem;
  font-weight: bold;
  color: #44ddff;
  min-width: 24px;
}

.health-bar {
  width: 120px;
  height: 14px;
  background: #2a2a4a;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid #4a6cf7;
}

.health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff4444, #44ff88);
  border-radius: 6px;
  transition: width 0.2s ease;
}

#health-text {
  font-size: 1rem;
  font-weight: bold;
  color: #44ff88;
  min-width: 30px;
}

#gameCanvas {
  display: block;
  background: #050510;
  cursor: crosshair;
}

.level-up {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  font-weight: bold;
  color: #44ddff;
  text-shadow: 0 0 30px rgba(68, 221, 255, 0.9), 0 0 60px rgba(74, 108, 247, 0.6);
  pointer-events: none;
  z-index: 10;
  animation: levelUpAnim 1.5s ease-out forwards;
}

.level-up.hidden {
  display: none;
}

@keyframes levelUpAnim {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(1);
  }
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 20, 0.85);
  backdrop-filter: blur(4px);
}

.overlay.hidden {
  display: none;
}

.panel {
  text-align: center;
  padding: 40px;
  background: rgba(20, 25, 60, 0.95);
  border: 2px solid #4a6cf7;
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(74, 108, 247, 0.3);
  max-width: 90%;
}

.panel h1 {
  font-size: 2rem;
  margin-bottom: 16px;
  color: #fff;
  text-shadow: 0 0 20px rgba(74, 108, 247, 0.8);
}

.controls {
  font-size: 0.95rem;
  line-height: 2;
  color: #aab;
  margin-bottom: 12px;
}

.hint {
  font-size: 0.85rem;
  color: #7788aa;
  margin-bottom: 24px;
}

kbd {
  display: inline-block;
  padding: 2px 8px;
  background: #2a2a5a;
  border: 1px solid #4a6cf7;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85rem;
}

.final-score,
.final-level {
  font-size: 1.2rem;
  margin-bottom: 12px;
  color: #ffd700;
}

.final-level {
  color: #44ddff;
  margin-bottom: 24px;
}

.btn {
  padding: 12px 32px;
  font-size: 1.1rem;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(135deg, #4a6cf7, #6a3cf7);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(74, 108, 247, 0.6);
}

.btn:active {
  transform: scale(0.98);
}
