/* ==================== 基础变量 ==================== */
:root {
  --primary: #a61b1f;
  --primary-light: #c73e42;
  --bg: #fffaf0;
  --bg-gradient-start: #fff8f5;
  --bg-gradient-end: #fdf6f0;
  --text: #333;
  --text-light: #666;
  --white: #ffffff;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 24px;
}

/* ==================== 本地字体 ==================== */
@font-face {
  font-family: 'Great Vibes';
  src: url('https://oss.hwj-dmx.love/assets/fonts/GreatVibes-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}



/* ==================== 重置样式 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: fixed;
  touch-action: none;
}

body {
  font-family: 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', 'Source Han Serif SC', 'SimSun', 'STSong', serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100%;
  width: 100%;
  position: relative;
}

/* ==================== 音乐控制按钮 ==================== */
.music-btn {
  position: fixed;
  top: max(15px, env(safe-area-inset-top));
  right: 15px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.8s ease;
}

.music-btn:active {
  transform: scale(0.95);
}

.music-btn.playing .music-wave {
  display: block;
}

.music-icon {
  font-size: 18px;
}

.music-wave {
  display: none;
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--primary);
  animation: wave 1.5s ease-out infinite;
}

@keyframes wave {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* 音乐按钮提示动画 */
@keyframes hintPulse {
  0%, 100% { 
    transform: scale(1); 
    box-shadow: 0 0 0 0 rgba(166, 27, 31, 0.7);
  }
  50% { 
    transform: scale(1.1); 
    box-shadow: 0 0 0 15px rgba(166, 27, 31, 0);
  }
}

.music-btn.hint-pulse {
  animation: hintPulse 0.6s ease-in-out 3;
}

/* ==================== 页面指示器 ==================== */
.page-dots {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  padding: 10px 20px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ddd;
  cursor: pointer;
  transition: all 0.3s ease;
  align-self: center;
}

.dot.active {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 4px;
  transform: rotate(45deg);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(166, 27, 31, 0.4);
}

.dot.active::before {
  content: '喜';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  color: white;
  font-size: 16px;
  font-weight: bold;
  font-family: 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', 'Source Han Serif SC', 'SimSun', serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  letter-spacing: 0;
  line-height: 1;
}

/* ==================== 页面基础 ==================== */
.page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: max(60px, env(safe-area-inset-top)) 5px max(80px, env(safe-area-inset-bottom));
  transition: all 0.6s cubic-bezier(0.645, 0.045, 0.355, 1);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transform: translateX(100%);
  /* 确保内容可以滚动 */
  min-height: 100vh;
}

.page.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.page.prev {
  transform: translateX(-100%);
}

/* ==================== 统一页面标题样式 ==================== */
.section-title,
.card-header,
.reincarnation-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  text-align: center;
}

.section-title h2,
.card-header h2,
.reincarnation-header h2 {
  font-size: 1.5rem;
  color: var(--primary);
  letter-spacing: 4px;
  font-weight: bold;
}

/* 副标题统一 */
.invitation-subtitle,
.reincarnation-subtitle,
.section-subtitle {
  font-size: 0.7rem;
  color: var(--text-light);
  letter-spacing: 2px;
  font-family: 'Great Vibes', cursive;
}

