/* 网页运行器基础样式：微信内置组件默认样式 + 手机外框 + 浮层 */
html, body { margin: 0; height: 100%; }
body { background: #EDE6DD; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; -webkit-font-smoothing: antialiased; color: #1F2329; }
.stage { height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.phone { box-sizing: border-box; width: 390px; height: 844px; border-radius: 54px; background: #1A1A1A; padding: 7px; box-shadow: 0 30px 80px rgba(60, 40, 20, .25), 0 0 0 1.5px #3A3A3A; flex-shrink: 0; position: relative; transform-origin: center center; }
.phone::before { content: ""; position: absolute; top: 18px; left: 50%; width: 112px; height: 32px; margin-left: -56px; background: #000; border-radius: 18px; z-index: 30; }
#wx-screen { position: relative; width: 376px; height: 830px; --rpx: calc(376px / 750); border-radius: 47px; overflow: hidden; background: #FFF8F0; display: flex; flex-direction: column; }
.wx-status { height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 28px 0 34px; font-size: 15px; font-weight: 600; box-sizing: border-box; background: inherit; position: relative; z-index: 20; }
.wx-status .r { display: flex; gap: 6px; align-items: center; }
.wx-status .bat { width: 24px; height: 11px; border: 1.5px solid #000; border-radius: 3px; position: relative; box-sizing: border-box; }
.wx-status .bat::after { content: ""; position: absolute; left: 1.5px; top: 1.5px; bottom: 1.5px; width: 70%; background: #000; border-radius: 1px; }
#wx-navbar { height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; position: relative; font-size: 17px; font-weight: 600; z-index: 10; }
#wx-title { max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#wx-back { position: absolute; left: 6px; top: 0; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
#wx-back::before { content: ""; width: 11px; height: 11px; border-left: 2.2px solid currentColor; border-bottom: 2.2px solid currentColor; transform: rotate(45deg); margin-left: 6px; }
.wx-capsule { position: absolute; right: 7px; top: 50px; width: 87px; height: 32px; border-radius: 16px; border: 1px solid rgba(0,0,0,.12); background: rgba(255,255,255,.7); display: flex; align-items: center; z-index: 25; box-sizing: border-box; }
.wx-capsule i { flex: 1; display: flex; justify-content: center; gap: 3px; }
.wx-capsule i b { width: 4px; height: 4px; border-radius: 50%; background: #000; display: block; }
.wx-capsule i:first-child b:nth-child(2) { width: 6px; height: 6px; margin-top: -1px; }
.wx-capsule s { width: 1px; height: 18px; background: rgba(0,0,0,.12); }
.wx-capsule u { flex: 1; display: flex; justify-content: center; }
.wx-capsule u::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #000; box-sizing: border-box; box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 10px #000; }
#wx-screen.custom-nav .wx-status { background: transparent; position: absolute; left: 0; right: 0; top: 0; }
#wx-screen.custom-nav #wx-viewport { padding-top: 0; }
#wx-viewport { flex: 1; position: relative; overflow: hidden; transform: translateZ(0); }
.wx-page { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; transition: transform 240ms cubic-bezier(.2,.8,.2,1), opacity 240ms; scrollbar-width: none; }
.wx-page::-webkit-scrollbar { display: none; }
.wx-page.wx-enter { transform: translateX(30%); opacity: 0; }
.wx-page.wx-leave { transform: translateX(30%); opacity: 0; pointer-events: none; }
#wx-tabbar { height: 50px; flex-shrink: 0; display: flex; border-top: 1px solid rgba(0,0,0,.06); position: relative; z-index: 10; }
.wx-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; font-size: 10px; }
.wx-tab img { width: 24px; height: 24px; }
.wx-home { height: 22px; flex-shrink: 0; position: relative; background: inherit; }
.wx-home::after { content: ""; position: absolute; left: 50%; bottom: 8px; width: 134px; height: 5px; margin-left: -67px; border-radius: 3px; background: #000; }

/* 微信内置组件默认样式（零优先级，页面样式会覆盖） */
:where(view, scroll-view, swiper, swiper-item, picker, page-meta, empty, carer-nav) { display: block; }
:where(text) { display: inline; white-space: pre-wrap; }
:where(page-meta) { display: none; }
:where(wx-image) { display: inline-block; overflow: hidden; width: 320px; height: 240px; position: relative; vertical-align: top; }
wx-image > img { display: block; width: 100%; height: 100%; object-fit: fill; }
wx-image[data-mode="aspectFill"] > img { object-fit: cover; }
wx-image[data-mode="aspectFit"] > img { object-fit: contain; }
wx-image[data-mode="widthFix"] { height: auto !important; }
wx-image[data-mode="widthFix"] > img { height: auto; }
wx-image > img:not([src]) { visibility: hidden; }
:where(button) { position: relative; display: block; margin: 0 auto; padding: 0 14px; box-sizing: border-box; font-size: 18px; text-align: center; line-height: 2.55555556; border-radius: 5px; overflow: hidden; color: #000; background-color: #F8F8F8; border: 0; width: 184px; font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; font-weight: 700; }
:where(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; pointer-events: none; }
:where(button[disabled]) { opacity: .6; cursor: default; }
:where(input) { display: block; height: 1.4rem; min-height: 1.4rem; border: 0; outline: 0; background: transparent; font: inherit; color: inherit; padding: 0; margin: 0; width: 100%; box-sizing: border-box; text-overflow: clip; }
:where(textarea) { display: block; width: 300px; height: 150px; border: 0; outline: 0; background: transparent; font: inherit; color: inherit; padding: 0; margin: 0; resize: none; box-sizing: border-box; }
input::placeholder, textarea::placeholder { color: #B5AA9F; }
:where(canvas) { display: block; width: 300px; height: 150px; touch-action: none; }
scroll-view.wx-sx { overflow-x: auto; overflow-y: hidden; }
scroll-view.wx-sy { overflow-y: auto; }
scroll-view.wx-nobar { scrollbar-width: none; }
scroll-view.wx-nobar::-webkit-scrollbar { display: none; }
:where(swiper) { height: 150px; position: relative; overflow: hidden; }
.wx-swiper-track { display: flex; height: 100%; width: 100%; }
swiper.wx-vertical .wx-swiper-track { flex-direction: column; }
.wx-swiper-track > swiper-item { flex: 0 0 100%; width: 100%; height: 100%; overflow: hidden; position: relative; }
switch.wx-switch { display: inline-block; width: 52px; height: 32px; border-radius: 16px; background: #E5E5E5; position: relative; transition: background 200ms; cursor: pointer; flex-shrink: 0; vertical-align: middle; }
switch.wx-switch i { position: absolute; top: 2px; left: 2px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform 200ms cubic-bezier(.2,.8,.2,1); }
switch.wx-switch.on { background: var(--sw); }
switch.wx-switch.on i { transform: translateX(20px); }
picker { cursor: pointer; }
[class] { -webkit-tap-highlight-color: transparent; }

/* 浮层 */
#wx-layer { position: absolute; inset: 0; z-index: 50; display: none; }
#wx-layer.on { display: block; }
.wx-mask { position: absolute; inset: 0; background: rgba(0,0,0,.5); opacity: 0; transition: opacity 200ms; }
#wx-layer.in .wx-mask { opacity: 1; }
.wx-modal { position: absolute; left: 50%; top: 50%; width: 80%; transform: translate(-50%, -46%) scale(.96); opacity: 0; transition: all 200ms; background: #fff; border-radius: 12px; overflow: hidden; text-align: center; }
#wx-layer.in .wx-modal { opacity: 1; transform: translate(-50%, -50%); }
.wx-modal-title { font-size: 17px; font-weight: 600; padding: 28px 24px 0; }
.wx-modal-body { font-size: 15px; color: #555; padding: 16px 24px 28px; line-height: 1.6; white-space: pre-wrap; }
.wx-modal-ft { display: flex; border-top: 1px solid #eee; }
.wx-modal-ft div { flex: 1; height: 54px; line-height: 54px; font-size: 17px; font-weight: 600; cursor: pointer; }
.wx-modal-ft .c { color: #000; border-right: 1px solid #eee; font-weight: 500; }
.wx-sheet { position: absolute; left: 0; right: 0; bottom: 0; background: #F7F7F7; border-radius: 12px 12px 0 0; transform: translateY(100%); transition: transform 220ms cubic-bezier(.2,.8,.2,1); overflow: hidden; padding-bottom: 20px; }
#wx-layer.in .wx-sheet { transform: none; }
.wx-picker-list { background: #fff; max-height: 360px; overflow-y: auto; }
.wx-sheet-item, .wx-picker-item { height: 56px; line-height: 56px; text-align: center; font-size: 17px; border-bottom: 1px solid #f0f0f0; cursor: pointer; background: #fff; }
.wx-picker-item.on { font-weight: 700; color: #1F2329; background: #FAF6F1; }
.wx-sheet-cancel, .wx-sheet-ok { height: 56px; line-height: 56px; text-align: center; font-size: 17px; background: #fff; margin-top: 8px; cursor: pointer; }
.wx-sheet-ok { color: #FF6B35; font-weight: 600; margin-top: 0; }
.wx-sheet-title { text-align: center; padding: 16px; font-weight: 600; background: #fff; border-bottom: 1px solid #f0f0f0; }
.wx-sheet-body { background: #fff; padding: 20px; }
.wx-native { width: 100%; font-size: 18px; padding: 10px; border: 1px solid #ddd; border-radius: 8px; box-sizing: border-box; height: auto; }
.wx-preview { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 200ms; }
#wx-layer.in .wx-preview { opacity: 1; }
.wx-preview img { max-width: 100%; max-height: 100%; }
.wx-toast { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%) scale(.9); background: rgba(17,17,17,.82); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px; max-width: 70%; text-align: center; z-index: 60; opacity: 0; pointer-events: none; transition: all 180ms; line-height: 1.5; }
.wx-toast.in { opacity: 1; transform: translate(-50%, -50%); }
.wx-toast.icon { min-width: 120px; padding: 22px 18px 16px; }
.wx-toast b { display: block; margin: 0 auto 10px; }
.wx-toast b.ok { width: 30px; height: 16px; border-left: 3px solid #fff; border-bottom: 3px solid #fff; transform: rotate(-45deg); margin-top: 4px; margin-bottom: 18px; }
.wx-toast b.spin { width: 32px; height: 32px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; animation: wxspin .8s linear infinite; }
@keyframes wxspin { to { transform: rotate(360deg); } }

/* 手机上直接全屏 */
@media (max-width: 560px) {
  body { background: #FFF8F0; }
  .stage { padding: 0; display: block; }
    .phone { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; padding: 0; box-shadow: none; background: none; }
  .phone::before { display: none; }
  #wx-screen { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; --rpx: calc(100vw / 750); }
  .wx-status { display: none; }
  .wx-capsule { top: 6px; }
  #wx-screen.custom-nav #wx-viewport { padding-top: 0; }
  .wx-home { height: env(safe-area-inset-bottom, 0); }
  .wx-home::after { display: none; }
}
