Aimable reticle using mouse which has limited degrees

I’m basically making something for aiming both starfighter rotation and cannon facing direction. I want it to be limited to, say, 10 degrees no matter your screen resolution. My current implementation gives you a wider firing range the lower your screen size. For ship rotation, I simply divided by 100 (the max pixel radius) but for cannon firing, this will not fire in the expected direction because the reticle may be farther than it actually fires. Is there a way to calculate what the pixel radius should be based on the resolution? Or maybe an even better way to do the whole thing?

        int centerX = Screen.width / 2;
        int centerY = Screen.height / 2;
        var center = new Vector3(centerX, centerY, 0);
        var mouse = Input.mousePosition;
        if (mouse != _lastMousePosition && _joystick)
        {
            _lastMousePosition = mouse;
            _joystick = false;
        }

        if (Input.GetAxis("Joystick Y") != 0 || Input.GetAxis("Joystick X") != 0) _joystick = true;

        if (_joystick)
        {
            Cursor.visible = false;
            Cursor.lockState = CursorLockMode.None;
            _offset.x = Input.GetAxis("Joystick X") * 100;
            _offset.y = Input.GetAxis("Joystick Y") * 100;
        }
        else
        {
            Cursor.visible = true;
            Cursor.lockState = CursorLockMode.None;
            _offset = mouse - center;
            if (Vector3.Distance(_offset, Vector3.zero) < 10) _offset = Vector3.zero;
        }
        if (Vector3.Distance(_offset, Vector3.zero) > 100) _offset = _offset.normalized * 100;
        var direction = Camera.main.ScreenPointToRay(_offset + center).direction;
        var directionRotation = Quaternion.LookRotation(direction);

Not sure if this will help, but if you use, gameObject.transform.rotation.eulerAngles.z <= 90).
The “z” designates the axis you want to check for angle height, so you can make it y , x, or z. If you use this with an “if” statement you can make sure that the cursor only goes to the desired height. I am sorry I do not have all the code for you but hopefully this will suffice. Best of luck!