Typed) * 100 : 100;
          return Math.max(0, Math.min(100, acc));
        }

        function updateHUD() {
          scoreEl.textContent = state.score;
          levelEl.textContent = state.level;
          accEl.textContent = accuracy().toFixed(0) + '%';
          livesEl.textContent = state.lives;
        }

        function resetGame() {
          state.running = false; state.paused = false;
          state.lastTime = 0; state.elapsed = 0;
          state.score = 0; state.level = 1; state.lives = 3;