.title-deco {
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.title-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* ==================== 封面页 ==================== */
.page-cover {
  background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
    url('https://oss.hwj-dmx.love/assets/images/cover.png') no-repeat center center/cover;
  color: var(--white);
  text-align: center;
  background-color: #333; /* 后备颜色 */
}

.cover-content {
  z-index: 2;
  padding: 0 20px;
}

.subtitle {
  font-size: 0.8rem;
  letter-spacing: 4px;
  margin-bottom: 12px;
  opacity: 0.9;
}

/* 首页名字布局 */
.hero-names {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin: 20px 0;
  font-family: 'Great Vibes', cursive;
}

.name-left,
.name-right {
  font-size: 2.2rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.name-ampersand {
  font-size: 1.8rem;
  opacity: 0.9;
  font-family: 'Great Vibes', cursive;
}

/* 兼容旧样式 */
.hero-title {
  font-family: 'Great Vibes', cursive;
  font-size: 2.8rem;
  margin: 12px 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-date {
  font-size: 1rem;
  letter-spacing: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.5);
  padding-top: 12px;
  margin-top: 12px;
}

/* 自动播放提示 */
.auto-play-hint {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.hint-text {
  font-size: 0.75rem;
  opacity: 0.8;
  letter-spacing: 2px;
}

.progress-bar {
  width: 120px;
  height: 2px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
}

.progress {
  height: 100%;
  background: var(--white);
  width: 0%;
  animation: progress 3s linear forwards;
}

@keyframes progress {
  to { width: 100%; }
}

/* 花瓣动画 */
.petals-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.petal {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 12px;
  background: linear-gradient(135deg, #ffb6c1, #ffc0cb);
  border-radius: 50% 0 50% 50%;
  opacity: 0.6;
  animation: fall linear infinite;
}

@keyframes fall {
  0% {
    transform: translateY(0) rotate(0deg) translateX(0);
    opacity: 0.6;
  }
  25% {
    transform: translateY(25vh) rotate(180deg) translateX(20px);
  }
  50% {
    transform: translateY(50vh) rotate(360deg) translateX(-10px);
  }
  75% {
    transform: translateY(75vh) rotate(540deg) translateX(15px);
    opacity: 0.4;
  }
  100% {
    transform: translateY(105vh) rotate(720deg) translateX(0);
    opacity: 0;
  }
}

/* ==================== 邀请详情页 ==================== */
.page-invitation {
  background: linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg) 50%, var(--bg-gradient-end) 100%);
}

.invitation-card {
  background: var(--white);
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-width: 360px;
  width: 90%;
  text-align: center;
  margin: 0 auto;
  border: 1px solid rgba(166, 27, 31, 0.05);
}

/* 邀请页标题间距调整 */
.page-invitation .section-title {
  margin-bottom: 15px;
}

.couple-names {
  margin: 10px 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.couple-names .name {
  font-size: 1.4rem;
  color: var(--primary);
  font-weight: bold;
}

.couple-names .heart {
  color: var(--primary);
  font-size: 1rem;
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* 邀请文字样式 */
.invitation-text {
  color: var(--text-light);
  font-size: 0.85rem;
  line-height: 1.9;
  margin: 15px 0;
}

/* 宾客显示行 */
.invitation-guest {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 12px;
  line-height: 1.5;
}

/* 单人样式 */
.guest-single {
  color: var(--primary);
  font-weight: bold;
  font-size: 1.2em;
  letter-spacing: 3px;
  margin: 4px 0;
}

/* 夫妇名字容器 */
.guest-names-couple {
  display: inline-block;
  position: relative;
  text-align: left;
}

/* 名字包装器 - 只让名字居中 */
.guest-names-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

/* 每个名字列 */
.guest-name-col {
  color: var(--primary);
  font-weight: bold;
  font-size: 1.2em;
  text-shadow: 0 0 10px rgba(166, 27, 31, 0.2);
  letter-spacing: 3px;
  line-height: 1.3;
}

/* 夫妇后缀 - 绝对定位在右侧中间 */
.couple-suffix-inline {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  color: var(--primary);
  font-weight: bold;
  font-size: 0.75em;
  padding: 2px 8px;
  background: linear-gradient(135deg, rgba(166, 27, 31, 0.1), rgba(166, 27, 31, 0.05));
  border-radius: 8px;
  letter-spacing: 2px;
  white-space: nowrap;
}

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--bg);
  border-radius: 10px;
}

.info-icon {
  font-size: 1.3rem;
}

.info-content {
  text-align: left;
  flex: 1;
}

.info-content b {
  display: block;
  color: var(--primary);
  font-size: 0.75rem;
  margin-bottom: 3px;
}

.info-content span {
  display: block;
  color: var(--text-light);
  font-size: 0.8rem;
}

/* ==================== 故事页 ==================== */
.page-video {
  background: linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg) 50%, var(--bg-gradient-end) 100%);
}

