/* ==========================================================================
   闪技 · 设计系统（小红书风）
   共享 tokens / 基础动效 / 组件原子类
   ========================================================================== */

:root {
  /* 品牌色 */
  --brand: #FF2442;
  --brand-soft: #FFF0F2;
  --brand-deep: #D91E3A;
  --brand-grad: linear-gradient(135deg, #FF4D6D 0%, #FF2442 55%, #FF1644 100%);

  /* 中性色 */
  --c-bg: #FAFAFA;
  --c-surface: #FFFFFF;
  --c-surface-2: #F6F6F7;
  --c-text: #1F1F1F;
  --c-text-2: #555;
  --c-text-3: #8A8A8A;
  --c-border: rgba(0, 0, 0, 0.06);
  --c-divider: rgba(0, 0, 0, 0.04);

  /* 语义 */
  --c-success: #00B578;
  --c-warn: #FFB800;
  --c-danger: #FF3B30;
  --c-like: #FF2442;

  /* 圆角 */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 9999px;

  /* 阴影 */
  --sh-s: 0 1px 3px rgba(0, 0, 0, 0.04);
  --sh-m: 0 4px 16px rgba(0, 0, 0, 0.06);
  --sh-l: 0 12px 32px rgba(0, 0, 0, 0.10);
  --sh-brand: 0 8px 24px rgba(255, 36, 66, 0.28);

  /* 间距 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* 字体 */
  --font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', 'Segoe UI', Roboto, sans-serif;

  /* 动效 */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.75, 0);
  --dur-fast: 160ms;
  --dur: 260ms;
  --dur-slow: 420ms;

  /* 安全区 */
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  font-family: var(--font-family);
  color: var(--c-text);
  background: var(--c-bg);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body { min-height: 100vh; overflow-x: hidden; }

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

/* ---------- 通用滚动条（桌面） ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ================ 动效关键帧 ================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translate3d(0, 12px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes heartBurst {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  70% { transform: scale(0.92); }
  100% { transform: scale(1); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(12px) scale(0.9); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-40px) scale(1.2); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* stagger 进入 */
.stagger > * { opacity: 0; animation: fadeInUp var(--dur-slow) var(--ease) forwards; }
.stagger > *:nth-child(1) { animation-delay: 0.03s; }
.stagger > *:nth-child(2) { animation-delay: 0.07s; }
.stagger > *:nth-child(3) { animation-delay: 0.11s; }
.stagger > *:nth-child(4) { animation-delay: 0.15s; }
.stagger > *:nth-child(5) { animation-delay: 0.19s; }
.stagger > *:nth-child(6) { animation-delay: 0.23s; }
.stagger > *:nth-child(7) { animation-delay: 0.27s; }
.stagger > *:nth-child(8) { animation-delay: 0.31s; }
.stagger > *:nth-child(n+9) { animation-delay: 0.35s; }

.fade-in { animation: fadeIn var(--dur) var(--ease); }
.pop-in { animation: popIn var(--dur) var(--ease); }

/* 骨架屏 */
.skeleton {
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--r-sm);
}

/* ================ 原子组件 ================ */

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--r-full);
  font-size: 14px; font-weight: 600; line-height: 1;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast);
  user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: var(--sh-brand); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--c-surface-2); color: var(--c-text); }
.btn-ghost:hover { background: #ececee; }
.btn-outline { background: transparent; border: 1px solid var(--brand); color: var(--brand); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 22px; font-size: 15px; }
.btn-block { width: 100%; }

/* 胶囊 Tag */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: 12px; line-height: 1.4;
  background: var(--c-surface-2); color: var(--c-text-2);
}
.tag-brand { background: var(--brand-soft); color: var(--brand); }
.tag-success { background: #E6F7EE; color: var(--c-success); }
.tag-warn { background: #FFF6E0; color: #C88A00; }

/* 卡片 */
.card {
  background: var(--c-surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-s);
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--sh-m); }

/* 输入 */
.input, .textarea, .select {
  width: 100%; padding: 12px 14px;
  border-radius: var(--r-sm); border: 1px solid transparent;
  background: var(--c-surface-2); color: var(--c-text);
  font-size: 14px; outline: none;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--brand); background: #fff; }

/* 头像 */
.avatar { border-radius: 50%; background: var(--c-surface-2); object-fit: cover; }
.avatar-24 { width: 24px; height: 24px; }
.avatar-32 { width: 32px; height: 32px; }
.avatar-40 { width: 40px; height: 40px; }
.avatar-56 { width: 56px; height: 56px; }
.avatar-72 { width: 72px; height: 72px; }

/* 圆点红点 */
.dot {
  position: absolute; top: -4px; right: -6px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: var(--r-full);
  background: var(--brand); color: #fff; font-size: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px #fff;
}

/* 头像点赞心形 */
.heart { transition: transform var(--dur-fast) var(--ease); }
.heart.active { color: var(--c-like); animation: heartBurst 420ms var(--ease); }

/* 遮罩 */
.backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  z-index: 900; opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.backdrop.show { opacity: 1; pointer-events: auto; }

/* Toast */
.toast {
  position: fixed; left: 50%; top: 25%; transform: translate(-50%, 0) scale(0.9);
  padding: 10px 18px; border-radius: var(--r-full);
  background: rgba(0, 0, 0, 0.82); color: #fff; font-size: 13px;
  z-index: 9999; opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* 加载旋转 */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* 通用布局工具 */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 22px; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--c-text-3); }
.text-brand { color: var(--brand); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp-1 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; }
.clamp-2 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.hidden { display: none !important; }

/* 不可选中文本 */
.noselect { user-select: none; -webkit-user-select: none; }

/* 页面过渡（加到 body 即可） */
.page-enter { animation: fadeInUp var(--dur) var(--ease); }
