Description: Wrap saveGlobalState() in a debounce function to avoid excessive localStorage writes, improving performance on high input activity.