.video-container {
  width: 90%;
  max-width: 400px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--white);
  border: 1px solid rgba(166, 27, 31, 0.05);
  position: relative;
}

.video-container video {
  width: 100%;
  height: auto;
  display: block;
}

/* 视频播放按钮遮罩 */
.video-play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.video-play-overlay:hover {
  background: rgba(0, 0, 0, 0.2);
}

.video-play-overlay.hidden {
  display: none;
}

.play-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.play-icon {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--primary);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.video-play-overlay:active .play-icon {
  transform: scale(0.95);
}

.play-text {
  color: white;
  font-size: 0.85rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.video-desc {
  margin-top: 12px;
  color: var(--text-light);
  font-size: 0.8rem;
}

/* 爱情的四季 */
.love-seasons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 25px;
  width: 100%;
  max-width: 380px;
}

.season-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--white);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(166, 27, 31, 0.08);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  flex: 1;
  min-width: 0;
}

.season-item:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.season-icon {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 2px;
}

.season-name {
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: bold;
  font-family: 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', 'Source Han Serif SC', 'SimSun', serif;
}

.season-text {
  font-size: 0.65rem;
  color: var(--text-light);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* ==================== 地图页 ==================== */
.page-map {
  background: linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg) 50%, var(--bg-gradient-end) 100%);
}

.venue-info {
  margin-bottom: 15px;
  width: 92%;
  max-width: 380px;
}

.venue-card {
  background: var(--white);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid rgba(166, 27, 31, 0.05);
}

.venue-card h3 {
  color: var(--primary);
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.venue-hall {
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: bold;
  margin-top: 4px;
}

.map-container {
  width: 92%;
  max-width: 380px;
  height: 200px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(166, 27, 31, 0.05);
}

.map-image-wrapper {
  width: 100%;
  height: 100%;
  cursor: pointer;
  transition: all 0.3s ease;
}

.map-image-wrapper:active {
  transform: scale(0.98);
}

.map-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.map-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e8e8e8 0%, #f5f5f5 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.map-placeholder:active {
  transform: scale(0.98);
}

.map-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.map-placeholder p {
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: bold;
}

.map-address {
  color: var(--text-light);
  font-size: 0.75rem;
  margin-top: 4px;
}

.map-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

/* 联系方式 */
.contact-section {
  margin-top: 15px;
  text-align: center;
}

.contact-section p {
  color: var(--text-light);
  font-size: 0.75rem;
  margin-bottom: 10px;
}

.contact-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-contact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--white);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  border: 1px solid rgba(166, 27, 31, 0.08);
}

.btn-contact:active {
  transform: scale(0.95);
}

/* ==================== 按钮样式 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.8rem;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:active {
  transform: scale(0.95);
  background: var(--primary-light);
}

.btn-secondary {
  background: var(--white);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-secondary:active {
  background: var(--bg);
}

/* ==================== 淡入动画 ==================== */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s ease forwards;
}

