/* 微信朋友圈气质：浅灰画布、白卡片、微信绿点缀；非 Inter/紫色渐变 */

:root {
  --wx-bg: #ededed;
  --wx-card: #ffffff;
  --wx-text: #181818;
  --wx-muted: #888888;
  --wx-sub: #576b95;
  --wx-green: #07c160;
  --wx-line: rgba(0, 0, 0, 0.06);
  --wx-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  --wx-radius: 10px;
  --feed-max: 560px;
  /* 霞鹜文楷 LXGW WenKai（lxgw-wenkai-webfont CDN） */
  --font-ui: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-display: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--wx-text);
  background: var(--wx-bg);
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(7, 193, 96, 0.06), transparent 55%),
    radial-gradient(900px 500px at 10% 110%, rgba(87, 107, 149, 0.05), transparent 50%),
    var(--wx-bg);
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(237, 237, 237, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--wx-line);
}

.top-bar__inner {
  max-width: var(--feed-max);
  margin: 0 auto;
  padding: 10px 14px calc(10px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top-bar__title-btn {
  margin: 0;
  flex: 1;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 10px;
  transition: background 0.2s ease, transform 0.15s ease;
}

.top-bar__title-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.top-bar__title-btn:active {
  transform: scale(0.98);
}

.top-bar__title-btn:focus-visible {
  outline: 2px solid var(--wx-green);
  outline-offset: 2px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--wx-text);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--wx-green);
  outline-offset: 2px;
}

/* 返回：没有上一页时的俏皮摇头（无文案） */
.icon-btn--wiggle {
  animation: back-wiggle 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes back-wiggle {
  0%,
  100% {
    transform: translateX(0) rotate(0deg);
  }
  18% {
    transform: translateX(-7px) rotate(-8deg);
  }
  36% {
    transform: translateX(7px) rotate(8deg);
  }
  54% {
    transform: translateX(-4px) rotate(-4deg);
  }
  72% {
    transform: translateX(4px) rotate(4deg);
  }
}

/* 相机：快门感弹跳 */
.icon-btn--snap {
  animation: camera-snap 0.55s cubic-bezier(0.34, 1.45, 0.64, 1);
}

@keyframes camera-snap {
  0% {
    transform: scale(1) rotate(0deg);
  }
  35% {
    transform: scale(0.86) rotate(-10deg);
  }
  65% {
    transform: scale(1.08) rotate(4deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

.feed-wrap {
  max-width: var(--feed-max);
  margin: 0 auto;
  padding: 12px 12px 28px;
}

@media (min-width: 768px) {
  .feed-wrap {
    padding: 20px 16px 40px;
  }

  .top-bar__inner {
    padding-left: 8px;
    padding-right: 8px;
  }
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.feed[aria-busy="false"] .moment {
  animation: rise 0.55s ease backwards;
}

.feed[aria-busy="false"] .moment:nth-child(1) { animation-delay: 0.04s; }
.feed[aria-busy="false"] .moment:nth-child(2) { animation-delay: 0.1s; }
.feed[aria-busy="false"] .moment:nth-child(3) { animation-delay: 0.16s; }
.feed[aria-busy="false"] .moment:nth-child(4) { animation-delay: 0.22s; }
.feed[aria-busy="false"] .moment:nth-child(5) { animation-delay: 0.28s; }
.feed[aria-busy="false"] .moment:nth-child(n+6) { animation-delay: 0.34s; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.moment {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--wx-line);
}

.moment:last-child {
  border-bottom: none;
}

.moment__avatar {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: #e5e5e5;
  box-shadow: var(--wx-shadow);
}

.moment__main {
  min-width: 0;
}

.moment__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-bottom: 6px;
}

.moment__name {
  font-weight: 600;
  font-size: 15px;
  color: var(--wx-sub);
}

.moment__meta {
  font-size: 12px;
  color: var(--wx-muted);
}

.moment__meta time {
  margin-right: 6px;
}

.moment__body {
  font-size: 15px;
  color: var(--wx-text);
  word-break: break-word;
}

.moment__body p {
  margin: 0 0 0.6em;
}

.moment__body p:last-child {
  margin-bottom: 0;
}

.moment__body a {
  color: var(--wx-sub);
  text-decoration: none;
}

.moment__body a:hover {
  text-decoration: underline;
}

.moment__body strong {
  font-weight: 600;
}

.moment__body ul,
.moment__body ol {
  margin: 0.4em 0 0.6em;
  padding-left: 1.2em;
}

.moment__gallery {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  max-width: 100%;
}

.moment__gallery--1 {
  grid-template-columns: 1fr;
}

.moment__gallery--2,
.moment__gallery--4 {
  grid-template-columns: repeat(2, 1fr);
}

.moment__gallery--3,
.moment__gallery--5,
.moment__gallery--6,
.moment__gallery--7,
.moment__gallery--8,
.moment__gallery--9 {
  grid-template-columns: repeat(3, 1fr);
}

.moment__pic {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  background: #ddd;
  cursor: zoom-in;
}

.moment__gallery--1 .moment__pic {
  aspect-ratio: 16 / 10;
  max-height: 280px;
}

/* 最新锚点：用于“回到最新”按钮定位 */
.latest-anchor {
  height: 1px;
  scroll-margin-top: 90px; /* 吸顶栏高度 + 余量 */
}

.load-sentinel {
  height: 1px;
}

.btn-latest {
  position: fixed;
  right: 18px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 120;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.10);
  color: var(--wx-green);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform: translateY(10px) scale(0.98);
  opacity: 0;
}

.btn-latest.is-visible {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.btn-latest:hover {
  transform: translateY(-1px) scale(1.02);
}

.btn-latest:active {
  transform: translateY(0) scale(0.98);
}

.btn-latest:focus-visible {
  outline: 2px solid var(--wx-green);
  outline-offset: 2px;
}

/* 相机点击：飘出的装饰（无文案） */
.play-effects {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  overflow: visible;
}

.play-emoji {
  position: fixed;
  left: 0;
  top: 0;
  font-size: 1.28rem;
  line-height: 1;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.95),
    0 1px 2px rgba(0, 0, 0, 0.08);
  animation: emoji-rise 1.05s ease-out forwards;
  transform: translate(-50%, 0);
}

@keyframes emoji-rise {
  0% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift, 0px)), 0) scale(0.45) rotate(-6deg);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift, 0px)), -118px) scale(1.05) rotate(14deg);
  }
}

.feed-error {
  text-align: center;
  color: #b54a4a;
  padding: 24px 12px;
  font-size: 14px;
}

.site-footer {
  max-width: var(--feed-max);
  margin: 0 auto;
  padding: 0 16px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--wx-muted);
}

@media (min-width: 1024px) {
  :root {
    --feed-max: 600px;
  }

  body {
    font-size: 15px;
  }
}
