/* Desktop keeps the Eclipse multi-pane workbench. Phone uses dedicated views. */
#mobile-nav, .mobile-row-actions, .mobile-menu-back { display: none; }
@media (max-width: 760px), (max-width: 1000px) and (max-height: 540px) and (pointer: coarse) {
  #shell {
    height: var(--phone-viewport, 100dvh);
    padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  #menubar, #toolbar, #perspective-bar, #bottom-tabs, #editor-tabs {
    flex: none;
    flex-wrap: nowrap;
    overflow: auto hidden;
    scrollbar-width: none;
    overscroll-behavior-inline: contain;
  }
  #menubar::-webkit-scrollbar, #toolbar::-webkit-scrollbar, #perspective-bar::-webkit-scrollbar,
  #bottom-tabs::-webkit-scrollbar, #editor-tabs::-webkit-scrollbar { display: none; }
  #menubar { height: 37px; }
  .menu-root { flex: none; min-height: 36px; padding: 0 10px; }
  #toolbar { height: 45px; }
  #toolbar .tb, .persp-tools .tb { flex: 0 0 42px; width: 42px; height: 40px; }
  #toolbar .tb-sep { flex: 0 0 1px; margin-inline: 2px; }
  #toolbar .tb[data-cmd="run"], #toolbar .tb[data-cmd="run-web"] { background: var(--accent-soft); }
  #toolbar .quick-search input { height: 34px; width: 150px; font-size: 16px; }
  #perspective-bar { height: 39px; }
  #perspective-bar .persp-tab, #perspective-bar .persp-open { flex: none; min-height: 36px; }
  #perspective-bar .persp-open { min-width: 40px; }
  .persp-tools { padding-bottom: 0; }
  #workbench { display: block; min-height: 0; overflow: hidden; }
  #workbench .sash { display: none; }
  #view-explorer, #view-outline, #center { height: 100%; width: 100% !important; margin: 0; }
  #view-explorer, #view-outline, #center, #editor-stack, #bottom-panel { display: none; }
  #shell[data-mobile-pane="files"] #view-explorer,
  #shell[data-mobile-pane="outline"] #view-outline,
  #shell[data-mobile-pane="editor"] #center,
  #shell[data-mobile-pane="tools"] #center,
  #shell[data-mobile-pane="editor"] #editor-stack,
  #shell[data-mobile-pane="tools"] #bottom-panel { display: flex; }
  #bottom-panel { flex: 1; min-height: 0; height: auto !important; margin: 0; }
  #editor-area { margin: 0; }
  #mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    flex: none;
    border-top: 1px solid var(--border);
    background: var(--toolbar-flat);
  }
  #mobile-nav button {
    min-height: 45px;
    border: 0;
    border-top: 2px solid transparent;
    background: transparent;
    color: var(--text);
    font: 600 12px var(--font-ui);
    padding: 1px 3px;
  }
  #mobile-nav button[aria-pressed="true"] {
    border-top-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
  }
  .view-title { height: 40px; font-size: 13px; }
  .view-title button { width: 40px; height: 36px; }
  .tree-row { min-height: 41px; font-size: 14px; }
  .mobile-row-actions {
    margin-left: auto;
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 42px;
    min-height: 38px;
    border: 0;
    background: transparent;
    color: inherit;
    font: 20px var(--font-ui);
  }
  #explorer-filter, #view-explorer input, .modal-body input[type="text"], .modal-body select,
  .modal-body textarea, .web-bar input { min-width: 0; min-height: 38px; font-size: 16px; }
  #editor-tabs, #bottom-tabs { min-height: 41px; padding: 0 4px; }
  .ed-tab, .b-tab, .b-tab.active { flex: none; min-height: 39px; }
  .ed-tab .close { min-width: 34px; min-height: 36px; }
  .ed-input, .ed-highlight, .ed-gutter, .ed-measure { font-size: 16px; line-height: 23px; }
  .ed-gutter { width: 42px; }
  .ed-findbar { flex-wrap: wrap; }
  .ed-findbar input { flex: 1 1 90px; min-width: 0; height: 34px; font-size: 16px; }
  .ed-findbar button { min-height: 34px; }
  .scrap-toolbar { flex-wrap: wrap; }
  .scrap-toolbar .link-btn { min-height: 36px; }
  .page { overflow-wrap: anywhere; }
  .ed-complete { max-width: 100%; }
  .web-bar { flex-wrap: wrap; padding: 4px; gap: 3px; }
  .web-bar .link-btn { min-width: 40px; min-height: 39px; }
  .web-bar .web-url { flex: 1 1 150px; }
  .web-status { white-space: normal; overflow-wrap: anywhere; }
  .b-view-toolbar { height: 41px; overflow-x: auto; white-space: nowrap; }
  .b-view-toolbar button { flex: none; min-width: 40px; height: 37px; }
  .problem-row { min-height: 40px; }
  .b-view-body, #view-explorer .view-body, #view-outline .view-body { overscroll-behavior: contain; }
  .welcome-inner { padding: 16px; }
  .welcome-grid { grid-template-columns: 1fr; }
  .welcome-card { text-align: start; }
  #statusbar { min-height: 22px; flex: none; overflow: hidden; }
  #statusbar .status-item { display: none; }
  #statusbar #status-jvm { display: block; }
  #status-message { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #menu-popup, #context-menu {
    left: max(6px, env(safe-area-inset-left)) !important;
    right: max(6px, env(safe-area-inset-right));
    top: auto !important;
    bottom: calc(52px + env(safe-area-inset-bottom));
    min-width: 0;
    max-height: min(68dvh, 560px);
    overflow: auto;
    border-radius: 8px;
  }
  .menu-entry { min-height: 40px; padding: 8px 12px; }
  .menu-entry .accel { padding-left: 8px; }
  .mobile-menu-back {
    display: flex;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: var(--toolbar-flat);
    color: var(--text);
    text-align: left;
  }
  .modal {
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: calc(100% - 24px) !important;
    max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .modal-body { overflow: auto; }
  .modal-buttons { flex: none; flex-wrap: wrap; }
  .modal-buttons button { min-height: 38px; }
  #toast { max-width: calc(100% - 24px); bottom: calc(72px + env(safe-area-inset-bottom)); }
}
