/* Keep the model outside the editable canvas. These overrides intentionally
   ignore old floating-window positions/sizes without deleting local drafts. */
@media (min-width: 1024px) {
  .editor-page-gesture-boundary {
    --cwm-model-width: clamp(280px, 30vw, 420px);
  }

  .editor-page-gesture-boundary:has(> [data-visualization-preview-3d]) .editor-container .canvas-drop-zone {
    margin-right: calc(var(--cwm-model-width) + 24px);
    min-width: 0;
  }

  .editor-page-gesture-boundary > [data-visualization-preview-3d] .tesla-window {
    left: auto !important;
    right: 12px !important;
    top: 72px !important;
    width: var(--cwm-model-width) !important;
    height: calc(var(--cwm-model-width) * 0.75) !important;
    max-height: calc(100dvh - 88px);
  }

  /* A docked panel cannot be dragged or resized back over the editor. */
  .editor-page-gesture-boundary > [data-visualization-preview-3d] .tesla-window > button[aria-label="Move 3D preview"],
  .editor-page-gesture-boundary > [data-visualization-preview-3d] .tesla-window > [class*="cursor-"][class*="-resize"] {
    display: none !important;
  }
}

/* Use the existing open/back mobile preview flow on tablets too, keeping
   enough space for the canvas and the expanded assets/layers panel. */
@media (min-width: 768px) and (max-width: 1023px) {
  .editor-page-gesture-boundary > [data-visualization-preview-3d].md\:block {
    display: none !important;
  }

  .editor-page-gesture-boundary > [data-visualization-preview-3d].md\:hidden {
    display: block !important;
  }
}
