/* 2026-07-01: mobile-only modal safety net. Keep close buttons visible; no routes, no DOM, no app logic. */
@media (max-width: 640px) {
  body .fixed.inset-0:has(button[aria-label*="关闭"]),
  body .fixed.inset-0:has(button[title*="关闭"]),
  body .fixed.inset-0:has(button[aria-label*="close" i]),
  body .fixed.inset-0:has(button[title*="close" i]),
  body [role="dialog"]:has(button[aria-label*="关闭"]),
  body [role="dialog"]:has(button[title*="关闭"]),
  body [role="dialog"]:has(button[aria-label*="close" i]),
  body [role="dialog"]:has(button[title*="close" i]) {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    align-items: flex-start !important;
    justify-content: center !important;
    padding-top: max(14px, env(safe-area-inset-top)) !important;
    padding-bottom: max(18px, env(safe-area-inset-bottom)) !important;
  }

  body .fixed.inset-0:has(button[aria-label*="关闭"]) > *,
  body .fixed.inset-0:has(button[title*="关闭"]) > *,
  body .fixed.inset-0:has(button[aria-label*="close" i]) > *,
  body .fixed.inset-0:has(button[title*="close" i]) > *,
  body [role="dialog"]:has(button[aria-label*="关闭"]),
  body [role="dialog"]:has(button[title*="关闭"]),
  body [role="dialog"]:has(button[aria-label*="close" i]),
  body [role="dialog"]:has(button[title*="close" i]) {
    max-height: calc(100dvh - 24px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  body .fixed.inset-0 button[aria-label*="关闭"],
  body .fixed.inset-0 button[title*="关闭"],
  body .fixed.inset-0 button[aria-label*="close" i],
  body .fixed.inset-0 button[title*="close" i],
  body [role="dialog"] button[aria-label*="关闭"],
  body [role="dialog"] button[title*="关闭"],
  body [role="dialog"] button[aria-label*="close" i],
  body [role="dialog"] button[title*="close" i] {
    position: fixed !important;
    top: max(10px, env(safe-area-inset-top)) !important;
    right: max(10px, env(safe-area-inset-right)) !important;
    z-index: 2147483647 !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    border-radius: 999px !important;
    background: rgba(255,255,255,.96) !important;
    color: #172554 !important;
    box-shadow: 0 10px 28px rgba(15,23,42,.18) !important;
  }
}
