/* The shell owns its fixed header; only its body owns the scrollbar. */
:is(dialog,#mobile-menu,#duel-details,#lottery-details,#victory-details):has(>.popup-body){padding:0;overflow:hidden;scrollbar-gutter:auto;min-height:0}
dialog[open]:has(>.popup-body){display:flex;flex-direction:column}
dialog:has(>.popup-body)>.popup-header,dialog:has(>.popup-body)>.dialog-heading,.tile-popover>.popup-header{position:relative;top:auto;flex:none;margin:0;padding:10px var(--popup-padding,24px)}
.popup-body{box-sizing:border-box;flex:1 1 auto;min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:16px var(--popup-padding,24px) var(--popup-padding,24px)}
.popup-body>:first-child{margin-block-start:0}.popup-body>:last-child{margin-block-end:0}
.account-picker,.session-dialog{--popup-padding:20px}
.tile-popover:has(>.popup-body){padding:0;overflow:hidden;scrollbar-gutter:auto}.tile-popover:not([hidden]):has(>.popup-body){display:flex;flex-direction:column}
/* Participant input remains an unscrollable, inertness-guarded arena. */
#duel-details.duel-input-locked>.popup-body{overflow:hidden;overscroll-behavior:none;touch-action:none;flex:none}
#mobile-menu:has(>.popup-body){padding:0;overflow:hidden}#mobile-menu>.popup-header{padding-block-start:max(10px,env(safe-area-inset-top))}#mobile-menu>.popup-body{padding-block-end:calc(16px + env(safe-area-inset-bottom))}
/* Consent keeps its form ownership and reading pane, including short screens. */
#agreement-dialog.agreement-dialog{padding:0;overflow:hidden}#agreement-dialog #agreement-form{display:flex;flex-direction:column;height:min(800px,calc(100dvh - 28px));max-height:calc(100dvh - 28px);min-height:0;margin:0}
#agreement-dialog .agreement-heading{position:relative;top:auto;flex:none;margin:0}
#agreement-dialog .agreement-body{padding:0 0 16px;display:flex;flex-direction:column}
#agreement-dialog .agreement-reader{flex:0 0 auto;height:clamp(140px,30dvh,320px);min-height:0}
@media(max-width:760px),(max-width:1000px) and (max-height:500px){.account-picker,.session-dialog{--popup-padding:16px}.popup-body{padding-block-start:14px}}

/* Modal dropdown options share the body scroller and its native touch targets. */
.game-dropdown[data-menu-layout="inline"]>nav{position:static;inset:auto;width:100%;max-width:none;max-height:none;overflow:visible;margin-block-start:8px}

/* Keep native body scrolling; only window handles consume a drag gesture. */
dialog:not(#mobile-menu):not(.duel-input-locked) :is(.popup-header,.dialog-heading,.agreement-heading),#notice,.session-notice,.bankruptcy-notice,.party-invitation-notice>header{cursor:grab;touch-action:none}
.bankruptcy-notice{pointer-events:auto}
.popup-dragging,.popup-dragging :is(.popup-header,.dialog-heading,.agreement-heading){cursor:grabbing!important}