.fade-in:nth-child(1) { animation-delay: 0.2s; }
.fade-in:nth-child(2) { animation-delay: 0.4s; }
.fade-in:nth-child(3) { animation-delay: 0.6s; }
.fade-in:nth-child(4) { animation-delay: 0.8s; }

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 页面进入动画 */
.page.active .invitation-card,
.page.active .video-container,
.page.active .venue-card {
  animation: scaleIn 0.5s ease forwards;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==================== 移动端适配 ==================== */
@media (max-width: 380px) {
  .hero-title {
    font-size: 2.4rem;
  }
  
  .name-left,
  .name-right {
    font-size: 1.8rem;
  }
  
  .name-ampersand {
    font-size: 1.5rem;
  }
  
  .invitation-card {
    padding: 25px 18px;
  }
  
  .couple-names .name {
    font-size: 1.2rem;
  }
  
  .love-timeline {
    gap: 10px;
  }
  
  .timeline-text {
    font-size: 0.7rem;
  }
}

@media (min-width: 414px) {
  .hero-title {
    font-size: 3.5rem;
  }
  
  .invitation-card {
    max-width: 380px;
  }
}

/* 横屏提示 */
@media (orientation: landscape) and (max-height: 500px) {
  .page {
    justify-content: flex-start;
    padding-top: 20px;
  }
  
  .page-cover .cover-content {
    transform: scale(0.8);
  }
}

/* ==================== 相册页 ==================== */
.page-gallery {
  background: linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg) 50%, var(--bg-gradient-end) 100%);
  padding-top: 40px;
  padding-bottom: 70px;
}

.page-gallery .section-title {
  margin-bottom: 15px;
}

.gallery-wrapper {
  width: 92%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 主图 */
.gallery-main {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-hover);
  background: var(--white);
  aspect-ratio: 1/1;
  perspective: 1000px;
  border: 1px solid rgba(166, 27, 31, 0.05);
}

.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.4s ease;
  backface-visibility: hidden;
}

/* 图片说明 */
.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 15px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.5));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.caption-date {
  display: none;
}

.caption-text {
  color: rgba(255,255,255,0.98);
  font-size: 1rem;
  font-weight: normal;
  font-family: 'ZCOOL QingKe HuangYou', 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', 'Source Han Serif SC', 'SimSun', serif;
  letter-spacing: 1px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6), 0 0 20px rgba(0,0,0,0.3);
  line-height: 1.3;
  padding: 4px 0;
}

