/* v1.9.7 | Telegram iPhone: docks at the real safe bottom, no historical Netlify gap. */
body.viewer-immersive{
  --studio-primary-height:52px;
  --studio-quick-height:48px;
  --studio-primary-bottom:calc(8px + var(--studio-safe-bottom));
  --studio-quick-bottom:calc(var(--studio-primary-bottom) + var(--studio-primary-height) + 7px);
}
body.viewer-immersive .immersive-actions{
  bottom:var(--studio-primary-bottom)!important;
  grid-template-columns:.82fr .82fr .7fr 1.66fr!important;
  gap:5px!important;
  min-height:52px!important;
  max-width:650px!important;
}
body.viewer-immersive .immersive-actions .immersive-action{
  min-height:52px!important;
  padding:5px 3px!important;
  border-radius:11px!important;
  white-space:normal!important;
  line-height:1.25!important;
  font-size:11px!important;
}
body.viewer-immersive .immersive-actions .immersive-exit{
  white-space:normal!important;
  font-size:10px!important;
  font-weight:800!important;
  line-height:1.17!important;
  text-align:center!important;
  color:#ffdbdb;
  border-color:#a15a66;
}
.immersive-exit .exit-full-label{display:none}
body.viewer-immersive .immersive-exit .exit-full-label{display:block}
body.viewer-immersive .immersive-quickbar{
  bottom:var(--studio-quick-bottom)!important;
  min-height:48px!important;
  max-width:650px!important;
  padding:3px!important;
}
body.viewer-immersive .immersive-quickbar button[data-viewer-tool="selectbody"].active{
  color:#c6ffe7!important;
  border-color:#5fe7bb!important;
  background:#225a58!important;
}
/* Smaller i button beside every pre-existing tool button. Original handlers untouched. */
.viewer-tool-item{
  min-width:0;
  display:flex;
  align-items:stretch;
  gap:3px;
  border-radius:10px;
}
body.viewer-immersive .viewer-toolbox .floating-grid .viewer-tool-item>.viewer-tool-main{
  flex:1 1 auto;
  min-width:0!important;
  width:100%!important;
  padding:6px 4px!important;
  font-size:10.5px!important;
  text-align:center!important;
  line-height:1.25;
  border-radius:9px 4px 4px 9px;
}
body.viewer-immersive .viewer-toolbox .floating-grid .viewer-tool-item>.viewer-help-btn{
  flex:0 0 28px!important;
  width:28px!important;
  min-width:28px!important;
  max-width:28px!important;
  min-height:44px!important;
  padding:0!important;
  margin:0!important;
  box-sizing:border-box!important;
  font:800 15px/1 system-ui,sans-serif!important;
  font-style:italic!important;
  color:#b8eaff!important;
  background:#153a53!important;
  border:1px solid #5c8da8!important;
  border-radius:4px 9px 9px 4px!important;
  text-align:center!important;
  touch-action:manipulation;
}
body.viewer-immersive .viewer-toolbox .floating-grid .viewer-help-btn[aria-expanded="true"]{
  color:#061b2a!important;
  background:#85d4fa!important;
}
body.viewer-immersive .viewer-toolbox .floating-grid .viewer-tool-item{
  grid-column:auto;min-height:44px;
}
.viewer-tool-help[hidden]{display:none!important}
.viewer-tool-help{
  position:sticky;top:0;z-index:10;
  display:flex;align-items:start;gap:9px;
  min-width:0;
  background:#1a415b;
  border:1px solid #67a7c8;
  border-radius:10px;
  padding:11px 10px;
  color:#d9f1ff;
  font:500 12px/1.45 system-ui,sans-serif;
  box-shadow:0 6px 18px #0008;
  margin:9px 0;
}
.viewer-tool-help .viewer-tool-help-text{flex:1 1 auto;min-width:0;overflow-wrap:anywhere}
.viewer-tool-help .viewer-help-close{
  min-height:32px!important;
  min-width:32px!important;
  max-width:32px!important;
  padding:0!important;
  border:1px solid #6395b3;
  border-radius:8px;
  background:#19354a;
  color:#fff;
  font:700 22px/1 system-ui,sans-serif;
  touch-action:manipulation;
}
/* Selection mode badge: visible only when one-tap object picking is enabled. */
.viewer-selection-badge{display:none}
body.viewer-immersive .viewer-selection-badge:not([hidden]){
  position:absolute;
  top:107px;
  left:12px;right:12px;
  margin:auto;
  width:max-content;max-width:calc(100% - 24px);
  display:block;pointer-events:none;
  padding:7px 11px;
  border:1px solid #63cbb7;
  background:rgba(16,59,64,.90);
  color:#cdfff5;
  font:650 11px/1.35 system-ui,sans-serif;
  border-radius:10px;
  z-index:25;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
body.viewer-immersive .viewer-toolbox{
  max-height:min(64dvh,calc(100dvh - 250px))!important;
}
@media(max-width:380px){
  body.viewer-immersive .immersive-actions{grid-template-columns:.74fr .74fr .62fr 1.75fr!important;}
  body.viewer-immersive .immersive-actions .immersive-action{font-size:10px!important;}
  body.viewer-immersive .viewer-toolbox .floating-grid{gap:5px!important;}
  body.viewer-immersive .viewer-toolbox .floating-grid .viewer-tool-item>.viewer-tool-main{font-size:10px!important;}
  body.viewer-immersive .viewer-toolbox .floating-grid .viewer-tool-item>.viewer-help-btn{
    flex-basis:26px!important;width:26px!important;min-width:26px!important;max-width:26px!important;
  }
}
@media(max-height:610px) and (orientation:landscape){
  body.viewer-immersive{
    --studio-primary-height:44px;
    --studio-primary-bottom:calc(5px + var(--studio-safe-bottom));
    --studio-quick-bottom:calc(var(--studio-primary-bottom) + var(--studio-primary-height) + 5px);
  }
  body.viewer-immersive .immersive-actions,
  body.viewer-immersive .immersive-actions .immersive-action{min-height:44px!important;}
  body.viewer-immersive .viewer-toolbox{max-height:calc(100dvh - 185px)!important;}
  body.viewer-immersive .viewer-selection-badge{top:56px!important}
}
