Cool graphics!
This would really benefit from Pointer Lock API (https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API), you should look into that. As is, there’s an arbitrary limit to how far one can turn, based on the width of the window.