:root {
  --pink: #ff6b9a;
  --pink-deep: #e84a7f;
  --pink-soft: #ffe3ec;
  --ink: #4a3540;
  --muted: #8a6f7b;
  --card: rgba(255, 255, 255, 0.78);
  --bg1: #fff0f5;
  --bg2: #ffe4ec;
  --bg3: #f3e8ff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f6e6ee;
    --muted: #c9a9b8;
    --card: rgba(40, 24, 34, 0.78);
    --pink-soft: #4a2335;
    --bg1: #1d1218;
    --bg2: #2a1621;
    --bg3: #1e1530;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  background: linear-gradient(160deg, var(--bg1), var(--bg2) 45%, var(--bg3));
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

#hearts { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

.nav {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 4px; padding: 6px; z-index: 10;
  background: var(--card); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: 999px; box-shadow: 0 6px 24px rgba(232, 74, 127, .15);
}
.nav a {
  color: var(--ink); text-decoration: none; font-size: 14px;
  padding: 6px 14px; border-radius: 999px; transition: background .2s, color .2s;
}
.nav a:hover { background: var(--pink); color: #fff; }

.hero, .section, .footer { position: relative; z-index: 1; }

.hero {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 90px 16px 40px; text-align: center;
}
.couple { display: flex; align-items: center; gap: clamp(16px, 6vw, 56px); }
.person { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.avatar {
  width: clamp(84px, 22vw, 130px); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; font-size: clamp(40px, 10vw, 64px);
  background: var(--card); border: 4px solid #fff; overflow: hidden;
  box-shadow: 0 10px 30px rgba(232, 74, 127, .25);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.name { font-size: clamp(18px, 4.5vw, 24px); font-weight: 600; }
.beat { font-size: clamp(36px, 9vw, 56px); color: var(--pink); animation: beat 1.2s infinite; }
.beat-small { color: var(--pink); display: inline-block; animation: beat 1.2s infinite; }
@keyframes beat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.25); }
  30% { transform: scale(1); }
  45% { transform: scale(1.15); }
}
.tagline { margin: 28px 0; font-size: clamp(15px, 3.8vw, 19px); color: var(--muted); max-width: 560px; line-height: 1.7; }

.counter-card {
  background: var(--card); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: 24px; padding: 22px clamp(16px, 5vw, 40px);
  box-shadow: 0 12px 40px rgba(232, 74, 127, .18); max-width: 100%;
}
.counter-title { color: var(--muted); font-size: 15px; margin-bottom: 12px; }
.counter { display: flex; gap: clamp(10px, 4vw, 28px); justify-content: center; }
.counter div { display: flex; flex-direction: column; align-items: center; min-width: 52px; }
.counter span {
  font-size: clamp(28px, 8vw, 48px); font-weight: 700; color: var(--pink-deep);
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.counter small { color: var(--muted); font-size: 13px; margin-top: 4px; }
.next { margin-top: 14px; font-size: 14px; color: var(--muted); }
.next b { color: var(--pink-deep); }
.scroll-hint { margin-top: 36px; color: var(--muted); text-decoration: none; font-size: 14px; animation: float 2s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(6px); } }

.section { max-width: 960px; margin: 0 auto; padding: 80px 16px; }
.section h2 { text-align: center; font-size: clamp(24px, 6vw, 32px); margin: 0 0 40px; }
.section h2::after { content: " ❀"; color: var(--pink); }

/* 时间线 */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(var(--pink), transparent);
}
.tl-item {
  position: relative; margin-bottom: 26px; background: var(--card);
  border-radius: 18px; padding: 18px 20px; box-shadow: 0 8px 26px rgba(232, 74, 127, .12);
  opacity: 0; transform: translateY(24px); transition: opacity .7s, transform .7s;
}
.tl-item.show { opacity: 1; transform: none; }
.tl-item::before {
  content: "❤"; position: absolute; left: -28px; top: 18px; width: 20px; text-align: center;
  color: var(--pink); font-size: 16px; background: transparent;
}
.tl-date { font-size: 13px; color: var(--pink-deep); font-weight: 600; }
.tl-title { font-size: 18px; font-weight: 600; margin: 4px 0 6px; }
.tl-text { color: var(--muted); line-height: 1.7; margin: 0; }
.tl-ago { font-size: 12px; color: var(--muted); opacity: .8; margin-top: 8px; }
.tl-item img { width: 100%; max-height: 320px; object-fit: cover; border-radius: 12px; margin-top: 12px; }

/* 相册 */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 16px; }
.photo {
  position: relative; aspect-ratio: 4 / 5; border-radius: 18px; overflow: hidden; cursor: zoom-in;
  background: linear-gradient(135deg, #ffb3c9, #ffd9b3);
  box-shadow: 0 8px 26px rgba(232, 74, 127, .15);
  transition: transform .3s;
}
.photo:nth-child(3n+2) { background: linear-gradient(135deg, #c9b3ff, #ffb3d9); }
.photo:nth-child(3n) { background: linear-gradient(135deg, #b3e5ff, #ffc9e0); }
.photo:hover { transform: translateY(-4px) rotate(-.6deg); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 46px; }
.photo .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 14px 12px; color: #fff; font-size: 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .45));
}

/* 情书 */
.letter-paper {
  background: var(--card); border-radius: 20px; padding: clamp(22px, 6vw, 48px);
  box-shadow: 0 12px 40px rgba(232, 74, 127, .15); max-width: 640px; margin: 0 auto;
  background-image: repeating-linear-gradient(transparent 0 33px, rgba(255, 107, 154, .15) 33px 34px);
}
.letter-paper pre {
  margin: 0; white-space: pre-wrap; word-break: break-word; font-family: inherit;
  font-size: clamp(15px, 4vw, 17px); line-height: 34px; min-height: 200px;
}
.letter-paper pre.typing::after { content: "|"; color: var(--pink); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.footer { text-align: center; padding: 40px 16px 60px; color: var(--muted); font-size: 14px; }

/* 灯箱 */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .85);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 82vh; border-radius: 12px; }
.lightbox div { color: #fff; margin-top: 14px; }

.music {
  position: fixed; right: 18px; bottom: 18px; z-index: 20; width: 46px; height: 46px; border-radius: 50%;
  border: none; background: var(--pink); color: #fff; font-size: 20px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(232, 74, 127, .4);
}
.music.playing { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.click-heart {
  position: fixed; pointer-events: none; z-index: 60; color: var(--pink); font-size: 18px;
  animation: pop 1s ease-out forwards;
}
@keyframes pop { to { transform: translate(-50%, -70px) scale(1.6); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
