/* ============================================================
 * base.css —— reset + 字体 + 背景4层 + 响应式断点
 * ============================================================ */

/* 字体 — 本地托管优先 + 系统 fallback，零外部网络依赖（A-1 合规）。
 * Noto Sans SC / Noto Serif SC 的 woff2 已落地 client/assets/fonts/，
 * 由 css/fonts.css 以 @font-face + font-display:swap 引入；
 * 未就绪时 swap 到系统字体（Windows 微软雅黑 / macOS 苹方），
 * 绝不引用 fonts.googleapis.com 等外链（历史教训：被墙致白屏）。 */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  color: var(--text-dark);
  background: var(--sky-bottom);
  overflow: hidden;            /* SPA 内部滚动，禁止 body 滚动 */
  position: relative;
  -webkit-font-smoothing: antialiased;
}
.hero-name, .pname, .stitle, .serif { font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }
input, textarea, select { font-family: inherit; }

/* ============ 背景四层叠加结构（顺序不可变） ============ */
.bg-photo {
  position: absolute; inset: 0; z-index: var(--z-bg);
  background-size: cover; background-position: center 30%; background-repeat: no-repeat;
}
.bg-overlay {
  position: absolute; inset: 0; z-index: var(--z-bg);
  pointer-events: none; mix-blend-mode: soft-light; opacity: 0.55;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255,240,205,0.15) 0%, rgba(255,240,205,0) 55%),
    radial-gradient(ellipse 110% 70% at 50% 112%, rgba(130,185,225,0.12) 0%, rgba(130,185,225,0) 52%),
    linear-gradient(180deg, rgba(185,222,246,0.04) 0%, rgba(205,232,250,0) 38%, rgba(255,250,235,0.02) 72%, rgba(232,246,255,0.06) 100%);
}
.ray {
  position: absolute; top: -15%; width: 80px; height: 85%; z-index: var(--z-bg);
  transform-origin: top center; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,245,210,0.16), transparent 72%);
  filter: blur(10px); opacity: 0.28;
}
.bg-scrim {
  position: absolute; inset: 0; z-index: var(--z-bg);
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(250,253,255,0.25) 0%, rgba(250,253,255,0.08) 16%,
    rgba(248,252,255,0.04) 40%, rgba(240,248,255,0.04) 64%,
    rgba(220,240,255,0.20) 100%);
}

/* ============ 内容区 ============ */
#app { position: absolute; inset: 0; z-index: var(--z-content); }
#page-root { position: absolute; inset: 0; }

/* ============ 底部导航 ============ */
.bottom-nav {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: var(--z-tabbar);
  display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
  margin-bottom: 10px; /* 问题 5：下移 10px 避免与 FAB 压盖 */
  pointer-events: none;
}
.nav-pill {
  pointer-events: auto;
  display: flex; width: 100%; max-width: 360px; height: 60px; margin-bottom: 14px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-radius: 32px; border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 6px 28px rgba(20,60,100,0.16);
  overflow: hidden;
}
.nitem {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-light); transition: background .25s ease;
  border-radius: 32px;
}
.nitem svg { width: 20px; height: 20px; color: var(--text-light); }
.nitem span { font-size: 9.5px; font-weight: 600; color: var(--text-light); letter-spacing: .5px; }
.nitem.active { background: var(--grad-blue); }
.nitem.active svg, .nitem.active span { color: var(--cloud-white); }

/* ============ 无网络提示条 ============ */
.netbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 300;
  background: var(--grad-danger); color: var(--cloud-white); text-align: center;
  font-size: 13px; padding: 8px 0; box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* ============ Toast ============ */
.toast-root {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 320;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.toast {
  background: rgba(16,58,94,0.88); color: var(--cloud-white); padding: 10px 18px; border-radius: 20px;
  font-size: 13.5px; box-shadow: 0 4px 16px rgba(0,0,0,.22);
  animation: toastIn .3s ease both; max-width: 80vw; text-align: center;
}
.toast.toast-out { animation: toastOut .3s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(16px); } }

/* ============ 通用布局 ============ */
.content {
  position: absolute; left: 0; right: 0;
  top: 70px; bottom: 100px;
  overflow-y: auto; overflow-x: hidden;
  padding: 2px 16px 0;
  -webkit-overflow-scrolling: touch;
}
.content::-webkit-scrollbar { display: none; }

/* 顶部标题栏（in-app-nav / header） */
.page-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: var(--z-nav);
  padding: 54px 16px 0; /* 顶部安全区 */
}

/* FAB */
.fab {
  position: absolute; right: 20px; bottom: 160px; z-index: var(--z-fab);
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--grad-orange); color: var(--cloud-white);
  box-shadow: var(--fab-shadow);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s ease;
}
.fab:active { transform: scale(0.92); }
.fab svg { width: 26px; height: 26px; }

/* 保存栏（表单底部固定） */
.save-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: var(--z-savebar);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0));
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.85) 40%);
  backdrop-filter: blur(8px);
}
.save-bar .btn-primary { width: 100%; }

