:root {
  /* 秋天花的世界 · 暖色调 */
  --cream: #fff3e0;
  --peach: #ffd9a0;
  --amber: #f6b26b;
  --rust: #d98c5f;
  --terracotta: #b5654a;
  --gold: #ffb347;
  --gold-deep: #e8743b;
  --leaf: #c97b4a;
  --ink: #5b3a2e;
  --card: rgba(255, 255, 255, 0.5);
  --shadow: 0 18px 40px rgba(150, 80, 40, 0.28);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 255, 255, 0.6), transparent 60%),
    linear-gradient(180deg, var(--cream) 0%, var(--peach) 22%, var(--amber) 52%, var(--rust) 80%, var(--terracotta) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* 顶部光晕（秋日暖阳） */
.sun-glow {
  position: fixed;
  top: -18vh; left: 50%;
  width: 70vw; height: 70vw;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 226, 150, 0.9), rgba(255, 226, 150, 0) 60%);
  pointer-events: none;
  z-index: 0;
  animation: pulse 9s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:.9} 50%{opacity:.55} }

/* 飘落花瓣 */
.petals { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.petal {
  position: absolute;
  top: -8%;
  width: 14px; height: 14px;
  background: radial-gradient(circle at 30% 30%, #fff, var(--gold) 70%);
  border-radius: 0 100% 0 100% / 100% 0 100% 0;
  opacity: .85;
  animation: fall linear infinite;
  filter: drop-shadow(0 2px 4px rgba(230, 120, 60, .35));
}
@keyframes fall {
  0%   { transform: translateY(-10vh) translateX(0) rotate(0deg); }
  100% { transform: translateY(110vh) translateX(40px) rotate(360deg); }
}

/* 首屏 */
.hero {
  position: relative; z-index: 2;
  height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 0 20px;
}
.hero-title {
  font-family: "Ma Shan Zheng", "Noto Serif SC", serif;
  font-size: clamp(64px, 16vw, 180px);
  font-weight: 400;
  color: #fff;
  letter-spacing: .1em;
  text-shadow: 0 6px 30px rgba(200, 90, 40, .5), 0 2px 6px rgba(120, 60, 30, .3);
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-14px)} }
.hero-sub {
  margin-top: 18px;
  font-size: clamp(15px, 2.6vw, 22px);
  color: #7a4a30;
  letter-spacing: .25em;
  text-shadow: 0 1px 6px rgba(255,255,255,.6);
}
.scroll-hint {
  position: absolute; bottom: 38px;
  color: #8a5236; font-size: 14px; letter-spacing: .2em;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  animation: bob 2.4s ease-in-out infinite;
}
.scroll-hint .arrow { font-size: 22px; line-height: 1; }
@keyframes bob { 0%,100%{transform:translateY(0);opacity:.7} 50%{transform:translateY(8px);opacity:1} }

/* 相册 */
.gallery { position: relative; z-index: 2; max-width: 1180px; margin: 0 auto; padding: 40px 18px 80px; }
.grid {
  column-count: 4;
  column-gap: 16px;
}
@media (max-width: 980px){ .grid{ column-count: 3; } }
@media (max-width: 680px){ .grid{ column-count: 2; } }
@media (max-width: 420px){ .grid{ column-count: 1; } }

.card {
  position: relative;
  break-inside: avoid;
  margin-bottom: 16px;
  border-radius: 18px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  transform: translateY(16px);
  opacity: 0;
  transition: transform .6s ease, opacity .6s ease, box-shadow .3s ease;
}
.card.show { transform: translateY(0); opacity: 1; }
.card:hover { box-shadow: 0 26px 56px rgba(170, 90, 140, .38); }
.card img {
  display: block; width: 100%; height: auto;
  transition: transform .6s ease;
}
.card:hover img { transform: scale(1.06); }
.card .cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 30px 14px 12px;
  font-size: 14px; letter-spacing: .12em;
  color: #fff;
  background: linear-gradient(transparent, rgba(90, 40, 20, .6));
  opacity: 0; transition: opacity .35s ease;
}
.card:hover .cap, .card:focus .cap { opacity: 1; }

