JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://threejs.org/build/three.min.js"></script>

<script src="https://threejs.org/examples/js/controls/OrbitControls.js"></script>
<script src="https://threejs.org/examples/js/renderers/CSS3DRenderer.js"></script>
  <div id="css"></div>
    <div id="webgl"></div>

CSS

*
{
    margin: 0;
    padding: 0;
}

html,
body
{
    overflow: hidden;
}

.webgl
{
    position: fixed;
    top: 0;
    left: 0;
    outline: none;
}
body {
    background-color: #ffffff;
    margin: 0;
    overflow: hidden;
}

* {
    outline: none;
}

#css, #webgl {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0; left: 0;
}

#css {
    --c1: #122538;
    --c2: #112233;
    background: repeating-linear-gradient(
        -45deg,
        var(--c1),
        var(--c1) 20px,
        var(--c2) 20px,
        var(--c2) 40px
    );
}

#webgl {
  pointer-events: none;
}

JavaScript

var camera, root, scene, renderer, renderer2, background;
var sphere;
var light

init();
animate(performance.now());

function init() {
    scene = new THREE.Scene()
    root = new THREE.Object3D()
    root.position.y = 20
    root.rotation.y = Math.PI / 3
    scene.add(root)

    background = makeElementObject('div', 200, 200)
    background.css3dObject.element.textContent = "I am an HTML <div> element mixed into the WebGL scene. This text is editable!"
    background.css3dObject.element.setAttribute('contenteditable', '')
    background.position.z = 20
    background.css3dObject.element.style.opacity = "1"
    background.css3dObject.element.style.padding = '10px'
    const color1 = '#7bb38d'
    const color2 = '#71a381'
    background.css3dObject.element.style.background = `repeating-linear-gradient(
        45deg,
        ${color1},
        ${color1} 10px,
        ${color2} 10px,
        ${color2} 20px
    )`
    root.add(background);

    const button = makeElementObject('button', 75, 20)
    button.css3dObject.element.style.border = '2px solid #fa5a85'
    button.css3dObject.element.textContent = "Click me!"
    button.css3dObject.element.addEventListener('click', () => alert('You clicked a <button> element in the DOM!'))
    button.position.y = 10
    button.position.z = 10
    button.css3dObject.element.style.background = '#e64e77'
    background.add(button)



    // light
    var ambientLight = new THREE.AmbientLight(0x999999, 1.5);
    root.add(ambientLight);

    light = new THREE.PointLight(0xffffff, 1, 0);
    light.castShadow = true;
    light.position.z = 150;
    light.shadow.mapSize.width = 1024;  // default
    light.shadow.mapSize.height = 1024; // default
    light.shadow.camera.near = 1;       // default
    light.shadow.camera.far = 2000;      // default

    scene.add(new THREE.PointLightHelper(light, 10))

    root.add(light);

    windowHalfX = window.innerWidth / 2;
    windowHalfY = window.innerHeight / 2;
    camera = new...