/* Mobile form text prevents focus zoom while preserving pinch-to-zoom. */
@media(max-width:800px),(pointer:coarse){
 input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea{font-size:16px!important}
 input,select,textarea{scroll-margin-block:24px;max-width:100%}
}
@media(max-width:800px){
 html{-webkit-text-size-adjust:100%;text-size-adjust:100%;scroll-padding-bottom:100px}
 body{min-width:0}
 main,.shell,.content-grid,.community-main,.weight-main,.meal-diary,.field{min-width:0;max-width:100%}
 main{overflow-wrap:anywhere}
 .page-heading,.photo-toolbar,.meal-day,.weight-card-heading{flex-wrap:wrap}
 .page-heading>div,.meal-day>div,.weight-card-heading>div{min-width:0}
 .page-heading .pill{flex-shrink:0}
 .field{align-content:start}
 .field input,.field select,.field textarea{box-sizing:border-box}
 .form-grid,.meal-form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .weight-inputs{grid-template-columns:minmax(0,1fr) 90px}
 .progress-tabs{gap:20px;flex-wrap:wrap;height:auto;justify-content:flex-start}
 .photo-toolbar select{min-width:0;max-width:100%}
 .meal-day{gap:14px}
 .meal-date-label{max-width:100%;min-width:0}
 .meal-date-label input{max-width:190px;min-height:44px}
 .meal-result{min-width:0}
 .meal-result strong,.logged-meal-copy,.weight-history-row>div{overflow-wrap:anywhere;min-width:0}
 .meal-form-macros{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
 .meal-picker-footer{flex-wrap:wrap;gap:12px}
 .meal-picker-footer>span{text-align:left;max-width:100%;font-size:11px}
 .meal-save-row{display:flex;flex-wrap:wrap;gap:12px;align-items:center}
 .meal-save-row>.button{flex:1;min-width:150px;justify-content:center}
 .meal-close,.install-close,.dialog-close{min-width:44px;min-height:44px}
 .meal-dialog h2:focus{outline:none}
 .meal-dialog-head{position:sticky;top:0;background:#fafbf7;z-index:1}
 .meal-results{max-height:none;overflow:visible}
 /* One scroll surface per dialog; dimensions follow the keyboard's visible area. */
 dialog,#install-guide,dialog.meal-dialog{position:fixed;inset:auto;left:50%;top:calc(var(--app-visible-top,0px) + var(--app-visible-height,100dvh)/2);transform:translate(-50%,-50%);margin:0;width:calc(100% - 24px);max-width:640px;max-height:calc(var(--app-visible-height,100dvh) - 24px);overflow-y:auto;overscroll-behavior-y:contain;box-sizing:border-box;scroll-padding-block:90px 24px}
 dialog:not(.meal-dialog):not(#install-guide){padding:32px 20px 24px}
 body:has(dialog[open]){overflow:hidden}
 body.keyboard-open .sidebar{visibility:hidden;pointer-events:none}
 body.keyboard-open .shell{padding-bottom:24px}
 #toast{bottom:calc(88px + env(safe-area-inset-bottom,0px));overflow-wrap:anywhere;text-align:center}
 .top-actions{flex-shrink:0}
}
@media(max-width:380px){
 main{padding-inline:16px}
 .topbar{padding-inline:16px}
 .form-grid,.meal-form-grid{grid-template-columns:minmax(0,1fr)}
 .weight-stats{gap:10px}
 .weight-stats strong{font-size:25px}
 .weight-history-row{grid-template-columns:minmax(0,1fr) auto auto;gap:8px}
 .weight-history-row>div:nth-child(2){grid-column:1}
 .weight-history-row>button{grid-row:1 / span 2}
 .photo-actions .button{white-space:normal}
}
@media(max-width:800px){
 .meal-picker-footer{position:sticky;bottom:0;background:#fafbf7;border-top:1px solid var(--line);z-index:1}
}

/* A recovery action must remain easy to tap after a version conflict. */
.profile-reload{min-height:44px}
