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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0C0D14;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #E0E0E0;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* HUD */
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
}

.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 420px;
  background: rgba(12, 13, 20, 0.7);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 10px 20px;
  pointer-events: auto;
}

.game-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: 0.02em;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #666;
  font-weight: 600;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
}

.new-game-btn {
  pointer-events: auto;
  padding: 10px 28px;
  border: 2px solid rgba(124, 77, 255, 0.5);
  border-radius: 12px;
  background: rgba(12, 13, 20, 0.7);
  backdrop-filter: blur(8px);
  color: #7C4DFF;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}

.new-game-btn:hover {
  background: #7C4DFF;
  color: #FFFFFF;
  box-shadow: 0 2px 16px rgba(124, 77, 255, 0.4);
}

/* Win Overlay */
.win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 13, 20, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 100;
}

.win-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.win-modal {
  background: #1A1B26;
  border: 2px solid #7C4DFF;
  border-radius: 20px;
  padding: 40px 56px;
  text-align: center;
  box-shadow: 0 0 60px rgba(124, 77, 255, 0.3);
  transform: scale(0.85);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.win-overlay.visible .win-modal {
  transform: scale(1);
}

.win-modal h2 {
  font-size: 2rem;
  color: #7C4DFF;
  margin-bottom: 20px;
}

.win-stats {
  display: flex;
  gap: 32px;
  justify-content: center;
  margin-bottom: 28px;
}

.win-stats p {
  font-size: 1.1rem;
  color: #AAA;
}

.win-stats span {
  color: #FFFFFF;
  font-weight: 700;
}

.play-again-btn {
  padding: 12px 36px;
  border: none;
  border-radius: 12px;
  background: #7C4DFF;
  color: #FFFFFF;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.play-again-btn:hover {
  background: #9B7BFF;
  box-shadow: 0 4px 20px rgba(124, 77, 255, 0.5);
}

/* Responsive */
@media (max-width: 500px) {
  .hud {
    padding: 10px;
  }

  .hud-top {
    padding: 8px 14px;
  }

  .game-title {
    font-size: 1rem;
  }

  .stat-value {
    font-size: 1.1rem;
  }

  .new-game-btn {
    padding: 8px 22px;
    font-size: 0.8rem;
  }

  .win-modal {
    padding: 28px 32px;
  }

  .win-modal h2 {
    font-size: 1.5rem;
  }

  .win-stats {
    gap: 20px;
  }
}

@media (max-height: 500px) {
  .hud-top {
    padding: 6px 14px;
    border-radius: 10px;
  }

  .game-title {
    font-size: 0.9rem;
  }

  .stat-value {
    font-size: 1rem;
  }

  .new-game-btn {
    margin-bottom: 4px;
    padding: 6px 18px;
  }
}
