/* 微信小程序外壳：状态栏 / 胶囊按钮 / 自定义导航栏 / TabBar / 安全区 */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: #1f1f23;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Helvetica, "Microsoft YaHei", sans-serif;
  color: var(--text-1);
  font-size: var(--fs-md);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  color: inherit;
}

input, textarea {
  font-family: inherit;
  border: none;
  outline: none;
  background: none;
  color: inherit;
}

/* === 小程序外壳容器 === */
.mp-shell {
  width: var(--viewport-w);
  min-height: var(--viewport-h);
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 在画板里时撑满 iframe */
.mp-shell.standalone {
  margin: 24px auto;
  border-radius: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  min-height: var(--viewport-h);
}

/* === 状态栏（系统） === */
.mp-statusbar {
  height: var(--statusbar-h);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-1);
  position: relative;
  z-index: 10;
}
.mp-statusbar .time {
  letter-spacing: 0.5px;
}
.mp-statusbar .right {
  display: flex;
  align-items: center;
  gap: 4px;
}
.mp-statusbar .signal {
  display: inline-flex;
  align-items: flex-end;
  gap: 1px;
  height: 8px;
}
.mp-statusbar .signal span {
  width: 2px;
  background: var(--text-1);
  border-radius: 1px;
}
.mp-statusbar .signal span:nth-child(1) { height: 3px; }
.mp-statusbar .signal span:nth-child(2) { height: 5px; }
.mp-statusbar .signal span:nth-child(3) { height: 7px; }
.mp-statusbar .signal span:nth-child(4) { height: 8px; }
.mp-statusbar .battery {
  width: 22px;
  height: 10px;
  border: 1px solid var(--text-1);
  border-radius: 2px;
  position: relative;
  padding: 1px;
}
.mp-statusbar .battery::after {
  content: '';
  position: absolute;
  right: -3px; top: 2px;
  width: 2px; height: 4px;
  background: var(--text-1);
  border-radius: 0 1px 1px 0;
}
.mp-statusbar .battery .fill {
  display: block;
  height: 100%;
  background: var(--text-1);
  border-radius: 1px;
  width: 80%;
}

/* === 自定义导航栏 + 胶囊按钮 === */
.mp-navbar {
  height: var(--navbar-h);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: relative;
  z-index: 10;
}
.mp-navbar .left,
.mp-navbar .right {
  display: flex;
  align-items: center;
  min-width: 88px;
}
.mp-navbar .right {
  justify-content: flex-end;
}
.mp-navbar .title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text-1);
}
.mp-navbar .nav-title-left {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text-1);
}
.mp-navbar .back {
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-1);
  font-size: 22px;
  white-space: nowrap;
  text-decoration: none;
}
.mp-navbar .back.text-back {
  font-size: var(--fs-md);
  color: var(--text-2);
}
.mp-capsule {
  width: 87px;
  height: 32px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-around;
  color: var(--text-1);
}
.mp-capsule .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-1);
}
.mp-capsule .dots {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}
.mp-capsule .divider {
  width: 1px;
  height: 18px;
  background: rgba(0, 0, 0, 0.1);
}
.mp-capsule .circle {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--text-1);
  border-radius: 50%;
}

/* === 内容区 === */
.mp-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* === TabBar === */
.mp-tabbar {
  height: var(--tabbar-h);
  padding-bottom: var(--safearea-b);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.mp-tabbar .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  padding-top: 6px;
}
.mp-tabbar .tab.active {
  color: var(--brand-orange);
}
.mp-tabbar .tab .icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.mp-tabbar .tab.active .icon {
  background: var(--brand-orange);
  color: white;
}
.mp-tabbar .tab:not(.active) .icon {
  background: #d8d9dc;
}

/* === 全屏页（隐藏状态栏背景同步） === */
.mp-shell.fullscreen .mp-statusbar {
  background: transparent;
  color: white;
}
.mp-shell.fullscreen .mp-statusbar .signal span,
.mp-shell.fullscreen .mp-statusbar .battery,
.mp-shell.fullscreen .mp-statusbar .battery::after,
.mp-shell.fullscreen .mp-statusbar .battery .fill {
  background: white;
  border-color: white;
}
