/* ============================================================================
 * base.css — wxweb 宿主基础样式
 * 作用：① 小程序元素名 → 浏览器元素的对齐（view/text/image/swiper…）
 *       ② rpx 自适应：--rpx = min(100vw, 430px)/750  → 和手机上一模一样
 *       ③ wx.* 垫片用到的浮层样式（toast / modal / loading / actionSheet / 预览图）
 * 注意：页面自身的视觉全部来自小程序 app.wxss + 页面 wxss（同一份代码，不许手抄）
 * ========================================================================== */

/* rpx 基准：以前写的是 calc(min(100vw,430px)/750)，老内核浏览器（部分安卓 WebView / 国产浏览器）
   不支持 calc 里的 min()，会导致整个 --rpx 失效 → 图标按原始大小撑爆、间距边框全丢（用户看到的"毫无UI"）。
   这里给一个静态兜底值（= 400px 宽手机），真实值由 JS 按当前宽度设置，全浏览器可用。 */
:root { --rpx: 0.5333px; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: #e9ebef;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #1f2733;
  -webkit-font-smoothing: antialiased;
}
/* 手机一样的可视列（桌面上居中，宽度同小程序上限） */
.wx-page {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: #f5f6f8;
  position: relative;
  overflow-x: hidden;
}
/* 小程序里的 page{} 选择器 */
body > .wx-page { font-size: 28px; font-size: calc(var(--rpx) * 28); }

/* ---------------------------------------------- 元素名对齐（关键：block 化） */
view, scroll-view, swiper, swiper-item, block, form, cover-view, picker, label,
movable-area, movable-view, slot, page-meta, navigation-bar { display: block; }
text { display: inline; }
image { display: inline-block; vertical-align: top; }
button { font: inherit; border: none; background: none; padding: 0; }
input, textarea {
  border: none; outline: none; background: transparent; font: inherit; color: inherit;
  width: 100%; padding: 0; margin: 0;
}
input::placeholder, textarea::placeholder { color: #b8c0cc; }
.wx-comp { display: block; }

/* ------------------------------------------------------------------- swiper */
.wx-swiper { position: relative; overflow: hidden; }
.wx-swiper-track { display: flex; transition: transform .35s ease; will-change: transform; }
.wx-swiper-track > * { flex: 0 0 100%; min-width: 0; }
.wx-swiper-dots { position: absolute; left: 0; right: 0; bottom: calc(var(--rpx) * 12); text-align: center; }
.wx-swiper-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255, 255, 255, .4); margin: 0 3px; vertical-align: middle;
}
.wx-swiper-dot.on { background: #f0a93b; width: 14px; border-radius: 3px; }

/* ----------------------------------------------------- 浮层（wx.* 垫片用） */
.wx-toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(17, 17, 17, .82); color: #fff; border-radius: 8px;
  padding: 18px 22px; font-size: 14px; z-index: 99999; max-width: 70vw;
  text-align: center; line-height: 1.5; animation: wxin .16s ease;
}
.wx-toast.out { opacity: 0; transition: opacity .25s; }
.wx-toast-ic { font-size: 22px; margin-bottom: 4px; }
@keyframes wxin { from { opacity: 0; } to { opacity: 1; } }

.wx-modal-mask, .wx-sheet-mask, .wx-preview, .wx-loading {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, .45); z-index: 99998;
  display: flex; align-items: center; justify-content: center;
}
.wx-modal { width: 270px; background: #fff; border-radius: 12px; overflow: hidden; text-align: center; }
.wx-modal-t { padding: 22px 20px 8px; font-size: 16px; font-weight: 600; }
.wx-modal-c { padding: 0 20px 20px; font-size: 14px; color: #5a6472; line-height: 1.6; }
.wx-modal-b { display: flex; border-top: 1px solid #eceef1; }
.wx-modal-btn { flex: 1; padding: 14px 0; font-size: 16px; cursor: pointer; }
.wx-modal-btn.cancel { color: #7b8593; border-right: 1px solid #eceef1; }
.wx-modal-btn.ok { color: #1d4e79; font-weight: 600; }

.wx-loading { background: rgba(0, 0, 0, .35); }
.wx-loading-box {
  background: rgba(17, 17, 17, .82); color: #fff; border-radius: 8px;
  padding: 18px 22px; font-size: 13px; text-align: center;
}
.wx-loading-box .spin {
  width: 22px; height: 22px; margin: 0 auto 8px; border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #f0a93b; border-radius: 50%; animation: wxspin .8s linear infinite;
}
@keyframes wxspin { to { transform: rotate(360deg); } }

.wx-sheet-mask { align-items: flex-end; }
.wx-sheet { width: 100%; max-width: 430px; background: #fff; border-radius: 12px 12px 0 0; overflow: hidden; }
.wx-sheet-i { padding: 15px 0; text-align: center; font-size: 15px; border-top: 1px solid #f0f2f5; cursor: pointer; }
.wx-sheet-i:first-child { border-top: none; }
.wx-sheet-i.cancel { color: #7b8593; border-top: 6px solid #f2f4f7; }

.wx-preview { background: rgba(0, 0, 0, .92); }
.wx-preview img { max-width: 94vw; max-height: 88vh; }

/* 隐藏小程序里没有的滚动条细节，尽量贴近真机观感 */
.wx-page ::-webkit-scrollbar { width: 0; height: 0; }

/* ============================================================================
 * 桌面端（宽屏）观感：小程序本身只有手机宽度，大屏上留白会显得"像坏了"。
 * 这里只加一个外框，APP 列本身一像素不动 —— 手机上完全看不到这些规则。
 * ========================================================================== */
@media (min-width: 700px) {
  body {
    background: #eef1f5;
    background-image: radial-gradient(circle at 50% 0, rgba(29, 78, 121, .06), transparent 55%);
  }
  .wx-page {
    min-height: 100vh;
    box-shadow: 0 0 0 1px rgba(23, 43, 66, .06), 0 18px 60px rgba(23, 43, 66, .13);
  }
  /* 底栏在小程序里是 fixed 左右贴边；大屏上收进手机列（只约束左右和宽度，不动 position，
     否则会掉到页面最底部——踩过这个坑） */
  .wx-page .tabbar {
    left: 0 !important;
    right: 0 !important;
    max-width: 430px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    transform: none !important;
  }
}

/* 启动占位（脚本加载前的兜底，脚本跑起来就会被移除） */
#mp-boot { padding: 40vh 24px 0; text-align: center; }
.wx-boot { color: #8a94a6; font-size: 14px; line-height: 1.9; }
.wx-boot-fail { color: #b5473c; font-size: 15px; line-height: 2; background: #fff; border-radius: 12px; padding: 20px 18px; box-shadow: 0 6px 24px rgba(23,43,66,.10); }

/* 网页端没有微信授权环境：隐藏「微信一键登录」按钮与它上面的分隔线（小程序端仍在） */
.wx-page .lb-btn-wx, .wx-page .lb-or { display: none !important; }

/* scroll-view 横向滚动：隐藏滚动条、子项不压缩（对齐小程序 scroll-x 行为） */
.wx-scroll-x { -ms-overflow-style: none; scrollbar-width: none; }
.wx-scroll-x::-webkit-scrollbar { display: none; height: 0; }
.wx-scroll-x > * { flex: 0 0 auto; }

/* 固定底栏不遮挡页面末尾内容（对齐小程序 tab-hold 占位；含中间凸起按钮外溢高度） */
html.mp-bottom-hold body { padding-bottom: calc(var(--rpx) * 150); }
