⚪ Good SSE reconnection logic with exponential backoff.
🟡 Retry counter resets on ANY message — A single heartbeat message resets _retryCount. If the server sends heartbeats but no real data, the client never gives up.
🔵 No data buffering — Each frame overwrites the previous. For replay/analysis, a ring buffer of recent frames would be valuable.
🟡 innerHTML += fallback for keyframe injection — Comment says "for test runners" but this re-parses the entire stylesheet on each call. The insertRule() primary path is correct.
🟡 _injectedKeyframes set grows forever — No cleanup when components unmount. Over long sessions, hundreds of keyframes accumulate.
🔵 Master sheet assumption — All coaches are assumed to be 10×10 grid spritesheets. No validation that the PNG actually matches.
🟡 play() returns a Promise that resolves after animation. If the animation CSS is missing or the element doesn't exist, the promise could hang forever. Add a timeout fallback.
🟡 No priority/exclusivity system — Multiple pages can register handlers simultaneously. When PauseMenu is open, the underlying page's handler still fires.
🔵 No key mapping abstraction — Hardcoded e.key === 'ArrowDown' everywhere. A central key-action mapping would allow rebinding.
🟡 clearTimeout and clearInterval mixed — sequenceTimeouts stores both timeout and interval IDs. clearTimeout works on intervals in most browsers but it's not spec-guaranteed.