Oh it feels a little bit confusing that you can get upside down! Try limiting the angle rotation of the player when getting the mouse input back.
I thought it was fine to get upside down, I apologize if it ruined your gameplay. Thanks for playing though!