/* Shared regression guard: retain border and focus ring within control bounds. */
@media(max-width:800px){html:root input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]),html:root select,html:root textarea{box-sizing:border-box!important;min-width:0!important;max-width:100%!important}html:root input:focus,html:root select:focus,html:root textarea:focus{outline-offset:-3px!important}html:root input[type=date],html:root input[type=time],html:root input[type=datetime-local]{appearance:none;-webkit-appearance:none}html:root input::-webkit-date-and-time-value{min-width:0;text-align:left}html:root form,html:root fieldset{min-width:0;box-sizing:border-box}html:root fieldset{max-width:100%}}

/* Mobile scroll contract: root scroll for pages; modal scroll fills its surface. */
@media(max-width:800px){
 html:root main:not(dialog main){overflow-y:visible}
 html:root dialog:is(#editor,#dayDialog,#attachmentViewer),html:root dialog.ai-sheet:not(#familyChat),html:root dialog.sheet:not(#familyChat){padding:0}
 html:root #editor .modal-head{padding:18px 18px 14px}
 html:root #editorScroll{width:100%;max-width:100%;margin:0;padding:14px 18px 6px;box-sizing:border-box}
 html:root #editor .editor-save-area{padding:10px 18px 18px}
 html:root #dayDialog>.modal-head{padding:16px 16px 0}
 html:root #dayDialogLunar{padding-inline:16px}
 html:root #dayDialog .memo-day-tabs{margin-inline:16px}
 html:root #memoScroll{width:100%;max-width:100%;margin:0;padding:0 16px 12px;box-sizing:border-box}
 html:root #dayDialog .popup-footer{padding:0 16px 16px;margin:0}
 html:root .ai-content,html:root .sheet-content,html:root #attachmentViewer .attachment-viewer-body{width:100%;margin-inline:0;box-sizing:border-box}
 html:root .app-message-page #familyChat{left:0;right:0;width:100%;max-width:100%;padding:0}
 html:root #chatMessages,html:root .chat-share-area,html:root .chat-batch-result{width:100%;max-width:100%;margin-inline:0;box-sizing:border-box}
}

/* Shared touch policy: suppress double-tap zoom without blocking scrolling or pinch zoom. */
html,body,button,a,input,select,textarea,summary,label,[role=button]{touch-action:manipulation}
/* iOS focuses controls smaller than 16px by zooming; keep editing text at readable native size. */
@media(max-width:800px),(pointer:coarse){html:root input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]):not([type=button]):not([type=submit]),html:root textarea,html:root select{font-size:16px!important}}
