/* One bounded preview, with native rail scrolling and page-owned controls. */
@media(max-width:900px){
  html{scroll-padding-top:var(--editor-control-top,80px)}
  body.has-media #mobileFrameStudio{
    position:sticky!important;
    top:var(--editor-header-height,60px)!important;
    z-index:40!important;
    display:grid!important;
    height:min(340px,38svh)!important;
    min-height:0!important;
    grid-template-columns:minmax(0,1fr) 112px!important;
    grid-template-rows:minmax(0,1fr)!important;
    align-items:stretch!important;
    background:#fff!important;
    box-shadow:0 5px 14px rgba(20,26,33,.08)!important;
    overflow:hidden!important;
  }
  body.has-media.is-media-landscape #mobileFrameStudio{
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:minmax(0,1fr) 105px!important;
  }
  body.has-media #mobileFrameStudio .mobile-preview-pane{
    display:flex!important;flex-direction:column!important;
    width:100%!important;height:100%!important;min-height:0!important;
  }
  body.has-media #mobileFrameStudio .mobile-preview-head{flex:0 0 28px!important;min-height:0!important}
  #mobileOutputRatio{margin-left:auto;margin-right:7px;font-size:10px;color:#636b75;font-variant-numeric:tabular-nums}
  body.has-media #editorLivePreview{
    display:flex!important;align-items:center!important;justify-content:center!important;
    position:relative!important;flex:1 1 0!important;
    width:100%!important;height:0!important;min-height:0!important;
    padding:6px!important;overflow:hidden!important;
    touch-action:pan-y pinch-zoom!important;
  }
  body.has-media #editorLiveCanvas{
    position:static!important;flex:0 0 auto!important;
    width:var(--live-canvas-width,1px)!important;
    height:var(--live-canvas-height,1px)!important;
    max-width:100%!important;max-height:100%!important;
    transform:none!important;object-fit:contain!important;
    touch-action:pan-y pinch-zoom!important;
  }
  body.has-media #mobileFrameStudio .mobile-frame-browser{
    display:flex!important;min-height:0!important;height:100%!important;
  }
  body.has-media #mobileFrameStudio .mobile-frame-browser-head{min-height:26px!important;padding:4px 7px!important;flex:0 0 auto!important}
  body.has-media #mobilePresetRail{
    flex:1 1 0!important;min-height:0!important;min-width:0!important;
    scroll-snap-type:none!important;overscroll-behavior:auto!important;
    -webkit-overflow-scrolling:touch;
    touch-action:pan-y pinch-zoom!important;
    overflow-y:auto!important;overflow-x:hidden!important;
  }
  body.has-media.is-media-landscape #mobilePresetRail{
    flex-direction:row!important;overflow-x:auto!important;overflow-y:hidden!important;
    touch-action:pan-x pan-y pinch-zoom!important;
  }
  #mobilePresetRail .mobile-preset-option{touch-action:inherit!important}
  #mobilePresetRail .mobile-preset-thumb{height:54px!important;pointer-events:none}
  #mobilePresetRail .mobile-preset-copy{pointer-events:none}
  body.has-media.is-media-landscape #mobilePresetRail .mobile-preset-option{flex:0 0 108px!important;gap:3px!important;padding:4px!important}
  body.has-media.is-media-landscape #mobilePresetRail .mobile-preset-thumb{height:28px!important}
  body.has-media .editor-content{position:relative;z-index:0}
  body.has-media .details-card,body.has-media #frameMetaControls{scroll-margin-top:0!important}
  body.has-media .quick-ratio-section{scroll-margin-top:0!important}
  body.has-media .field input,body.has-media .field select,body.has-media .field textarea{font-size:16px!important}
  body.has-media #ratioGrid{touch-action:pan-x pan-y pinch-zoom!important;overscroll-behavior:auto!important}
  body.has-media[data-editor-tab="text"] #mobileFrameStudio{grid-template-columns:1fr!important;grid-template-rows:minmax(0,1fr)!important}
  body.has-media[data-editor-tab="text"] #mobileFrameStudio .mobile-frame-browser{display:none!important}
  body.has-media.editor-keyboard-open #mobileFrameStudio{
    height:clamp(100px,calc(var(--editor-visual-height,400px) * .32),180px)!important;
    grid-template-columns:minmax(0,1fr) 104px!important;grid-template-rows:minmax(0,1fr)!important;
  }
  body.has-media.editor-keyboard-open #mobileFrameStudio .mobile-frame-browser{display:none!important}
  body.has-media.editor-keyboard-open #mobileFrameStudio{grid-template-columns:1fr!important}
}
@media(max-width:900px) and (max-height:520px){
  body.has-media #mobileFrameStudio{height:150px!important;grid-template-columns:minmax(0,1fr) 150px!important;grid-template-rows:minmax(0,1fr)!important}
  body.has-media.is-media-landscape #mobilePresetRail{flex-direction:column!important;overflow-y:auto!important;overflow-x:hidden!important;touch-action:pan-y pinch-zoom!important}
  body.has-media.is-media-landscape #mobilePresetRail .mobile-preset-option{flex:0 0 auto!important;width:100%!important}
}
