1) If I was praying and when I finished reading the second Surah I moved unintentionally (I can’t remain still) is my prayer invalid?

I then bowed like 40 degrees forward and then lifted my head because I wanted to recite again while being still, then realized maybe my prayer was invalid because I lifted up from 40 degrees bowing. I then bowed properly and continued my prayer.

Is my prayer valid?

1) No, as long as you didn’t turn away from the qiblah
2) if you did not reach the full extent of the ruk’u then the prayer is valid