/* A grid owns modal placement. No centering transform can leak into phone layouts. */
.routine-modal-positioner{position:fixed;inset:0;z-index:50;display:grid;place-items:center;pointer-events:none;padding:16px}
.routine-modal-content{position:relative;pointer-events:auto;min-width:0;max-height:calc(100vh - 32px);max-height:calc(100dvh - 32px);overflow-y:auto;overscroll-behavior:contain}
.routine-modal-overlay[data-state=open]{animation:modal-backdrop-in 160ms ease-out both}
.routine-modal-overlay[data-state=closed]{pointer-events:none;animation:modal-backdrop-out 120ms ease-in both}
.routine-modal-content[data-state=open]{animation:modal-content-in 180ms cubic-bezier(.2,.8,.2,1) both}
.routine-modal-content[data-state=closed]{animation:modal-content-out 120ms ease-in both}
.routine-modal-content [data-slot=dialog-title]:focus{outline:none}
@keyframes modal-backdrop-in{from{opacity:0}to{opacity:1}}
@keyframes modal-backdrop-out{from{opacity:1}to{opacity:0}}
/* Opacity leaves fixed close controls and iOS keyboard coordinates unchanged. */
@keyframes modal-content-in{from{opacity:0}to{opacity:1}}
@keyframes modal-content-out{from{opacity:1}to{opacity:0}}
@keyframes mobile-screen-in{from{opacity:.4;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}
@media(max-width:900px){
 .routine-modal-positioner{padding:0}
 .mobile-screen{animation:mobile-screen-in 160ms cubic-bezier(.2,.8,.2,1)}
 .mobile-tracker button,.mobile-habit{transition:background-color 140ms ease,border-color 140ms ease,color 140ms ease}
 .mobile-habit:has(label:active){background:#e8eee3;border-color:#c2cdbb}
 .mobile-bottom-nav button:active,.mobile-icon:active{background:#e1e8db}
 .mobile-habit label{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
 .journal-dialog,.detail-dialog,.habit-dialog{-webkit-overflow-scrolling:touch}
}
@media(prefers-reduced-motion:reduce){
 .routine-modal-content,.routine-modal-overlay,.mobile-screen{animation:none!important}
 .mobile-tracker *{transition:none!important;scroll-behavior:auto!important}
}