/* 缩略图列表 */
.gallery-thumbs {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 8px 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.gallery-thumbs::-webkit-scrollbar {
  display: none;
}

.thumb-item {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0.6;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-item.active {
  border-color: var(--primary);
  opacity: 1;
  transform: scale(1.08);
  box-shadow: 0 4px 15px rgba(166, 27, 31, 0.25);
}

.thumb-item:active {
  transform: scale(0.95);
}

.gallery-hint {
  margin-top: 8px;
  color: var(--text-light);
  font-size: 0.7rem;
  opacity: 0.6;
}

/* ==================== 照片预览 ==================== */
.photo-preview {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(10px);
}

.preview-content {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.preview-content img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: previewZoomIn 0.3s ease;
  transition: transform 0.1s ease;
}

/* 图片容器 - 用于缩放 */
.preview-img-container {
  width: 100%;
  height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

@keyframes previewZoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.preview-info {
  margin-top: 20px;
  text-align: center;
  color: var(--white);
}

.preview-date {
  display: block;
  font-size: 0.8rem;
  opacity: 0.7;
  margin-bottom: 5px;
}

.preview-text {
  display: block;
  font-size: 1.2rem;
  font-weight: bold;
}

.preview-close {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.2);
  color: var(--white);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.preview-close:active {
  background: rgba(255,255,255,0.3);
  transform: scale(0.95);
}

/* 预览左右切换按钮 */
.preview-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.preview-nav:hover {
  background: rgba(255,255,255,0.3);
}

.preview-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.preview-prev {
  left: 10px;
}

.preview-next {
  right: 10px;
}

/* 预览图片切换动画 */
#preview-img {
  transition: opacity 0.2s ease;
}

/* 主图点击提示 */
.gallery-main {
  cursor: pointer;
}

.gallery-main::after {
  content: '🔍';
  position: absolute;
  top: 15px;
  right: 15px;
  width: 36px;
  height: 36px;
  background: rgba(0,0,0,0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  opacity: 0;
  transition: all 0.3s ease;
}

.gallery-main:active::after {
  opacity: 1;
}

/* ==================== 选中样式 ==================== */
::selection {
  background: rgba(166, 27, 31, 0.2);
  color: var(--primary);
}

/* ==================== 三生三世页面 ==================== */
.page-reincarnation {
  background: linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 50%, var(--bg-gradient-start) 100%);
  padding-top: 60px;
  padding-bottom: 120px;
  /* 确保可以滚动 */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  /* 覆盖默认的flex布局 */
  justify-content: flex-start;
  align-items: center;
}

.reincarnation-content {
  width: 94%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 通用时代标签 */
.era-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.life-number {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  box-shadow: 0 3px 10px rgba(166, 27, 31, 0.3);
}

.life-era {
  font-size: 0.7rem;
  color: var(--primary);
  font-weight: bold;
  letter-spacing: 1px;
}

/* 每一世的部分 - 初始隐藏 */
.life-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(30px);
  display: none;
  /* 确保在滚动流中 */
  flex-shrink: 0;
  border: 1px solid rgba(166, 27, 31, 0.05);
}

.life-section.visible {
  display: block;
}

.life-section h3 {
  font-size: 1rem;
  color: var(--primary);
  letter-spacing: 3px;
  margin-bottom: 6px;
}

.life-section p {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* ========== 第一世：古代 - 左右布局 ========== */
.ancient-layout {
  display: flex;
  gap: 14px;
  align-items: center;
}

.ancient-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ancient-text h3 {
  text-align: left;
}

.ancient-images {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 170px;
}

/* ========== 第二世：民国 - 上下布局 ========== */
.republic-layout {
  display: flex;
  flex-direction: column;
  gap: 0px;
}

.republic-images {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: flex-end;
  padding: 0 8px;
}

.republic-text {
  text-align: center;
}

.republic-text h3 {
  margin-bottom: 6px;
}

.location-tag {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  background: linear-gradient(135deg, rgba(166, 27, 31, 0.1), rgba(166, 27, 31, 0.05));
  border: 1px solid rgba(166, 27, 31, 0.2);
  border-radius: 12px;
  font-size: 0.7rem;
  color: var(--primary);
  letter-spacing: 1px;
}

/* ========== 第三世：现代 - 对角线布局 ========== */
.modern-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modern-top {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  /* 上面的照片往下一点 */
  padding-top: 5px;
  position: relative;
}

/* 双喜装饰 */
.double-xi-decoration {
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), #c73e42);
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(166, 27, 31, 0.3);
  z-index: 10;
}

.double-xi-decoration::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: inherit;
  border-radius: inherit;
  transform: rotate(45deg);
  z-index: -1;
}

.xi-character {
  color: white;
  font-size: 20px;
  font-weight: bold;
  font-family: 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', 'Source Han Serif SC', 'SimSun', serif;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.modern-text-main {
  flex: 1;
}

.modern-text-main h3 {
  text-align: left;
  margin-bottom: 4px;
}

.modern-bottom {
  display: flex;
  /* 下面的照片定位到文字下方，再往右 */
  justify-content: flex-start;
  padding-left: 145px;
  margin-top: -80px;
  position: relative;
  z-index: 2;
}

/* ========== 图片框架样式 - 放大 ========== */
.img-frame {
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  background: var(--white);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  cursor: pointer;
}

.img-frame::after {
  content: '🔍';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  opacity: 0;
  transition: all 0.3s ease;
}

.img-frame:hover::after {
  opacity: 1;
}

.img-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 古代竖版 - 放大 */
.frame-vertical {
  width: 100%;
  height: 140px;
  border-radius: 12px;
  padding: 5px;
}

.frame-vertical img {
  border-radius: 8px;
  object-fit: cover;
}

/* 第一世第一张图往左 */
.ancient-images > .img-frame.tilt-left > img {
  object-position: 70% center;
}

/* 民国大小图 - 调整比例避免挤压 */
.frame-large {
  width: 185px;
  height: 160px;
  border-radius: 14px;
  padding: 5px;
  flex-shrink: 0;
  margin-bottom: 5px;
}

.frame-large img {
  border-radius: 10px;
  object-position: center 65%;
}

.frame-small {
  width: 135px;
  height: 135px;
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 5px;
  flex-shrink: 0;
}

.frame-small img {
  border-radius: 8px;
  object-position: 70% center;
}

/* 现代拍立得 - 调整尺寸，白边与前面两段一致 */
.frame-polaroid {
  width: 160px;
  padding: 5px 5px 32px 5px;
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 6px 22px rgba(0,0,0,0.15);
}

.frame-polaroid img {
  width: 100%;
  height: 125px;
  object-fit: cover;
  object-position: 80% center;
  border-radius: 5px;
}

.polaroid-date {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-light);
  font-family: 'Great Vibes', cursive;
}

