@media screen and (max-width: 640px) {
  html, body { width:100%; max-width:100%; overflow-x:hidden !important; overscroll-behavior-x:none; touch-action:pan-y pinch-zoom; }
  *, *::before, *::after { box-sizing:border-box; }
  main, .container, .outer-wrap, .modal, .modal-backdrop, .card-top, .card-actions, .field, .field-row { min-width:0; max-width:100%; }
  input, select, textarea { min-width:0; max-width:100%; font-size:16px !important; }
  .status-select { max-width:130px; }
  img, video, iframe { max-width:100%; }
  h1, h2, h3, p, .task-title, .subtask-title, .meta-badge, .file-item, .link-title { overflow-wrap:anywhere; }
  .file-item, .link-item, .config-tabs { flex-wrap:wrap; }
  .config-tabs { overflow-x:hidden; }
  .subtask-list [data-id] { margin-left:0.35rem !important; padding-left:0.25rem !important; }
  .modal-backdrop { overflow-x:hidden; overscroll-behavior:contain; }
  .modal { overflow-x:hidden; overscroll-behavior-y:contain; }
  body:has(.modal-backdrop.open) { overflow-y:hidden; }
  body:has(.modal-backdrop.open) .fab-add,
  body:has(.modal-backdrop.open) .undo-completion { display:none !important; }
  .undo-completion { bottom:calc(5rem + env(safe-area-inset-bottom, 0px)); }
  #modalBackdrop .modal { display:flex; flex-direction:column; height:92vh; height:92dvh; max-height:92dvh; overflow:hidden; padding:0; }
  #modalBackdrop .task-editor-body { flex:1; min-height:0; overflow-y:auto; overflow-x:hidden; padding:1.25rem 1rem; overscroll-behavior:contain; }
  #modalBackdrop .modal-footer { flex:none; position:relative; margin:0; padding:0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px)); box-shadow:0 -3px 12px #0001; z-index:1; }
}
