@media (max-width: 720px) {
  html, body { height: var(--app-height, 100dvh) !important; }
  body { top: var(--visual-top, 0px) !important; bottom: auto !important; }
  body > header { position: absolute !important; top: 0 !important; }
  body > main {
    position: absolute !important;
    top: var(--mobile-header) !important;
    bottom: 0 !important;
    height: auto !important;
  }
  body.keyboard-open .mobile-terminal,
  body.keyboard-open .mobile-terminal:has(#mobile-task-list:empty),
  body.keyboard-open .mobile-terminal:has(#mobile-task-list > .terminal-empty) {
    grid-template-rows: 0 0 minmax(0, 1fr) 0 !important;
  }
  body.keyboard-open #thermal-dots,
  body.keyboard-open #mobile-quick,
  body.keyboard-open #mobile-task-list,
  body.keyboard-open #mobile-signal { display: none !important; }
  body.keyboard-open #focus-pager { grid-row: 3; min-height: 0; height: 100%; }
  body.keyboard-open .terminal-card,
  body.keyboard-open .chat-terminal,
  body.keyboard-open .chat-focus { min-height: 0; height: 100%; }
  body.keyboard-open .terminal-card .follow,
  body.keyboard-open .chat-compose,
  body.keyboard-open .codex-compose { flex-shrink: 0; padding-bottom: 6px !important; }
  body.keyboard-open .terminal-card-scroll,
  body.keyboard-open .chat-stream { min-height: 0; overflow-y: auto; }
  body.keyboard-open #remote-orb,
  body.keyboard-open #orb-menu {
    top: calc(var(--visual-top, 0px) + var(--mobile-header) + 8px) !important;
  }
  body.keyboard-open #orb-menu {
    max-height: max(110px, calc(var(--app-height, 100dvh) - var(--mobile-header) - 82px)) !important;
  }
  body.keyboard-open #orb-menu .orb-menu-items {
    max-height: max(48px, calc(var(--app-height, 100dvh) - var(--mobile-header) - 146px)) !important;
  }
}
