*{margin:0;padding:0;box-sizing:border-box}
body{background:#000;overflow:hidden;font-family:'SF Mono','Cascadia Code','Fira Code',monospace}
canvas{display:block;position:fixed;top:0;left:0;width:100vw;height:100vh}
#panel{position:fixed;top:8px;left:8px;background:rgba(6,8,18,0.9);border:1px solid rgba(90,110,200,0.25);
  border-radius:6px;color:#8890aa;font-size:10px;width:222px;backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);z-index:10;user-select:none;-webkit-user-select:none;
  max-height:calc(100vh - 16px);overflow-y:auto;scrollbar-width:thin;scrollbar-color:rgba(90,110,200,0.2) transparent}
.ph{padding:8px 12px 6px;cursor:pointer;display:flex;justify-content:space-between;align-items:center;
  border-bottom:1px solid rgba(90,110,200,0.15)}
.ph h1{font-size:10px;font-weight:600;letter-spacing:.08em;color:#b0b8d8;text-transform:uppercase;margin:0}
.ph .t{color:#5a6a90;font-size:9px}
.hint{padding:3px 12px 4px;font-size:8px;color:#4a5272}
#pb{padding:0 12px 10px}
#pb.collapsed{display:none}
.gl{font-size:8px;font-weight:600;letter-spacing:.12em;color:#5a6aaa;text-transform:uppercase;
  margin:10px 0 4px;padding-bottom:2px;border-bottom:1px solid rgba(90,110,200,0.1);cursor:pointer}
.gl::after{content:'▾';float:right;color:#4a5272;font-size:10px;transition:transform .2s}
.gl.collapsed::after{content:'▸'}
.gp.hidden{display:none}
.pr{display:flex;align-items:center;margin:3px 0;gap:4px}
.pr label{flex:0 0 68px;font-size:9px;color:#6a7294}
.pr input[type=range]{flex:1;height:2px;-webkit-appearance:none;appearance:none;
  background:rgba(60,70,120,.35);border-radius:2px;outline:none;cursor:pointer}
.pr input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:8px;height:8px;
  border-radius:50%;background:#6a80cc;border:none;cursor:pointer}
.pr input[type=range]::-moz-range-thumb{width:8px;height:8px;border-radius:50%;
  background:#6a80cc;border:none;cursor:pointer}
.pr select{flex:1;min-width:0;font-family:inherit;font-size:9px;color:#8890aa;
  background:rgba(60,70,120,.15);border:1px solid rgba(90,110,200,.2);border-radius:3px;padding:2px 3px;cursor:pointer}
.pr select option{background:#0a0c18;color:#8890aa}
.pr .v{flex:0 0 30px;text-align:right;font-size:9px;color:#7a84aa;font-variant-numeric:tabular-nums}
.cb{display:flex;align-items:center;margin:3px 0;gap:6px}
.cb input{accent-color:#6a80cc;cursor:pointer}
.cb label{font-size:9px;color:#6a7294;cursor:pointer}
.btn{display:inline-block;margin:4px 3px 0 0;padding:5px 10px;font-family:inherit;font-size:9px;
  letter-spacing:.06em;text-transform:uppercase;color:#6a7294;background:rgba(60,70,120,.15);
  border:1px solid rgba(90,110,200,.2);border-radius:3px;cursor:pointer}
.btn:hover{background:rgba(60,70,120,.3);color:#8a94b4}
#info{position:fixed;bottom:8px;right:8px;font-size:9px;color:#3a4262;font-family:inherit;z-index:10}
/* The 3D view keeps every touch: drag orbits, two fingers pinch (main.js INPUT). */
#gl{touch-action:none}
#ph{touch-action:manipulation;-webkit-tap-highlight-color:transparent}

/* TOUCH: any touch screen (phones and tablets) gets 44 px targets and
   text of 12 px or more. */
@media (pointer:coarse){
  #panel{font-size:13px;width:280px}
  .ph{min-height:48px}
  .ph h1{font-size:12px}
  .ph .t{font-size:13px;padding:8px}
  .hint{font-size:12px;color:#6a7294}
  .gl{font-size:12px;min-height:44px;display:flex;align-items:center;justify-content:space-between;margin:6px 0 2px}
  .gl::after{float:none;font-size:13px}
  .pr{min-height:44px;margin:0;gap:8px}
  .pr label{flex:0 0 92px;font-size:13px}
  .pr .v{flex:0 0 44px;font-size:12px}
  .pr input[type=range]{height:36px;background:linear-gradient(rgba(60,70,120,.45),rgba(60,70,120,.45)) center/100% 4px no-repeat}
  .pr input[type=range]::-webkit-slider-thumb{width:24px;height:24px}
  .pr input[type=range]::-moz-range-thumb{width:22px;height:22px}
  /* 16 px stops iOS Safari zooming the page when a select takes focus */
  .pr select{font-size:16px;min-height:40px;padding:4px 8px}
  .cb{min-height:44px;margin:0;gap:10px}
  .cb input{width:22px;height:22px}
  .cb label{flex:1;font-size:13px;padding:12px 0}
  .btn{min-height:44px;padding:0 18px;font-size:12px;margin:8px 8px 0 0}
  #info{font-size:12px}
}

/* PHONE: the panel is a bottom sheet in portrait. The header is the bar
   at the base; a tap opens the controls. main.js pans the camera so the
   body sits in the part the sheet leaves clear. */
@media (max-width:700px), (max-height:500px) and (pointer:coarse){
  canvas{height:100vh;height:100dvh}
  #panel{top:auto;left:0;right:0;bottom:0;width:auto;max-height:min(56vh,520px);max-height:min(56dvh,520px);
    border-radius:14px 14px 0 0;border-width:1px 0 0;overscroll-behavior:contain;
    padding:0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
  .ph{position:sticky;top:0;z-index:1;min-height:52px;padding:0 16px;background:rgba(6,8,18,0.97)}
  .ph h1{font-size:13px}
  .hint{padding:4px 16px 6px}
  #pb{padding:0 16px 14px}
  #info{top:calc(8px + env(safe-area-inset-top));bottom:auto;right:calc(10px + env(safe-area-inset-right))}
}
/* LANDSCAPE phone: the panel is a drawer at the right edge. Closed, it is
   only its header at the top right. */
@media (max-height:500px) and (pointer:coarse) and (orientation:landscape){
  #panel{top:0;bottom:auto;left:auto;right:0;width:min(320px,46vw);max-height:100vh;max-height:100dvh;
    border-radius:0 0 0 12px;border-width:0 0 1px 1px;padding:0 env(safe-area-inset-right) env(safe-area-inset-bottom) 0}
  #info{right:auto;left:calc(10px + env(safe-area-inset-left))}
}
