/* ============================================================
   宝宝成长照片墙 - 前台样式
   ============================================================ */
:root {
  --bg: #fff8f0;
  --bg-soft: #fff1e6;
  --pink: #ffb6c1;
  --pink-deep: #ff8fab;
  --blue: #a8d8ea;
  --blue-deep: #7cc0d8;
  --yellow: #ffe3a3;
  --ink: #5b4a4a;
  --ink-soft: #9a8888;
  --card: #ffffff;
  --shadow: 0 6px 24px rgba(255, 143, 171, .18);
  --shadow-lg: 0 14px 40px rgba(255, 143, 171, .28);
  --radius: 18px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(168, 216, 234, .35), transparent 60%),
    radial-gradient(1000px 500px at 10% 0%, rgba(255, 182, 193, .30), transparent 55%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; }

img { -webkit-user-drag: none; }

/* ---------------- 漂浮装饰 ---------------- */
.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.sky span { position: absolute; opacity: .7; will-change: transform; }
.cloud { font-size: 42px; animation: drift 60s linear infinite; }
.c1 { top: 8%;  animation-duration: 75s; }
.c2 { top: 30%; font-size: 30px; animation-duration: 95s; animation-delay: -40s; }
.c3 { top: 62%; font-size: 52px; animation-duration: 120s; animation-delay: -70s; opacity: .45; }
@keyframes drift {
  from { transform: translateX(-120px); }
  to   { transform: translateX(calc(100vw + 120px)); }
}
.twinkle { animation: twinkle 3s ease-in-out infinite; font-size: 20px; }
.t1 { top: 15%; left: 12%; }
.t2 { top: 22%; right: 10%; animation-delay: 1s; }
.t3 { top: 70%; left: 6%;  animation-delay: 2s; }
.t4 { top: 10%; right: 28%; font-size: 26px; animation-delay: .5s; }
@keyframes twinkle {
  0%, 100% { opacity: .25; transform: scale(.85); }
  50%      { opacity: .9;  transform: scale(1.1); }
}
.heartfloat { font-size: 24px; animation: rise 14s ease-in infinite; bottom: -40px; }
.h1 { left: 16%; animation-delay: 0s; }
.h2 { right: 12%; animation-delay: 7s; }
@keyframes rise {
  0%   { transform: translateY(0) rotate(0); opacity: 0; }
  12%  { opacity: .75; }
  100% { transform: translateY(-110vh) rotate(24deg); opacity: 0; }
}

