/* wx-runtime.css — 基础元素行为 + 手机框 + 内置组件(switch/toast/modal/preview) */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: #000;
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* 手机框：桌面居中限宽，移动端全屏。transform 让内部 position:fixed 相对此框 */
#app {
  position: relative;
  width: min(100vw, 430px);
  height: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: #000;
  transform: translateZ(0);   /* 关键：使后代 fixed 以 #app 为包含块 */
  box-shadow: 0 0 40px rgba(0,0,0,.6);
}

/* 小程序组件 → 网页元素的默认显示 */
view { display: block; }
text { display: inline; }
scroll-view { display: block; overflow: hidden; }
scroll-view[scroll-y] { overflow-y: auto; -webkit-overflow-scrolling: touch; }
scroll-view[scroll-x] { overflow-x: auto; -webkit-overflow-scrolling: touch; }
image { display: inline-block; }
img { max-width: 100%; }

/* 页面容器：填满手机框 */
.wx-page { position: absolute; inset: 0; }

/* ---- switch 开关 ---- */
switch {
  display: inline-block; position: relative;
  width: 52px; height: 32px; border-radius: 16px;
  background: #e9e9ea; transition: background .2s; flex-shrink: 0; cursor: pointer;
  vertical-align: middle;
}
switch.wx-switch-on { background: #07c160; }
.wx-switch-knob {
  position: absolute; top: 2px; left: 2px; width: 28px; height: 28px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s;
}
switch.wx-switch-on .wx-switch-knob { transform: translateX(20px); }

/* ---- toast ---- */
.wx-toast {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.75); color: #fff; font-size: 15px;
  padding: 14px 20px; border-radius: 10px; max-width: 70%; text-align: center;
  z-index: 9000; line-height: 1.5; pointer-events: none;
}
.wx-toast-mask { /* 占位 */ }

/* ---- modal ---- */
.wx-modal-mask {
  position: absolute; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 9100;
}
.wx-modal { width: 80%; max-width: 320px; background: #fff; border-radius: 12px; overflow: hidden; }
.wx-modal-title { text-align: center; font-size: 17px; font-weight: 600; color: #181818; padding: 24px 20px 8px; }
.wx-modal-content { text-align: center; font-size: 15px; color: #666; padding: 0 20px 22px; line-height: 1.5; }
.wx-modal-btns { display: flex; border-top: 1px solid #eee; }
.wx-modal-btn { flex: 1; text-align: center; padding: 14px 0; font-size: 17px; cursor: pointer; }
.wx-modal-btn.wx-cancel { color: #353535; border-right: 1px solid #eee; }
.wx-modal-btn.wx-confirm { color: #07c160; }
.wx-modal-btn:active { background: #f7f7f7; }

/* ---- 图片预览 ---- */
.wx-preview-mask {
  position: absolute; inset: 0; background: #000;
  display: flex; align-items: center; justify-content: center; z-index: 9200;
}
.wx-preview-img { max-width: 100%; max-height: 100%; object-fit: contain; }
