 (!state.buffer) return;
          state.buffer = state.buffer.slice(0, -1);
          const target = state.words.find(w => w.id === state.targetId);
          if (target) target.typed = Math.min(target.typed, state.buffer.length);
          setTargetByBuffer();
          updateHUD();
        }

        function completeWord(word) {
          state.score += Math.round(word.text.length * (1 + (state.level - 1) * 0.15));
          levelUpIfNeeded();
          const idx = state.words.findIndex(w => w.id === wo