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

/* ============================================================
   v50 性能重构：所有持续动画只用 transform / opacity，
   彻底避开 layout（left/top）与 CSS 变量插值（@property）。
   照片拆成 4 层，每层只负责一种变换，互不覆盖：
     .slot  → translate3d 定位（位移过渡）
     .bob   → translateY 微浮动（无限循环，随机相位）
     .rise  → scale 浮起放大（riseCycle）
     .photo → rotate 静态倾斜（不参与动画）
     .glow  → 浮起高亮，只动 opacity（阴影本体静态，不重绘）
   ============================================================ */

:root {
  --pink: #ff9ecb;
  --deep: #1a0b2e;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 背景 ---------- */
body {
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 94, 161, .18), transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(124, 58, 237, .25), transparent 55%),
    linear-gradient(160deg, #1a0b2e 0%, #2d1036 45%, #16081f 100%);
  color: #fff;
}

.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.sky .star {
  position: absolute; border-radius: 50%;
  background: #fff; opacity: .35;
  animation: twinkle 4s ease-in-out infinite;
}
@keyframes twinkle { 0%,100% { opacity: .15; } 50% { opacity: .6; } }

/* ---------- 标题 ---------- */
.site-header {
  position: fixed; top: 4vh; left: 0; right: 0;
  text-align: center; z-index: 5; pointer-events: none;
  text-shadow: 0 2px 18px rgba(0,0,0,.45);
}
.site-title {
  font-size: clamp(34px, 6vw, 60px);
  font-weight: 700; letter-spacing: .06em;
  background: linear-gradient(90deg, #ff9ecb, #ffd3e8, #c4b5fd, #ff9ecb);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 6s linear infinite;
}
.site-title .heart { -webkit-text-fill-color: #ff5ea1; animation: heartbeat 1.6s ease-in-out infinite; display: inline-block; }
@keyframes shimmer { to { background-position: 200% center; } }
@keyframes heartbeat { 0%,100% { transform: scale(1); } 25% { transform: scale(1.18); } 40% { transform: scale(1); } 60% { transform: scale(1.12); } }
.site-sub {
  margin-top: 6px; font-size: clamp(12px, 2vw, 15px);
  letter-spacing: .35em; color: rgba(255,255,255,.72);
}

/* ---------- 照片墙 ---------- */
.wall { position: fixed; inset: 0; z-index: 1; }

/* 第 1 层：定位。left/top 恒为 0，位置全部用 translate3d —— 不触发 layout，纯合成层平移 */
.slot {
  position: absolute;
  left: 0; top: 0;
  transform: translate3d(0, 0, 0);
  transition: transform 3s cubic-bezier(.45,.05,.35,1), opacity .8s ease;
  z-index: 1;
}
.slot.entering { opacity: 0; }
.slot.landed { opacity: 1; }
.slot.raised { z-index: 15; }
.slot:hover { z-index: 30; }

/* 第 2 层：微浮动。纯 translate3d 关键帧，可完全提升到合成器线程；相位由 JS 随机错开 */
.bob {
  width: 100%; height: 100%;
  animation: bob 6s ease-in-out infinite;
  animation-delay: var(--bob-delay, 0s);
}
@keyframes bob {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(0, -5px, 0); }
}

/* 第 3 层：浮起放大。scale 独占一层，不与 bob 的 translateY 抢同一个 transform。
   v50.1：换图与弹起合并为一个动作 —— JS 先在原地静默换好图（照片此时被上层盖住不可见），
   再触发 riseCycle 把「新照片」弹起来展示。视觉上是一次连贯动作：新照片浮现登场。 */
.rise {
  position: relative;
  width: 100%; height: 100%;
  transform: scale(1);
}
.rise.raising { animation: riseCycle 9s cubic-bezier(.45,.05,.35,1) forwards; }
/* 0-25% 弹起放大到 1.6 倍（缓出减速）；25-70% 缓慢缩回原大小；70-100% 停留在最上层 */
@keyframes riseCycle {
  0%   { transform: scale(1) translate3d(0,0,0);            animation-timing-function: cubic-bezier(.22,.61,.36,1); }
  25%  { transform: scale(1.6) translate3d(0,-10px,0);      animation-timing-function: cubic-bezier(.45,.05,.35,1); }
  70%  { transform: scale(1) translate3d(0,0,0);            animation-timing-function: ease-in-out; }
  100% { transform: scale(1) translate3d(0,0,0); }
}

/* 第 4 层：倾斜坐标系。rotate 独占一层，让 .photo 与 .glow 共处同一旋转坐标系 ——
   v50 首版把 rotate 放在 .photo 上、.glow 是它的兄弟节点，导致高亮描边是正方框、
   照片是斜的，放大 1.6 倍后偏差被放大、明显不贴合（杰哥 2026-08-27 反馈）。
   rotate 值来自静态 CSS 变量，不参与插值，不影响合成层性能。 */
.tilt {
  position: relative;
  width: 100%; height: 100%;
  transform: rotate(var(--rot, 0deg));
}

/* 第 5 层：图片本体。阴影/描边全程不变 → 只 paint 一次后由合成层缓存。
   v52：去掉换图的淡入淡出（杰哥 2026-08-27 反馈"多的淡化动作反而不简洁"）——
   换图时照片被上层盖住本就不可见，淡化纯属多余动作，还白等 400ms。
   现在是直接硬切 src，然后立刻弹起，动作最干净。 */
.photo {
  display: block;
  width: 100%; height: 100%;
  border-radius: 12px;
  object-fit: cover;
  cursor: pointer;
  /* blur 半径 18px → 12px：模糊成本按面积增长，电脑端照片大 4-8 倍，这里省的是首帧 paint 与层内存 */
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
  /* 粉色描边从 box-shadow spread 改为 outline，与阴影解耦，轮播换图时不引起阴影重算 */
  outline: 2px solid rgba(255,158,203,.35);
  outline-offset: -1px;
}

/* 浮起高亮层：与 .photo 同为 .tilt 的子节点，因此共享同一 rotate，描边始终贴合照片。
   box-shadow 本体静态，只有 opacity 在动画 —— 避免每帧重绘阴影 */
.glow {
  position: absolute; inset: 0;
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(255,94,161,.45);
  outline: 2px solid rgba(255,158,203,.75);
  outline-offset: -1px;
  opacity: 0;
  pointer-events: none;
}
.rise.raising .glow { animation: glowCycle 9s cubic-bezier(.45,.05,.35,1) forwards; }
@keyframes glowCycle {
  0%        { opacity: 0; }
  25%       { opacity: 1; }
  70%, 100% { opacity: 0; }
}

/* 悬停：只改 outline 颜色（单个元素重绘，成本可忽略） */
.slot:hover .photo { outline-color: rgba(255,158,203,.75); }

/* 页面切到后台时冻结全部动画，不白烧 CPU / 电量 */
.anim-paused .bob,
.anim-paused .rise.raising,
.anim-paused .rise.raising .glow,
.anim-paused .star,
.anim-paused .site-title,
.anim-paused .site-title .heart,
.anim-paused .upload-btn { animation-play-state: paused; }

/* 尊重系统「减弱动态效果」偏好：关掉持续浮动，保留功能 */
@media (prefers-reduced-motion: reduce) {
  .bob, .star, .upload-btn { animation: none; }
  .slot { transition: opacity .8s ease; }
}

/* ---------- 上传按钮 ---------- */
.upload-btn {
  position: fixed; right: 22px; bottom: 24px; z-index: 6;
  display: flex; align-items: center; gap: 8px;
  padding: 15px 26px; border-radius: 50px; border: none;
  font-size: 17px; font-weight: 600; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, #ff5ea1, #a855f7);
  box-shadow: 0 6px 22px rgba(255,94,161,.5);
  white-space: nowrap;
  transition: transform .2s ease, box-shadow .2s ease;
  animation: btnPulse 2.2s ease-in-out infinite;
}
.upload-btn:hover { transform: scale(1.08); box-shadow: 0 8px 30px rgba(255,94,161,.75); }
.upload-btn:active { transform: scale(.96); }
.upload-btn[hidden] { display: none; }
@keyframes btnPulse {
  0%,100% { box-shadow: 0 8px 26px rgba(255,94,161,.55); }
  50% { box-shadow: 0 8px 38px rgba(255,94,161,.9); }
}
/* 手机端：圆形大＋按钮，防文字溢出 */
@media (max-width: 480px) {
  .upload-btn {
    width: 58px; height: 58px; padding: 0;
    justify-content: center; gap: 0;
    font-size: 28px; border-radius: 50%;
  }
  .btn-label { display: none; }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(8, 4, 16, .92);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.lightbox[hidden] { display: none; } /* 关键：覆盖 display:flex，否则蒙版常驻 */
.lb-img {
  max-width: 90vw; max-height: 88vh;
  border-radius: 10px; box-shadow: 0 0 60px rgba(255,94,161,.3);
  animation: zoomIn .25s ease;
}
@keyframes zoomIn { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lb-hint {
  position: absolute; top: 24px; left: 0; right: 0; text-align: center;
  color: rgba(255,255,255,.55); font-size: 13px; letter-spacing: .15em;
  pointer-events: none; z-index: 1;
}
.lb-close {
  position: absolute; top: 18px; right: 18px;
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,.14); border: none; color: #fff; font-size: 24px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: .95; transition: background .2s, transform .2s;
  z-index: 2;
}
.lb-close:hover { background: rgba(255,94,161,.4); transform: rotate(90deg); }
.lb-prev, .lb-next { display: none; } /* 左右切换箭头已移除 */
.lb-counter {
  position: absolute; bottom: 24px; left: 0; right: 0; text-align: center;
  color: rgba(255,255,255,.6); font-size: 14px; letter-spacing: .2em;
}
.lb-actions {
  position: absolute; bottom: 60px; left: 0; right: 0;
  display: flex; justify-content: center; z-index: 2;
}
.lb-del {
  padding: 10px 26px; border-radius: 50px; border: none;
  font-size: 15px; font-weight: 600; color: #fff; cursor: pointer;
  background: rgba(255, 80, 80, .9); box-shadow: 0 4px 16px rgba(255,80,80,.35);
  transition: transform .2s ease;
}
.lb-del:hover { transform: scale(1.06); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; right: 24px; bottom: 104px; z-index: 30;
  background: rgba(20, 10, 30, .92); border: 1px solid rgba(255,158,203,.4);
  color: #fff; padding: 12px 22px; border-radius: 12px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  animation: toastIn .3s ease;
}
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 600px) {
  .upload-btn { right: 18px; bottom: 18px; width: 54px; height: 54px; font-size: 26px; }
}

/* ---------- 备案号（蜀ICP备2026048814号-1） ---------- */
.site-footer {
  position: fixed; left: 0; right: 0; bottom: 10px;
  text-align: center; z-index: 5;
  font-size: 11px; letter-spacing: .06em;
  color: rgba(255,255,255,.38);
  text-shadow: 0 1px 8px rgba(0,0,0,.35);
  pointer-events: none; /* 容器不拦截照片点击，仅链接可点 */
}
.site-footer a {
  color: inherit; text-decoration: none;
  padding: 8px 14px; /* 扩大点击热区 */
  pointer-events: auto;
  transition: color .25s ease;
}
.site-footer a:hover { color: rgba(255,255,255,.8); }
