/* LL AI v64.4.7 — Images composer / Android tablet keyboard rebuild.
   Loaded last. While the Images prompt owns focus, the workspace is isolated
   to the browser's visual viewport and the sidebar is temporarily removed. */

:root{
  --ll647-vv-top:0px;
  --ll647-vv-height:100dvh;
}

/* Hide the sidebar BEFORE the software keyboard animates in. This does not
   change or persist the user's normal sidebar preference. */
body.ll647ImageTyping #side,
body.ll647ImageTyping #sidebarScrim{
  display:none!important;
  visibility:hidden!important;
  opacity:0!important;
  pointer-events:none!important;
}
body.ll647ImageTyping .app{
  grid-template-columns:0 minmax(0,1fr)!important;
}

/* Make Images occupy exactly the currently visible browser area. This works
   whether Android resizes the layout viewport or overlays the keyboard. */
body.ll647ImageTyping #imageStudio.v632Workspace,
body.ll647ImageTyping #imageStudio{
  position:fixed!important;
  inset:auto 0 auto 0!important;
  top:var(--ll647-vv-top)!important;
  left:0!important;
  right:0!important;
  bottom:auto!important;
  width:100vw!important;
  height:var(--ll647-vv-height)!important;
  max-height:var(--ll647-vv-height)!important;
  min-height:0!important;
  transition:none!important;
  contain:layout style paint!important;
}

/* The composer is absolute INSIDE that visual-viewport-sized workspace,
   rather than fixed to the old desktop/layout viewport. */
body.ll647ImageTyping #imageStudio .imagePromptBar{
  position:absolute!important;
  left:50%!important;
  right:auto!important;
  top:auto!important;
  bottom:max(8px,env(safe-area-inset-bottom,0px))!important;
  transform:translateX(-50%)!important;
  width:min(820px,calc(100vw - 18px))!important;
  max-width:820px!important;
  margin:0!important;
  z-index:5000!important;
}
body.ll647ImageTyping #imageStudio .imageStatus{
  position:absolute!important;
  left:50%!important;
  right:auto!important;
  top:auto!important;
  bottom:78px!important;
  transform:translateX(-50%)!important;
  width:min(790px,calc(100vw - 28px))!important;
  z-index:4990!important;
}
body.ll647ImageTyping #imageStudio .imageStudioBody{
  height:100%!important;
  min-height:0!important;
  padding-bottom:104px!important;
  scroll-padding-bottom:104px!important;
  overscroll-behavior:contain!important;
}
body.ll647ImageTyping #imageStudio .imageStudioTop{
  flex:0 0 auto!important;
}

/* Kill the three older keyboard-offset variables while this rebuild owns the
   prompt so they cannot stack and move the composer twice. */
body.ll647ImageTyping{
  --ll-image-keyboard:0px!important;
  --ll-image-vv-bottom:0px!important;
  --ll-image-kb:0px!important;
}

/* Modern Chromium fallback even if the JS class is delayed for one frame. */
@supports selector(body:has(#imagePrompt:focus)){
  body:has(#imageStudio:not([hidden]) #imagePrompt:focus) #side,
  body:has(#imageStudio:not([hidden]) #imagePrompt:focus) #sidebarScrim{
    display:none!important;
  }
  body:has(#imageStudio:not([hidden]) #imagePrompt:focus) #imageStudio{
    left:0!important;
    right:0!important;
    width:100vw!important;
  }
}

@media(max-width:900px){
  body.ll647ImageTyping #imageStudio .imagePromptBar{
    width:calc(100vw - 12px)!important;
    border-radius:20px!important;
  }
  body.ll647ImageTyping #imageStudio .imageStatus{
    width:calc(100vw - 20px)!important;
  }
}

/* Landscape tablet: keep the prompt compact so the keyboard still leaves
   useful room for the image/gallery above it. */
@media(orientation:landscape) and (max-height:700px){
  body.ll647ImageTyping #imageStudio .imageStudioTop{
    height:54px!important;
    min-height:54px!important;
  }
  body.ll647ImageTyping #imageStudio .imageStudioBody{
    padding-top:10px!important;
    padding-bottom:92px!important;
  }
  body.ll647ImageTyping #imageStudio .imagePromptBar textarea{
    min-height:42px!important;
    max-height:88px!important;
  }
  body.ll647ImageTyping #imageStudio .imagePromptBar{
    bottom:6px!important;
  }
  body.ll647ImageTyping #imageStudio .imageStatus{
    bottom:70px!important;
  }
}
