Press Space to continue not working.

Using multiple SDL_PollEvent loops is rarely a good idea because they “steal” events from each other (an event that is handled in one loop won’t get handled by the other loop). I guess it might be fine if you have two completely different “game states” that runs at different times and need to handle events completely different but that is rarely the case. Usually you have at least some events, like SDL_QUIT, SDL_WINDOWEVENT_SIZE_CHANGED or global keyboard shortcuts, that should always (or almost always) work the same regardless of the state of the game. For that reason it’s usually better to poll all events in one place, and then pass them down to other functions (which might depend on the game state) if necessary.