Fixed: Mouse position is now correctly calculated relative to the viewport (independent of camera scroll), preventing the edge-detection zone from drifting during scrolling. Fixed: Cursor positions outside the visible canvas (e.g. on letterbox black bars) are now clamped to the viewport bounds, so edge scrolling continues to work correctly when the mouse moves past the game area.