/* 倾斜效果 - 加大角度 */
.tilt-left {
  transform: rotate(-6deg);
}

.tilt-right {
  transform: rotate(6deg);
}

/* 大倾斜角度 - 用于第三世下面的图 */
.tilt-right-large {
  transform: rotate(8deg);
}

.img-frame:hover {
  transform: rotate(0deg) scale(1.03);
  box-shadow: 0 10px 30px rgba(166, 27, 31, 0.2);
}

.img-frame:active {
  transform: scale(0.98);
}

/* 页脚诗句 */
.reincarnation-footer {
  text-align: center;
  margin-top: 18px;
  padding: 20px 15px;
  background: linear-gradient(135deg, rgba(166, 27, 31, 0.05), rgba(166, 27, 31, 0.02));
  border-radius: 15px;
  width: 92%;
  max-width: 400px;
  opacity: 0;
  display: none;
}

.reincarnation-footer.visible {
  display: block;
}

.reincarnation-footer .poem {
  font-size: 0.85rem;
  color: var(--primary);
  line-height: 1.8;
  letter-spacing: 2px;
  font-style: italic;
  margin-bottom: 8px;
}

.reincarnation-footer .poem-author {
  font-size: 0.65rem;
  color: var(--text-light);
  letter-spacing: 1px;
}

/* 移动端适配 */
@media (min-width: 380px) {
  .ancient-images {
    width: 185px;
  }
  
  .frame-vertical {
    height: 155px;
  }
  
  .frame-large {
    width: 200px;
    height: 170px;
    margin-bottom: 8px;
  }
  
  .frame-small {
    width: 145px;
    height: 145px;
    margin-bottom: 8px;
  }
  
  .frame-polaroid {
    width: 175px;
    padding: 6px 6px 25px 6px;
  }
  
  .frame-polaroid img {
    height: 140px;
    object-position: 80% center;
  }
  
  .modern-bottom {
    padding-left: 180px;
    margin-top: -100px;
  }
}

@media (max-width: 350px) {
  .ancient-layout {
    flex-direction: column;
  }
  
  .ancient-images {
    width: 100%;
    flex-direction: row;
    justify-content: center;
  }
  
  .frame-vertical {
    width: 125px;
    height: 105px;
  }
  
  .republic-images {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .frame-large {
    width: 140px;
    height: 115px;
    margin-bottom: 0;
  }
  
  .frame-small {
    width: 100px;
    height: 100px;
    margin-bottom: 0;
  }
  
  .modern-top {
    flex-direction: column;
    align-items: center;
  }
  
  .modern-bottom {
    justify-content: center;
    padding-left: 0;
    margin-top: 15px;
  }
  
  .frame-polaroid {
    width: 130px;
    padding: 5px 5px 30px 5px;
  }
  
  .frame-polaroid img {
    height: 115px;
    object-position: 80% center;
  }
}
