/* Preserve the approved composition while allowing edited fonts and copy to wrap. */
#qe #q-story :is(.ls-heading,.ls-framework-scene,.ls-research-layout,.ls-access-layout,.ls-curriculum-head,.v8-area-layout,.library-head) > *,
#qe :is(.ls-reader-top,.imgbar,.imgtools) > *{min-width:0}
#qe #q-story :is(.ls-price-top,.price-row){flex-wrap:wrap}
#qe #q-story .ls-price-card .price-row{row-gap:10px}
#qe #q-story :is(.ls-heading h2,.ls-module-panel h3,.ls-access-aside h3,.ls-price-card h3,.q10-deck-head>span),
#qe :is(.ls-reader-top h3,.ls-source-essay>h2,.q11-reader-history a){overflow-wrap:anywhere}

/* The reading body takes the space remaining below its actual header height. */
#qe :is(.ls-reading-room,.ls-library-dialog)[open],
#qe.retro-edition #image-reader[open]{display:flex;flex-direction:column}
#qe .ls-reader-top{flex:0 0 auto}
#qe .ls-reader-top>button{flex:0 0 auto}
#qe .ls-reader-scroll,
#qe #q-story .ls-library-dialog #lib-contents{flex:1 1 auto;min-height:0;max-height:none}
#qe.retro-edition #image-reader :is(.imgbar,.imgtools){flex:0 0 auto}
#qe.retro-edition #image-reader .imgbar>span{overflow-wrap:anywhere}
#qe.retro-edition #image-reader .imgbar>button{flex:0 0 auto}
#qe.retro-edition #image-reader .imgwindow,
#qe.retro-edition #image-reader.has-history .imgwindow{flex:1 1 auto;min-height:0}
#qe #image-reader .q11-reader-history{flex:0 1 auto;min-height:0;max-height:min(150px,26svh)}

@media(max-width:720px){
  /* Lifetime is wider than a numerical statistic; reserve the room it needs. */
  #qe #q-story .ls-course-facts{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1.3fr)}
  #qe #q-story .ls-course-facts>div{min-width:0}
  #qe #q-story .ls-course-facts>div:last-child strong{font-size:clamp(27px,7.95vw,36px)}
  #qe #q-story .ls-price-card .price-row{column-gap:17px}
  #qe .ls-reader-top{align-items:flex-start}
  #qe .ls-reader-top>div{overflow-wrap:anywhere}
  #qe.retro-edition #image-reader .imgbar{flex-wrap:wrap}
  #qe.retro-edition #image-reader .imgbar>span{flex:1 1 100%}
}

@media(max-width:380px){
  /* The two amounts may use separate lines instead of pushing beyond the card. */
  #qe #q-story .ls-price-card .price-row strong{font-size:clamp(45px,17.18vw,55px)}
}

@media(pointer:coarse){
  #qe #q-story .q10-deck-controls>button{width:44px;height:44px}
  #qe #q-story :is(.ls-lens-tabs button,.noise-tabs button,.regime-buttons button,.qflow button){min-height:44px}
  #qe :is(.ls-reader-top>button,.imgbar>button,.imgtools>button){min-height:44px}
  #qe.retro-edition #image-reader .imgtools>button{min-width:44px}
  /* A readable control size also avoids automatic zoom on iOS form focus. */
  #qe #q-story :is(.ls-search input,.v8-area-picker select,#ls-library-dialog .search-field input){font-size:16px;min-height:44px}
}

@media(pointer:coarse) and (max-width:720px){
  #qe.retro-edition .top-right{gap:12px}
  #qe.retro-edition :is(.audio-switch,.nav-toggle){min-width:24px;min-height:44px;justify-content:center}
  #qe.retro-edition .ah-login{min-height:44px;display:inline-flex;align-items:center}
  #qe #q-story .q10-deck-head{align-items:flex-start}
  #qe #q-story .q10-deck-head>span{padding-top:9px}
}
@media(pointer:coarse) and (max-width:380px){#qe.retro-edition .top-right{gap:8px}}
