html, body { margin: 0; padding: 0; height: 100%; background: #000; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
  #glcanvas { display: block; width: 100vw; height: 100vh; cursor: grab; }
  #glcanvas.dragging { cursor: grabbing; }
  #ui { position: fixed; left: 0; right: 0; bottom: 0; padding: 16px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 15px; color: #e8e8f0; background: linear-gradient(to top, rgba(0,0,0,0.6), rgba(0,0,0,0)); opacity: 0; transition: opacity 0.5s ease; pointer-events: none; user-select: none; font-size: 13px; letter-spacing: 0.02em; }
  #ui.show { opacity: 1; pointer-events: auto; }
  #ui .group { display: flex; align-items: center; gap: 8px; }
  #ui label { opacity: 0.75; white-space: nowrap; }
  #ui input[type=range] { width: 100px; accent-color: #b18cff; }
  .rotwrap { position: relative; display: inline-block; width: 100px; height: 18px; }
  .rotwrap #rot { width: 100px; position: relative; z-index: 2; }
  .rotwrap .rottick { position: absolute; top: 1px; width: 2px; height: 5px; background: rgba(255,255,255,0.85); transform: translateX(-1px); pointer-events: none; z-index: 1; }
  .rotwrap .rottick:nth-child(2), .rotwrap .rottick:nth-child(4), .rotwrap .rottick:nth-child(6) { top: 12px; height: 5px; }
  #ui button { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18); color: #e8e8f0; padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; transition: background 0.2s ease; }
  #ui button:hover { background: rgba(255,255,255,0.18); }
  #brand { position: fixed; top: 16px; right: 20px; color: rgba(255,255,255,0.5); font-size: 13px; letter-spacing: 0.15em; text-transform: lowercase; opacity: 0; transition: opacity 0.5s ease; user-select: none; pointer-events: none; }
  #brand.show { opacity: 1; }
  #fyi { position: fixed; top: 52px; left: 20px; z-index: 25; max-width: 300px; color: rgba(255,255,255,0.82); font-size: 12px; line-height: 1.5; background: rgba(0,0,0,0.55); padding: 10px 13px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.12); opacity: 0; transition: opacity 0.5s ease; pointer-events: none; }
  #fyi.show { opacity: 1; pointer-events: auto; }
  #fyi b { color: #b18cff; }
  #fallback { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; color: #b18cff; text-align: center; padding: 24px; font-size: 15px; }

#guide{position:fixed;top:0;bottom:0;left:50%;width:1px;transform:translateX(-0.5px);background:rgba(255,255,255,0.55);box-shadow:0 0 2px rgba(0,0,0,0.6);pointer-events:none;z-index:7;display:none}#guide.on{display:block}

#vig{position:fixed;inset:0;pointer-events:none;z-index:5;opacity:0;transition:opacity .4s;background:radial-gradient(ellipse 70% 70% at 50% 50%, rgba(0,0,0,0) 45%, rgba(0,0,0,0.55) 100%)}#vig.on{opacity:1}#grain{position:fixed;inset:0;pointer-events:none;z-index:6;opacity:0;mix-blend-mode:overlay;background-image:url("data:image/svg+xml;utf8,<svg xmlns=%27http://www.w3.org/2000/svg%27 width=%27120%27 height=%27120%27><filter id=%27n%27><feTurbulence type=%27fractalNoise%27 baseFrequency=%270.9%27 numOctaves=%272%27 stitchTiles=%27stitch%27/></filter><rect width=%27100%25%27 height=%27100%25%27 filter=%27url(%23n)%27/></svg>");background-size:180px 180px}#grain.sub{opacity:.06}#grain.med{opacity:.14}

#gear{position:fixed;left:16px;bottom:16px;z-index:40;width:44px;height:44px;border-radius:50%;background:rgba(20,20,28,.72);border:1px solid rgba(255,255,255,.18);color:#e8e8f0;font-size:20px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:opacity .4s}
#panel{position:fixed;left:0;top:0;bottom:0;z-index:39;width:300px;max-width:82vw;background:rgba(16,16,22,.86);backdrop-filter:blur(8px);border-right:1px solid rgba(255,255,255,.12);box-shadow:4px 0 24px rgba(0,0,0,.4);transform:translateX(-104%);transition:transform .32s ease;overflow-y:auto;padding:56px 18px 24px;color:#e8e8f0}
#panel.open{transform:translateX(0)}
#panelClose{position:absolute;top:12px;right:14px;cursor:pointer;font-size:22px;line-height:1;opacity:.7;color:#e8e8f0}
.uiHidden{opacity:0 !important;pointer-events:none !important}
#ui.inpanel{position:static;left:auto;right:auto;bottom:auto;display:flex;flex-direction:column;align-items:stretch;gap:14px;padding:0;background:none;opacity:1 !important;pointer-events:auto !important;transform:none;flex-wrap:nowrap;width:100%}
#ui.inpanel .group{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%}
#ui.inpanel .group label{flex:0 0 auto;min-width:62px}
#ui.inpanel input[type=range]{flex:1 1 auto;width:auto}
#ui.inpanel select{flex:1 1 auto;max-width:160px}
#ui.inpanel button{width:100%}
#shareGroup button{width:34px !important}

#posterFrame{position:fixed;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:40;display:none;}#posterFrame.on{display:block;}#posterFrame .mask{position:absolute;background:rgba(0,0,0,0.55);pointer-events:none;}#posterFrame .box{position:absolute;border:2px solid rgba(255,255,255,0.95);box-shadow:0 0 0 1px rgba(0,0,0,0.7),0 0 14px rgba(0,0,0,0.5);pointer-events:auto;cursor:move;}#posterFrame .h{position:absolute;width:16px;height:16px;background:#fff;border:2px solid #111;border-radius:3px;pointer-events:auto;}#posterFrame .h.nw{left:-9px;top:-9px;cursor:nwse-resize;}#posterFrame .h.ne{right:-9px;top:-9px;cursor:nesw-resize;}#posterFrame .h.sw{left:-9px;bottom:-9px;cursor:nesw-resize;}#posterFrame .h.se{right:-9px;bottom:-9px;cursor:nwse-resize;}#posterFrame .lbl{position:absolute;left:50%;transform:translateX(-50%);top:-26px;font:12px/1.4 system-ui,sans-serif;color:#fff;background:rgba(0,0,0,0.75);padding:2px 8px;border-radius:4px;white-space:nowrap;}#posterFrame .hint{position:fixed;left:50%;transform:translateX(-50%);bottom:14px;font:12px/1.4 system-ui,sans-serif;color:#fff;background:rgba(0,0,0,0.7);padding:4px 12px;border-radius:6px;white-space:nowrap;pointer-events:none;}
