I pressed P and I don't know what happened
P used to be the key to start game mode.  I think they unbound it in recent versions to prevent people from having this problem.  (yes, I also fell victim to that once; and the Shift+Space toggle).

I agree with all the comments suggesting the Esc key as a possible remedy.  (although it won't get you back from Shift+Space; another Shift+Space does).