/* 网页外壳样式（与小程序的 app.wxss 独立，负责布局与交互层） */

:root {
  /* 1rpx = 1/750 视口宽；桌面端封顶 560px，避免字号被拉伸 */
  --rpx: calc(100vw / 750);
}

@media (min-width: 561px) {
  :root {
    --rpx: calc(560px / 750);
  }
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #ececec;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: #333;
  overflow: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* 手机宽度居中，桌面看着像 App */
.mp-root {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #f5f5f5;
}

.mp-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  height: 44px;
  padding: 0 8px;
  background: #D4380D;
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  z-index: 20;
}

.mp-nav[hidden] { display: none; }

.mp-nav-back {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  padding: 0 0 4px;
}

.mp-nav-title {
  font-size: 16px;
  font-weight: 600;
}

.mp-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

.mp-ptr {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #999;
  transform: translateY(-40px);
  pointer-events: none;
  z-index: 5;
}

.mp-tabbar {
  display: flex;
  flex: 0 0 auto;
  height: 52px;
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid #eee;
  z-index: 20;
}

.mp-tabbar[hidden] { display: none; }

.mp-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: #999;
  font-size: 11px;
}

.mp-tab img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.mp-tab.active { color: #D4380D; }

/* 页面容器：让自定义页面撑满可视区 */
#mp-scroll > div { min-height: 100%; }

/* ---------------------------------------------------------------- 交互层 */
.mp-toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  max-width: 76vw;
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  z-index: 9999;
}

.mp-loading {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 96px;
  padding: 16px 18px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 13px;
  text-align: center;
  z-index: 9999;
}

.mp-loading-spin {
  width: 22px;
  height: 22px;
  margin: 0 auto 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: mp-spin 0.8s linear infinite;
}

@keyframes mp-spin { to { transform: rotate(360deg); } }

.mp-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.mp-modal {
  width: min(76vw, 420px);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.mp-modal-title {
  padding: 20px 20px 8px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.mp-modal-body {
  padding: 0 20px 20px;
  font-size: 14px;
  line-height: 1.6;
  color: #555;
  text-align: center;
  /* 公告/提示里的换行要保住，不然一大坨文字糊在一起 */
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 55vh;
  overflow-y: auto;
}

.mp-modal-actions {
  display: flex;
  border-top: 1px solid #eee;
}

.mp-modal-btn {
  flex: 1;
  padding: 13px 0;
  border: none;
  background: #fff;
  font-size: 15px;
}

.mp-modal-btn.cancel { color: #666; border-right: 1px solid #eee; }
.mp-modal-btn.confirm { color: #D4380D; font-weight: 600; }

#mp-boot {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  color: #999;
  font-size: 14px;
  z-index: 9998;
}
