rd.id);
          if (idx >= 0) state.words.splice(idx, 1);
          state.buffer = '';
          state.targetId = null;
        }

        let missFlashT = 0;
        function flashMiss() { missFlashT = 160; }

        function loop() {
          if (!state.running) return;
          const now = performance.now();
          const dt = Math.min(50, now - state.lastTime);
          state.lastTime = now;
          if (!state.paused) update(dt);
          render(dt);
          if (!state.paused) requestAnimat