/* ---------------- 顶部 ---------------- */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 56px 20px 10px;
}
.hero h1 {
  font-size: clamp(30px, 5.5vw, 48px);
  letter-spacing: 2px;
  background: linear-gradient(120deg, var(--pink-deep), #f7a072 45%, var(--blue-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 6px rgba(255, 143, 171, .3));
}
.welcome {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 15px;
  letter-spacing: 3px;
}
.age-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 9px 22px;
  background: var(--card);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 15px;
  animation: pop .6s cubic-bezier(.34, 1.56, .64, 1);
}
.age-icon { animation: wobble 2.4s ease-in-out infinite; display: inline-block; }
@keyframes wobble {
  0%, 100% { transform: rotate(-8deg); }
  50%      { transform: rotate(8deg); }
}
@keyframes pop {
  from { transform: scale(.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.age-badge b { color: var(--pink-deep); font-size: 17px; margin: 0 2px; }

/* ---------------- 模式切换 ---------------- */
.mode-bar {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  width: fit-content;
  max-width: calc(100vw - 24px);
  margin: 26px auto 6px;
  padding: 8px;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(12px);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink-soft);
  transition: all .25s;
}
.mode-btn span { font-size: 16px; }
.mode-btn:hover { background: var(--bg-soft); color: var(--ink); transform: translateY(-1px); }
.mode-btn.active {
  background: linear-gradient(120deg, var(--pink), var(--pink-deep));
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 143, 171, .45);
}

/* ---------------- 展示区 ---------------- */
.gallery {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 26px auto 60px;
  padding: 0 20px;
  min-height: 300px;
  animation: fadein .5s ease;
}
@keyframes fadein {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.empty-tip {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 70px 20px;
  color: var(--ink-soft);
}
.empty-emoji { font-size: 64px; animation: wobble 2.4s ease-in-out infinite; }
.empty-tip p { margin-top: 14px; font-size: 17px; }
.empty-sub { font-size: 13px !important; opacity: .8; }

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 30px 16px 90px;
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 1px;
}

/* ============================================================
   模式 1：瀑布流
   ============================================================ */
.masonry { columns: 4 240px; column-gap: 18px; }
.masonry .m-item {
  break-inside: avoid;
  margin-bottom: 18px;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: zoom-in;
  transition: transform .3s, box-shadow .3s;
  animation: fadein .6s ease backwards;
}
.masonry .m-item:hover { transform: translateY(-6px) scale(1.015); box-shadow: var(--shadow-lg); }
.masonry img { width: 100%; display: block; }
.masonry .m-label {
  padding: 10px 14px 12px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.masonry .m-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.masonry .m-date { color: var(--ink-soft); font-size: 12px; flex-shrink: 0; }

/* ============================================================
   模式 2：成长时间轴
   ============================================================ */
.timeline { max-width: 860px; margin: 0 auto; position: relative; padding: 20px 0 40px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 4px;
  transform: translateX(-50%);
  background: linear-gradient(var(--pink), var(--blue));
  border-radius: 4px;
  opacity: .5;
}
.tl-row {
  position: relative;
  width: 50%;
  padding: 12px 44px 28px 0;
  animation: fadein .6s ease backwards;
}
.tl-row.right { margin-left: 50%; padding: 12px 0 28px 44px; }
.tl-dot {
  position: absolute;
  top: 26px;
  right: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--pink-deep);
  box-shadow: 0 0 0 5px rgba(255, 143, 171, .18);
  z-index: 2;
}
.tl-row.right .tl-dot { right: auto; left: -9px; border-color: var(--blue-deep); box-shadow: 0 0 0 5px rgba(124, 192, 216, .18); }
.tl-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: zoom-in;
  transition: transform .3s, box-shadow .3s;
}
.tl-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.tl-card img { width: 100%; display: block; max-height: 340px; object-fit: cover; }
.tl-info { padding: 12px 16px 14px; }
.tl-age-chip {
  display: inline-block;
  padding: 3px 12px;
  background: linear-gradient(120deg, var(--yellow), #ffd6a5);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #8a6d3b;
  margin-bottom: 7px;
}
.tl-row.right .tl-age-chip { background: linear-gradient(120deg, #d3f0fa, var(--blue)); color: #33667a; }
.tl-title { font-weight: 600; font-size: 15px; }
.tl-date { color: var(--ink-soft); font-size: 12px; margin-top: 3px; }
@media (max-width: 640px) {
  .timeline::before { left: 14px; }
  .tl-row, .tl-row.right { width: 100%; margin: 0; padding: 12px 0 26px 42px; }
  .tl-dot, .tl-row.right .tl-dot { left: 5px; right: auto; }
}

/* ============================================================
   模式 3：拍立得桌面（可拖动）
   ============================================================ */
.polaroid-desk {
  position: relative;
  min-height: 70vh;
  border-radius: 24px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.5), transparent 40%),
    repeating-linear-gradient(45deg, #f8e8d8 0 24px, #f4e0cc 24px 48px);
  box-shadow: inset 0 0 60px rgba(150, 100, 60, .12);
  overflow: hidden;
  touch-action: none;
}
.pol-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #b09679;
  background: rgba(255,255,255,.6);
  padding: 4px 14px;
  border-radius: 999px;
  pointer-events: none;
  z-index: 5;
}
.pol {
  position: absolute;
  width: 190px;
  padding: 10px 10px 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(90, 60, 40, .28);
  border-radius: 4px;
  cursor: grab;
  transform: rotate(var(--rot, 0deg));
  transition: box-shadow .25s;
  animation: dealIn .55s cubic-bezier(.34,1.4,.64,1) backwards;
  user-select: none;
}
@keyframes dealIn {
  from { transform: translateY(-50px) rotate(calc(var(--rot) + 16deg)) scale(.8); opacity: 0; }
  to   { transform: rotate(var(--rot)) scale(1); opacity: 1; }
}
.pol.dragging { cursor: grabbing; box-shadow: 0 20px 44px rgba(90, 60, 40, .4); z-index: 50 !important; transition: none; animation: none; }
.pol img {
  width: 100%;
  height: 165px;
  object-fit: cover;
  display: block;
  background: #eee;
  pointer-events: none;
}
.pol .pol-tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  width: 74px;
  height: 24px;
  background: rgba(255, 226, 160, .8);
  box-shadow: 0 2px 5px rgba(0,0,0,.08);
  border-radius: 2px;
}
.pol .pol-cap {
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  color: #6d5c50;
  font-family: "Kaiti SC", KaiTi, "Segoe Script", cursive, var(--font);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 560px) { .pol { width: 140px; } .pol img { height: 120px; } }