/* 通用按钮 */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 46px; padding: 0 20px; border-radius: 17px;
  background: var(--grad-blue); color: var(--cloud-white); font-size: 15px; font-weight: 600;
  box-shadow: 0 4px 14px rgba(74,144,217,0.4); border: 1px solid rgba(255,255,255,0.5);
  transition: transform .15s ease;
}
.btn-primary:active { transform: scale(0.97); }
.btn-secondary {
  height: 46px; padding: 0 20px; border-radius: 17px;
  background: var(--btn-secondary-bg); color: var(--text-dark); font-size: 15px; font-weight: 600;
}
.btn-danger {
  height: 46px; padding: 0 20px; border-radius: 17px;
  background: var(--grad-danger); color: var(--cloud-white); font-size: 15px; font-weight: 600;
  box-shadow: 0 4px 14px rgba(230,74,25,0.38);
}

/* ============ 响应式：桌面端左右分栏 ============ */
@media (min-width: 768px) {
  .content { left: 50%; transform: translateX(-50%); max-width: var(--maxw-content); }
  .page-header { left: 50%; transform: translateX(-50%); max-width: var(--maxw-content); }
  /* 底部导航变左侧垂直栏 */
  .bottom-nav {
    left: 0; right: auto; top: 0; bottom: 0;
    flex-direction: column; justify-content: center; padding: 0 0 0 12px;
    pointer-events: none;
  }
  .nav-pill {
    flex-direction: column; width: 88px; height: auto; max-width: none; margin: 0;
    padding: 18px 6px; gap: 6px; border-radius: 28px;
  }
  .content { bottom: 24px; }
  .fab { right: calc(50% - var(--maxw-content) / 2 + 20px); }
}

/* 动画淡入 */
.fade-in { animation: fadeIn .35s ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============ 开机页（A-3） ============ */
/* 纯 CSS 动画，不阻塞渲染；DOMContentLoaded 后由 app.js 加 .is-hidden 淡出移除 */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--sky-bottom) 0%, var(--sky-mid) 100%);
  opacity: 1; transition: opacity .8s ease; /* 0.8s 淡出（原 0.4s × 2） */
}
.splash.is-hidden { opacity: 0; pointer-events: none; }
.splash-logo {
  width: 132px; height: 132px; object-fit: contain;
  animation: splashPop .9s cubic-bezier(0.34, 1.56, 0.64, 1) both; /* 0.9s（原 0.45s × 2） */
}
.splash-name {
  margin-top: 18px; font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  font-size: 26px; font-weight: 700; color: var(--text-dark); letter-spacing: 2px;
  text-shadow: var(--text-halo);
}
.splash-sub { margin-top: 6px; font-size: 13px; color: var(--text-mid); }
@keyframes splashPop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ============ 吉祥物浮动元素（A-2） ============ */
.mascot {
  position: absolute; right: 14px; bottom: 230px; z-index: var(--z-mascot);
  width: 84px; height: 84px; pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(20,60,100,0.18));
  animation: mascotFloat 3.6s ease-in-out infinite; /* 整体周期 >400ms，单次起伏柔和 */
}
.mascot img { width: 100%; height: 100%; object-fit: contain; }
@keyframes mascotFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* ============ 暗色系覆盖（base 层） ============ */
[data-theme="dark"] body {
  background: #1E1E1E;
}
/* 背景图压暗 */
[data-theme="dark"] .bg-photo {
  filter: brightness(0.3) saturate(0.6);
}
/* overlay 暗化 */
[data-theme="dark"] .bg-overlay {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(40,40,50,0.3) 0%, transparent 55%),
    radial-gradient(ellipse 110% 70% at 50% 112%, rgba(20,20,30,0.2) 0%, transparent 52%),
    linear-gradient(180deg, rgba(30,30,40,0.1) 0%, transparent 38%, rgba(20,20,30,0.05) 72%, rgba(25,25,35,0.15) 100%);
}
/* 光线暗化 */
[data-theme="dark"] .ray {
  background: linear-gradient(180deg, rgba(60,60,80,0.08), transparent 72%);
  opacity: 0.12;
}
/* 底部遮罩暗化 */
[data-theme="dark"] .bg-scrim {
  background: linear-gradient(180deg,
    rgba(30,30,30,0.3) 0%, rgba(30,30,30,0.1) 16%,
    rgba(30,30,30,0.05) 40%, rgba(30,30,30,0.05) 64%,
    rgba(30,30,30,0.4) 100%);
}
/* 底部导航暗色玻璃 */
[data-theme="dark"] .nav-pill {
  background: rgba(35,35,40,0.82);
  border: 1px solid rgba(60,60,65,0.6);
  box-shadow: 0 6px 28px rgba(0,0,0,0.4);
}
/* 保存栏暗色渐变 */
[data-theme="dark"] .save-bar {
  background: linear-gradient(180deg, rgba(30,30,30,0) 0%, rgba(30,30,30,0.9) 40%);
}
/* Toast 暗色 */
[data-theme="dark"] .toast {
  background: rgba(50,50,55,0.92);
}
/* 开机页暗色 */
[data-theme="dark"] .splash {
  background: linear-gradient(180deg, #1E1E1E 0%, #2C3E50 100%);
}
