/* Shared small-screen behaviour for every Hanguita page. */
html{scroll-padding-top:100px}
body:has(dialog[open]){overflow:hidden}
dialog{overscroll-behavior:contain}
.cutout-viewport{touch-action:pan-x pan-y pinch-zoom}
@media(max-width:600px){
  html{scroll-padding-top:90px}
  .masthead .head{grid-template-columns:1fr auto 1fr!important;gap:8px!important}
  .masthead .head-actions a.icon-button{display:none}
  .masthead .head-actions button.icon-button{width:44px;height:44px;min-width:44px;padding:6px}
  .masthead .head>.logo img{width:60px!important;height:75px!important;object-fit:contain}
  .masthead .head nav#hanga-main-menu{max-height:calc(100dvh - 110px);overflow-y:auto;overscroll-behavior:contain}
  input:not([type=radio]):not([type=checkbox]):not([type=hidden]),select,textarea,
  #references .reference-note textarea,.custom .field input[type=file],#album-page-select,#page-jump{font-size:16px!important;max-width:100%;min-width:0}
  fieldset{min-inline-size:0}
  button,.button,.btn,.primary,.secondary{min-height:44px}
  .frame-arrow,.frame-pause,.showcase-actions button,.close,.feedback-close,.hanga-help-close,.reference-remove,#references .reference-remove,.hanga-review-close{min-width:44px;min-height:44px}
  .frame-arrow{width:44px;height:44px}
  #references .reference-remove{width:44px;height:44px;right:-6px;top:-8px}
  .reference-card .reference-remove{right:-8px;top:-8px}
  .spread{min-height:0;padding-block:18px;touch-action:pan-y pinch-zoom}
  .spread .page{width:50%;max-width:none;flex:0 1 50%}
  .spread .page:only-child{width:80%;max-width:310px;flex-basis:80%}
  .spread.landscape .page:only-child{width:100%;max-width:none;flex-basis:100%}
  .viewer-tools{flex-wrap:wrap;gap:12px}
  .album-page-row{flex-wrap:wrap;gap:12px}
  .album-page-row select{max-width:100%}
  .album-lightbox-top,.album-lightbox-bottom,.zoom-toolbar{flex-wrap:wrap}
  dialog,.reference-zoom,#sticker-zoom,.album-lightbox,.strip-lightbox{
    box-sizing:border-box;width:calc(100% - 24px);max-width:calc(100% - 24px);
    max-height:calc(100dvh - 24px);margin:auto;padding:16px;overflow-y:auto;border-radius:18px
  }
  .reference-zoom img,#sticker-zoom img,.strip-lightbox:not(.zoomed) img{
    width:100%;height:auto;max-height:min(74dvh,calc(100dvh - 160px));object-fit:contain
  }
  .album-lightbox .album-stage{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;gap:8px;height:auto;min-height:0;padding:8px}
  .album-lightbox .album-stage img{grid-column:1/-1;grid-row:1;width:100%;height:auto;max-height:calc(100dvh - 245px);object-fit:contain}
  .album-lightbox .album-arrow{position:static;transform:none;grid-row:2;width:44px;height:44px}
  .album-lightbox .album-arrow.prev{grid-column:1}.album-lightbox .album-arrow.next{grid-column:3}
  .dialog-header{gap:12px;align-items:flex-start}
  .dialog-header h2{font-size:28px;overflow-wrap:anywhere}
  .dialog-header .close{flex-shrink:0}
  .cart-actions,.custom-actions{flex-wrap:wrap}
  .cart-actions>*,.custom-actions>*{max-width:100%}
  .cart-item,.cart-row{min-width:0;overflow-wrap:anywhere}
  .hanga-help{right:12px;bottom:calc(12px + env(safe-area-inset-bottom));width:calc(50% - 18px)}
  .hanga-help-toggle{width:100%;min-height:50px;height:50px;padding:10px 12px;gap:7px;font-size:14px;justify-content:center;white-space:nowrap}
  .hanga-help-toggle svg{width:23px;height:23px;flex-shrink:0}
  .hanga-email-dock{left:12px;right:auto;bottom:calc(12px + env(safe-area-inset-bottom));width:calc(50% - 18px)}
  .hanga-email-dock .hanga-email-bubble{width:100%;min-height:50px;height:50px;padding:7px 10px;gap:7px;box-sizing:border-box}
  .hanga-email-bubble strong{font-size:11px;line-height:1.2}
  .hanga-email-bubble small{display:none}
  .hanga-email-person{width:54px;height:54px;right:12px}
  .hanga-help-panel{width:min(330px,calc(100vw - 24px));max-height:calc(100dvh - 100px - env(safe-area-inset-bottom));overflow-y:auto;bottom:65px;padding:24px 18px;overscroll-behavior:contain}
  body:has(input:not([type=checkbox]):not([type=radio]):focus,textarea:focus,select:focus) .hanga-help,
  body:has(input:not([type=checkbox]):not([type=radio]):focus,textarea:focus,select:focus) .hanga-email-dock{visibility:hidden;pointer-events:none}
  body:has(.hanga-menu-toggle[aria-expanded=true]) .hanga-help,
  body:has(.hanga-menu-toggle[aria-expanded=true]) .hanga-email-dock{visibility:hidden;pointer-events:none}
  body>footer,.footer{padding-bottom:calc(90px + env(safe-area-inset-bottom))!important}
  .hanga-cart-toast{left:12px;right:12px;max-width:none;width:auto;box-sizing:border-box;gap:10px}
  .hanga-cart-toast button{flex-shrink:0}
  #editor{width:calc(100% - 16px);max-width:calc(100% - 16px)}
}
@media(prefers-reduced-motion:reduce){
  html{scroll-behavior:auto!important}
  *,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}
@media(max-width:1100px){
  input:not([type=radio]):not([type=checkbox]):not([type=hidden]),select,textarea{font-size:16px!important}
  .masthead .head nav#hanga-main-menu{max-height:calc(100dvh - 110px);overflow-y:auto;overscroll-behavior:contain}
}
.album-spread{touch-action:pan-y pinch-zoom}
