/* Scope app sheets to owned dialogs; Stripe's 3DS dialog keeps its own layout. */
dialog:where(#productDialog,#cartDialog,#accountDialog,#preferencesDialog,#installDialog,#paymentDialog){width:min(780px,calc(100vw - 40px));height:min(760px,calc(100dvh - 40px));max-height:calc(100dvh - 40px);margin:auto;overscroll-behavior:contain}
dialog:where(#productDialog,#cartDialog,#accountDialog,#preferencesDialog,#installDialog,#paymentDialog)[open]{display:flex;flex-direction:column}
dialog:where(#productDialog,#cartDialog,#accountDialog,#preferencesDialog,#installDialog,#paymentDialog)[open]>form#productForm{display:flex;flex:1;flex-direction:column;min-height:0;max-height:none;overflow:hidden}
dialog:where(#productDialog,#cartDialog,#accountDialog,#preferencesDialog,#installDialog,#paymentDialog)>.dialog-scroll,#productForm>.dialog-scroll{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain}
#preferencesDialog{height:min(720px,calc(100dvh - 40px))}
#accountDialog{height:min(680px,calc(100dvh - 40px))}
#installDialog{height:min(520px,calc(100dvh - 40px))}
.dialog-head{flex:none}.dialog-head>div{min-width:0}.dialog-head h2{overflow-wrap:break-word}
.dialog-actions{flex:none;align-items:center;box-shadow:0 -8px 24px #30201506}
.quantity-control{flex:none;display:flex;align-items:center;gap:12px}
.quantity-control>label{font-size:12px;font-weight:750;color:var(--muted)}
.quantity-stepper{display:flex;align-items:center;border:1px solid #dfcbb5;border-radius:14px;overflow:hidden;background:#fff}
.quantity-stepper button{width:44px;height:48px;flex:none;background:#fff7eb;color:#66340e;font-size:24px;font-weight:600}
.quantity-stepper #productQuantity{width:46px;min-height:48px;border:0;border-radius:0;padding:8px 0;text-align:center;appearance:textfield;-moz-appearance:textfield;font-weight:750}
#productQuantity::-webkit-inner-spin-button,#productQuantity::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.quantity-stepper button:disabled{opacity:.35}.quantity-stepper button:focus-visible{outline-offset:-3px}
#productDialog .dialog-actions .primary{max-width:none;min-width:180px}
#cartDialog .dialog-actions .primary{max-width:none;flex:1;min-width:200px}
#cartDialog .dialog-actions .secondary{font-size:13px}
#checkoutButton[aria-busy=true]::before{content:"";width:16px;height:16px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;margin-right:10px;animation:checkout-spin .8s linear infinite}
#checkoutButton[aria-busy=true]{opacity:.8;cursor:progress}
#checkoutFallback{display:block;margin:12px 0;font-weight:750;color:#8c3d16}
#checkoutFallback[hidden]{display:none}
@keyframes checkout-spin{to{transform:rotate(360deg)}}
@keyframes sheet-enter{from{transform:translateY(60px);opacity:.45}to{transform:translateY(0);opacity:1}}
@media(max-width:1100px),(pointer:coarse){
 dialog:where(#productDialog,#cartDialog,#accountDialog,#preferencesDialog,#installDialog,#paymentDialog){position:fixed;inset:auto 0 0;width:min(860px,100%);height:94dvh;max-height:94dvh;max-width:100%;margin:0 auto;border-radius:28px 28px 0 0;border-bottom:0;padding-top:17px}
 dialog:where(#productDialog,#cartDialog,#accountDialog,#preferencesDialog,#installDialog,#paymentDialog)[open]{animation:sheet-enter .25s cubic-bezier(.2,.7,.2,1)}
 dialog:where(#productDialog,#cartDialog,#accountDialog,#preferencesDialog,#installDialog,#paymentDialog)::before{content:"";position:absolute;top:7px;left:calc(50% - 20px);width:40px;height:4px;background:#cec3b6;border-radius:10px}
 #preferencesDialog,#accountDialog{height:min(800px,92dvh);max-height:92dvh}
 #installDialog{height:min(600px,88dvh);max-height:88dvh}
 .dialog-head{padding:18px 24px;gap:14px}.dialog-head h2{font-size:clamp(24px,3.5vw,32px)}
 .dialog-scroll{padding:22px 24px}.dialog-actions{padding:16px 24px max(16px,env(safe-area-inset-bottom));gap:12px}
 #preferencesForm{padding-bottom:max(24px,env(safe-area-inset-bottom))}
 .dialog-scroll input:not([type=checkbox]):not([type=radio]),.dialog-scroll textarea,.dialog-scroll select{font-size:16px}
}
@media(max-width:600px){
 .dialog-head{padding:14px 20px}.dialog-head .eyebrow{font-size:9px}.dialog-head h2{font-size:26px}
 .dialog-scroll{padding:18px 20px}.dialog-actions{padding:12px 20px max(16px,env(safe-area-inset-bottom))}
 .quantity-control{flex-basis:100%;justify-content:space-between}.quantity-stepper button{width:48px}
 #productDialog .dialog-actions .primary{width:100%;margin:0;min-height:50px;font-size:15px}
 #cartDialog .dialog-actions{gap:8px}#cartDialog .dialog-actions .secondary{order:2;min-height:38px;padding:8px;background:transparent;border:0}
 #cartDialog .dialog-actions .primary{flex:auto;min-height:52px;font-size:14px;padding:13px 10px;white-space:normal}
 .option-grid{grid-template-columns:1fr}.choice{min-height:52px}.choice strong{font-size:14px}
 .cart-line .qty button{width:36px;height:40px;border-radius:10px;background:#fff2df}
 #preferencesForm .choice{padding:16px 13px}#preferencesForm .choice strong{font-size:15px}#preferencesForm .choice small{font-size:13px}
}
@media(prefers-reduced-motion:reduce){dialog:where(#productDialog,#cartDialog,#accountDialog,#preferencesDialog,#installDialog,#paymentDialog)[open]{animation:none}#checkoutButton[aria-busy=true]::before{animation:none}}
