/* ════════════════════════════════════════════════════════════════
   PATCH_OCT_20260525_MOBILE_T1: 手机救命三连
   独立于 style.css, 避免和它里面 body{overflow:hidden} 冲突
   所有页面 (包括 hall) 应该都 link 这个文件
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* 1) 防 iOS 自动放大输入框 (字号 < 16px 触发) */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* 2) nav 缩紧 + 自动 wrap, 防右上角按钮挤出屏幕 */
  .nav, nav.nav { height: auto !important; min-height: 48px; }
  .nav-inner {
    padding: 0 12px !important;
    flex-wrap: wrap;
    gap: 4px !important;
  }
  .nav-brand span { font-size: 14px !important; }
  .nav-btn {
    padding: 6px 10px !important;
    font-size: 12px !important;
    min-height: 36px;
    min-width: 36px;
  }

  /* 3) 触控目标 ≥ 44×44px (WCAG / Apple HIG), nav 内单独缩 */
  button:not(.nav-btn), .btn, a.btn, [role="button"] {
    min-height: 44px;
    box-sizing: border-box;
  }

  /* 4) 主容器横向不超过视口 */
  main, .main, .container {
    padding-left: 14px !important;
    padding-right: 14px !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  /* 5) 多列 grid 自动塌成单列 */
  .row-2col, .row-2, .grid-2, .layout, .filter-bar > div {
    grid-template-columns: 1fr !important;
  }
  .grid { grid-template-columns: 1fr !important; gap: 14px !important; }

  /* 6) modal 全屏 (从底部弹起的抽屉效果) */
  .modal-overlay { align-items: flex-end !important; }
  .modal-overlay > .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 88vh !important;
    border-radius: 16px 16px 0 0 !important;
    margin: 0 !important;
    padding: 18px !important;
  }

  /* 7) 大字号 hero 缩小 */
  .hero h1, .head h1, .head > .head-inner > h1, h1 { font-size: 20px !important; }
  .hero .sub, .head-sub { font-size: 12px !important; }
  .hero, .head { padding: 18px 16px !important; }
  .hero-stats { gap: 10px !important; flex-wrap: wrap; }
  .hero-stat-val { font-size: 18px !important; }
  .hero-stat-label { font-size: 10px !important; }

  /* 8) 表格 → 横滚 (避免溢出整个页面) */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
  }

  /* 9) 卡片间距收紧 */
  .card { padding: 14px !important; margin-bottom: 12px !important; border-radius: 10px !important; }
  .section-title { font-size: 13px !important; }

  /* 10) 给底部 tabbar 留呼吸空间 */
  body.has-mobile-tabbar { padding-bottom: 64px !important; }

  /* 11) 修复 producer card 图片避免压扁 */
  .cover-video, .cover-img { aspect-ratio: 16/10; }

  /* 12) toast 离底部稍远 (避开 tabbar) */
  .toast { bottom: 80px !important; }

  /* 13) 隐藏鼠标 hover 才出现的辅助元素 */
  .hover-only { display: none !important; }

  /* 14) tabs / filter-group 横滚 + snap, 防溢出 */
  .tabs, .filter-group, .role-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    flex-wrap: nowrap !important;
    white-space: nowrap;
  }
  .tabs::-webkit-scrollbar, .filter-group::-webkit-scrollbar, .role-tabs::-webkit-scrollbar { display: none; }

  /* 15) 文件上传区高度收紧 */
  .upload-zone { padding: 18px !important; }

  /* 18) user-menu chip: 隐藏用户名 + 缩头像, 只露头像 + 红点 */
  .um-chip {
    padding: 4px !important;
    gap: 4px !important;
    background: transparent !important;
  }
  .um-name, .um-arrow { display: none !important; }
  .um-avatar { width: 32px !important; height: 32px !important; font-size: 13px !important; }
  .um-chip-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    padding: 0 5px !important;
    font-size: 10px !important;
    min-width: 16px !important;
    border: 2px solid #fff;
  }
  .um-wrap { position: relative; }
  .um-menu {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    min-width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 75vh;
    overflow-y: auto;
    padding: 8px !important;
    padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    box-shadow: 0 -8px 28px rgba(0,0,0,0.15) !important;
  }
  .um-menu::before { display: none !important; }
  .um-item { padding: 14px 14px !important; font-size: 15px !important; }
  .um-ico { font-size: 19px !important; }

  /* 16) hall-order 双栏: 订单详情 + 聊天 → 单列 */
  main.main[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* 17) 聊天框高度按视口 (不要写死 600px) */
  .chat-box { height: calc(100vh - 220px) !important; min-height: 400px; }
}

/* ── 手机底部 tabbar (仅 ≤768px 显示) ── */
.mobile-tabbar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0,0,0,0.08);
  z-index: 999;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: center;
}
@media (max-width: 768px) {
  .mobile-tabbar { display: flex; }
}
.mobile-tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  color: #6b7280;
  text-decoration: none;
  font-size: 10px;
  min-height: 44px;
  position: relative;
}
.mobile-tabbar a .ic { font-size: 20px; line-height: 1; }
.mobile-tabbar a.active { color: #2e2b5f; font-weight: 600; }
