:root {
  --pink-50: #fff5f8;
  --pink-100: #ffe6ee;
  --pink-200: #ffc9da;
  --pink-300: #ffa3c0;
  --pink-400: #ff7fa8;
  --pink-500: #f85c8e;
  --pink-600: #e23f77;
  --ink: #4a2a35;
  --ink-soft: #8b6470;
  --card: rgba(255, 255, 255, 0.92);
  --shadow: 0 10px 30px rgba(240, 90, 140, 0.16);
  --radius: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #fff0f5 0%, #ffe3ec 45%, #fff7f0 100%);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* 背景漂浮的爱心光斑 */
.bg-decor { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bg-decor span {
  position: absolute; border-radius: 50%; filter: blur(40px); opacity: 0.55;
  background: radial-gradient(circle, #ffb6cc, transparent 70%);
  animation: float 18s ease-in-out infinite;
}
.bg-decor span:nth-child(1) { width: 260px; height: 260px; top: -60px; left: -60px; }
.bg-decor span:nth-child(2) { width: 320px; height: 320px; top: 20%; right: -120px; animation-delay: -4s; }
.bg-decor span:nth-child(3) { width: 220px; height: 220px; bottom: 10%; left: 10%; animation-delay: -8s; }
.bg-decor span:nth-child(4) { width: 280px; height: 280px; bottom: -100px; right: 20%; animation-delay: -12s; }
.bg-decor span:nth-child(5) { width: 160px; height: 160px; top: 55%; left: 45%; animation-delay: -6s; }
.bg-decor span:nth-child(6) { width: 200px; height: 200px; top: 8%; left: 50%; animation-delay: -10s; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -40px) scale(1.12); }
}

/* 顶部 */
.hero { position: relative; z-index: 1; padding: calc(28px + env(safe-area-inset-top, 0px)) 16px 28px; text-align: center; }
.hero-inner { max-width: 720px; margin: 0 auto; position: relative; }
.hero-kicker {
  margin: 0 0 6px; font-size: 12px; letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--pink-600); opacity: 0.75;
}
.hero h1 {
  margin: 0; font-size: clamp(26px, 7vw, 38px); line-height: 1.25; letter-spacing: 0.04em;
  background: linear-gradient(120deg, #f85c8e, #ff9a8b 70%, #ffb199);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { margin: 8px 0 0; color: var(--ink-soft); font-size: 15px; }
.counter {
  margin: 18px auto 0; display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 18px; border-radius: 999px; background: var(--card);
  box-shadow: var(--shadow); font-size: 14px; color: var(--ink-soft);
}
.counter-num b { font-size: 22px; color: var(--pink-600); margin-right: 2px; font-variant-numeric: tabular-nums; }
.hero-settings { position: absolute; top: -8px; right: 0; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--card);
  box-shadow: var(--shadow); color: var(--pink-600); font-size: 18px; line-height: 1;
}

/* 主体 */
.wrap { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 0 14px 40px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

/* 发布框 */
.composer { padding: 14px; margin-bottom: 18px; }
.composer-top { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.seg { display: inline-flex; background: var(--pink-100); border-radius: 999px; padding: 3px; flex: 1; min-width: 0; }
.seg button {
  flex: 1; border: 0; background: transparent; border-radius: 999px; padding: 7px 10px;
  font-size: 14px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: all 0.2s;
}
.seg button.active { background: #fff; color: var(--pink-600); box-shadow: 0 2px 8px rgba(240, 90, 140, 0.2); font-weight: 600; }
input[type="date"] {
  border: 1px solid var(--pink-200); background: #fff; border-radius: 999px;
  padding: 7px 12px; font-size: 14px; color: var(--ink); min-width: 0;
}
textarea {
  width: 100%; border: 1px solid var(--pink-200); border-radius: 14px; padding: 12px;
  resize: vertical; min-height: 84px; background: #fffafb; font-size: 16px; line-height: 1.6;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
textarea:focus, input:focus { border-color: var(--pink-400); box-shadow: 0 0 0 3px rgba(255, 127, 168, 0.2); }
.mood-row { display: flex; gap: 6px; overflow-x: auto; padding: 10px 2px 4px; scrollbar-width: none; }
.mood-row::-webkit-scrollbar { display: none; }
.mood {
  flex: none; border: 1px solid var(--pink-200); background: #fff; border-radius: 999px;
  padding: 5px 12px; font-size: 14px; color: var(--ink-soft); transition: all 0.2s;
}
.mood.active { background: var(--pink-100); border-color: var(--pink-400); color: var(--pink-600); transform: translateY(-1px); }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 10px 0 2px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--pink-100); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .rm {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: rgba(74, 42, 53, 0.6); color: #fff; font-size: 13px; line-height: 1;
}
.thumb .tag {
  position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: 6px;
  background: rgba(74, 42, 53, 0.6); color: #fff; font-size: 11px;
}

.composer-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.hint { flex: 1; font-size: 12px; color: var(--ink-soft); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 999px;
  background: var(--pink-100); color: var(--pink-600); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.primary {
  border: 0; border-radius: 999px; padding: 10px 22px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #ff7fa8, #f85c8e); box-shadow: 0 6px 16px rgba(248, 92, 142, 0.35);
  white-space: nowrap; transition: transform 0.15s, opacity 0.15s;
}
.primary:active { transform: scale(0.97); }
.primary:disabled { opacity: 0.6; cursor: default; }
.primary.block { width: 100%; padding: 12px; font-size: 16px; }
.ghost {
  border: 1px solid var(--pink-200); background: #fff; color: var(--pink-600);
  border-radius: 999px; padding: 9px 20px; font-size: 14px;
}
.progress { height: 4px; border-radius: 4px; background: var(--pink-100); margin-top: 12px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffb199, #f85c8e); transition: width 0.2s; }

/* 筛选 */
.filter-bar { display: flex; align-items: center; gap: 6px; margin: 4px 2px 14px; overflow-x: auto; scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }
.tab {
  flex: none; border: 0; background: transparent; padding: 6px 14px; border-radius: 999px;
  font-size: 14px; color: var(--ink-soft);
}
.tab.active { background: var(--pink-500); color: #fff; box-shadow: 0 4px 12px rgba(248, 92, 142, 0.3); }
.total { margin-left: auto; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }

/* 时间线 */
.timeline { position: relative; display: flex; flex-direction: column; gap: 16px; }
.timeline::before {
  content: ""; position: absolute; left: 9px; top: 10px; bottom: 10px; width: 2px;
  background: linear-gradient(180deg, var(--pink-300), var(--pink-100)); border-radius: 2px;
}
.post { position: relative; padding-left: 30px; }
.post::before {
  content: ""; position: absolute; left: 3px; top: 20px; width: 14px; height: 14px;
  border-radius: 50%; background: #fff; border: 3px solid var(--pink-400);
  box-shadow: 0 0 0 4px rgba(255, 127, 168, 0.15);
}
.post-card { padding: 14px; animation: rise 0.4s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.post-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
  background: linear-gradient(135deg, #ff9a8b, #f85c8e);
}
.avatar.b { background: linear-gradient(135deg, #b9a4ff, #ff8fb1); }
.post-meta { min-width: 0; flex: 1; }
.post-author { font-weight: 600; font-size: 15px; }
.post-date { font-size: 12px; color: var(--ink-soft); }
.post-mood { font-size: 20px; }
.post-del {
  border: 0; background: transparent; color: #d9a9b6; font-size: 16px; padding: 4px 6px;
  border-radius: 8px; opacity: 0.7;
}
.post-content { white-space: pre-wrap; word-break: break-word; font-size: 16px; margin: 0 0 4px; }

/* 九宫格 */
.grid { display: grid; gap: 6px; margin-top: 10px; grid-template-columns: repeat(3, 1fr); }
.grid.n1 { grid-template-columns: minmax(0, 320px); }
.grid.n2, .grid.n4 { grid-template-columns: repeat(2, 1fr); }
.cell {
  position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  background: var(--pink-100); cursor: pointer; border: 0; padding: 0; display: block; width: 100%;
}
.grid.n1 .cell { aspect-ratio: 4 / 3; }
.cell img, .cell video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cell .play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(180deg, transparent 40%, rgba(74, 42, 53, 0.35));
}
.cell .play i {
  width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, 0.88);
  display: grid; place-items: center; color: var(--pink-600); font-style: normal; font-size: 18px;
  padding-left: 3px;
}
.cell .more {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgba(74, 42, 53, 0.45);
  color: #fff; font-size: 18px; font-weight: 600;
}
audio { width: 100%; margin-top: 10px; }

.empty { text-align: center; color: var(--ink-soft); padding: 40px 0; }
#loadMore { display: block; margin: 20px auto 0; }
.foot { position: relative; z-index: 1; text-align: center; padding: 10px 0 calc(26px + var(--safe-b)); color: #d9a9b6; font-size: 13px; }

/* 查看器 */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(40, 18, 28, 0.94);
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
}
.lightbox[hidden] { display: none; }
.lb-stage { display: grid; place-items: center; width: 100%; height: 100%; min-width: 0; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 88vh; object-fit: contain; border-radius: 8px; }
.lb-close {
  position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 12px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 18px;
}
.lb-nav { border: 0; background: transparent; color: #fff; font-size: 34px; height: 100%; opacity: 0.8; }
.lb-count { position: absolute; bottom: calc(16px + var(--safe-b)); left: 0; right: 0; text-align: center; color: rgba(255, 255, 255, 0.75); font-size: 13px; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 60; background: rgba(74, 42, 53, 0.45);
  display: grid; place-items: center; padding: 16px; backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }
.modal-body { width: 100%; max-width: 420px; padding: 20px; display: grid; gap: 12px; }
.modal-body h2 { margin: 0 0 2px; font-size: 20px; color: var(--pink-600); }
.modal-body label { display: grid; gap: 5px; font-size: 13px; color: var(--ink-soft); }
.modal-body input {
  border: 1px solid var(--pink-200); border-radius: 12px; padding: 10px 12px; background: #fff; font-size: 16px; outline: none;
}
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* 登录页 */
.login-page { display: grid; place-items: center; padding: 20px; }
.login-card { position: relative; z-index: 1; width: 100%; max-width: 360px; padding: 30px 24px 26px; text-align: center; }
.login-heart {
  width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center;
  font-size: 34px; color: #fff; background: linear-gradient(135deg, #ff9a8b, #f85c8e);
  box-shadow: 0 8px 20px rgba(248, 92, 142, 0.35); animation: beat 1.6s ease-in-out infinite;
}
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.14); } 30% { transform: scale(1); } 45% { transform: scale(1.1); } }
.login-card h1 { margin: 0; font-size: 24px; color: var(--pink-600); letter-spacing: 0.08em; }
.login-sub { margin: 4px 0 18px; color: var(--ink-soft); font-size: 14px; }
.login-card input[type="password"] {
  width: 100%; border: 1px solid var(--pink-200); border-radius: 14px; padding: 12px 14px;
  font-size: 16px; background: #fffafb; outline: none; margin-bottom: 14px; text-align: center;
}
.login-err { margin: 12px 0 0; color: #d93a5e; font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(28px + var(--safe-b)); transform: translateX(-50%); z-index: 80;
  background: rgba(74, 42, 53, 0.9); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); max-width: 86vw; text-align: center;
}

@media (min-width: 640px) {
  .composer { padding: 18px; }
  .post-card { padding: 18px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
