/* 2026-10-19: iPhone Image welcome, compact at rest, full controls on demand.
   Never change generated History, Video, desktop or native Create. */
@media(max-width:680px){
  html:not(.pv-native-lab) body:has(#app.image-studio-active:not([hidden]) #image-gallery-empty:not([hidden]) #lab-welcome-start:not([hidden])) #studio-header{
    transition:none!important;
  }
  /* Keep the signed-in welcome masthead stable, regardless of scrollY. */
  html:not(.pv-native-lab) body:has(#app.image-studio-active:not([hidden]) #image-gallery-empty:not([hidden]) #lab-welcome-start:not([hidden])) #studio-header.pv-mobile-entry-condensed{
    height:78px!important;min-height:78px!important;
  }
  /* Keep a small safety gap above the fixed compact dock, not the previous
     255px reservation for a two-row deck. */
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    .image-gallery-empty:has(#lab-welcome-start:not([hidden])){
    padding-bottom:182px!important;
  }
  /* Reduce only welcome copy spacing; the original photographs are not resized. */
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    .image-gallery-empty:has(#lab-welcome-start:not([hidden])){
    padding-top:5px!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active #lab-welcome-start h2{
    margin-top:7px!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active #lab-welcome-start .lab-welcome-subtitle{
    margin-top:8px!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active #lab-welcome-start .lab-welcome-carousel{
    margin-top:13px!important;
  }
  /* Give the original photographs the space recovered from the second
     toolbar row. This also closes the remaining blank gap above the deck. */
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #lab-welcome-start .lab-welcome-preset{
    height:clamp(214px,calc(56vw + 30px),282px)!important;
  }
  /* Shared Image Studio deck: identical compact controls in welcome, Inspiration and History.\n     Do not tie composer geometry to whether the first-image cards are mounted.\n     Generated History keeps its own normal vertical scrolling. */\n  /* The resting composer becomes a single horizontal tools row. Its textarea,
     uploaded refs, quote, Generate and actual original inputs remain mounted. */
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer.mobile-polish-ready:not(.is-pv-soul){
    padding:9px 11px 10px!important;border-radius:18px!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer:not(.is-pv-soul) .image-composer-top{
    min-height:39px!important;padding-bottom:4px!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer:not(.is-pv-soul) #image-composer-prompt{
    min-height:39px!important;height:39px;max-height:130px;
  }
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer:not(.is-pv-soul) .image-composer-toolbar{
    margin-top:6px!important;gap:7px!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer:not(.is-pv-soul) .composer-controls{
    gap:5px!important;flex-wrap:wrap!important;align-items:center!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer:not(.is-pv-soul) .composer-controls::before{
    order:5!important;display:none!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer:not(.is-pv-soul) .composer-controls>.composer-add-wrap{order:0!important}
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer:not(.is-pv-soul) .composer-controls>.scene-image-library-wrap{order:1!important}
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer:not(.is-pv-soul) .composer-controls>.composer-model-wrap{order:2!important;flex:1 1 90px!important}
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer:not(.is-pv-soul) .composer-controls>.composer-mood-control{order:3!important}
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer:not(.is-pv-soul) .composer-controls>.composer-mobile-more{
    order:4!important;display:inline-flex!important;
    width:35px!important;min-width:35px!important;flex:0 0 35px!important;
    height:35px!important;min-height:35px!important;padding:0!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer:not(.is-pv-soul) .composer-mobile-more span{
    position:absolute!important;width:1px!important;height:1px!important;
    overflow:hidden!important;clip-path:inset(50%)!important;white-space:nowrap!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer:not(.is-pv-soul) .composer-mobile-more svg{
    width:17px!important;height:17px!important;
  }
  /* Collapse only secondary controls; do not alter their values or listeners. */
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer.mobile-polish-ready:not(.is-pv-soul):not([data-mobile-settings="open"])
    .composer-controls>:not(.composer-add-wrap):not(.scene-image-library-wrap):not(.composer-model-wrap):not(.composer-mood-control):not(.composer-mobile-more){
    display:none!important;
  }
  /* Restore secondary actions explicitly in the expanded state. Their
     [hidden] flags still win for models where a control is unsupported. */
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul)
    :is(#image-composer-edit-area,#composer-reference-intent-toggle,#composer-exact-prompt-option,#composer-more-anchor):not([hidden]){
    display:inline-flex!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul)
    .composer-select-pill:has(#image-composer-ratio):not([hidden]){
    display:inline-flex!important;
  }
  /* Expanded options are a real second row within the deck, not a floating
     overlay that can be cut off by Safari. */
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul)
    .composer-controls::before{display:block!important;flex:0 0 100%!important}
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul)
    .composer-controls::after{display:none!important}
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul)
    :is(#image-composer-resolution-wrap,#image-composer-count-wrap):not([hidden]){
    position:relative!important;bottom:auto!important;right:auto!important;
    width:auto!important;min-width:65px!important;z-index:auto!important;
    display:inline-flex!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
    #image-composer:not(.is-pv-soul) .composer-generate{
    height:48px!important;min-height:48px!important;max-height:48px!important;
    padding:8px 12px!important;
  }
}
/* Lock only the resting signed-in welcome, with enough phone height to
   display both the cards and compact Generate. Keyboard, options and History
   automatically restore scrolling through the :has exclusions. */
@media(max-width:680px) and (min-height:690px){
  html:not(.pv-native-lab):has(#app.image-studio-active:not([hidden]) #image-gallery-empty:not([hidden]) #lab-welcome-start:not([hidden])):not(:has(#image-composer:focus-within)):not(:has(#image-composer[data-mobile-settings="open"])):not(:has(#image-composer.pv-deck-expanded)){
    height:100dvh!important;overflow-y:hidden!important;overscroll-behavior-y:none!important;
  }
  html:not(.pv-native-lab):has(#app.image-studio-active:not([hidden]) #image-gallery-empty:not([hidden]) #lab-welcome-start:not([hidden])):not(:has(#image-composer:focus-within)):not(:has(#image-composer[data-mobile-settings="open"])):not(:has(#image-composer.pv-deck-expanded)) body{
    max-height:100dvh!important;overflow-y:hidden!important;overscroll-behavior-y:none!important;
  }
}

/* Public and authenticated phone Image decks share the compact instrument.
   Guest buttons retain their local-photo / sign-in handlers. */
#gate #pv-guest-mobile-more{display:none}
@media(max-width:680px){
  /* iOS focus zoom is triggered by undersized editable text. Keep pinch zoom. */
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-prompt,
  html:not(.pv-native-lab) #app.image-studio-active #image-composer:not(.is-pv-soul) #image-composer-prompt{
    font-size:16px!important;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image .pv-guest-content{
    padding-bottom:330px!important;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-composer{
    position:fixed;left:50%;bottom:max(3px,env(safe-area-inset-bottom));
    transform:translateX(-50%);z-index:82;
    box-sizing:border-box;width:calc(100vw - 18px);max-width:none;
    margin:0;padding:9px 11px 10px;border-radius:18px!important;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-composer>.pv-guest-prompt-row{
    display:flex;align-items:center;min-height:39px;padding-bottom:4px;
    border-bottom:1px solid rgba(255,255,255,.10);
  }
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-composer #pv-guest-prompt{
    height:39px;min-height:39px;max-height:130px;padding:5px 3px;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-composer.pv-deck-expanded #pv-guest-prompt{
    height:102px;min-height:102px;max-height:123px;
    white-space:pre-wrap;overflow-x:hidden;overflow-y:auto;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image .pv-guest-composer-footer{
    gap:7px;margin-top:6px;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image .pv-guest-settings{
    display:flex;flex-wrap:wrap;gap:5px;width:100%;min-width:0;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image .pv-guest-settings>:is(.composer-add-wrap,.scene-image-library-wrap,.composer-model-wrap,.composer-mood-control){
    display:block;min-width:0;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image .pv-guest-setting{
    box-sizing:border-box;height:35px;min-height:35px;border-radius:9px;
    font-size:11px;padding:5px 6px;gap:4px;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image .composer-add-wrap{order:0;flex:0 0 35px}
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-add{width:35px;font:350 26px/1 Arial,sans-serif;background:#292c2a}
  html:not(.pv-native-lab) #gate.pv-guest-image .scene-image-library-wrap{order:1;flex:0 0 35px}
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-library{
    display:flex;align-items:center;justify-content:center;width:35px;border-radius:50%;border-color:#626762;background:transparent;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-library svg{width:17px;height:17px}
  html:not(.pv-native-lab) #gate.pv-guest-image .composer-model-wrap{order:2;flex:1 1 0px}
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-model{display:flex;width:100%;min-width:0}
  html:not(.pv-native-lab) #gate.pv-guest-image .pv-guest-model-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
  html:not(.pv-native-lab) #gate.pv-guest-image .pv-guest-model-symbol,
  html:not(.pv-native-lab) #gate.pv-guest-image .pv-guest-model-symbol img{display:block;width:20px;height:20px;flex:none}
  html:not(.pv-native-lab) #gate.pv-guest-image .composer-mood-control{order:3;flex:0 0 75px}
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-moods{display:flex;width:100%;font-size:10.5px;color:#dcff00;justify-content:center}
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-mobile-more{
    display:flex;align-items:center;justify-content:center;order:4;flex:0 0 35px;width:35px;padding:0;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-mobile-more[aria-expanded="true"] svg{transform:rotate(180deg)}
  html:not(.pv-native-lab) #gate.pv-guest-image .pv-guest-settings>:is(#pv-guest-base,#pv-guest-ratio,#pv-guest-resolution,#pv-guest-count){order:6}
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-composer:not([data-mobile-settings="open"]) .pv-guest-settings>:is(#pv-guest-base,#pv-guest-ratio,#pv-guest-resolution,#pv-guest-count){display:none}
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-composer[data-mobile-settings="open"] .pv-guest-settings>:is(#pv-guest-base,#pv-guest-ratio,#pv-guest-resolution,#pv-guest-count){display:inline-flex}
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-composer[data-mobile-settings="open"] .pv-guest-settings:before{content:"";order:5;flex:0 0 100%;height:0}
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-generate{
    height:48px;min-height:48px;max-height:48px;padding:8px 12px;font-size:13px;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image #pv-guest-generate small{display:none}
}

@media(max-width:360px){
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden]) #image-composer:not(.is-pv-soul) .composer-controls>.composer-model-wrap{flex-basis:0!important}
  html:not(.pv-native-lab) #gate.pv-guest-image :is(.composer-add-wrap,.scene-image-library-wrap){flex-basis:33px}
  html:not(.pv-native-lab) #gate.pv-guest-image :is(#pv-guest-add,#pv-guest-library){width:33px}
  html:not(.pv-native-lab) #gate.pv-guest-image .composer-mood-control{flex-basis:71px}
}

/* 2026-10-24: guest Image on short Safari/in-app viewports.
   The prompt is already a fixed dock. A 330px bottom content spacer plus
   scrollIntoView on that fixed dock exposed a second, empty page. Keep the
   resting editor in one viewport; unlock naturally for text focus, photo tray,
   Options, closed-account recovery and shorter devices. Never target History. */
@media(max-width:680px){
  html:not(.pv-native-lab) #gate.pv-guest-image[data-guest-tool="image"] .pv-guest-content{
    padding-bottom:28px!important;
  }
}
@media(max-width:680px) and (min-height:550px){
  html:not(.pv-native-lab):has(#gate.pv-guest-image[data-guest-tool="image"]:not([hidden])):not(:has(#pv-guest-closed-state:not([hidden]))):not(:has(#pv-guest-composer:focus-within)):not(:has(#pv-guest-composer[data-mobile-settings="open"])):not(:has(#pv-guest-attachments:not([hidden]))){
    height:100dvh!important;overflow-y:hidden!important;
    overscroll-behavior-y:none!important;scroll-behavior:auto!important;
  }
  html:not(.pv-native-lab):has(#gate.pv-guest-image[data-guest-tool="image"]:not([hidden])):not(:has(#pv-guest-closed-state:not([hidden]))):not(:has(#pv-guest-composer:focus-within)):not(:has(#pv-guest-composer[data-mobile-settings="open"])):not(:has(#pv-guest-attachments:not([hidden]))) body{
    height:100dvh!important;max-height:100dvh!important;
    overflow-x:hidden!important;overflow-y:hidden!important;
    overscroll-behavior-y:none!important;
  }
  html:not(.pv-native-lab):has(#gate.pv-guest-image[data-guest-tool="image"]:not([hidden])):not(:has(#pv-guest-closed-state:not([hidden]))):not(:has(#pv-guest-composer:focus-within)):not(:has(#pv-guest-composer[data-mobile-settings="open"])):not(:has(#pv-guest-attachments:not([hidden]))) body>main#main{
    box-sizing:border-box;height:calc(100dvh - 78px)!important;
    min-height:0!important;max-height:none!important;overflow:hidden!important;
  }
  html:not(.pv-native-lab):has(#gate.pv-guest-image[data-guest-tool="image"]:not([hidden])):not(:has(#pv-guest-closed-state:not([hidden]))):not(:has(#pv-guest-composer:focus-within)):not(:has(#pv-guest-composer[data-mobile-settings="open"])):not(:has(#pv-guest-attachments:not([hidden]))) #gate.pv-guest-image[data-guest-tool="image"]{
    box-sizing:border-box;height:100%!important;min-height:0!important;
    max-height:100%!important;overflow:hidden!important;
  }
  html:not(.pv-native-lab):has(#gate.pv-guest-image[data-guest-tool="image"]:not([hidden])):not(:has(#pv-guest-closed-state:not([hidden]))):not(:has(#pv-guest-composer:focus-within)):not(:has(#pv-guest-composer[data-mobile-settings="open"])):not(:has(#pv-guest-attachments:not([hidden]))) #gate.pv-guest-image .pv-guest-content{
    box-sizing:border-box;height:100%;min-height:0;overflow:visible;
    padding-bottom:0!important;
  }
  html:not(.pv-native-lab):has(#gate.pv-guest-image[data-guest-tool="image"]:not([hidden])):not(:has(#pv-guest-closed-state:not([hidden]))):not(:has(#pv-guest-composer:focus-within)):not(:has(#pv-guest-composer[data-mobile-settings="open"])):not(:has(#pv-guest-attachments:not([hidden]))) body>footer.pv-lab-footer{display:none!important}
}
/* Keep both original photographs above the fixed editor when mobile browser
   chrome reduces the usable height. Unaltered on normal/tall phones. */
@media(max-width:680px) and (min-height:550px) and (max-height:689px){
  html:not(.pv-native-lab):has(#gate.pv-guest-image[data-guest-tool="image"]:not([hidden])):not(:has(#pv-guest-closed-state:not([hidden]))):not(:has(#pv-guest-composer:focus-within)):not(:has(#pv-guest-composer[data-mobile-settings="open"])):not(:has(#pv-guest-attachments:not([hidden]))) #gate.pv-guest-image .pv-guest-content{
    padding-top:clamp(15px,3dvh,26px)!important;
  }
  html:not(.pv-native-lab):has(#gate.pv-guest-image[data-guest-tool="image"]:not([hidden])):not(:has(#pv-guest-closed-state:not([hidden]))):not(:has(#pv-guest-composer:focus-within)):not(:has(#pv-guest-composer[data-mobile-settings="open"])):not(:has(#pv-guest-attachments:not([hidden]))) #gate.pv-guest-image h1{
    margin-top:6px!important;
  }
  html:not(.pv-native-lab):has(#gate.pv-guest-image[data-guest-tool="image"]:not([hidden])):not(:has(#pv-guest-closed-state:not([hidden]))):not(:has(#pv-guest-composer:focus-within)):not(:has(#pv-guest-composer[data-mobile-settings="open"])):not(:has(#pv-guest-attachments:not([hidden]))) #gate.pv-guest-image .pv-guest-cards{
    margin-top:12px!important;
  }
  html:not(.pv-native-lab):has(#gate.pv-guest-image[data-guest-tool="image"]:not([hidden])):not(:has(#pv-guest-closed-state:not([hidden]))):not(:has(#pv-guest-composer:focus-within)):not(:has(#pv-guest-composer[data-mobile-settings="open"])):not(:has(#pv-guest-attachments:not([hidden]))):not(:has(#pv-guest-composer.pv-deck-expanded)) #gate.pv-guest-image .pv-guest-card{
    height:clamp(134px,calc(100dvh - 455px),195px)!important;
  }
}

/* The Image masthead is now compact from first paint. Keep Sign in aligned
   with Video/Upscaler/Fashion's existing 10px right inset on phones. */
@media(max-width:680px){
  body:has(#gate.pv-guest-image[data-guest-tool="image"]:not([hidden]))
    >#studio-header.pv-mobile-entry-condensed .wrap.top{
    padding-right:10px!important;
  }
}

/* 2026-11-04 | Restore approved Image 2 spacing.
   Revert only the 3 November negative carousel offsets. The original phone
   rules above remain: 13px signed-in and the Inspiration stylesheet's 23px
   signed-out margin. Neither state changes position when a Mood expands the
   prompt. Keep original card dimensions, real prompt expansion, scroll access
   and the later mobile settings/Retouch improvements unchanged. */

/* iPhone Image | Secondary options retain their existing disclosure behavior.
   Retouch has its own Studio route; it does not need a duplicate button here.
   The More control moves into Retouch's vacant first slot once the options
   are open, while staying in the main row when closed so it is always reachable. */
@media(max-width:680px){
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
  #image-composer.mobile-polish-ready:not(.is-pv-soul) #image-composer-edit-area,
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
  #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul) #image-composer-edit-area:not([hidden]){
    /* Match the expanded-state :is(#image-composer-edit-area,...) rule above
       in specificity; otherwise it brings Retouch back with !important. */
    display:none!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
  #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul) .composer-controls::before{
    display:block!important;order:5!important;flex:0 0 100%!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
  #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul)
  .composer-controls>.composer-mobile-more{
    order:6!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
  #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul)
  .composer-select-pill:has(#image-composer-ratio){order:7!important}
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
  #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul)
  #composer-reference-intent-toggle{order:8!important}
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
  #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul)
  #image-reference-mode-wrap{order:8!important}
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
  #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul)
  #image-composer-resolution-wrap{order:9!important}
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
  #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul)
  #image-composer-count-wrap{order:10!important}
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
  #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul)
  #composer-exact-prompt-option{order:11!important}
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden])
  #image-composer.mobile-polish-ready[data-mobile-settings="open"]:not(.is-pv-soul)
  #composer-more-anchor{order:12!important}

  /* Expanded prompt or open settings may unlock the welcome scroll. The
     fixed composer remains visible, while the full original photographs and
     headline can scroll above it without overlap or being permanently cut off.
     The reserve follows the actual dock height via ResizeObserver. */
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden]):has(#image-composer.pv-deck-expanded)
  .image-gallery-empty:has(#lab-welcome-start:not([hidden])),
  html:not(.pv-native-lab) #app.image-studio-active:not([hidden]):has(#image-composer[data-mobile-settings="open"])
  .image-gallery-empty:has(#lab-welcome-start:not([hidden])){
    padding-bottom:max(182px,var(--pv-mobile-image-dock-reserve,320px))!important;
  }
}

/* 4 Nov: keep the approved LOCKED viewport and fixed Generate (the prior
   flow position regressed in an in-app iPhone browser). Only the expanded
   public preview gets the signed-in-style portrait cards WHEN they fit.
   Never switch the editor to normal document flow or unlock root scrolling. */
@media(max-width:680px) and (min-height:690px){
  html:not(.pv-native-lab) #gate.pv-guest-image[data-guest-tool="image"]:has(#pv-guest-composer.pv-deck-expanded) .pv-guest-carousel{
    margin-top:8px!important;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image[data-guest-tool="image"]:has(#pv-guest-composer.pv-deck-expanded) .pv-guest-card{
    height:max(clamp(185px,calc(100dvh - 540px),225px),clamp(178px,53.5vw,264px))!important;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image[data-guest-tool="image"] #pv-guest-composer.pv-deck-expanded{
    position:fixed!important;
    left:50%!important;
    right:auto!important;
    top:auto!important;
    bottom:max(3px,env(safe-area-inset-bottom))!important;
    transform:translateX(-50%)!important;
    margin:0!important;
    width:calc(100vw - 18px)!important;
    max-width:none!important;
  }
}


/* 2026-11-11 | Restore phone Inspiration clearance after prompt expansion.
   The Nov 4 fixed-deck treatment stays locked. These rules affect only the
   public or signed-in Image Inspiration entrance, never History or Moods.
   A measured shift is applied by image-editorial-deck.js; small browser
   viewports may reduce photo height only when translation cannot suffice. */
@media(max-width:680px){
  html:not(.pv-native-lab) #gate.pv-guest-image[data-guest-tool="image"]:has(#pv-guest-composer.pv-deck-expanded)
    .pv-guest-carousel{margin-top:8px!important}
  html:not(.pv-native-lab) #app.image-studio-active:has(#image-composer.pv-deck-expanded)
    #lab-welcome-start:not([hidden]) .lab-welcome-carousel{margin-top:8px!important}
  /* Never translate .pv-guest-content itself: it owns the position:fixed
     composer. A transformed ancestor would rebase that fixed dock and cause
     keyboard/scroll drift. Move only the heading and carousel siblings. */
  html:not(.pv-native-lab) #gate.pv-guest-image[data-guest-tool="image"]
    .pv-guest-content.pv-phone-inspiration-lift
    > :is(.pv-guest-kicker,h1,.pv-guest-subtitle,.pv-guest-credit-note,.pv-guest-carousel){
    translate:0 calc(0px - var(--pv-phone-inspiration-lift,0px))!important;
  }
  html:not(.pv-native-lab) #app.image-studio-active
    #lab-welcome-start.pv-phone-inspiration-lift{
    translate:0 calc(0px - var(--pv-phone-inspiration-lift,0px))!important;
  }
  html:not(.pv-native-lab) #gate.pv-guest-image[data-guest-tool="image"]
    .pv-guest-content.pv-phone-inspiration-lift .pv-guest-cards.pv-phone-inspiration-compact-cards .pv-guest-card,
  html:not(.pv-native-lab) #app.image-studio-active
    #lab-welcome-start.pv-phone-inspiration-lift .lab-welcome-presets.pv-phone-inspiration-compact-cards .lab-welcome-preset{
    height:var(--pv-phone-inspiration-card-height)!important;
  }
}

/* Reopened Inspiration retains its archive DOM. Elevate the parent stacking
   context, not only the History button, and let the carousel receive taps
   everywhere outside the actual return control. */
html:not(.pv-native-lab):not(.pv-image-previews-hidden) #app.image-studio-active.pv-moods-discovery-open
  .image-gallery-shell:has(> #image-gallery-empty:not([hidden])) > .image-gallery-host{
  position:relative;z-index:7!important;pointer-events:none;
}
html:not(.pv-native-lab):not(.pv-image-previews-hidden) #app.image-studio-active.pv-moods-discovery-open
  .image-gallery-host #history-moods-toggle{
  pointer-events:auto;touch-action:manipulation;
}
@media(max-width:680px){
  /* Reserve the History control's own row above the title, including when
     the expanded fixed composer needs to lift the welcome content. */
  html:not(.pv-native-lab) #app.image-studio-active.pv-moods-discovery-open:not([hidden])
    .image-gallery-shell:has(> #image-gallery-empty:not([hidden]) #lab-welcome-start:not([hidden]))
    > #image-gallery-empty{
    padding-top:54px!important;
  }
  /* Use the same approved photographic backdrop as the guest entrance. */
  html:not(.pv-native-lab):not(.pv-image-previews-hidden)
    #app.image-studio-active.pv-moods-discovery-open:not([hidden])
    .image-gallery-shell:has(> #image-gallery-empty:not([hidden]) #lab-welcome-start:not([hidden]))::before{
    background:url("./visuals/image-hero-chrome-editorial-20261031.jpg") 60% top/cover no-repeat!important;
    opacity:1!important;filter:none!important;transform:none!important;
  }
}