/* ============================================================
   模式 4：3D 旋转画廊
   ============================================================ */
.stage3d {
  height: 66vh;
  min-height: 420px;
  perspective: 1300px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  touch-action: pan-y;
}
.ring3d {
  position: relative;
  width: 240px;
  height: 320px;
  transform-style: preserve-3d;
}
.ring3d .r-item {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 44px rgba(90, 60, 80, .35);
  border: 5px solid #fff;
  background: #fff;
  cursor: pointer;
  backface-visibility: hidden;
}
.ring3d .r-item img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.stage-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--ink-soft);
  background: rgba(255,255,255,.7);
  padding: 4px 14px;
  border-radius: 999px;
  pointer-events: none;
}
@media (max-width: 560px) { .ring3d { width: 170px; height: 230px; } }

/* ============================================================
   模式 5：爱心墙
   ============================================================ */
.heart-wall {
  position: relative;
  margin: 0 auto;
  animation: heartbeat 6s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  3%  { transform: scale(1.025); }
  6%  { transform: scale(1); }
  9%  { transform: scale(1.02); }
  12% { transform: scale(1); }
}
.heart-cell {
  position: absolute;
  border-radius: 22%;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(255, 120, 150, .3);
  border: 3px solid #fff;
  cursor: pointer;
  transition: transform .3s, z-index 0s;
  animation: pop .5s cubic-bezier(.34,1.56,.64,1) backwards;
}
.heart-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.heart-cell:hover { transform: scale(1.75); z-index: 10; box-shadow: var(--shadow-lg); border-radius: 14%; }

/* ============================================================
   模式 6：气泡漂浮
   ============================================================ */
.bubble-sea {
  position: relative;
  height: 74vh;
  min-height: 460px;
  overflow: hidden;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(214, 240, 250, .55), rgba(255, 228, 238, .55));
  box-shadow: inset 0 0 50px rgba(140, 190, 220, .18);
}
.bub {
  position: absolute;
  bottom: -220px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid rgba(255, 255, 255, .85);
  box-shadow: 0 10px 26px rgba(120, 160, 200, .3), inset 0 0 18px rgba(255,255,255,.5);
  cursor: pointer;
  animation: floatup linear infinite;
  transition: transform .25s;
}
.bub:hover { transform: scale(1.12); }
.bub img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.bub::after {
  content: "";
  position: absolute;
  top: 8%;
  left: 14%;
  width: 26%;
  height: 18%;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  filter: blur(2px);
  transform: rotate(-30deg);
}
@keyframes floatup {
  0%   { transform: translateY(0) translateX(0) rotate(-2deg); }
  25%  { transform: translateY(-28vh) translateX(26px) rotate(2deg); }
  50%  { transform: translateY(-56vh) translateX(-20px) rotate(-2deg); }
  75%  { transform: translateY(-84vh) translateX(22px) rotate(2deg); }
  100% { transform: translateY(-118vh) translateX(0) rotate(0); }
}

