/* QuantDinger v5.4.1 mobile integration fixes.
 * Loaded after the official bundles; desktop behavior is intentionally untouched.
 */
@media (max-width: 767px), (max-height: 500px) and (max-width: 900px) {
  html,
  body,
  #app {
    width: 100%;
    min-height: 100%;
    min-height: 100dvh;
    overflow-x: hidden;
  }

  .basic-route-view-shell {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  /* The official page fixes this wrapper to the viewport and hides overflow,
     while its workbench is taller. Let the existing route shell own scrolling. */
  .professional-analysis-page {
    height: auto !important;
    min-height: 100% !important;
    overflow: visible !important;
  }

  .professional-analysis-page .copilot-workbench,
  .professional-analysis-page .chat-panel {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .professional-analysis-page .composer {
    padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
  }

  /* Keep compact header actions usable by touch without changing desktop. */
  .ant-pro-global-header .ant-pro-global-header-index-action,
  .ant-pro-global-header button {
    min-width: 44px;
    min-height: 44px;
  }

  .strategy-ide-shell .toolbar-left .ant-btn,
  .strategy-ide-shell .toolbar-right .ant-btn {
    min-height: 44px;
  }

  .strategy-ide-shell .section-header {
    height: auto !important;
    min-height: 64px;
    align-items: flex-start !important;
    flex-wrap: wrap;
    gap: 8px;
    padding-block: 10px !important;
  }

  .strategy-ide-shell .section-actions {
    position: static !important;
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    flex-wrap: wrap;
    justify-content: flex-start !important;
    gap: 8px;
  }

  .strategy-ide-shell .section-actions .ant-btn,
  .strategy-ide-shell .section-actions a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}
