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

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--text-strong);
  -webkit-font-smoothing: antialiased;
}

/* 独立打开单页时的居中画布背景 */
body.mp-body {
  min-height: 100vh;
  background: #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px 16px 36px;
  gap: 14px;
}

body.pc-body {
  min-height: 100vh;
  background: var(--bg-page);
}

/* 嵌入到总览画板 iframe 时移除外围阴影和灰底 */
body.is-embed.mp-body {
  padding: 0;
  background: transparent;
  min-height: var(--phone-h);
}

body.is-embed .proto-meta-bar,
body.is-embed .proto-state-bar {
  display: none !important;
}

/* 独立浏览顶部提示与状态切换条 */
.proto-meta-bar {
  width: var(--phone-w);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.proto-meta-bar a {
  color: var(--brand-blue-deep);
  text-decoration: none;
  font-weight: 600;
}

.proto-state-bar {
  width: var(--phone-w);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border-base);
  border-radius: 12px;
  padding: 8px 10px;
}

.proto-state-btn {
  border: 1px solid var(--border-base);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.proto-state-btn.is-active {
  background: var(--text-strong);
  border-color: var(--text-strong);
  color: #ffffff;
}

/* ================================================================
   微信小程序手机壳 (390×844)
   ================================================================ */
.phone-shell {
  width: var(--phone-w);
  height: var(--phone-h);
  background: var(--bg-page);
  border-radius: 38px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22), 0 0 0 8px #1e293b;
}

body.is-embed .phone-shell {
  border-radius: 0;
  box-shadow: none;
}

/* iOS 状态栏 + 微信导航条 + 胶囊 */
.wx-chrome {
  position: relative;
  flex-shrink: 0;
  background: #ffffff;
  z-index: 50;
  border-bottom: 1px solid var(--border-light);
}

.wx-chrome.is-transparent {
  background: transparent;
  border-bottom-color: transparent;
}

.wx-chrome.is-pink {
  background: var(--brand-pink);
  color: #ffffff;
  border-bottom-color: transparent;
}

.wx-chrome.is-warm {
  background: var(--bg-warm);
  border-bottom-color: rgba(226, 232, 240, 0.7);
}

.wx-status-bar {
  height: var(--wx-status-h);
  padding: 10px 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.wx-status-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wx-navbar {
  height: var(--wx-nav-h);
  position: relative;
  display: flex;
  align-items: center;
  padding-left: 12px;
  padding-right: var(--wx-capsule-safe-right);
}

/* 微信右上角原生系统胶囊 (••• | ◎) */
.wx-capsule {
  position: absolute;
  right: var(--wx-capsule-right);
  top: 50%;
  transform: translateY(-50%);
  width: var(--wx-capsule-w);
  height: var(--wx-capsule-h);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(15, 23, 42, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  z-index: 60;
  pointer-events: none;
}

.wx-chrome.is-pink .wx-capsule {
  background: rgba(0, 0, 0, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

.wx-capsule-divider {
  width: 1px;
  height: 16px;
  background: rgba(15, 23, 42, 0.16);
}

.wx-chrome.is-pink .wx-capsule-divider {
  background: rgba(255, 255, 255, 0.35);
}

/* 红线安全区辅助框 (?guides=1 或总览画板开关打开时显示) */
.wx-safe-guide-capsule,
.wx-safe-guide-bottom {
  display: none;
  pointer-events: none;
}

body.show-guides .wx-safe-guide-capsule {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: absolute;
  right: 2px;
  top: calc(var(--wx-status-h) + 2px);
  width: 98px;
  height: 40px;
  border: 1.5px dashed #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 10px;
  z-index: 999;
  font-size: 9px;
  font-weight: 700;
  color: #dc2626;
  padding-bottom: 1px;
}

body.show-guides .wx-safe-guide-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 2px;
  height: 18px;
  border: 1.5px dashed #f97316;
  background: rgba(249, 115, 22, 0.09);
  border-radius: 6px;
  z-index: 999;
  font-size: 9px;
  font-weight: 700;
  color: #ea580c;
}

/* 手机内部滚动内容区 */
.phone-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

.phone-scroll::-webkit-scrollbar {
  display: none;
}

/* 底部 5 格 TabBar (对应 软萌拼豆记/pages/index/index.vue) */
.wx-tabbar {
  height: calc(var(--wx-tabbar-h) + var(--wx-home-bar-h));
  padding-bottom: var(--wx-home-bar-h);
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border-light);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 40;
}

.wx-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-placeholder);
  font-size: 10px;
  font-weight: 600;
}

.wx-tab-item.is-active {
  color: var(--text-strong);
  font-weight: 700;
}

.wx-tab-item.is-active svg {
  color: var(--brand-pink);
}

.wx-tab-center-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--grad-pink);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -16px;
  box-shadow: 0 6px 14px rgba(236, 72, 153, 0.34);
  border: 3px solid #ffffff;
}

/* iOS Home Indicator (无 TabBar 页面底部安全条) */
.wx-home-indicator {
  height: var(--wx-home-bar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.wx-home-indicator::after {
  content: "";
  width: 126px;
  height: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.22);
}

/* 通用小型组件 */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--text-muted);
  white-space: nowrap;
}

.pill.is-active-blue {
  background: var(--brand-blue-soft);
  color: var(--brand-blue-deep);
}

.pill.is-active-pink {
  background: var(--brand-pink);
  color: #ffffff;
}

.pill.is-active-dark {
  background: var(--text-strong);
  color: #ffffff;
}

.nav-back-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-title-center {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 弹窗底罩 (在 .phone-shell 内部模拟 uni-app 页面级弹窗) */
.phone-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  z-index: 80;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.phone-modal-mask.is-open {
  display: flex;
}

.phone-modal-mask.is-center {
  align-items: center;
  padding: 18px;
}

/* ================================================================
   PC 端通用顶栏 (对应 pc/src/components/HeaderNav.vue)
   ================================================================ */
.pc-shell {
  width: 100%;
  min-width: 1180px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
}

.pc-header {
  height: 56px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-base);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.pc-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 16px;
  color: var(--text-primary);
}

.pc-brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--grad-pink);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
}

.pc-nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-muted);
  padding: 4px;
  border-radius: 12px;
}

.pc-nav-tab {
  padding: 6px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
}

.pc-nav-tab.is-active {
  background: #ffffff;
  color: var(--brand-pink);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.pc-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border-base);
  background: #ffffff;
  color: var(--text-body);
  cursor: pointer;
}

.pc-btn-pink {
  background: var(--brand-pink);
  border-color: var(--brand-pink);
  color: #ffffff;
}
