Airplane stalls when flying straight up/down

Hello! I wrote a very basic airplane control script that I will soon refine, but one major problem occurs. If you fly straight up or straight down, the plane gets locked and you can not move up and down, you can only spin. Any help would be greatly appreciated. The Z rotation is to simulate tilting btw.

private var speed = 150.0;
private var tspeed = 100.0;
	
function Update () {
var hor = Input.GetAxis("Horizontal");
var ver = Input.GetAxis("Vertical");
transform.Translate(Vector3.forward * Time.deltaTime * speed);
		transform.Rotate(ver * tspeed * Time.deltaTime, 0, 0);
		transform.Rotate(0, hor * tspeed * Time.deltaTime, 0, Space.World);
            transform.localEulerAngles.z = (45 * -hor);
}

Do you mean that you lose the ability to pitch (rotate) up/down? Or that the plane stops translating vertically?

Rotation axes

If your pitch locks, then it sounds like you might be experiencing Gimbal Lock due to working with the rotations in Euler angles. Any Euler angle system has points where two of the axes become collinear and you lose a degree of freedom.

If that sounds like it might explain your problem, I can show you an example using Quaternion math to avoid gimbal lock.