how to set limit on camera rotation

hi i am trying to make my cam rotate around the x with the mouse but my problem is that i can rotate 360
and i want to set limit on rotationthnx in advance
the code

  mousey += Input.GetAxis("Mouse X");
        mousex -= Input.GetAxis("Mouse Y");
        player.transform.eulerAngles = new Vector3(0, mousey, 0);
        Cursor.lockState = CursorLockMode.Locked;
        
        if (camm.transform.rotation.x <= 35 && camm.transform.rotation.x >= -90)
        {
            camm.transform.rotation = transform.rotation * Quaternion.Euler(mousex, 0, 0);
        }

You could use the Mathf.Clamp function, that locks a value between two bounds. Something like this:

mousey += Input.GetAxis("Mouse X");
mousex -= Input.GetAxis("Mouse Y");
mousex = Mathf.Clamp(mousex, -90, 35);
player.transform.eulerAngles = new Vector3(mouseX, mousey, 0);
Cursor.lockState = CursorLockMode.Locked;

It Can Help You