/* 3D Studio AI v1.9.6 · one full-screen tool entry, compact ergonomic docks.
   One row of scrollable tools and one row of primary controls. Keep touch targets 44px.
   Do not overlap the Telegram host header or existing Netlify provider clearance. */
body.viewer-immersive{
  --studio-primary-height:44px;
  --studio-quick-height:48px;
  --studio-dock-gap:7px;
  --studio-quick-bottom:calc(var(--studio-primary-bottom) + var(--studio-primary-height) + 8px);
}
/* The original "Инструменты" is the ONLY menu opener. */
body.viewer-immersive .viewer-floating-tools{
  top:50px!important;left:12px!important;right:auto!important;
  z-index:130!important;max-width:calc(100vw - 24px);
}
body.viewer-immersive #viewer-tools-toggle{
  min-height:44px!important;min-width:118px;max-width:148px;
  padding:7px 12px!important;border-radius:12px!important;
  font-size:12px!important;box-sizing:border-box;
  display:inline-flex;align-items:center;gap:5px;
  border-color:#548aa7;
}
body.viewer-immersive .viewer-hud{top:12px;left:12px;max-width:58%}
body.viewer-immersive .orientation-gizmo{top:9px;right:12px}
/* A single camera dropdown replaces an entire 3rd row of wide camera buttons. */
.immersive-view-select-label{display:none}
body.viewer-immersive .immersive-view-select-label{
  display:flex;align-items:center;gap:5px;position:absolute;
  top:50px;right:12px;width:144px;max-width:calc(100vw - 165px);
  min-height:44px;padding:0 7px;box-sizing:border-box;
  border:1px solid #517d9a;border-radius:12px;
  background:#172f44ec;color:#b8e6fc;z-index:26;
  box-shadow:0 4px 10px #0003;
}
body.viewer-immersive .immersive-view-select-label>span{font-size:15px;pointer-events:none}
body.viewer-immersive #immersive-view-select{
  width:100%;min-width:0;height:42px;padding:3px 0;
  font:700 12px/1.1 system-ui,sans-serif;color:#e6f6ff;
  background:transparent;border:0;outline:0;
  -webkit-appearance:menulist;appearance:menulist;
  touch-action:manipulation;
}
body.viewer-immersive #immersive-view-select option{background:#18344a;color:#fff}
body.viewer-immersive .view-controls{display:none!important}
/* Quick actions are one compact horizontal strip, not multiple overlapping rows. */
body.viewer-immersive .immersive-quickbar{
  display:flex!important;
  position:absolute!important;
  bottom:var(--studio-quick-bottom)!important;
  left:max(10px,env(safe-area-inset-left,0px))!important;
  right:max(10px,env(safe-area-inset-right,0px))!important;
  width:auto!important;max-width:600px!important;min-height:48px!important;
  margin:0 auto!important;padding:3px!important;
  gap:5px!important;border-radius:13px!important;
  overflow-x:auto!important;overflow-y:hidden!important;
  scroll-snap-type:x proximity;scroll-padding-left:3px;
  -webkit-overflow-scrolling:touch;touch-action:pan-x;
  overscroll-behavior-x:contain;
  background:#122a3bdb!important;backdrop-filter:blur(7px);
  z-index:27!important;
}
body.viewer-immersive .immersive-quickbar :is(button,.quick-import){
  display:inline-flex;align-items:center;justify-content:center;
  flex:0 0 auto!important;min-width:58px!important;min-height:44px!important;
  max-width:130px;margin:0;padding:8px 10px!important;
  box-sizing:border-box;white-space:nowrap;scroll-snap-align:start;
  font:700 11px/1.1 system-ui,sans-serif!important;
  border:1px solid #47718c;border-radius:9px;
  color:#dff3ff;background:#204158ed;
  -webkit-tap-highlight-color:transparent;
}
body.viewer-immersive .immersive-quickbar .quick-import{
  position:relative;overflow:hidden;cursor:pointer;color:#b5efff;
  background:#265875;border-color:#68b5d6;
  touch-action:manipulation;
}
body.viewer-immersive .immersive-quickbar .quick-import .stl-input{
  position:absolute;inset:0;width:100%;height:100%;opacity:0;
  z-index:5;cursor:pointer;font-size:16px;
}
body.viewer-immersive .immersive-quickbar button:active{background:#32627a}
/* The primary dock now offers rotate, pan, PNG and exit. No duplicate Menu. */
body.viewer-immersive .immersive-actions{
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  min-height:44px!important;gap:6px!important;
  left:max(10px,env(safe-area-inset-left,0px))!important;
  right:max(10px,env(safe-area-inset-right,0px))!important;
  max-width:600px!important;
  bottom:var(--studio-primary-bottom)!important;
  z-index:27!important;
}
body.viewer-immersive .immersive-actions .immersive-action{
  display:flex;align-items:center;justify-content:center;
  min-height:44px!important;padding:7px 4px!important;
  font-size:11px!important;letter-spacing:0;white-space:nowrap;
  box-sizing:border-box;
}
body.viewer-immersive .immersive-actions .immersive-exit{color:#ffd1d1}
/* Single popup near the menu opener; it scrolls, does not cover bottom controls. */
body.viewer-immersive .viewer-toolbox{
  position:absolute!important;
  top:52px!important;bottom:auto!important;
  left:0!important;right:auto!important;
  transform:none!important;
  width:min(370px,calc(100vw - 24px))!important;
  max-height:min(58dvh,calc(100dvh - 300px))!important;
  min-height:0!important;overflow-y:auto!important;overflow-x:hidden!important;
  z-index:135!important;
  box-sizing:border-box!important;border:1px solid #5486a5;
  border-radius:14px;box-shadow:0 20px 50px #000c;
  -webkit-overflow-scrolling:touch;touch-action:pan-y;
}
body.viewer-immersive .viewer-toolbox .floating-grid{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;
}
body.viewer-immersive .viewer-toolbox .floating-grid button{
  min-width:0;min-height:44px!important;padding:7px 8px;font-size:11px;
  text-align:center;overflow-wrap:anywhere;
}
body.viewer-immersive.toolbox-open .immersive-quickbar{
  opacity:.45;pointer-events:none;
}
body.viewer-immersive.toolbox-open .immersive-actions{opacity:.62;pointer-events:none}
/* Non-fullscreen remains unchanged; quick import exists only in full-screen. */
@media(max-width:375px){
 body.viewer-immersive #viewer-tools-toggle{min-width:108px;max-width:130px;padding:7px 8px!important}
 body.viewer-immersive .immersive-view-select-label{max-width:calc(100vw - 157px);width:132px}
 body.viewer-immersive .immersive-actions .immersive-action{font-size:10px!important}
}
@media(max-height:610px) and (orientation:landscape){
 body.viewer-immersive{--studio-primary-height:40px;--studio-quick-height:42px;--studio-dock-gap:5px}
 body.viewer-immersive .viewer-floating-tools{top:8px!important}
 body.viewer-immersive .immersive-view-select-label{top:8px;min-height:42px}
 body.viewer-immersive #immersive-view-select{height:40px}
 body.viewer-immersive .viewer-toolbox{top:46px!important;max-height:40dvh!important}
 body.viewer-immersive .immersive-quickbar{min-height:42px!important}
 body.viewer-immersive .immersive-quickbar :is(button,.quick-import){min-height:40px!important}
 body.viewer-immersive .immersive-actions .immersive-action{min-height:40px!important}
}

/* Any file-picker result stays visible next to the sticky Import button. */
.io-dock .io-dock-status{
  display:block;flex:1 0 100%;grid-column:1/-1;
  width:100%;min-width:0;box-sizing:border-box;
  margin:0;padding:2px 5px;line-height:1.45;
  font:500 11px/1.45 system-ui,sans-serif;
  color:#b8d8e8;overflow-wrap:anywhere;
}
.io-dock .io-dock-status[hidden]{display:none!important}
.io-dock .io-dock-status.error{color:#ffaea8}
.io-dock .io-dock-status.ok{color:#8be9bf}
