/* 位极青云 · 手机竖屏自适应（纯样式覆盖，不动主程序） */

/* ---------- 通用：防横向溢出 ---------- */
html, body { max-width: 100% !important; overflow-x: hidden !important; }
img, video, canvas, svg, table, pre { max-width: 100% !important; }
body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* ---------- 手机竖屏 ≤ 640px ---------- */
@media (max-width: 640px) {

  /* 1) 多列栅格一律单列：手机上竖着排，不再挤压 */
  [class*="grid-cols-2"],
  [class*="grid-cols-3"],
  [class*="grid-cols-4"],
  [class*="grid-cols-5"],
  [class*="grid-cols-6"] {
    grid-template-columns: 1fr !important;
  }

  /* 2) 横排容器允许换行 */
  [class*="flex-row"] { flex-wrap: wrap !important; }

  /* 3) 大容器占满宽度 */
  [class*="max-w-xl"], [class*="max-w-2xl"], [class*="max-w-3xl"],
  [class*="max-w-4xl"], [class*="max-w-5xl"], [class*="max-w-6xl"] {
    max-width: 100% !important;
  }

  /* 4) 表格：可横向滑动，单元格允许换行 */
  table { display: block !important; width: 100% !important; overflow-x: auto !important;
          -webkit-overflow-scrolling: touch; }
  th, td { white-space: normal !important; word-break: break-word; }

  /* 5) 点击区域：按钮加高，手指点得中 */
  button, [role="button"], a[class*="btn"] { min-height: 36px !important; }

  /* 6) 输入框 16px 起，避免 iOS 聚焦时整页被放大 */
  input, textarea, select { font-size: 16px !important; }

  /* 7) 弹窗/浮层限高可滚动 */
  [class*="fixed"][class*="inset-0"] > div {
    max-height: 92vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* 8) 刘海屏 / 手势条安全区 */
  body { padding-bottom: env(safe-area-inset-bottom) !important; }
  [class*="fixed"][class*="top-0"], [class*="fixed"][class*="top-2"] {
    top: calc(env(safe-area-inset-top) + 6px) !important;
  }

  /* 9) 最小字号抬到 12px，别让说明文字看不清 */
  [class*="text-[10px]"], [class*="text-[9px]"] { font-size: 12px !important; }

  /* 10) 长文行距与断词 */
  p, li { line-height: 1.75 !important; }
  body { word-break: break-word; }
}

/* ---------- 矮横屏 ---------- */
@media (orientation: landscape) and (max-height: 430px) {
  [class*="fixed"][class*="inset-0"] > div { max-height: 96vh !important; overflow-y: auto !important; }
}

/* ---------- 政务台浮窗在手机上的适配 ---------- */
@media (max-width: 640px) {
  .gov-win { width: 100% !important; max-height: 92vh !important; }
  .gov-tabs { flex-wrap: nowrap !important; overflow-x: auto !important; }
  .gov-tab { flex: 0 0 auto !important; padding: 10px 14px !important; font-size: 14px !important; }
  #gov-body { padding: 10px !important; font-size: 14px !important; }
  .gov-btn { padding: 7px 12px !important; font-size: 13px !important; }
  .gov-grid { grid-template-columns: 1fr !important; }
  #gov-fab { padding: 12px 16px !important; font-size: 14px !important;
             bottom: calc(env(safe-area-inset-bottom) + 14px) !important; }
}
