window.addEventListener("deviceorientation", function (e) {
  var absolute = event.absolute;
  var alpha    = event.alpha;
  var x     = event.beta;
  var y    = event.gamma;

  // document.getElementById("content").innerHTML =  "gamma: " + y + "<br />";

  debugx.innerHTML = "x: " + x;
  debugy.innerHTML = "y: " + y;

  if (x >  90) { x =  90};
  if (x < -90) { x = -90};

  document.getElementById("content").style.transform = "rotate3d(1, 0, 0, " + x + "deg)";
}, true);
@@ -318,63 +318,8 @@
 y;%0A%0A
-  if (x %3E  90) %7B x =  90%7D;%0A  if (x %3C -90) %7B x = -90%7D;%0A%0A
   do
@@ -392,17 +392,22 @@
  0, %22 + 
-x
+(x+90)
  + %22deg)

Fix rotation offset