/* ===== Reset & Base Styles ===== */
/* 与浏览器顶栏 theme-color 对齐：浅白 / 深黑，再向下溶入页面主题色 */
:root {
  --system-bg: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --system-bg: #000000;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* 回弹/露底时也跟系统栏同色，避免露出主题底 */
html {
  background: var(--system-bg);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.page {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 16px));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* 加载 */
.loading-spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 骨架屏 */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--divider) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.2s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card {
  height: 120px;
  margin-bottom: 12px;
  border-radius: var(--radius);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.empty-state-icon {
  font-size: 40px;
  margin-bottom: 10px;
  opacity: 0.5;
}

/* ===== 清雾光场：浅色只留青玉薄雾，去掉金雾 ===== */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse 640px 420px at 12% 0%, rgba(26, 122, 120, 0.07) 0%, transparent 70%),
    radial-gradient(ellipse 480px 340px at 90% 40%, rgba(26, 122, 120, 0.04) 0%, transparent 72%),
    radial-gradient(ellipse 400px 280px at 50% 100%, rgba(26, 122, 120, 0.03) 0%, transparent 75%);
  pointer-events: none;
  z-index: 0;
  animation: meshFloat 18s ease-in-out infinite;
}
@media (prefers-color-scheme: dark) {
  body::before {
    background:
      radial-gradient(ellipse 700px 460px at 16% 6%, rgba(62, 181, 176, 0.13) 0%, transparent 68%),
      radial-gradient(ellipse 520px 380px at 86% 42%, rgba(216, 190, 126, 0.10) 0%, transparent 70%),
      radial-gradient(ellipse 420px 300px at 50% 100%, rgba(47, 154, 150, 0.07) 0%, transparent 72%);
  }
}
@keyframes meshFloat {
  0%, 100% { opacity: 1; }
  33% { opacity: 0.75; }
  66% { opacity: 0.92; }
}
body > * { position: relative; z-index: 1; }

/* 顶部/底部颜色融合：仅铺在背景层，不遮挡交互内容 */
.page-bg-fade-top,
.page-bg-fade-bottom {
  position: fixed;
  left: 0; right: 0;
  pointer-events: none;
  z-index: 0;
}
.page-bg-fade-top {
  top: 0;
  height: 160px;
  background: linear-gradient(to bottom, var(--system-bg) 0%, transparent 100%);
}
.page-bg-fade-bottom {
  bottom: 0;
  height: 120px;
  background: linear-gradient(to top, var(--system-bg) 0%, transparent 100%);
}

@keyframes tabFadeSlideIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@supports (-webkit-touch-callout: none) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="image"]),
  textarea,
  select {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}
