/* ===== 多端适配层（配合 adapt.js）===== */

/* 手机：页面底色与内容一致，不露出两侧灰底；按缩放比例保证一屏高度 */
html.is-phone, html.is-phone body { background: #fff; }
.page { min-height: calc(100vh / var(--z, 1)); }
@supports (height: 100dvh) { .page { min-height: calc(100dvh / var(--z, 1)); } }

/* ===== 小程序胶囊（统一位置：右上角，87×32，距右 7）===== */
.mp-capsule {
  position: fixed; z-index: 1000; top: calc(8px + env(safe-area-inset-top)); right: 7px;
  width: 87px; height: 32px; border-radius: 16px; box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-around;
  background: rgba(255,255,255,.72); border: .5px solid rgba(0,0,0,.12);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); cursor: pointer;
}
.mp-dots { display: flex; gap: 3px; } .mp-dots i { width: 5px; height: 5px; border-radius: 50%; background: #1a1a1a; }
.mp-dots i:nth-child(2) { width: 7px; height: 7px; margin-top: -1px; }
.mp-sep { width: .5px; height: 18px; background: rgba(0,0,0,.18); }
.mp-close { width: 17px; height: 17px; border-radius: 50%; border: 2.2px solid #1a1a1a; box-sizing: border-box; position: relative; }
.mp-close::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: #1a1a1a; }

/* 页头给胶囊让位：右侧留 102px，高度对齐胶囊（48px 导航行） */
.mp-safe { padding-right: 102px !important; min-height: 48px; box-sizing: border-box; }
.detail-hero .overlay-btns.mp-safe { padding-right: 0 !important; min-height: 0; }
.mp-top-gap { padding-top: 48px; }
.nav-header.mp-safe .title { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.nav-header.mp-safe { position: relative; }
.nav-header .back-group { display: flex; align-items: center; gap: 10px; border: 1px solid #F2F2F2; border-radius: 20px; padding: 5px 10px; }
.nav-header .back-group .split { width: 1px; height: 16px; background: #F2F2F2; }

/* 搜索框提示语：小屏不换行，超出显示省略号 */
.vi-search span, .search-bar span, .act-search-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* 横向滑动行：右侧渐隐，提示可滑动；滑到底取消 */
.mp-hscroll:not(.at-end) { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }

/* ===== 宽屏：折叠屏展开 / 平板（宽 ≥ 600）===== */
html.is-wide body { background: #F2F2F2; }
html.is-wide .page { max-width: 900px; }
html.is-wide .fixed-top, html.is-wide .fixed-bottom, html.is-wide .ops-bar, html.is-wide .filter-drawer { max-width: 900px; }
html.is-wide .navbar { max-width: 560px; margin: 0 auto; }
html.is-wide .mp-multicol { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important; }
html.is-wide .vi-hero { height: 280px; }
html.is-wide .vi-hero .en { font-size: 34px; }
html.is-wide .banner { aspect-ratio: auto; height: 420px; }
html.is-wide .detail-hero { height: 380px; }
html.is-wide .detail-hero img { object-fit: contain; background: #f2f2f2; }
/* 宽屏时胶囊贴着内容区右上角，而不是整个屏幕右上角 */
html.is-wide .mp-capsule { right: max(7px, calc((100vw - 900px) / 2 + 7px)); }

/* 专题详情：文章内容（替换原占位块） */
.topic-article { background: #fff; margin: 10px 0; padding: 16px; font-size: 15px; line-height: 1.75; color: #333; }
.topic-article .cover { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; margin-bottom: 12px; }
.topic-article p { margin-bottom: 10px; }
.topic-article .tip { background: #EAF3FD; border-radius: 8px; padding: 10px 12px; font-size: 14px; color: #01396E; }
.topic-article .tip b { display: block; margin-bottom: 4px; }
/* 活动卡片：状态角标移到图片左下角，不压海报标题 */
.activity-status { top: auto !important; bottom: 6px; }

/* 设计方案切换按钮：移到电脑端预览台顶栏（preview.html），页面内隐藏 */
.preview-toggles { display: none !important; }

/* 首页主视觉标语条：只占文字宽度，不被拉成整行 */
.vi-hero .zh { align-self: flex-start; }
/* 宽屏：金刚区图标不铺满，限宽居中 */
html.is-wide .vi-kingkong .vi-grid { max-width: 640px; margin-left: auto; margin-right: auto; }
html.is-wide .vi-hero .left { width: 50%; padding-left: 32px; }
html.is-wide .vi-hero .right { width: 50%; }

/* 详情页（大图顶部）：返回 / 首页按钮与胶囊对齐在同一行 */
.overlay-btns { top: calc(8px + env(safe-area-inset-top)) !important; }

/* =====================================================================
   第二轮：UI 规范统一（参考 ChatGPT 评审 + 实测）
   页边距 16 ｜ 卡片间距 12 ｜ 热区 44 ｜ 圆角 卡片12 / 图片8 / 标签4 ｜ 页面底 #F5F7FA
   ===================================================================== */
:root { --mp-pad: 16px; --mp-gap: 12px; --mp-bg: #F5F7FA; --mp-line: #E9EDF2; --mp-navy: #01396E; --mp-blue: #1677D2; --mp-ink: #182230; --mp-sub: #526174; }

/* ---------- 点击热区：小于 44 的可点元素，用透明伪元素扩到 44×44（视觉大小不变）---------- */
.mp-hit { position: relative; }
.mp-hit::before { content: ''; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%); }

/* ---------- 底部悬浮 Tab 栏：79 → 64，背景不透明，列表底部预留足够空间 ---------- */
.fixed-bottom { padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important; }
.navbar { padding: 7px 4px !important; background: rgba(255,255,255,.97) !important; box-shadow: 0 6px 24px rgba(16,42,80,.14) !important; }
.nav-item { font-size: 12px !important; gap: 2px !important; min-height: 44px; justify-content: center; }
.nav-item svg { width: 22px !important; height: 22px !important; }
.nav-item.active { color: var(--mp-navy) !important; }
.nav-item.active svg { fill: rgba(22,119,210,.14) !important; }
.page { padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important; }

/* ---------- 详情页：顶部加导航栏，返回 / 首页与胶囊同一行，不再压在商品图上 ---------- */
.mp-navbar { position: fixed; top: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px; height: calc(48px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; box-sizing: border-box; background: rgba(255,255,255,.97); z-index: 900; display: flex; align-items: center; box-shadow: 0 1px 0 var(--mp-line); }
html.is-wide .mp-navbar { max-width: 900px; }
.mp-navbar .overlay-btns { position: static !important; display: flex; align-items: center; gap: 10px; border: 1px solid #E5E8EE; border-radius: 999px; padding: 5px 12px; background: #fff; }
.mp-navbar .overlay-btns .round { width: 22px; height: 22px; background: transparent !important; color: #1a1a1a !important; border-radius: 0; }
.mp-navbar .overlay-btns .round + .round { border-left: 1px solid #E5E8EE; padding-left: 10px; width: 33px; }
.mp-navbar .overlay-btns .round svg { width: 18px; height: 18px; }
.page.mp-has-nav { padding-top: calc(48px + env(safe-area-inset-top)); }
.detail-hero { height: 240px !important; }
.page.mp-prod .detail-hero { background: #fff !important; }
.page.mp-prod .detail-hero img { object-fit: contain !important; padding: 16px 24px; box-sizing: border-box; }

/* ---------- 首页：顶部四个板块压缩，产品推荐提前出现 ---------- */
.vi-hero { height: 176px !important; }
.vi-hero .en { font-size: 22px !important; }
.vi-hero .btn { padding: 7px 14px !important; }
.home .vi-kingkong { margin: 4px 0 8px !important; }
.home .vi-kingkong .vi-grid { padding: 2px 8px 4px !important; }
.home .vi-kingkong .vi-grid.prods { padding-top: 6px !important; margin-top: 4px !important; }
.home .vi-kingkong .vi-grid-item { padding: 2px 0 !important; gap: 4px !important; }
.home .vi-kingkong .vi-grid-item .ic { width: 44px !important; height: 44px !important; }
.home .vi-kingkong .vi-grid-item span { font-size: 13px !important; }
.vi-trio { height: 124px !important; gap: 8px !important; }
.vi-trio .b { padding: 10px 12px !important; }
.vi-trio .b .d { line-height: 1.45 !important; margin-top: 3px !important; }

/* ---------- 灵感应用：去掉两层胶囊外框，分类 / 子分类 / 排序平铺 ---------- */
.vi-catwrap { margin: 8px var(--mp-pad) 0 !important; padding: 0 !important; background: transparent !important; border-radius: 0 !important; box-shadow: none !important; }
.vi-subbar { margin: 8px 0 0 !important; padding: 8px var(--mp-pad) !important; border-radius: 0 !important; box-shadow: 0 1px 0 var(--mp-line) !important; background: #fff !important; }
.vi-subbar.is-stuck { box-shadow: 0 4px 12px rgba(20,60,120,.08) !important; }
.vi-cat { height: 32px !important; border-radius: 999px !important; }

/* ---------- 产品介绍：品牌横幅压缩；产品图完整显示（不裁切） ---------- */
.vi-pbanner { padding: 16px var(--mp-pad) 14px !important; }
.vi-prod .img { aspect-ratio: auto !important; height: 160px; background: #fff !important; }
.vi-prod .img img { object-fit: contain !important; padding: 12px; box-sizing: border-box; }
.vi-prod-grid { gap: var(--mp-gap) !important; }

/* ---------- 卡片统一：圆角 12、轻阴影 ---------- */
.card, .vi-prod, .insight-card, .vi-recipe, .pc-list, .pc-stats, .pc-user { border-radius: 12px !important; }
.card, .vi-prod, .insight-card, .vi-recipe { box-shadow: 0 2px 8px rgba(20,40,80,.06) !important; }

/* ---------- 专题 / 活动：浅色页面底，只保留顶部深色标题区 ---------- */
.page.blue { background: var(--mp-bg) !important; }
.mp-darkhead { background: #0C2846; padding-bottom: 4px; margin-bottom: 12px; }
.activity-list-item { border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(20,40,80,.06); margin-bottom: var(--mp-gap) !important; }

/* ---------- 收藏：统一心形，点击即时切换 ---------- */
.mp-faved, .mp-faved * { color: #E30613 !important; }
.mp-faved svg path { fill: #E30613; stroke: #E30613; }

/* ---------- 产品详情：底部操作栏加「咨询产品」主按钮 ---------- */
.ops-bar { padding: 8px var(--mp-pad) calc(8px + env(safe-area-inset-bottom)) !important; gap: 8px; }
.ops-bar .op { flex: 0 0 auto; min-width: 64px; min-height: 44px; justify-content: center; }
.ops-bar .op.mp-cta { flex: 1; height: 44px; border-radius: 999px; background: var(--mp-navy); color: #fff; font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: center; }

/* ---------- 宽屏（折叠屏展开 / 平板）：边距 20、间距 16、列表变两列 ---------- */
html.is-wide { --mp-pad: 20px; --mp-gap: 16px; }
html.is-wide .vi-hero { height: 220px !important; }
html.is-wide .vi-ins-list, html.is-wide .mp-list, html.is-wide .activity-content-container { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-content: start; }
html.is-wide .vi-ins-list > *, html.is-wide .mp-list > *, html.is-wide .activity-content-container > * { margin: 0 !important; }
html.is-wide .mp-list { padding: 0 20px; }
html.is-wide .vi-ins-list { padding: 0 20px; }
@media (min-width: 768px) { html.is-wide { --mp-pad: 24px; } html.is-wide .vi-hero { height: 250px !important; } }
.mp-navbar .overlay-btns { padding-right: 12px !important; min-height: 0 !important; }
/* 标题换行更均匀，避免最后一行只剩一个字 */
.insight-card .title, .vi-prod .name, .activity-list-item .title, .vi-recipe .name, .section-head .t { text-wrap: pretty; }
/* 宽屏：左图右文的横向卡片列表，每列至少 300 宽（折叠屏 2 列），不能按小卡片的 190 拆成 3 列 */
html.is-wide .vi-ins-list.mp-multicol, html.is-wide .mp-list.mp-multicol, html.is-wide .activity-content-container.mp-multicol,
html.is-wide .vi-ins-list, html.is-wide .mp-list, html.is-wide .activity-content-container { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important; }
