.ml-panel {
  box-sizing: border-box;
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(144px + env(safe-area-inset-bottom));
  width: 320px;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 220px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: manipulation;
  z-index: 20;
  padding: 16px;
  border: 2px solid #536367;
  border-radius: 14px;
  background: #fcf7e8;
  color: #1d3036;
  box-shadow: 0 5px 24px #142e3940;
  font: 16px/1.4 system-ui, sans-serif;
}
.ml-panel[hidden] { display: none; }
.ml-panel h2 { margin: 10px 0; font-size: 21px; }
.ml-panel p { margin: 10px 0; }
.ml-panel button, .ml-panel select {
  box-sizing: border-box;
  min-height: 44px;
  min-width: 44px;
  max-width: 100%;
  margin: 4px 0;
  padding: 8px 12px;
  border: 1px solid #536367;
  border-radius: 8px;
  background: #fffdf7;
  color: inherit;
  font: inherit;
  touch-action: manipulation;
  overflow-wrap: anywhere;
}
.ml-panel button { width: 100%; cursor: pointer; text-align: left; }
.ml-panel button:disabled { opacity: .55; cursor: default; }
.ml-panel :focus-visible { outline: 3px solid #146d91; outline-offset: 2px; }
.ml-panel button[aria-pressed="true"] { background: #cce6de; border-width: 2px; }
.ml-panel label { display: block; }
.ml-panel select { display: block; width: 100%; }
.ml-panel-status { font-size: 19px; font-weight: 650; }
.ml-panel-glyph { display: inline-block; width: 28px; height: 28px; vertical-align: middle; margin-right: 8px; }
.ml-panel-glyph svg, .ml-panel-glyph img { width: 100%; height: 100%; }
.ml-panel-port { margin: 10px 0; }
.ml-panel progress { display: block; width: 100%; height: 10px; accent-color: #287c6f; }
.ml-problems { left: max(12px, env(safe-area-inset-left)); right: auto; }
.ml-problem-row { white-space: normal; }
@media (max-width: 680px) {
  .ml-panel { bottom: calc(12px + env(safe-area-inset-bottom)); max-height: calc(100dvh - 90px - env(safe-area-inset-top)); }
  .ml-problems { z-index: 21; }
}

/* Reserve the camera control column even when the inspector is fully expanded.
   On phones, keep a scrollable panel below all four camera buttons. */
@media (min-width: 681px) {
  .ml-inspector { right: calc(120px + env(safe-area-inset-right, 0px)); }
}
@media (max-width: 680px) {
  .ml-inspector { top: calc(280px + env(safe-area-inset-top, 0px));
    bottom: calc(76px + env(safe-area-inset-bottom, 0px)); max-height: none; }
}
