/* ============================================================
   亲密时刻记 · 基础样式与通用组件
   ============================================================ */

/* ---------- 重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
svg { display: block; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 页面骨架 ---------- */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* 沉浸式状态栏：由 App.applyStatusBar() 写入 --sbh（CSS px）；
     非沉浸环境该变量为 0，不影响布局 */
  padding-top: var(--sbh, 0px);
}
.topbar {
  height: 52px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  position: relative;
}
.topbar .title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 17px;
  font-weight: 600;
}
.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--c-text);
  transition: background .18s;
}
.icon-btn:active { background: var(--c-surface-2); }
.icon-btn.is-hidden { visibility: hidden; }
.content { flex: 1; padding: 0 16px 28px; }
.content.no-pad { padding: 0; }

/* ---------- 按钮 ---------- */
.btn {
  height: 52px;
  border-radius: var(--r-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  transition: transform .15s var(--ease), opacity .15s, box-shadow .2s;
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn[disabled], .btn.is-loading { opacity: .55; pointer-events: none; }
.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 8px 22px rgba(232, 101, 126, .28);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--c-primary);
  color: var(--c-primary);
}
.btn-plain {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  color: var(--c-text);
}
.btn-danger-ghost {
  background: transparent;
  border: 1px solid rgba(240, 85, 79, .4);
  color: var(--c-danger);
}
.btn-block { width: 100%; }
.btn-sm { height: 40px; font-size: 14px; border-radius: 20px; }

/* ---------- 输入 ---------- */
.field { margin-bottom: 14px; }
.field .label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: 8px;
}
.input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-input);
  padding: 0 14px;
  min-height: 52px;
  transition: border-color .2s, box-shadow .2s;
}
.input-wrap:focus-within {
  border-color: var(--c-primary-l);
  box-shadow: 0 0 0 3px rgba(232, 101, 126, .10);
}
.input-wrap .ico { color: var(--c-text-3); flex: none; display: flex; }
.input-wrap .suffix {
  flex: none;
  color: var(--c-text-3);
  display: flex;
  align-items: center;
  gap: 4px;
}
.input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  padding: 0;
}
.input::placeholder { color: var(--c-text-3); }
.hint {
  font-size: 12px;
  color: var(--c-text-3);
  margin-top: 6px;
  min-height: 16px;
}
.hint.is-error { color: var(--c-danger); }

/* 验证码 */
.captcha-box {
  width: 104px;
  height: 44px;
  flex: none;
  border-radius: 10px;
  overflow: hidden;
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.captcha-box svg { width: 100%; height: 100%; }
.captcha-box.is-loading { opacity: .5; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--c-surface);
  border-radius: var(--r-card);
  box-shadow: var(--sd-card);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.card-plain { box-shadow: none; border: 1px solid var(--c-line); }

/* ---------- 认证页（登录 / 注册） ---------- */
/* 只能用 padding-left/right 长写：
   若用 padding 简写，会把 .page 上的 padding-top（沉浸式状态栏留白）
   重置为 0，导致登录页顶部 logo 被状态栏时间压住 */
.auth-page { padding-left: 24px; padding-right: 24px; }
.auth-hero { padding: 26px 2px 24px; }
.auth-logo {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--grad-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(232, 101, 126, .28);
  margin-bottom: 20px;
}
.auth-hero h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.3px;
}
.auth-hero p {
  margin: 0;
  font-size: 14px;
  color: var(--c-text-2);
}
.auth-form { padding-top: 4px; }
.auth-actions { margin-top: 22px; }
.auth-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
  color: var(--c-text-2);
}
.auth-foot a { color: var(--c-primary); font-weight: 600; }
.auth-tip {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: var(--c-primary-bg);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--c-primary-d);
  margin-top: 18px;
}
.auth-tip .ico { flex: none; margin-top: 1px; }

/* ---------- Toast ---------- */
.toast-layer {
  position: fixed;
  left: 0; right: 0; top: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* 沉浸式时让开状态栏，否则 Toast 会被时间挡住 */
  padding-top: calc(14px + var(--sbh, 0px));
  pointer-events: none;
}
.toast {
  max-width: 82vw;
  background: rgba(43, 43, 51, .92);
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
  padding: 10px 16px;
  border-radius: 12px;
  margin-bottom: 8px;
  animation: toast-in .24s var(--ease);
  box-shadow: var(--sd-pop);
}
.toast.is-out { animation: toast-out .2s var(--ease) forwards; }
.toast.is-ok { background: rgba(60, 150, 110, .94); }
.toast.is-err { background: rgba(214, 70, 66, .94); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-10px); }
}

/* ---------- 全屏 Loading ---------- */
.loading-layer {
  position: fixed;
  inset: 0;
  z-index: 9100;
  background: rgba(251, 247, 248, .72);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  backdrop-filter: blur(2px);
}
.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(232, 101, 126, .22);
  border-top-color: var(--c-primary);
  animation: spin .7s linear infinite;
}
.loading-layer .msg { font-size: 13px; color: var(--c-text-2); }
@keyframes spin { to { transform: rotate(360deg); } }
.is-hidden { display: none !important; }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed;
  inset: 0;
  z-index: 9200;
  background: rgba(30, 20, 26, .42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in .2s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 320px;
  background: var(--c-surface);
  border-radius: 20px;
  padding: 22px 20px 18px;
  box-shadow: var(--sd-pop);
  animation: pop-in .24s var(--ease);
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}
.modal h3 { margin: 0 0 8px; font-size: 17px; font-weight: 600; text-align: center; }
.modal .desc {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--c-text-2);
  text-align: center;
  line-height: 1.55;
}
.modal .acts { display: flex; gap: 10px; }
.modal .acts .btn { flex: 1; height: 46px; font-size: 15px; }

/* ---------- 骨架屏 ---------- */
.skeleton {
  background: linear-gradient(90deg, #F2ECEE 25%, #FAF6F7 37%, #F2ECEE 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------- 空态 ---------- */
.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--c-text-3);
}
.empty .art { display: flex; justify-content: center; margin-bottom: 16px; }
.empty .t { font-size: 15px; color: var(--c-text-2); margin-bottom: 6px; }
.empty .s { font-size: 13px; }

/* ---------- 页面进入动效 ---------- */
.fade-up { animation: fade-up .28s var(--ease) both; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.d1 { animation-delay: .04s; }
.d2 { animation-delay: .08s; }
.d3 { animation-delay: .12s; }
.d4 { animation-delay: .16s; }