/* ============================================================
   小程序网页预览 · 外壳样式
   （页面自身的 WXSS 由 mini.css 提供，这里只管浏览器环境）
   ============================================================ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0d1117;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  color: #22271d;
}

#wx-root {
  position: relative;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  overflow: hidden;
  background: #f4f3ec;
  transform: translateZ(0);
}

/* ---------------- 页面层 ---------------- */
.wx-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg, #f4f3ec);
}

.wx-layer-enter {
  animation: wx-slide-in .22s cubic-bezier(.22, .8, .3, 1);
}

@keyframes wx-slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.wx-layer .page {
  height: 100%;
}

/* ---------------- 基础元素 ---------------- */
.wx-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.wx-scroll::-webkit-scrollbar { width: 0; height: 0; }

.wx-scroll-x { overflow-x: auto; overflow-y: hidden; }

img {
  display: inline-block;
  vertical-align: top;
  width: 320px;
  height: 240px;
  object-fit: fill;
}

input, textarea {
  font: inherit;
  color: inherit;
  border: 0;
  outline: none;
  background: transparent;
  width: 100%;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}

textarea { resize: none; }

.wx-comp { display: block; }

/* ---------------- 开关 ---------------- */
.wx-switch-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: calc(102 * var(--wx-rpx));
  height: calc(62 * var(--wx-rpx));
  border-radius: 999px;
  background: #d9d9d9;
  transition: background .2s ease;
  cursor: pointer;
}

.wx-switch-wrap.wx-switch-on { background: var(--wx-switch-color, #3d6b2f); }

.wx-switch {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100% !important;
  height: 100% !important;
  margin: 0;
  cursor: pointer;
}

.wx-switch-knob {
  position: absolute;
  top: calc(4 * var(--wx-rpx));
  left: calc(4 * var(--wx-rpx));
  width: calc(54 * var(--wx-rpx));
  height: calc(54 * var(--wx-rpx));
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s ease;
  pointer-events: none;
}

.wx-switch-wrap.wx-switch-on .wx-switch-knob {
  transform: translateX(calc(40 * var(--wx-rpx)));
}

/* ---------------- 假状态栏 + 微信胶囊 ---------------- */
.wx-statusbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .5px;
  z-index: 950;
  pointer-events: none;
  transition: color .2s ease;
}

body.wx-nav-dark .wx-statusbar { color: #14180f; }

.wx-statusbar .wx-signal {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.wx-statusbar .wx-signal i {
  display: block;
  width: 3px;
  border-radius: 1px;
  background: currentColor;
  opacity: .9;
}

.wx-statusbar .wx-signal i:nth-child(1) { height: 5px; }
.wx-statusbar .wx-signal i:nth-child(2) { height: 8px; }
.wx-statusbar .wx-signal i:nth-child(3) { height: 11px; }

.wx-statusbar .wx-signal b {
  display: block;
  width: 22px;
  height: 11px;
  margin-left: 3px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  opacity: .9;
  position: relative;
}

.wx-statusbar .wx-signal b::after {
  content: '';
  position: absolute;
  inset: 1.5px;
  right: 6px;
  background: currentColor;
  border-radius: 1px;
}

.wx-capsule {
  position: absolute;
  top: 50px;
  right: 8px;
  width: 87px;
  height: 32px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .26);
  border: 1px solid rgba(0, 0, 0, .08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 951;
  pointer-events: none;
  color: rgba(0, 0, 0, .72);
  font-size: 13px;
  line-height: 1;
}

body.wx-nav-dark .wx-capsule {
  background: rgba(0, 0, 0, .06);
  border-color: rgba(0, 0, 0, .1);
}

.wx-capsule-dots { letter-spacing: 1px; transform: translateY(-2px); }

.wx-capsule-split { width: 1px; height: 16px; background: rgba(0, 0, 0, .18); }

.wx-capsule-ring {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(0, 0, 0, .62);
  border-radius: 50%;
  position: relative;
}

.wx-capsule-ring::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .62);
}

/* ---------------- 弹层 ---------------- */
#wx-overlay {
  position: absolute;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

.wx-mask {
  position: absolute;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 14, 8, .46);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: auto;
  animation: wx-fade .18s ease;
}

.wx-mask--dark {
  align-items: center;
  background: rgba(0, 0, 0, .9);
}

@keyframes wx-fade { from { opacity: 0; } to { opacity: 1; } }

.wx-sheet {
  width: 100%;
  background: #f7f6f0;
  border-radius: 16px 16px 0 0;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: wx-sheet-up .22s cubic-bezier(.2, .85, .25, 1);
}

@keyframes wx-sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.wx-sheet-title {
  text-align: center;
  font-size: 13px;
  color: #8f9384;
  padding: 8px 0 4px;
}

.wx-sheet-item,
.wx-sheet-cancel {
  width: 100%;
  border: 0;
  background: #fff;
  border-radius: 12px;
  padding: 15px 12px;
  font-size: 16px;
  color: #22271d;
  font-family: inherit;
  cursor: pointer;
}

.wx-sheet-item:active { background: #eef1e6; }

.wx-sheet-cancel {
  color: #5e6354;
  font-weight: 600;
}

.wx-toast {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  max-width: 78%;
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(20, 28, 18, .92);
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  z-index: 1100;
  pointer-events: none;
  animation: wx-fade .2s ease;
}

.wx-preview-img {
  max-width: 92%;
  max-height: 82%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  pointer-events: auto;
}

.wx-mask--dark video {
  max-width: 92%;
  max-height: 82%;
  border-radius: 8px;
  pointer-events: auto;
}
