/* 用户端（手机优先）公共样式 */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; } /* 防止自定义 display 覆盖 hidden 属性 */
html, body { background: #f4f5f7; }
/* 禁止页面双击缩放（touch-action: manipulation 保留滚动、仅禁双击手势） */
html, body { touch-action: manipulation; }
/* 放大查看时锁定背景滚动 */
body.lock-scroll { overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #333; font-size: 14px;
}
img { display: block; }
a { text-decoration: none; color: inherit; }
.wrap { max-width: 640px; margin: 0 auto; min-height: 100vh; }

/* ---------- 顶部 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: #fff; padding: 10px 12px 0;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.brand-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 2px 8px;
}
.site-name { font-size: 22px; font-weight: 700; color: #c0392b; letter-spacing: 1px; }
.consult-mini {
  height: 30px; padding: 0 14px; border: 1px solid #c0392b; border-radius: 15px;
  background: #fff; color: #c0392b; font-size: 13px; cursor: pointer;
}
.consult-mini:active { background: #fdf3f2; }

.search-box { display: flex; gap: 8px; }
.search-box input {
  flex: 1; height: 36px; border: 1px solid #e5e5e5; border-radius: 18px;
  padding: 0 14px; font-size: 14px; outline: none; background: #f7f8fa;
}
.search-box input:focus { border-color: #c0392b; background: #fff; }
.search-box button {
  width: 64px; height: 36px; border: 0; border-radius: 18px;
  background: #c0392b; color: #fff; font-size: 14px;
}

/* 筛选栏 */
.filters {
  display: flex; gap: 8px; padding: 10px 0;
}
.filter {
  flex: 1; height: 32px; line-height: 30px; text-align: center;
  border: 1px solid #e5e5e5; border-radius: 16px; font-size: 12.5px;
  color: #555; background: #f7f8fa; position: relative; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 10px;
}
.filter .arrow {
  display: inline-block; width: 0; height: 0; margin-left: 4px;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid #999; vertical-align: middle;
}
.filter.active { border-color: #c0392b; color: #c0392b; background: #fdf3f2; }
.filter.active .arrow { border-top-color: #c0392b; transform: rotate(180deg); }

/* 下拉选项 */
.dropdown {
  position: absolute; left: 12px; right: 12px; top: 100%;
  background: #fff; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12);
  max-height: 260px; overflow-y: auto; margin-top: -4px; padding: 6px 0;
}
.dropdown .opt {
  padding: 11px 16px; font-size: 14px; color: #444; cursor: pointer;
}
.dropdown .opt:active { background: #f5f5f5; }
.dropdown .opt.selected { color: #c0392b; font-weight: 600; }
.dropdown .mask-hide {
  position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: -1;
}

/* ---------- 产品卡片（横向大卡片：左图右信息，铺满留白） ---------- */
.grid { padding: 12px 14px; }
.card {
  display: flex; gap: 12px; align-items: stretch;
  background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  padding: 10px; margin-bottom: 10px; cursor: pointer;
}
.card:active { background: #fafafa; }
.card .pic {
  position: relative; flex: 0 0 118px; height: 118px;
  border-radius: 8px; overflow: hidden; background: #f0f0f0;
}
.card .pic img { width: 100%; height: 100%; object-fit: cover; }
.card .pic .noimg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #bbb; font-size: 12px;
}
.card .info {
  flex: 1; min-width: 0; padding: 2px 2px 0 0;
  display: flex; flex-direction: column;
}
.card .tags {
  display: flex; gap: 6px; align-self: flex-start; margin-bottom: 5px;
  max-width: 100%; overflow: hidden;
}
.card .brand {
  font-size: 11px; color: #c0392b; background: #fdf3f2;
  border: 1px solid #f2c6c1; border-radius: 3px; padding: 1px 5px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 产品类型彩色标签（胶囊形，颜色按类型名分配，JS 内联覆盖） */
.ptype {
  flex: 0 0 auto; font-size: 11px; border-radius: 999px; padding: 1px 8px;
  white-space: nowrap; line-height: 1.5;
  border: 1px solid #e3e8ee;
}
.card .model {
  font-size: 16px; font-weight: 600; color: #222;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 规格标签组（纯文字）：经典大卡 / 电梯导航行共用 */
.spec { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; overflow: hidden; }
.spec .tag {
  flex: 0 0 auto; font-size: 11.5px; color: #8a97a5;
  white-space: nowrap; line-height: 1.5;
}
.card .price-row {
  display: flex; align-items: baseline; gap: 8px;
  margin-top: auto; padding-top: 6px;
}
.card .price { color: #c0392b; font-size: 17px; font-weight: 700; }
.card .price-tag { font-size: 11px; color: #999; }

/* ---------- 空状态 / 加载 ---------- */
.empty, .load-tip, .load-end { text-align: center; color: #aaa; padding: 30px 0; font-size: 13px; }

/* ---------- 详情页 ---------- */
.carousel {
  position: relative; background: #fff; overflow: hidden;
}
.slides {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  touch-action: pan-x; /* 明确只允许横向滑动切换 */
}
.slides::-webkit-scrollbar { display: none; }
.slides .slide {
  flex: 0 0 100%; scroll-snap-align: center;
  aspect-ratio: 1 / 1; background: #f0f0f0; position: relative;
}
.slides .slide img {
  width: 100%; height: 100%; object-fit: contain; cursor: zoom-in;
  -webkit-user-drag: none; -webkit-touch-callout: none; user-select: none;
}
.slides .slide .noimg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #bbb; font-size: 13px;
}
.dots {
  position: absolute; bottom: 10px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 6px;
}
.dots i {
  width: 6px; height: 6px; border-radius: 3px; background: rgba(0,0,0,.25); transition: all .2s;
}
.dots i.on { background: #c0392b; width: 14px; }
.page-tip {
  position: absolute; top: 10px; right: 10px; font-size: 11px; color: #888;
  background: rgba(255,255,255,.8); border-radius: 10px; padding: 2px 8px;
}

.detail-info { background: #fff; margin-top: 10px; padding: 14px; }
.detail-title { font-size: 17px; font-weight: 700; color: #222; }
.detail-title .fit-badge {
  display: inline-block; font-size: 11px; color: #c0392b; background: #fdf3f2;
  border: 1px solid #f2c6c1; border-radius: 3px; padding: 1px 6px; margin-right: 8px;
  vertical-align: 2px; font-weight: 500;
}
.detail-price { margin-top: 8px; }
.detail-price .p { color: #c0392b; font-size: 22px; font-weight: 700; }
.detail-price .p-tag { font-size: 11px; color: #999; margin-left: 6px; }

.params { background: #fff; margin-top: 10px; padding: 6px 14px 12px; }
.params h3 { font-size: 14px; padding: 10px 0 4px; color: #333; }
.params table { width: 100%; border-collapse: collapse; }
.params td {
  padding: 10px 0; border-bottom: 1px solid #f2f2f2; font-size: 13.5px; vertical-align: top;
}
.params td:last-child { color: #555; text-align: right; max-width: 62%; }
.params tr:last-child td { border-bottom: 0; }
.params .label { color: #999; width: 38%; }

.notice {
  margin: 10px 12px; padding: 10px 12px; font-size: 12px; color: #8a6d3b;
  background: #fcf8e3; border: 1px solid #faebcc; border-radius: 6px; line-height: 1.6;
}

/* 详情页：同品牌推荐卡片（一行两个，等高） */
.rel-sec { margin: 0 12px; }
.rel-title { font-size: 15px; font-weight: 700; color: #333; padding: 8px 2px 10px; }
.rel-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.rel-card {
  display: flex; flex-direction: column;
  background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.rel-card:active { background: #fafafa; }
.rel-card .pic {
  aspect-ratio: 1 / 1; background: #f7f8fa;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.rel-card .pic img { width: 100%; height: 100%; object-fit: contain; }
.rel-card .pic .noimg { color: #bbb; font-size: 12px; }
.rel-card .info { flex: 1; display: flex; flex-direction: column; padding: 8px 10px 10px; }
.rel-card .model {
  font-size: 13px; color: #333; line-height: 1.4; min-height: 36px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rel-card .price {
  margin-top: auto; padding-top: 6px;
  color: #c0392b; font-size: 15px; font-weight: 700;
}

/* 底部咨询条 */
.consult-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  display: flex; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #fff; box-shadow: 0 -1px 6px rgba(0,0,0,.06);
  max-width: 640px; margin: 0 auto;
}
.consult-bar .tel-btn {
  flex: 1; height: 42px; line-height: 42px; text-align: center;
  border: 1px solid #c0392b; color: #c0392b; border-radius: 21px; font-size: 14px;
}
.consult-bar .consult-btn {
  flex: 2; height: 42px; line-height: 42px; text-align: center;
  background: #c0392b; color: #fff; border-radius: 21px; font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.consult-placeholder { height: 74px; }

/* 遮罩弹层 */
.overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
}
.overlay .sheet {
  width: 84%; max-width: 340px; background: #fff; border-radius: 12px;
  padding: 22px 18px; text-align: center;
}
.overlay .sheet h3 { font-size: 16px; margin-bottom: 14px; }
.overlay .sheet .qr { width: 200px; height: 200px; margin: 0 auto; object-fit: contain; }
.overlay .sheet .qr-empty {
  width: 200px; height: 200px; margin: 0 auto; background: #f5f5f5; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 13px;
}
.overlay .sheet .phone-line { margin-top: 14px; font-size: 15px; }
.overlay .sheet .phone-line a { color: #c0392b; font-weight: 700; }
.overlay .sheet .close-btn {
  margin-top: 18px; height: 38px; line-height: 38px; border-radius: 19px;
  background: #f2f3f5; color: #666; font-size: 14px; cursor: pointer;
}

/* 图片查看器（mask 全屏层，多图横向轨道） */
.img-mask {
  position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.92);
  overflow: hidden; cursor: zoom-out;
  touch-action: none; /* 手势（捏合/平移/滑动切换）全部由 JS 接管，浏览器不抢 */
}
.viewer-track { display: flex; height: 100%; will-change: transform; }
.viewer-page {
  flex: 0 0 100%; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.viewer-page img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  pointer-events: none; transform-origin: center center; will-change: transform;
  -webkit-user-drag: none; user-select: none;
}
.img-mask .mask-count {
  position: absolute; bottom: calc(24px + env(safe-area-inset-bottom)); left: 0; right: 0;
  text-align: center; color: rgba(255,255,255,.85); font-size: 13px; pointer-events: none;
}

/* ---------- 电梯导航模式 ---------- */
.elevator {
  display: flex; align-items: stretch;
  padding: 0; min-height: calc(100vh - 180px);
}
/* 左侧品牌列：整列通底白底（高度随右侧内容拉伸） */
.ele-nav {
  flex: 0 0 86px; background: #fff; min-width: 0;
  border-right: 1px solid #f0f0f0;
}
/* 导航项容器 sticky 吸顶（top 由 JS 按顶栏高度设置） */
.ele-nav-inner {
  position: sticky; top: 150px;
  max-height: calc(100vh - 170px); overflow-y: auto; scrollbar-width: none;
}
.ele-nav-inner::-webkit-scrollbar { display: none; }
.ele-nav-item {
  padding: 15px 8px; text-align: center; font-size: 13px; color: #555;
  border-left: 3px solid transparent; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ele-nav-item:active { background: #f7f8fa; }
.ele-nav-item.active {
  color: #c0392b; font-weight: 700; background: #f4f5f7;
  border-left-color: #c0392b;
}
/* 右侧分组列表 */
.ele-main { flex: 1; min-width: 0; padding: 0 10px 12px; }
.ele-section { padding-top: 4px; }
.ele-sec-title {
  font-size: 14px; font-weight: 700; color: #333;
  padding: 10px 2px 8px;
}
/* 分组内产品行（横向小卡：左图右信息） */
.ele-row {
  display: flex; gap: 10px; align-items: stretch;
  background: #fff; border-radius: 8px; overflow: hidden;
  padding: 8px; margin-bottom: 8px; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.ele-row:active { background: #fafafa; }
.ele-row .pic {
  position: relative; flex: 0 0 84px; height: 84px;
  border-radius: 6px; overflow: hidden; background: #f0f0f0;
}
.ele-row .pic img { width: 100%; height: 100%; object-fit: cover; }
.ele-row .pic .noimg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #bbb; font-size: 11px;
}
.ele-row .info { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-top: 2px; }
.ele-row .model {
  font-size: 14.5px; font-weight: 600; color: #222; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ele-row .spec { margin-top: 3px; }
.ele-row .price { color: #c0392b; font-size: 16px; font-weight: 700; margin-top: auto; padding-top: 4px; }
