/* 全站移动端适配 */
html, body { max-width: 100%; overflow-x: clip; -webkit-text-size-adjust: 100%; }
body { font-size: 14px; }

/* 媒体元素不撑破 */
img, svg, canvas, video, iframe { max-width: 100% !important; }
pre, code { white-space: pre-wrap; word-break: break-word; }

/* 表格：横向滚动 + 首列固定 */
.mobile-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { max-width: 100%; }
.mobile-table-wrap table { min-width: 520px; }

/* 输入框 16px 防 iOS 聚焦缩放 */
input, select, textarea { font-size: 16px !important; }

/* 点击目标 */
button, a, [role="button"] { min-height: 32px; }

/* 弹层不超出屏幕 */
[role="dialog"], .modal, [class*="Dialog"], [class*="drawer"] {
  max-width: 96vw !important;
  max-height: 88vh !important;
  overflow: auto !important;
}

@media (max-width: 820px) {
  body { padding-left: 6px !important; padding-right: 6px !important; }
  h1 { font-size: 18px !important; }
  h2 { font-size: 16px !important; }
  h3 { font-size: 15px !important; }

  /* 多列网格压成 2 列 */
  [class*="grid-cols-3"], [class*="grid-cols-4"], [class*="grid-cols-5"], [class*="grid-cols-6"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  [class*="flex-row"] { flex-wrap: wrap !important; }
  [class*="gap-8"], [class*="gap-6"] { gap: 10px !important; }
  [class*="p-8"], [class*="px-8"], [class*="p-6"], [class*="px-6"] {
    padding-left: 10px !important; padding-right: 10px !important;
  }
  [class*="text-4xl"], [class*="text-5xl"], [class*="text-6xl"], [class*="text-7xl"] { font-size: 22px !important; }
  [class*="max-w-7xl"], [class*="max-w-6xl"], [class*="max-w-5xl"], [class*="max-w-4xl"] { max-width: 100% !important; }

  /* 侧栏/固定宽度面板在手机上隐藏或铺满 */
  [class*="w-80"], [class*="w-72"], [class*="w-64"] { width: 100% !important; min-width: 0 !important; }

  /* 表头/单元格紧凑 */
  thead th, tbody td { padding: 6px 8px !important; font-size: 12px !important; }
  .mobile-table-wrap table { min-width: 460px; }

  /* 顶部工具条允许换行，避免挤压 */
  header [class*="flex"] { flex-wrap: wrap !important; gap: 6px !important; }
}


/* 深色滚动条，消除右侧白色窄条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(120,140,160,.35); border-radius: 3px; }
::-webkit-scrollbar-corner { background: transparent; }
.mobile-table-wrap { background: transparent; }

/* 手机端彻底隐藏滚动条（含内层滚动容器），消除右侧白条；滑动功能保留 */
@media (max-width: 900px) {
  ::-webkit-scrollbar, *::-webkit-scrollbar { width: 0 !important; height: 0 !important; display: none !important; }
  * { scrollbar-width: none !important; -ms-overflow-style: none !important; }
  html, body { overflow-x: clip !important; }
  #root { max-width: 100vw !important; overflow-x: clip !important; }
}



/* 温和压缩：只动卡片内边距和卡片圆角，不改字号和高度，避免文字重叠 */
@media (max-width: 480px) {
  [class*="p-6"], [class*="p-5"] { padding: 10px !important; }
  [class*="rounded-2xl"] { border-radius: 10px !important; }
  [class*="grid-cols-2"], [class*="grid-cols-3"], [class*="grid-cols-4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* 套利监控 TOP2 卡片：窄屏下让"场内价 / 涨幅"那一行换行，避免和右侧溢价率叠字 */
@media (max-width: 480px) {
  .relative.flex.items-center.overflow-hidden.rounded-xl {
    gap: 6px !important;
    padding: 8px !important;
  }
  .relative.flex.items-center.overflow-hidden.rounded-xl > .min-w-0.flex-1 > .flex.items-center {
    flex-wrap: wrap !important;
    gap: 2px 8px !important;
  }
  .relative.flex.items-center.overflow-hidden.rounded-xl > .shrink-0.text-right > .text-xl {
    font-size: 16px !important;
    line-height: 1.2 !important;
  }
  .relative.flex.items-center.overflow-hidden.rounded-xl > .min-w-0.flex-1 > .mt-1.flex.items-center {
    flex-wrap: wrap !important;
    gap: 2px 8px !important;
  }
}
