/* ====== 基础 reset + 通用样式 + 组件 ====== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
  font-size: var(--font-md);
  color: var(--text-primary);
  background-color: var(--bg-page);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; background: transparent; cursor: pointer; padding: 0; color: inherit; }
input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

/* 应用容器：移动优先，桌面居中（最大 750px 设计宽度） */
.app {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background-color: var(--bg-page);
  overflow-x: hidden;
}

/* 全屏背景图 */
.page-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ====== 通用按钮 ====== */
.grad-btn {
  background: var(--primary);
  color: #FFFFFF;
  border-radius: var(--radius-pill);
  font-size: var(--font-lg);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
  box-shadow: var(--btn-shadow-primary);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  width: 100%;
}
.grad-btn:active { transform: scale(0.97); opacity: 0.92; }
.grad-btn[disabled] { opacity: 0.4; transform: none; }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: var(--font-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
  transition: all 0.2s;
  width: 100%;
}
.btn-secondary:active { background: var(--card-inner-bg-hover); }

.tap-shrink { transition: transform 0.1s ease; }
.tap-shrink:active { transform: scale(0.95); }

/* ====== 卡片 ====== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
}
.glass-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
}

/* ====== 统一导航栏 ====== */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  height: 88px;
  padding-top: env(safe-area-inset-top, 0px);
}
.nav-bar-inner { display: flex; align-items: center; flex: 1; padding: 0 16px; height: 44px; }
.nav-title { flex: 1; text-align: center; font-size: var(--font-lg); font-weight: 600; }
.nav-back {
  width: 72px; height: 72px; display: flex; align-items: center; justify-content: center;
}
.nav-back:active { opacity: 0.6; }
.nav-back svg, .nav-back img { width: 36px; height: 36px; }
.nav-right { width: 72px; display: flex; align-items: center; justify-content: center; }

/* 兼容原 nav-bar 固定定位 */
body { padding-top: env(safe-area-inset-top, 0px); }

/* ====== 滚动容器替代 scroll-view ====== */
.scroll-area {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.scroll-area::-webkit-scrollbar { display: none; }

/* ====== 通用图片加载占位 ====== */
img { background: var(--card-inner-bg); }

/* ====== 隐藏类 ====== */
.hidden { display: none !important; }
.center { display: flex; align-items: center; justify-content: center; }

/* ====== 文本辅助类 ====== */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-hint { color: var(--text-hint); }
.text-placeholder { color: var(--text-placeholder); }
.text-orange { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-pink { color: var(--pink); }
.text-blue { color: var(--blue); }

.fs-xs { font-size: var(--font-xs); }
.fs-sm { font-size: var(--font-sm); }
.fs-md { font-size: var(--font-md); }
.fs-lg { font-size: var(--font-lg); }
.fs-xl { font-size: var(--font-xl); }
.fs-xxl { font-size: var(--font-xxl); }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.flex { display: flex; }
.flex-1 { flex: 1; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }

.p-8 { padding: 8px; } .p-12 { padding: 12px; } .p-16 { padding: 16px; } .p-20 { padding: 20px; } .p-24 { padding: 24px; } .p-32 { padding: 32px; }
.px-12 { padding-left: 12px; padding-right: 12px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.px-20 { padding-left: 20px; padding-right: 20px; }
.py-8 { padding-top: 8px; padding-bottom: 8px; }
.py-12 { padding-top: 12px; padding-bottom: 12px; }
.py-16 { padding-top: 16px; padding-bottom: 16px; }

.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; } .mb-24 { margin-bottom: 24px; } .mb-32 { margin-bottom: 32px; }

.w-full { width: 100%; }
.text-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 移动端点击态 */
[data-tap]:active { opacity: 0.7; }

/* 渐入淡出 */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ====== 头像 ====== */
.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--card-inner-bg);
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 48px; height: 48px; }
.avatar-lg { width: 120px; height: 120px; }

/* ====== 列表项 ====== */
.list-item {
  display: flex;
  align-items: center;
  padding: 24px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  transition: background 0.2s;
}
.list-item:active { background: var(--card-inner-bg-hover); }
.list-item-arrow::after {
  content: '›';
  margin-left: 8px;
  color: var(--menu-arrow);
  font-size: 24px;
}

/* ====== 空状态 ====== */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  color: var(--text-hint);
  gap: 16px;
}
.empty-icon { font-size: 80px; opacity: 0.5; }

/* ====== 共享：返回箭头（subpkg 页面顶栏用） ====== */
.nav-back {
  width: 72px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  color: #1C1C1E;
  flex-shrink: 0;
}
.nav-back:active { opacity: 0.5; }
.back-arrow {
  width: 14px;
  height: 14px;
  border-top: 2.5px solid currentColor;
  border-left: 2.5px solid currentColor;
  transform: rotate(-45deg);
  display: block;
}