/* 页脚 */
.foot { position: relative; z-index: 2; text-align: center; padding: 30px 20px 60px; color: #8a5b40; font-size: 14px; letter-spacing: .2em; }

/* 空状态（没有本地照片时） */
.empty-state {
  margin: 10vh auto; max-width: 520px; text-align: center;
  color: #7a4a30; font-size: 18px; line-height: 2; letter-spacing: .08em;
  background: rgba(255,255,255,.45); border: 1px dashed rgba(181,101,74,.5);
  border-radius: 18px; padding: 40px 24px; backdrop-filter: blur(4px);
}
.empty-state code {
  padding: 2px 8px; color: #b5654a; background: rgba(255,255,255,.7);
  border-radius: 6px; font-family: Consolas, monospace; font-size: 15px;
}

/* 音乐开关 */
.music-btn {
  position: fixed; right: 22px; bottom: 22px; z-index: 30;
  width: 56px; height: 56px; border: none; cursor: pointer;
  border-radius: 50%;
  background: rgba(255,255,255,.7);
  box-shadow: 0 8px 22px rgba(170, 90, 140, .35);
  display: grid; place-items: center;
  backdrop-filter: blur(6px);
}
.music-btn .disc {
  position: absolute; width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #fff 18%, var(--gold) 20%, var(--gold-deep) 100%);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.4);
}
.music-btn .note { position: relative; color: #fff; font-size: 16px; z-index: 2; }
.music-btn.playing .disc { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.music-tip {
  position: fixed; right: 92px; bottom: 36px; z-index: 30;
  background: rgba(255,255,255,.8); color: #7a4a30;
  padding: 8px 14px; border-radius: 20px; font-size: 13px; letter-spacing: .1em;
  box-shadow: 0 6px 18px rgba(170,90,140,.25);
  animation: fadeHint 1s ease; cursor: pointer;
}
.music-tip.hide { opacity: 0; pointer-events: none; transition: opacity .6s ease; }

/* 灯箱 */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(60, 20, 45, .82);
  backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.lightbox.open { display: flex; }
.lb-figure { max-width: 92vw; max-height: 88vh; text-align: center; }
.lb-figure img {
  max-width: 92vw; max-height: 80vh; border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  transform-origin: center center;
  transition: transform .18s ease;
  cursor: grab;
  touch-action: none;
}
.lb-figure img.zoomed { cursor: grab; }
.lb-figure img.dragging { cursor: grabbing; transition: none; }

/* 缩放工具条 */
.lb-zoom {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 60; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.16); backdrop-filter: blur(8px);
  padding: 8px 12px; border-radius: 30px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.lb-zoom button {
  width: 38px; height: 38px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.25); color: #fff; font-size: 20px;
  cursor: pointer; display: grid; place-items: center; transition: background .2s ease;
}
.lb-zoom button:hover { background: rgba(255,255,255,.45); }
.lb-zoom #lbZoomReset { width: auto; padding: 0 14px; font-size: 14px; letter-spacing: .1em; border-radius: 20px; }
.lb-zoom #lbZoomVal { color: #fff; min-width: 52px; text-align: center; font-size: 14px; letter-spacing: .05em; }
@media (max-width: 600px){ .lb-zoom{ bottom: 14px; gap:6px; padding:6px 10px; } .lb-zoom button{ width:34px;height:34px;font-size:18px; } }
.lb-figure figcaption { color: #fff0e0; margin-top: 12px; letter-spacing: .15em; font-size: 15px; }
.lb-close, .lb-nav {
  position: absolute; border: none; cursor: pointer;
  color: #fff; background: rgba(255,255,255,.18);
  width: 48px; height: 48px; border-radius: 50%; font-size: 26px;
  display: grid; place-items: center; transition: background .25s ease;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,.35); }
.lb-close { top: 22px; right: 22px; }
.lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px){ .lb-prev{left:6px} .lb-next{right:6px} }

@media (prefers-reduced-motion: reduce) {
  .hero-title, .sun-glow, .scroll-hint, .music-btn.playing .disc, .petal { animation: none !important; }
}

/* ===== 老旧 WebView / 无 IntersectionObserver：自动简化 ===== */
/* 照片直接可见，不做入场淡入（避免老环境永远停在 opacity:0） */
.no-io .card,
.legacy .card { opacity: 1; transform: none; transition: box-shadow .3s ease; }
/* 关闭动态花瓣与多余动画，减轻低端设备负担 */
.legacy .petal { display: none; }
.legacy .sun-glow { animation: none; opacity: .8; }
.legacy .hero-title { animation: none; }
.legacy .scroll-hint { animation: none; }
.legacy .music-btn.playing .disc { animation: none; }
