/* Fixed86 — mobile workspace conflict cleanup */
@media (max-width:768px){
  /* Fixed54 is the single mobile navigation/sheet system. */
  .mobile-workspace-nav,
  .mobile-tools-toggle{display:none!important}

  /* Keep source editor visible behind result/chat/member sheets. */
  #appView.mobile-sheet-open .workspace,
  #appView.mobile-sheet-output .workspace,
  #appView.mobile-sheet-chat .workspace,
  #appView.mobile-sheet-members .workspace{display:block!important}
  #appView.mobile-sheet-open .editor-panel,
  #appView.mobile-sheet-output .editor-panel,
  #appView.mobile-sheet-chat .editor-panel,
  #appView.mobile-sheet-members .editor-panel{display:flex!important;visibility:visible!important}

  /* Bottom sheets must lay out vertically, not side-by-side. */
  #appView.mobile-sheet-output .io-panel,
  #appView.mobile-sheet-chat .chat-panel,
  #appView.mobile-sheet-members .members-panel{
    flex-direction:column!important;
    width:100%!important;
    min-width:0!important;
  }
  #appView.mobile-sheet-output .io-panel{height:min(54dvh,620px)!important}
  #appView.mobile-sheet-chat .chat-panel{height:min(62dvh,700px)!important}
  #appView.mobile-sheet-members .members-panel{height:min(54dvh,620px)!important}

  .io-panel .tabs{
    display:flex!important;
    flex:0 0 48px!important;
    width:100%!important;
    height:48px!important;
    margin:0!important;
  }
  .io-panel .tab-content{
    flex:1 1 auto!important;
    width:100%!important;
    height:auto!important;
    min-height:0!important;
  }
  .io-panel .output-meta{
    width:100%!important;
    height:auto!important;
    min-height:42px!important;
    padding:11px 14px!important;
    white-space:normal!important;
  }
  .io-panel #output{
    width:100%!important;
    height:calc(100% - 42px)!important;
    min-height:0!important;
    padding:14px 16px!important;
    overflow:auto!important;
  }
  .io-panel #stdinInput{font-size:16px!important}

  /* Let the editor use all space above the bottom nav. */
  .workspace{height:calc(100dvh - 58px - 64px - env(safe-area-inset-bottom))!important}
  #editor,.code-editor,.code-editor>.CodeMirror{
    height:calc(100dvh - 58px - 64px - 46px - 44px - env(safe-area-inset-bottom))!important;
    min-height:220px!important;
  }
  .CodeMirror-scroll{min-height:0!important}

  /* Result sheet handle follows actual sheet height. */
  #appView.mobile-sheet-output .mobile-sheet-handle{bottom:calc(64px + min(54dvh,620px) - 4px)!important}
  #appView.mobile-sheet-chat .mobile-sheet-handle{bottom:calc(64px + min(62dvh,700px) - 4px)!important}
  #appView.mobile-sheet-members .mobile-sheet-handle{bottom:calc(64px + min(54dvh,620px) - 4px)!important}

  /* Avoid Safari/Naver browser text enlargement and horizontal drift. */
  html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
  body{width:100%;overflow-x:hidden}
}