/* ---------------- 管理员按钮 ---------------- */
.admin-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: var(--ink-soft);
  box-shadow: var(--shadow);
  font-size: 13px;
  transition: all .3s;
  backdrop-filter: blur(8px);
}
.admin-fab em { font-style: normal; }
.admin-fab:hover {
  color: #fff;
  background: linear-gradient(120deg, var(--pink-deep), #f7a072);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ---------------- 弹窗 ---------------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(91, 74, 74, .45); backdrop-filter: blur(4px); }
.modal-card {
  position: relative;
  background: var(--card);
  border-radius: 24px;
  padding: 34px 34px 30px;
  width: min(92vw, 380px);
  box-shadow: var(--shadow-lg);
  animation: pop .4s cubic-bezier(.34,1.56,.64,1);
  text-align: center;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: none;
  background: var(--bg-soft);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--ink-soft);
  font-size: 14px;
  transition: all .2s;
}
.modal-close:hover { background: var(--pink); color: #fff; transform: rotate(90deg); }
.login-avatar { font-size: 46px; margin-bottom: 6px; }
.login-card h2 { font-size: 20px; letter-spacing: 1px; }
.login-sub { color: var(--ink-soft); font-size: 13px; margin: 8px 0 20px; }
.login-card input {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid #f2e4e4;
  border-radius: 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .25s;
  text-align: center;
  letter-spacing: 2px;
}
.login-card input:focus { border-color: var(--pink-deep); }
.login-error { color: #e05d6f; font-size: 13px; min-height: 20px; margin: 8px 0 4px; }
.btn-primary {
  width: 100%;
  border: none;
  padding: 13px;
  border-radius: 14px;
  font-size: 16px;
  letter-spacing: 6px;
  color: #fff;
  background: linear-gradient(120deg, var(--pink-deep), #f7a072);
  box-shadow: 0 6px 18px rgba(255, 143, 171, .4);
  transition: all .25s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(255, 143, 171, .5); }
.btn-primary:disabled { opacity: .6; transform: none; cursor: wait; }

/* ---------------- 灯箱 ---------------- */
.lightbox { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; }
.lightbox-mask { position: absolute; inset: 0; background: rgba(40, 28, 32, .88); backdrop-filter: blur(6px); }
.lb-body {
  position: relative;
  max-width: min(92vw, 1000px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: pop .35s cubic-bezier(.34,1.4,.64,1);
}
.lb-body img {
  max-width: 100%;
  max-height: 72vh;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
  background: #222;
}
.lb-caption { margin-top: 16px; text-align: center; color: #fff; max-width: 640px; padding: 0 12px; }
.lb-title { font-size: 18px; font-weight: 600; }
.lb-meta { margin-top: 6px; font-size: 13px; color: rgba(255,255,255,.75); display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lb-age {
  background: linear-gradient(120deg, var(--pink-deep), #f7a072);
  padding: 2px 12px;
  border-radius: 999px;
  color: #fff;
  font-weight: 600;
}
.lb-desc { margin-top: 8px; font-size: 13px; color: rgba(255,255,255,.65); line-height: 1.7; }
.lb-close {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 5;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 17px;
  transition: all .2s;
}
.lb-close:hover { background: var(--pink-deep); transform: rotate(90deg); }
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  border: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  transition: all .2s;
}
.lb-nav:hover { background: var(--pink-deep); }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
@media (max-width: 640px) {
  .lb-nav { width: 40px; height: 40px; font-size: 22px; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
}

[hidden] { display: none !important; }
