/* ============================================================
 * base.css - 基础层：重置 / 手机机身 / 纸张质感 / 公共动画 / 字级
 * （整合自 preview 设计稿，含 SPA 屏幕切换与工具类）
 * ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }

body {
  min-height: 100%;
  font-family: var(--font-body);
  background-color: var(--backdrop);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E"),
    radial-gradient(115% 85% at 50% 10%, rgba(255, 255, 255, .5) 0%, rgba(255, 255, 255, 0) 55%),
    radial-gradient(95% 95% at 50% 55%, #ded8cc 0%, #c7c0b0 55%, #a8a08e 100%);
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  color: var(--ink);
  line-height: 1.6;
}

button { font: inherit; border: none; background: none; cursor: pointer; color: inherit; }
/* 表单控件统一继承正文字体（浏览器默认会给表单控件单独字体） */
input, textarea, select { font-family: inherit; }
a { color: var(--red); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---- 应用外壳：宽度自适应（手机撑满全屏），最大 430px 对齐 Pro Max，桌面端不至于过宽 ---- */
/* 居中由 margin auto 承担（SPA 中机身外层还隔了一层 .screen 切换容器，不再直接参与 body flex） */
.app-shell {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  flex-shrink: 0;
  min-height: 100vh;
  background: var(--paper);
  box-shadow: 0 0 40px rgba(0, 0, 0, .18);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* 纸张噪点纹理 */
.app-shell::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='4' height='4' fill='%23fdfbf6'/%3E%3Crect width='1' height='1' fill='%23f0ead9' opacity='.5'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 0;
}
.app-shell > * { position: relative; z-index: 1; }

/* ---- 内容区 / 页脚 通用骨架（间距对齐 8px 栅格） ---- */
.content { padding: 24px 20px 0; flex: 1; }
/* 404 屏：简版单列垂直居中（无页眉页脚） */
#screen-404 .nf-content {
  display: flex; flex-direction: column; justify-content: center; gap: 16px;
  padding-bottom: 24px;
}
#screen-404 .nf-content .t-h1 { text-align: center; letter-spacing: 8px; color: var(--red); }
.foot {
  margin-top: 32px;
  padding: 32px 24px;
  border-top: 1px dashed var(--line);
  text-align: center;
  font-size: var(--fs-xs); line-height: 1.9; color: var(--ink-light);
}
/* 页脚落款：纯红签名（与文本式页脚和谐，无胶囊边框） */
.foot .brand { margin-top: 12px; color: var(--red); font-weight: 800; font-size: var(--fs-md); letter-spacing: 2px; }
.foot .icp { margin-top: 12px; }
.foot .icp a { color: var(--ink-light); }
.foot .icp a:hover { color: var(--red); }

/* ---- SPA 屏幕切换（单 index.html 多视图） ---- */
/* width:100% 让屏幕在 body flex 中撑满视口，机身宽度由内部 .app-shell 约束 */
.screen { display: none; width: 100%; }
.screen.active { display: block; }

/* ---- 公共动画 ---- */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
/* 盖章动画：角度由 --seal-angle 控制（默认 -12° 逆时针上扬；各章可自定义倾斜方向与幅度） */
@keyframes sealIn {
  from { transform: rotate(var(--seal-angle, -12deg)) scale(2.2); opacity: 0; }
  60%  { transform: rotate(var(--seal-angle, -12deg)) scale(.92); opacity: 1; }
  to   { transform: rotate(var(--seal-angle, -12deg)) scale(1); opacity: 1; }
}

/* 入场工具类：绑定激活屏幕，每次切屏 display none→block 都会重放；
   配合 --i 做错落延迟。fill 用 backwards 而非 both——动画结束后不锁定 transform，
   以免覆盖按钮 :active 的按压反馈（结束态与自然态一致，视觉无差） */
.screen.active .u-rise { animation: rise var(--dur-slow) var(--ease) backwards; animation-delay: calc(var(--i, 0) * 0.08s + 0.1s); }

/* ---- 字级工具（统一引用字号令牌） ---- */
.t-kicker { font-size: var(--fs-sm); font-weight: 700; letter-spacing: 3px; color: var(--red); }
.t-label  { font-size: var(--fs-sm); font-weight: 700; letter-spacing: 3px; color: var(--ink-light); }
.t-h1     { font-size: var(--fs-5xl); font-weight: 800; letter-spacing: 2px; }
.t-h2     { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: 2px; }
.t-body   { font-size: var(--fs-base); color: var(--ink-light); line-height: 1.6; }

/* ---- 通用工具类 ---- */
.hidden { display: none !important; }
/* 弹窗例外：保留 flex 布局以支持淡入淡出过渡（显隐由 visibility/opacity 控制） */
.modal.hidden { display: flex !important; visibility: hidden; opacity: 0; pointer-events: none; }
.text-center { text-align: center; }
