/* 网页版（小程序运行层）全局样式：外壳 + 内置组件默认样式 + 原生弹层。页面自己的样式由构建时编译注入。 */

:root {
  /* 1rpx：手机 = 屏宽 / 750（和小程序一样）；平板电脑封顶在 430pt 宽手机的密度，界面不会被放大 */
  --rpx: calc(min(100vw, 430px) / 750);
  --mp-side: 0px;
  --mp-bg: #fafbff;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; background: var(--mp-bg); overscroll-behavior: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px; color: #000; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
#mp-root { position: fixed; inset: 0; display: flex; }
/* 启动图（mp-shell 输出，boot.js 第一次渲染时被页面替掉）：盖满整屏，底色按页面来（登录页深色，见 mp-shell）。
   logo 等 0.4 秒才淡入 —— 正常加载根本看不到它，只有网慢时才出来，不会一闪而过 */
.mp-boot { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--mp-bg); }
.mp-boot img { width: 64px; height: 64px; border-radius: 16px; opacity: 0; animation: mp-boot-in .3s ease .4s forwards; }
@keyframes mp-boot-in { to { opacity: 1; } }

/* ── 外壳 ───────────────────────────────────────────────────────────── */
.mp-stage { position: relative; flex: 1; min-width: 0; height: 100%; overflow: hidden; background: var(--mp-bg); }
.mp-frame {
  position: absolute; inset: 0; margin: 0 auto;
  display: flex; flex-direction: column;
  /* transform 让页面里的 position:fixed 相对这个框定位（电脑上框不等于窗口） */
  transform: translateZ(0);
  overflow: hidden; background: var(--mp-bg);
  visibility: hidden; pointer-events: none; content-visibility: hidden;
}
.mp-frame.mp-on { visibility: visible; pointer-events: auto; content-visibility: visible; z-index: 1; }
.mp-frame[data-layout="column"] { width: min(100%, var(--mp-max, 640px)); }
.mp-scroll { position: relative; flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.mp-scroll.noscroll { overflow: hidden; }
wx-page { display: block; min-height: 100%; position: relative; }
.mp-frame.anim-push { animation: mp-push .32s cubic-bezier(.2,.9,.3,1) both; }
.mp-frame.anim-back { animation: mp-fade .18s ease-out both; }
.mp-frame.anim-fade { animation: mp-fade .16s ease-out both; }
@keyframes mp-push { from { transform: translate3d(36%,0,0); opacity: .6; } to { transform: translate3d(0,0,0); opacity: 1; } }
@keyframes mp-fade { from { opacity: .4; } to { opacity: 1; } }
@media (min-width: 700px) {
  .mp-frame.anim-push { animation: mp-fade .18s ease-out both; }
  .mp-frame[data-layout="column"] { box-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 12px 48px rgba(30,40,90,.06); }
  .mp-stage { background: #f2f3f8; }
}

/* 默认导航栏（navigationStyle 不是 custom 的页面） */
.mp-navbar { flex: none; height: 44px; display: flex; align-items: center; justify-content: center; position: relative; color: #000; z-index: 5; }
.mp-navbar.dark { color: #fff; }
.mp-navbar-t { font-size: 17px; font-weight: 600; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-navbar-back { position: absolute; left: 0; top: 0; width: 48px; height: 44px; cursor: pointer; }
.mp-navbar-back i { position: absolute; left: 18px; top: 15px; width: 12px; height: 12px; border-left: 2.4px solid currentColor; border-bottom: 2.4px solid currentColor; transform: rotate(45deg); border-radius: 1px; }

/* 下拉刷新 */
.mp-ptr { height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.mp-ptr.mp-on { height: 56px; }

/* 电脑侧边栏（≥1024） */
.mp-side { display: none; }
@media (min-width: 1024px) {
  :root { --mp-side: 232px; }
  .mp-side {
    display: flex; flex-direction: column; flex: none; width: var(--mp-side); height: 100%;
    padding: 28px 16px 20px; background: rgba(255,255,255,.72); border-right: 1px solid rgba(60,60,67,.08);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); z-index: 2;
  }
  .mp-side-brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; cursor: pointer; user-select: none; }
  .mp-side-brand img { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
  .mp-side-brand b { display: block; font-size: 17px; font-weight: 700; letter-spacing: .2px; }
  .mp-side-brand span { display: block; font-size: 12px; color: #8e8e93; margin-top: 2px; }
  .mp-side nav { display: flex; flex-direction: column; gap: 4px; }
  .mp-side-i { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 14px; border-radius: 12px; font-size: 15px; font-weight: 500; color: #3c3c43; cursor: pointer; user-select: none; transition: background .15s; }
  .mp-side-i img { width: 22px; height: 22px; }
  .mp-side-i:hover { background: rgba(0,0,0,.04); }
  .mp-side-i.mp-on { background: rgba(0,122,255,.1); color: #007aff; font-weight: 600; }
  .mp-side-foot { margin-top: auto; display: flex; gap: 14px; padding: 0 12px; }
  .mp-side-foot a { font-size: 12px; color: #8e8e93; text-decoration: none; }
  /* 有侧边栏就不要底部 tab 胶囊（两处导航只留一处） */
  [data-s~="c_custom_tab_bar"] { display: none !important; }
  .mp-side-foot a:hover { color: #007aff; }
}

/* ── 内置组件默认样式（微信 style: v2）──────────────────────────────────── */
wx-view, wx-label, wx-navigator, wx-swiper, wx-swiper-item, wx-scroll-view, wx-form, wx-rich-text, wx-picker { display: block; }
wx-text, wx-icon, wx-vhost { display: inline; }
wx-text { white-space: pre-line; }
wx-view, wx-text, wx-image, wx-button, wx-page { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
[data-sel], [data-sel] * { -webkit-user-select: text; user-select: text; }
[hidden] { display: none !important; }
[data-tap] { cursor: pointer; }

wx-image { display: inline-block; position: relative; overflow: hidden; width: 320px; height: 240px; }
wx-image > img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; max-width: none; -webkit-user-drag: none; }
wx-image[data-mode="widthFix"] { height: auto !important; }
wx-image[data-mode="widthFix"] > img { position: static; height: auto; }
wx-image[data-mode="heightFix"] { width: auto !important; }
wx-image[data-mode="heightFix"] > img { position: static; width: auto; height: 100%; }

wx-scroll-view { position: relative; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
wx-scroll-view[data-nobar] { scrollbar-width: none; }
wx-scroll-view[data-nobar]::-webkit-scrollbar { display: none; }
wx-scroll-view[data-flex] { display: flex; }
@media (pointer: fine) {
  .mp-scroll, wx-scroll-view { scrollbar-width: thin; scrollbar-color: rgba(0,0,0,.18) transparent; }
  .mp-scroll::-webkit-scrollbar, wx-scroll-view::-webkit-scrollbar { width: 8px; height: 8px; }
  .mp-scroll::-webkit-scrollbar-thumb, wx-scroll-view::-webkit-scrollbar-thumb { background: rgba(0,0,0,.16); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
}

wx-swiper { position: relative; overflow: hidden; height: 150px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
wx-swiper[data-vert] { touch-action: pan-x; }
wx-swiper img { -webkit-user-drag: none; user-select: none; }
wx-swiper-track { display: flex; width: 100%; height: 100%; will-change: transform; }
wx-swiper-item { flex: 0 0 100%; width: 100%; height: 100%; position: relative; overflow: hidden; }
wx-swiper-dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 8px; pointer-events: none; }
wx-swiper-dots i { width: 8px; height: 8px; border-radius: 50%; }

wx-button {
  position: relative; display: block; margin-left: auto; margin-right: auto; padding: 8px 24px; width: 184px; box-sizing: border-box;
  font-size: 17px; font-weight: 700; text-align: center; text-decoration: none; line-height: 1.41176471; border-radius: 8px;
  overflow: hidden; color: #06ae56; background-color: #f2f2f2; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
wx-button::after { content: " "; width: 200%; height: 200%; position: absolute; top: 0; left: 0; border: 1px solid rgba(0,0,0,.2); transform: scale(.5); transform-origin: 0 0; box-sizing: border-box; border-radius: 10px; border-width: 0; }
wx-button[type="primary"] { color: #fff; background-color: #07c160; }
wx-button[type="warn"] { color: #fa5151; background-color: #f2f2f2; }
wx-button[size="mini"] { display: inline-block; line-height: 2.3; font-size: 13px; padding: 0 1.34em; width: auto; }
wx-button[plain] { background-color: transparent; border: 1px solid currentColor; }
wx-button[disabled] { opacity: .5; cursor: default; }
.button-hover { background-color: #dedede; }
wx-button[type="primary"].button-hover { background-color: #06ad56; }
.wx-btn-loading { display: inline-block; width: 1em; height: 1em; margin-right: .4em; vertical-align: -0.15em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: mp-rot .8s linear infinite; }

input, textarea {
  display: block; border: 0; outline: none; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit;
  -webkit-appearance: none; appearance: none; border-radius: 0; min-width: 0;
}
input { height: 1.4em; min-height: 1.4em; line-height: 1.4em; width: 100%; text-overflow: clip; overflow: hidden; white-space: nowrap; }
textarea { width: 300px; height: 150px; resize: none; line-height: 1.4; }
textarea[data-auto] { height: auto; min-height: 1.4em; overflow: hidden; }
input::placeholder, textarea::placeholder { color: #808080; }

canvas { display: block; width: 300px; height: 150px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; }

wx-switch { display: inline-block; vertical-align: middle; cursor: pointer; }
wx-switch i { display: block; position: relative; width: 52px; height: 32px; border-radius: 16px; background: #e9e9ea; transition: background .2s, border-color .2s; }
wx-switch i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.06); transition: transform .25s cubic-bezier(.3,1.2,.5,1); }
wx-switch i[data-on]::after { transform: translateX(20px); }
wx-switch[data-disabled] { opacity: .5; cursor: default; }

wx-slider { display: block; margin: 10px 18px; padding: 0; }
wx-slider { display: flex; align-items: center; }
wx-slider-box { display: block; flex: 1; padding: 14px 0; cursor: pointer; touch-action: none; }
wx-slider-track { display: block; position: relative; height: 2px; border-radius: 1px; }
wx-slider-track > i { position: absolute; left: 0; top: 0; height: 100%; border-radius: 1px; }
wx-slider-track > b { position: absolute; top: 50%; border-radius: 50%; box-shadow: 0 0 4px rgba(0,0,0,.2); }
wx-slider-value { margin-left: 14px; font-size: 14px; color: #888; min-width: 2em; }

/* ── 弹层 ───────────────────────────────────────────────────────────── */
#mp-overlay { position: fixed; inset: 0; pointer-events: none; z-index: 9000; }
#mp-overlay > * { pointer-events: auto; }
.mp-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9001; }
.mp-mask-clear { position: fixed; inset: 0; }
.mp-fade { animation: mp-fade-in .2s ease-out both; }
.mp-fade-out { animation: mp-fade-o .18s ease-in both; }
@keyframes mp-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes mp-fade-o { to { opacity: 0; } }
.mp-pop { animation: mp-pop .22s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes mp-pop { from { opacity: 0; transform: translate(-50%,-50%) scale(.92); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }
@keyframes mp-rot { to { transform: rotate(360deg); } }

.mp-toast-wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 9100; }
.mp-toast { max-width: min(80vw, 320px); padding: 10px 16px; border-radius: 10px; background: rgba(17,17,17,.78); color: #fff; font-size: 15px; line-height: 1.45; text-align: center; animation: mp-fade-in .15s ease-out both; word-break: break-word; }
.mp-toast-icon { min-width: 128px; min-height: 128px; padding: 22px 14px 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 14px; }
.mp-toast-ic { height: 44px; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.mp-toast-img { width: 40px; height: 40px; margin-bottom: 8px; }
.mp-spin { display: inline-block; width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; animation: mp-rot .8s linear infinite; }
.mp-spin.dark { width: 22px; height: 22px; border-width: 2.5px; border-color: rgba(0,0,0,.12); border-top-color: rgba(0,0,0,.55); }

.mp-modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(84vw, 320px); background: #fff; border-radius: 14px; overflow: hidden; z-index: 9002; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.mp-modal-t { padding: 28px 24px 0; font-size: 17px; font-weight: 600; line-height: 1.4; color: #000; }
.mp-modal-c { padding: 10px 24px 26px; font-size: 15px; line-height: 1.55; color: rgba(0,0,0,.6); white-space: pre-line; word-break: break-word; max-height: 50vh; overflow: auto; }
.mp-modal-t + .mp-modal-b { margin-top: 26px; }
.mp-modal-c-only { padding-top: 30px; font-size: 17px; color: #000; }
.mp-modal-in { width: calc(100% - 48px); margin: 16px 24px 22px; height: 84px; padding: 10px 12px; border-radius: 8px; background: #f5f5f5; font-size: 15px; text-align: left; }
.mp-modal-b { display: flex; border-top: 1px solid rgba(0,0,0,.08); }
.mp-modal-btn { flex: 1; height: 56px; line-height: 56px; font-size: 17px; font-weight: 600; cursor: pointer; user-select: none; }
.mp-modal-btn + .mp-modal-btn { border-left: 1px solid rgba(0,0,0,.08); }
.mp-modal-btn:active, .mp-modal-btn:hover { background: rgba(0,0,0,.03); }

.mp-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9002; background: #f7f7f7; border-radius: 12px 12px 0 0; overflow: hidden; padding-bottom: env(safe-area-inset-bottom); }
.mp-slide { animation: mp-up .26s cubic-bezier(.2,.9,.3,1) both; }
.mp-slide-out { animation: mp-down .18s ease-in both; }
@keyframes mp-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes mp-down { to { transform: translateY(100%); } }
.mp-sheet-g { background: #fff; }
.mp-sheet-alert { padding: 16px 24px; font-size: 13px; color: rgba(0,0,0,.5); text-align: center; border-bottom: 1px solid rgba(0,0,0,.06); }
.mp-sheet-i { height: 56px; line-height: 56px; text-align: center; font-size: 17px; background: #fff; cursor: pointer; user-select: none; }
.mp-sheet-g .mp-sheet-i + .mp-sheet-i { border-top: 1px solid rgba(0,0,0,.06); }
.mp-sheet-i:active, .mp-sheet-i:hover { background: #f2f2f2; }
.mp-sheet-cancel { margin-top: 8px; }
@media (min-width: 700px) {
  .mp-sheet { left: 50%; right: auto; bottom: 50%; width: 360px; transform: translate(-50%, 50%); border-radius: 14px; padding-bottom: 0; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
  .mp-slide { animation: mp-fade-in .18s ease-out both; }
  .mp-slide-out { animation: mp-fade-o .15s ease-in both; }
}
.mp-picker { background: #fff; }
.mp-picker-h { height: 52px; display: flex; align-items: center; padding: 0 20px; border-bottom: 1px solid rgba(0,0,0,.06); }
.mp-picker-x { font-size: 16px; color: #3c3c43; cursor: pointer; }
.mp-picker-l { max-height: 50vh; overflow-y: auto; }
.mp-picker-i { height: 50px; line-height: 50px; text-align: center; font-size: 17px; cursor: pointer; }
.mp-picker-i.mp-on { color: #007aff; font-weight: 600; }
.mp-region-c { flex: 1; min-width: 0; display: flex; gap: 14px; margin-left: 18px; overflow-x: auto; white-space: nowrap; }
.mp-region-k { font-size: 15px; color: #11152e; cursor: pointer; }
.mp-region-k.mp-on { color: #007aff; font-weight: 600; cursor: default; }
.mp-region-l .mp-picker-i { text-align: left; padding: 0 24px; font-size: 16px; }

.mp-preview { position: fixed; inset: 0; z-index: 9200; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; }
.mp-preview-img { max-width: 100%; max-height: 82%; object-fit: contain; -webkit-touch-callout: default; user-select: auto; }
.mp-preview-tip { position: absolute; top: max(20px, env(safe-area-inset-top)); left: 0; right: 0; text-align: center; color: rgba(255,255,255,.85); font-size: 15px; }
.mp-preview-dl { position: absolute; bottom: max(28px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); padding: 10px 24px; border-radius: 22px; background: rgba(255,255,255,.16); color: #fff; font-size: 15px; text-decoration: none; }
.mp-save-mask { z-index: 9200; }
.mp-save { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9201; max-width: 520px; margin: 0 auto; background: #fff; border-radius: 28px 28px 0 0; padding: 18px 22px max(24px, env(safe-area-inset-bottom)); box-sizing: border-box; }
.mp-save-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.mp-save-t { font-size: 18px; font-weight: 700; }
.mp-save-x { width: 32px; height: 32px; border-radius: 50%; background: #f2f2f7; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.mp-save-box { background: #f5f6fa; border-radius: 16px; padding: 14px; display: flex; justify-content: center; }
.mp-save-img { display: block; max-width: 100%; max-height: 46vh; object-fit: contain; -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; }
.mp-save-btn { margin-top: 18px; height: 52px; line-height: 52px; border-radius: 26px; background: #007aff; color: #fff; font-size: 17px; font-weight: 600; text-align: center; cursor: pointer; box-shadow: 0 10px 24px rgba(0,122,255,.25); }
.mp-save-btn:active { background: #0051d5; }
.mp-save-err { margin-top: 10px; color: #ff3b30; font-size: 13px; text-align: center; line-height: 1.4; }
.mp-save-err:empty { display: none; }
.mp-save-row { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding: 0 6px; font-size: 14px; color: #8e8e93; }
.mp-save-only { color: #3c3c43; font-weight: 600; }
.mp-save-dl { color: #007aff; text-decoration: none; }

.mp-share { position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(88vw, 340px); background: #fff; border-radius: 20px; padding: 24px 22px 20px; z-index: 9002; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.mp-share-t { font-size: 17px; font-weight: 700; }
.mp-share-img { display: block; width: 100%; max-height: 160px; object-fit: contain; margin: 14px 0 0; border-radius: 12px; background: #f5f6fa; }
.mp-share-name { margin-top: 12px; font-size: 14px; color: #3c3c43; line-height: 1.4; }
.mp-share-qr { display: inline-flex; margin-top: 16px; padding: 12px; border-radius: 14px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.06); }
.mp-share-tip { margin-top: 10px; font-size: 12px; color: #8e8e93; }
.mp-share-url { margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: #f5f6fa; font-size: 12px; color: #3c3c43; word-break: break-all; user-select: all; }
.mp-share-b { display: flex; gap: 10px; margin-top: 16px; }
.mp-share-btn { flex: 1; height: 44px; line-height: 44px; border-radius: 22px; background: #007aff; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
.mp-share-btn.ghost { background: #f2f2f7; color: #000; }

/* ── 滑块验证 / 支付宝付款（runtime/web.js）── */
.mp-cap { position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); background: #fff; border-radius: 18px; padding: 12px; z-index: 9002; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.mp-cap-load { width: 300px; height: 260px; display: flex; align-items: center; justify-content: center; font-size: 13px; color: rgba(0,0,0,.4); }
.mp-cap-tip { text-align: center; font-size: 12px; color: #ff3b30; min-height: 0; }
.mp-cap-tip:not(:empty) { margin-top: 8px; }

/* 可点节点带了 tabindex（读屏 / 键盘）：鼠标点不画焦点框，键盘切过来才画 */
[role=button]:focus, [role=switch]:focus { outline: none; }
[role=button]:focus-visible, [role=switch]:focus-visible { outline: 2px solid #1677ff; outline-offset: 2px; }
