How to set limits to a player rotating an object

For practice, I’m making a game which is like one of those maze games where you rotate the maze itself and direct a ball, avoiding holes. I’ve managed to allow the maze’s rotation to be controlled by the player. However, I can’t figure out how to stop the maze from rotating past 30 degrees.

Here’s my script that controls this:

using UnityEngine;
using System.Collections;

public class MazeController : MonoBehaviour {

	public GameObject maze;
	// Use this for initialization
	void Start () 
	{
	
	}

	void FixedUpdate () 
	{
		float rotateEW = Input.GetAxis("Vertical");
		float rotateNS = Input.GetAxis("Horizontal");
		if (maze.transform.rotation.x < 30.0)
		{
			maze.transform.Rotate(0.0f, 0.0f, rotateNS);
		}
		if (maze.transform.rotation.z < 30.0)
		{
			maze.transform.Rotate(rotateEW, 0.0f, 0.0f);
		}
	}
}

Do not directly set euler angles. Use quaternions instead.
Here is sample script. I hope you fnd is useful:

public class RotationTest : MonoBehaviour {

    float xangle;
    float zangle;
	// Update is called once per frame
	void Update ()
    {
        zangle += Input.GetAxis("Horizontal");
        xangle += Input.GetAxis("Vertical");
        zangle = Mathf.Min(Mathf.Max(zangle, -30.0f),30.0f);
        xangle = Mathf.Min(Mathf.Max(xangle, -30.0f), 30.0f);
        this.transform.rotation = Quaternion.AngleAxis(xangle, Vector3.right) * Quaternion.AngleAxis(-zangle, Vector3.forward);
	}
}