:root {
  --bg: #fde8f1;
  --pink: #f06aa3;
  --pink-soft: #c2407a;
  --text: #5a2344;
  --muted: rgba(90, 35, 68, 0.6);
  --glass: rgba(255, 255, 255, 0.55);
  --glass-line: rgba(240, 106, 163, 0.25);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 90% at 50% 10%, #fff6fa 0%, #fde3ee 55%, #f8d3e3 100%) fixed;
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  overflow: hidden;
}
#sky { position: fixed; inset: 0; pointer-events: none; }

/* 顶部月份切换（爱心页） */
#month-tabs { position: fixed; z-index: 4; top: calc(88px + env(safe-area-inset-top)); left: 0; right: 0; display: flex; gap: 8px; justify-content: flex-start; overflow-x: auto; padding: 0 16px 6px; scrollbar-width: none; }
#month-tabs::-webkit-scrollbar { display: none; }
#month-tabs button { flex: none; border: 1px solid var(--glass-line); background: var(--glass); color: var(--muted); padding: 7px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; font-family: inherit; }
#month-tabs button.on { background: var(--pink); color: #fff; border-color: transparent; font-weight: 600; }
#heart-stage { top: 0; }
#celebrate { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 6; font-size: 16px; padding: 12px 26px; }
#celebrate[hidden] { display: none; }
body.night { background: radial-gradient(120% 90% at 50% 10%, #13224a 0%, #0a1330 55%, #050a1c 100%) fixed; color: #eef4ff; }
body.night nav#nav { background: rgba(10, 18, 44, .6); }
body.night nav#nav a { color: rgba(220, 232, 255, .6); }
body.night nav#nav a.on { color: #fff; }
body.night #days, body.night .hint { color: rgba(210, 225, 255, .6); }
body.night .pill-btn { color: #fff; background: rgba(255, 126, 182, .3); }
body.night #fw-small { color: #ffc2dc; }
#sky i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; opacity: .5; animation: twinkle 3s infinite ease-in-out; }
@keyframes twinkle { 50% { opacity: .1; } }

header#top { position: fixed; top: 0; left: 0; right: 0; z-index: 5; text-align: center; padding: max(14px, env(safe-area-inset-top)) 16px 0; pointer-events: none; }
#title { margin: 0; font-size: clamp(20px, 5vw, 28px); letter-spacing: .12em; font-weight: 600; text-shadow: 0 0 18px rgba(255, 126, 182, .55); }
#days { margin: 4px 0 0; color: var(--muted); font-size: 13px; letter-spacing: .06em; }
#days b { color: var(--pink-soft); font-size: 16px; }

.view { position: fixed; inset: 0; display: none; }
.view.on { display: block; }
.hint { position: fixed; left: 0; right: 0; bottom: calc(86px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: 12px; margin: 0; pointer-events: none; }

#heart-stage { position: absolute; inset: 0; touch-action: none; }
#heart-stage canvas { display: block; cursor: grab; }
#heart-stage canvas:active { cursor: grabbing; }

#fw-trail, #fw-top { position: absolute; inset: 0; width: 100%; height: 100%; }
#fw-text { position: absolute; left: 0; right: 0; top: 18%; text-align: center; pointer-events: none; padding: 0 16px; }
#fw-big { font-size: clamp(30px, 8vw, 56px); font-weight: 700; letter-spacing: .08em; background: linear-gradient(90deg, #ffd1e6, #ff7eb6, #ffd27a); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 16px rgba(255, 126, 182, .6)); opacity: 0; transform: scale(.8); transition: 1.2s cubic-bezier(.2, .8, .2, 1.2); }
#fw-small { margin-top: 10px; color: var(--pink-soft); font-size: 15px; opacity: 0; transition: 1.2s .6s; }
#fw-text.show #fw-big { opacity: 1; transform: none; }
#fw-text.show #fw-small { opacity: 1; }
#fw-to-month { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(110px + env(safe-area-inset-bottom)); }

.pill-btn { border: 1px solid var(--glass-line); background: rgba(255, 126, 182, .22); color: var(--text); padding: 10px 20px; border-radius: 999px; font-size: 14px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); cursor: pointer; font-family: inherit; }
.pill-btn:hover { background: rgba(255, 126, 182, .35); }

nav#nav { position: fixed; z-index: 6; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; gap: 4px; padding: 6px; border-radius: 999px; background: rgba(255, 255, 255, .72); border: 1px solid var(--glass-line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
nav#nav a { display: flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; color: var(--muted); white-space: nowrap; text-decoration: none; font-size: 14px; }
nav#nav a.on { background: rgba(240, 106, 163, .22); color: var(--text); }

/* 相册 */
#view-gallery { overflow-y: auto; padding: calc(78px + env(safe-area-inset-top)) 16px calc(100px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
#months { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; max-width: 980px; margin: 0 auto; }
#months::-webkit-scrollbar { display: none; }
#months button { flex: none; border: 1px solid var(--glass-line); background: var(--glass); color: var(--muted); padding: 8px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; font-family: inherit; }
#months button.on { background: var(--pink); color: #2a0c1c; border-color: transparent; font-weight: 600; }
#month-head { max-width: 980px; margin: 14px auto 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
#month-head h2 { margin: 0; font-size: 22px; }
#month-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
#grid { max-width: 980px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
#grid figure { margin: 0; position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--glass); cursor: pointer; animation: pop .5s both; }
#grid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
#grid figure:hover img { transform: scale(1.06); }
#grid figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 4px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .55)); }
@keyframes pop { from { opacity: 0; transform: scale(.92); } }
.empty { text-align: center; color: var(--muted); padding: 40px 0; line-height: 1.8; }

/* 大图 */
#lightbox { position: fixed; inset: 0; z-index: 20; background: rgba(6, 3, 14, .92); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#lightbox[hidden] { display: none; }
#lightbox figure { margin: 0; max-width: min(92vw, 1100px); text-align: center; }
#lb-img { max-width: 100%; max-height: 78vh; border-radius: 10px; box-shadow: 0 10px 50px rgba(255, 126, 182, .25); }
#lightbox figcaption { margin-top: 12px; color: var(--pink-soft); font-size: 14px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
#lb-cap { color: var(--text); }
#lightbox button { position: absolute; background: none; border: 0; color: #fff; font-size: 40px; cursor: pointer; padding: 12px; opacity: .75; font-family: inherit; }
#lightbox button:hover { opacity: 1; }
.lb-close { top: max(8px, env(safe-area-inset-top)); right: 8px; }
.lb-prev { left: 4px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 4px; top: 50%; transform: translateY(-50%); }

/* 小门锁 */
#lock { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 16px; }
#lock[hidden] { display: none; }
.lock-card { text-align: center; }
.lock-heart { font-size: 54px; animation: beat 1.2s infinite; }
@keyframes beat { 15% { transform: scale(1.18); } 30% { transform: scale(1); } 45% { transform: scale(1.12); } 60% { transform: scale(1); } }
#lock-input { display: block; margin: 14px auto; width: 200px; max-width: 100%; text-align: center; font-size: 22px; letter-spacing: .3em; padding: 10px; border-radius: 12px; border: 1px solid var(--glass-line); background: var(--glass); color: var(--text); outline: none; }
#lock-err { color: var(--pink); min-height: 1.4em; font-size: 13px; }
