Problem with the cursor

I am creating a 3D first-person game when you die you are supposed to go to the “you lose” screen and when you do there is a button “respawn” but when you want to press the button the cursor doesn’t move if you press ESC then the cursor does move but when you click the button the cursor disappears if you don’t understand the problem there is a link to a youtube video of that problem the problem - YouTube

you literally have to set the cursor state each time

Unlock the cursor with this line of code: Cursor.lockState = CursorLockMode.None;
Lock the cursor in place again: Cursor.lockState = CursorLockMode.Locked;

do you change your cursor lockstate and visibility after you lose?

Cursor.lockState = CursorLockMode.Confined;
Cursor.visible = true;

u can try adding these codes to your losing function