You can create a non-activating overlay window (an NSPanel with .nonactivatingPanel) so it stays visible but doesn’t receive input letting other apps stay focused while your UI sits on top
Then use a CGEventTap at the system level with Accessibility permissions to intercept and drop keyboard and mouse events before they reach any app.