Explain how debouncing works in the context of a web UI, and relate it to relevant CSS concepts you’ve used.
Implement a trailing-edge debounce simulator for timestamped UI events. Given events sorted by time and a wait interval, return the emitted events after the input stream ends. An event arriving at or before the pending deadline replaces the pending event. Use debounce_events(events, wait), where each event is [timestamp, value] and the result has the same shape.
def debounce_events(events, wait):