/* =============================================================
   FastOeIndex · 移动端适配层（叠加在 app.css 之上，不修改上游规则）
   分档：≤719px 手机平板竖屏 / ≤400px 小屏收紧
   全局（不限宽度）：触摸体验三件套（点按无灰闪、消除双击缩放延迟、禁止 iOS 文本自动放大）
   ============================================================= */

/* ---------- 全局触摸体验 ---------- */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{-webkit-tap-highlight-color:transparent}
button,a,input,select,textarea,label.check{touch-action:manipulation}
button{-webkit-user-select:none;user-select:none}

/* ---------- 全局可读性（对标 WCAG AA ≥4.5:1） ----------
   副标题 rgba(26,26,26,.60) 在 #F5F3F8 上实测 4.42:1 不达标，提到 .68（≈5.1:1） */
.hero-subline{color:rgba(26,26,26,.68)}

/* 触控热区扩展：36px 图标按钮通过透明伪元素把点击域扩到 ≥44px（HIG/Material） */
.icon-btn{position:relative}
.icon-btn::after{content:'';position:absolute;inset:-5px;border-radius:inherit}

/* ---------- ≤719px：手机 / 窄平板 ---------- */
@media(max-width:719px){
  :root{
    --pad-x:16px;          /* 收紧页面左右留白 */
    --topbar-height:106px; /* 两行顶栏：药丸行 + 页签行（toast 依此避让） */
  }

  /* 顶栏两行布局：第一行右侧用户药丸独占，第二行页签全宽滚动——
     避免单行挤压导致页签被裁切、登录态下 doubly 嵌套横滚 */
  .topbar{min-height:0;flex-wrap:wrap;row-gap:6px;padding-bottom:8px;overflow:visible}
  .top-spacer{order:0}
  .user-pill{order:1}
  .modes{order:2;flex:1 1 100%}
  .user-pill{padding:0 11px;font-size:12px}

  /* 模式 Tab：紧凑化减少横向滚动量，“级联”徽章在小屏隐藏 */
  .modes{max-width:100%;scroll-padding-inline:32px}
  .mode{height:44px;min-height:44px;padding:0 12px;font-size:13px;gap:5px}
  .mode .badge{display:none}
  .mode:active{background:rgba(26,26,26,.08)}
  .mode.active:active{background:#333}

  /* 首屏 Hero：压缩纵向空间，给搜索与结果让位 */
  .search-functional-layer{padding-top:28px;padding-bottom:22px}
  .hero-giant{font-size:clamp(2.7rem,13vw,4rem);margin-bottom:12px}
  .hero-headline{font-size:19px}
  .hero-subline{font-size:13.5px;margin-top:8px}
  .catalog-hero{padding-top:18px}
  .catalog-hero .hero-giant{font-size:clamp(2.4rem,11vw,3.4rem)}

  /* 搜索条：类型切换独占一行（居中），输入框独占一行——placeholder 不再被挤压裁切 */
  .hero-search-bar{gap:8px;border-radius:18px;padding:6px}
  .hero-search-bar .search-kinds{width:100%;max-width:100%;justify-content:center}
  .hero-search-bar .search-kinds button{flex:1 1 0;justify-content:center;height:40px;padding:0 10px;min-width:0}
  .field-hero{font-size:16px;min-height:46px;text-align:center}
  /* 输入内容/聚焦时回退左对齐，长件号编辑不跳眼 */
  .field-hero:not(:placeholder-shown),.field-hero:focus{text-align:left}
  .btn-hero{width:100%;height:46px;justify-content:center;border-radius:14px}
  .search-disclosure{width:100%}
  .disclosure-trigger{min-height:44px}
  .disclosure-body{padding:14px}

  /* 模式 Tab：仅在实际溢出可滚时才显示右缘渐隐（.scrollable 由 app.js 切换） */
  .modes.scrollable{
    -webkit-mask-image:linear-gradient(to right,#000 0,#000 calc(100% - 30px),transparent);
    mask-image:linear-gradient(to right,#000 0,#000 calc(100% - 30px),transparent);
  }
  .modes{scroll-snap-type:x proximity}
  .mode{scroll-snap-align:start}

  /* 空态与示例 */
  .state-box{padding:22px 16px}
  /* margin 归零改由 auto 居中：配合 result-stage 的 16px 内边距，避免 width:100% + 侧边距溢出 */
  .state-box.dashed{margin:12px auto}
  .state-box.error>.ic{width:44px;height:44px;padding:11px;margin-bottom:12px}

  /* 卡片与表格 */
  .card-head{padding:12px 14px}
  .card-body{padding:14px}
  .sup-filter{min-width:0;width:100%;margin-left:0}

  /* 下拉与列表：字号≥16px 防 iOS 聚焦自动放大；加高触控目标 */
  .combo-input{font-size:16px}
  .combo-item{min-height:44px}
  .combo-list{max-height:min(320px,46dvh)}
  .live-list{max-height:min(320px,46dvh)}
  .live-item{padding:11px 12px}
  .filter-bar select{font-size:16px}
  .tree-row{min-height:44px}

  /* 目录级联：纵向堆叠时禁止 flex 纵向拉伸（否则字段间出现大段空白） */
  .cat-controls .combo-field{flex:0 0 auto;min-width:0}

  /* 详情抽屉：图片缩小给编号让位，底部留安全区；图标按钮达标 40px+热区 */
  .drawer-img{width:80px;height:80px}
  .drawer-nr .nr{font-size:20px}
  .drawer-body{padding-bottom:calc(28px + env(safe-area-inset-bottom))}
  .dtab{padding:10px 2px;min-height:44px}
  .icon-btn{width:40px;height:40px}

  /* 弹窗改底部抽屉（bottom sheet）：拇指可达，按钮等宽，顶部带抓手 */
  .modal-backdrop{padding:0;align-items:flex-end}
  .modal{
    width:100% !important;                /* 覆盖用户中心弹窗的行内 width:520px */
    max-width:100%;border-radius:22px 22px 0 0;border-bottom:0;
    max-height:90dvh;animation:sheetUp .26s cubic-bezier(.16,1,.3,1);
  }
  .modal::before{
    content:'';position:absolute;top:8px;left:50%;transform:translateX(-50%);
    width:38px;height:4px;border-radius:2px;background:rgba(26,26,26,.16);pointer-events:none;
  }
  .modal-head{padding:16px 16px 14px}
  .modal-body{padding:16px}
  .modal-body:last-child{padding-bottom:calc(18px + env(safe-area-inset-bottom))}
  .modal-foot{padding:12px 16px calc(12px + env(safe-area-inset-bottom))}
  .modal-foot .btn{flex:1;min-height:44px}
  #btn-activate-license{min-height:44px}
  .veh-bar,.cat-controls{width:calc(100% - 24px)}

  /* Toast：小屏通栏居顶显示（含刘海安全区），避免右侧裁剪 */
  #toasts{left:16px;right:16px;max-width:none;top:calc(var(--topbar-height) + env(safe-area-inset-top) + 8px)}
  .toast{font-size:13px;padding:11px 13px}

  .foot-note{padding:0 16px}

  /* 结果卡片：名称/参数对齐到图片右侧文字列（原 1/-1 通栏悬挂在卡片左缘） */
  .tbl tr.row-link .td-name,.tbl tr.row-link .td-cri{grid-column:2}
  .tbl tr.row-link .td-cri{color:var(--ink-3)}
  /* 品类筛选条：右缘渐隐提示可滑动 */
  .result-stage .search-kinds,#vin-result .search-kinds{
    -webkit-mask-image:linear-gradient(to right,#000 calc(100% - 26px),transparent);
    mask-image:linear-gradient(to right,#000 calc(100% - 26px),transparent);
  }

  /* 账户胶囊与复选框行：直接把控件盒拉到 44px，不依赖会被顶栏 overflow 裁掉的伪元素 */
  .user-pill{min-height:44px;position:relative}
  label.check{min-height:44px;padding:0 4px}
  .result-stage .search-kinds,#vin-result .search-kinds{scroll-padding-inline:28px;padding-right:28px}
}

@keyframes sheetUp{from{opacity:.5;transform:translateY(28px)}to{opacity:1;transform:none}}

/* ---------- ≤400px：小屏手机再收紧 ---------- */
@media(max-width:400px){
  .mode{padding:0 10px}
  .hero-giant{font-size:clamp(2.4rem,12vw,3.4rem)}
  .drawer-img{width:68px;height:68px}
  .drawer-nr .nr{font-size:18px}
  .btn-hero{height:44px}
  .example-chip{padding:5px 10px}
}
