First-person camera script for space game jitters when rotating diagonally

I am working on a first-person shooter that is set in space. Since its set in space, the characters must be able to rotate in 2 directions at once. Currently, I am using 2 transform.rotates which causes my character to jitter whenever you try to move horizontally and vertically.

Edit: my current idea is to combine the two-axis(x and y) into one rotation

public float mouseSensitivity = 100f; public float xRotation = 0f;  // Start is called before the first frame update void Start() {     Cursor.lockState = CursorLockMode.Locked; }  // Update is called once per frame void FixedUpdate() {     //horizontal     float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;     this.transform.Rotate(Vector3.up, mouseX);     print(mouseX);     //vertical     float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;     xRotation -= mouseY;     transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f); }