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

:root {
  --gold: #C9A96E;
  --pink: #F4A7B9;
  --bg: #FFFFFF;
  --text: #333333;
  --sub: #888888;
  --danmu-bg: rgba(0,0,0,0.5);
}

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ===== 音乐按钮 ===== */
.music-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: rgba(255,255,255,0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.3s;
}
.music-btn.playing .music-icon {
  animation: spin 3s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== 封面区 ===== */
.cover {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 背景图层（JS 控制透明度） */
.cover-bg {
  position: absolute;
  inset: 0;
  background-image: url('wedding_img/01.jpg');
  background-size: cover;
  background-position: center top;
  opacity: 1;
  z-index: 0;
  transition: opacity 1.2s ease;
}

.cover-bg.dimmed {
  opacity: 0.55;
}

/* 渐变遮罩（JS 控制显隐） */
.cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(255,245,248,0.25) 0%,
    rgba(255,245,248,0.45) 50%,
    rgba(255,245,248,0.88) 100%
  );
  z-index: 1;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.cover-overlay.show {
  opacity: 1;
}

.cover-content {
  text-align: center;
  z-index: 2;
  padding: 40px 20px;
}

.cover-sub {
  font-size: 15px;
  color: #7a6a6a;
  letter-spacing: 6px;
  margin-bottom: 16px;
  text-shadow: 0 1px 4px rgba(255,255,255,0.8);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.cover-sub.show {
  opacity: 1;
  transform: translateY(0);
}

/* 名字行 */
.cover-names-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 16px;
  white-space: nowrap;
  min-height: 50px;
}

.cover-name {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 4px;
  background: linear-gradient(135deg, #3d2020 0%, #7a3030 50%, #3d2020 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  display: inline-block;
  opacity: 0;
  transition: transform 0.9s cubic-bezier(0.22,1,0.36,1), opacity 0.9s ease;
}

.cover-name-groom {
  transform: translateX(-120px);
}

.cover-name-bride {
  transform: translateX(120px);
}

.cover-name.arrived {
  opacity: 1;
  transform: translateX(0);
}

/* 心形 canvas */
.cover-heart {
  display: inline-block;
  vertical-align: middle;
  margin: 0 2px;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

.cover-heart.show {
  opacity: 1;
  transform: scale(1);
}

@keyframes heartBeat {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.45); }
  60%  { transform: scale(0.95); }
  80%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.cover-heart.beat {
  animation: heartBeat 0.6s ease forwards;
}

/* 日期等后续内容 */
.cover-after {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.cover-after.show {
  opacity: 1;
  transform: translateY(0);
}

.cover-date {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 8px;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #b5813a, #d4a055, #b5813a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.25));
}

.cover-lunar {
  font-size: 13px;
  color: #8a6a4a;
  letter-spacing: 4px;
  margin-bottom: 20px;
  text-shadow: 0 1px 4px rgba(255,255,255,0.8);
}

.cover-divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
  margin: 0 auto 20px;
}

.cover-invite {
  font-size: 14px;
  color: var(--sub);
  letter-spacing: 3px;
}

/* 花瓣动效 */
.petals {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 3;
}

.petal {
  position: absolute;
  top: -20px;
  font-size: 18px;
  animation: fall linear infinite;
  opacity: 0.7;
}

@keyframes fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 0.8; }
  100% { transform: translateY(110vh) rotate(360deg); opacity: 0; }
}

/* ===== 敬语页 ===== */
.letter-section {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

/* 背景图：全屏清晰展示 */
.letter-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('wedding_img/02.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.9;
  z-index: 0;
  transition: opacity 1s ease;
}

/* 进入卡片模式后背景变暗 */
.letter-section.card-mode::before {
  opacity: 0.65;
}

/* 轻薄遮罩，始终存在 */
.letter-section::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.12);
  z-index: 1;
  pointer-events: none;
}

/* 卡片舞台：居中 */
.letter-card-stage {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

/* 单张卡片 */
.letter-card {
  max-width: 360px;
  width: 100%;
  background: rgba(255,255,255,0.38);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.45);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  opacity: 0;
  transform: translateY(40px) scale(0.94);
  transition: opacity 0.7s cubic-bezier(0.22,1,0.36,1),
              transform 0.7s cubic-bezier(0.22,1,0.36,1);
  position: absolute;
}

.letter-card.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.letter-card.hide {
  opacity: 0;
  transform: translateY(-30px) scale(0.96);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.letter-card-icon {
  font-size: 30px;
  flex-shrink: 0;
  margin-top: 2px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.letter-card-body { flex: 1; }

.letter-card-title {
  font-size: 12px;
  color: rgba(255,220,160,0.95);
  letter-spacing: 4px;
  margin-bottom: 10px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.letter-card-text {
  font-size: 15px;
  color: rgba(255,255,255,0.92);
  line-height: 2;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.35);
}

/* 底部进度点 */
.letter-dots {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  gap: 8px;
}

.letter-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.45);
  transition: background 0.3s, transform 0.3s;
}

.letter-dot.active {
  background: #fff;
  transform: scale(1.4);
}

/* 署名卡片 */
.letter-sign-card {
  text-align: center;
}

.letter-sign-card .letter-card-text {
  font-size: 16px;
  color: #7a3030;
  font-weight: 500;
  letter-spacing: 3px;
  text-align: center;
}

.letter-sign-date {
  font-size: 12px;
  color: var(--sub);
  letter-spacing: 2px;
  margin-top: 8px;
  display: block;
  text-align: center;
}

/* ===== 通用 section ===== */
section {
  padding: 48px 20px;
}

.section-title {
  text-align: center;
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 28px;
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 40px;
  height: 2px;
  background: var(--gold);
  margin: 10px auto 0;
  border-radius: 2px;
}

/* ===== 恋爱故事页 ===== */
.story-section {
  background: linear-gradient(180deg, #fff 0%, #fff8f5 100%);
  padding: 48px 20px 56px;
}

.story-main-title { margin-bottom: 6px; }

.story-subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--sub);
  letter-spacing: 4px;
  margin-bottom: 28px;
}

/* 轮播容器 */
.story-carousel {
  position: relative;
  width: calc(100% + 40px);
  margin-left: -20px;
  margin-right: -20px;
  margin-bottom: 24px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  aspect-ratio: 3/4;
  background: #f0e8e0;
}

/* 图片轨道 */
.story-slides {
  position: relative;
  width: 100%;
  height: 100%;
}

.story-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 1.2s ease;
  will-change: opacity;
}

.story-slide.active {
  opacity: 1;
}

/* 文字叠加层 */
.story-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.story-overlay.show {
  opacity: 1;
}

.story-overlay-tag {
  background: rgba(255,255,255,0.88);
  color: var(--gold);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 6px;
  padding: 6px 22px;
  border-radius: 24px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(201,169,110,0.35);
  margin-bottom: 12px;
  text-shadow: none;
}

.story-overlay-text {
  font-size: 13px;
  color: rgba(255,255,255,0.92);
  letter-spacing: 2px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
  text-align: center;
  padding: 0 24px;
  line-height: 1.8;
}

/* 左右箭头 */
.story-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(4px);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 22px;
  color: #7a3030;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s, transform 0.2s;
  line-height: 1;
  padding: 0;
}

.story-arrow:active { transform: translateY(-50%) scale(0.9); }
.story-prev { left: 10px; }
.story-next { right: 10px; }

/* 组点 */
.story-group-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.story-gdot {
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.25);
  padding: 3px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
  backdrop-filter: blur(4px);
}

.story-gdot.active {
  background: rgba(201,169,110,0.85);
  color: #fff;
}

.story-end {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 16px;
  color: #7a3030;
  letter-spacing: 3px;
  font-weight: 500;
}

/* ===== 日历区 ===== */
.calendar-section {
  background: #fafafa;
}

.calendar {
  max-width: 360px;
  margin: 0 auto 24px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(201,169,110,0.15);
  overflow: hidden;
}

.cal-header {
  background: linear-gradient(135deg, var(--gold), #e8c88a);
  color: #fff;
  text-align: center;
  padding: 16px;
  font-size: 18px;
  letter-spacing: 4px;
}

.cal-month {
  margin-left: 8px;
  font-size: 22px;
  font-weight: 600;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f9f0e0;
  padding: 8px 0;
}

.cal-weekdays span {
  text-align: center;
  font-size: 12px;
  color: var(--sub);
}

.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 8px;
  gap: 4px;
}

.cal-day {
  text-align: center;
  padding: 8px 4px;
  font-size: 14px;
  border-radius: 8px;
  color: var(--text);
}

.cal-day.empty { color: transparent; }

.cal-day.wedding {
  background: linear-gradient(135deg, var(--pink), #f9c5d1);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(244,167,185,0.5);
  position: relative;
}

.cal-day.wedding::after {
  content: '❤';
  position: absolute;
  bottom: -2px;
  right: 2px;
  font-size: 8px;
}

.cal-day.today {
  border: 1px solid var(--gold);
  color: var(--gold);
}

.countdown {
  text-align: center;
  font-size: 16px;
  color: var(--sub);
}

.countdown strong {
  font-size: 36px;
  color: var(--gold);
  display: block;
  margin: 4px 0;
}

/* ===== 联系方式 ===== */
.contact-section {
  background: #fafafa;
  padding: 24px 20px;
}

.contact-list {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: nowrap;
}

.contact-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #f0e8d8;
  border-radius: 14px;
  padding: 14px 16px;
  text-decoration: none;
  flex: 1;
  max-width: 180px;
  box-shadow: 0 2px 12px rgba(201,169,110,0.12);
  transition: transform 0.2s, box-shadow 0.2s;
}

.contact-item:active {
  transform: scale(0.97);
  box-shadow: 0 4px 16px rgba(201,169,110,0.25);
}

.contact-role {
  font-size: 13px;
  color: var(--sub);
  letter-spacing: 1px;
}

.contact-phone {
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 1px;
}

/* ===== 地点区 ===== */
.location-section {
  background: #fff;
}

.location-info {
  text-align: center;
  margin-bottom: 16px;
}

.location-name {
  font-size: 15px;
  color: var(--text);
  line-height: 1.8;
}

.map-container {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  margin-bottom: 16px;
}

#amap {
  width: 100%;
  height: 260px;
}

.nav-btn {
  display: block;
  width: fit-content;
  margin: 0 auto;
  padding: 12px 36px;
  background: linear-gradient(135deg, var(--gold), #e8c88a);
  color: #fff;
  border-radius: 30px;
  text-decoration: none;
  font-size: 15px;
  letter-spacing: 2px;
  box-shadow: 0 4px 12px rgba(201,169,110,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.nav-btn:active {
  transform: scale(0.97);
}

/* ===== 固定弹幕层 ===== */
.danmu-fixed {
  position: fixed;
  bottom: 16px; /* 直接贴近底部，不再依赖固定按钮高度 */
  left: 0;
  right: 60px; /* 右侧留出按钮栏宽度，弹幕不被遮挡 */
  height: 200px;
  pointer-events: none;
  z-index: 500;
  overflow: hidden;
}

.danmu-item {
  position: absolute;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  padding: 6px 14px 6px 10px;
  border-radius: 20px;
  font-size: 13px;
  animation: danmuMove linear forwards;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.danmu-item.type-gift {
  border-color: rgba(244, 167, 185, 0.6);
  background: rgba(244, 167, 185, 0.18);
}

.danmu-item.type-comment {
  border-color: rgba(201, 169, 110, 0.6);
  background: rgba(201, 169, 110, 0.18);
}

@keyframes danmuMove {
  from { transform: translateX(110vw); }
  to { transform: translateX(-110%); }
}

/* ===== 右侧固定操作栏 ===== */
.right-bar {
  position: fixed;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
}

.right-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 52px;
  padding: 8px 4px;
  background: rgba(255,255,255,0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 12px;
  cursor: pointer;
  font-size: 22px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  border: 1px solid rgba(201,169,110,0.2);
  transition: transform 0.2s, background 0.2s;
  user-select: none;
}

.right-btn span {
  font-size: 10px;
  color: var(--sub);
  margin-top: 3px;
  letter-spacing: 0;
}

.right-btn:active {
  transform: scale(0.93);
  background: rgba(255,245,240,0.95);
}

.right-btn.wish-trigger {
  border-color: rgba(201,169,110,0.35);
  background: rgba(255,249,240,0.9);
}

.right-btn.wish-trigger span { color: var(--gold); }

/* ===== 礼物标注卡片 ===== */
.gift-label {
  position: fixed;
  top: 75%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9998;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  font-size: 17px;
  color: #fff;
  letter-spacing: 1px;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0,0,0,0.55);
  animation: giftLabelIn 0.4s ease;
  transition: opacity 0.6s ease;
}

.gift-label-name { font-weight: 700; color: #ffd6e0; }
.gift-label-blessing {
  font-weight: 700;
  font-size: 22px;
  color: #ffe082;
  letter-spacing: 4px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

/* ===== 清屏开关 ===== */
.clear-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 999;
  height: 36px;
  padding: 0 12px;
  border-radius: 18px;
  border: 1.5px solid rgba(201,169,110,0.45);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #7a6a5a;
  letter-spacing: 1px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.clear-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #a08060;
  transition: color 0.2s;
}

/* 默认显示眼睛，隐藏斜线 */
.clear-icon .eye-closed { display: none; }
.clear-icon .eye-open   { display: block; }

/* 清屏状态：显示斜线，隐藏眼睛 */
.clear-btn.active .eye-closed { display: block; }
.clear-btn.active .eye-open   { display: none; }

.clear-btn.active {
  background: rgba(244,167,185,0.45);
  border-color: var(--pink);
  color: #c0405a;
}

.clear-btn.active .clear-icon { color: #c0405a; }

/* 移除旧的 ::before 伪元素 */
.clear-btn::before { content: none; }
.clear-btn.active::before { content: none; }


@keyframes giftLabelIn {
  from { transform: translate(-50%, -50%) scale(0.7); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}

/* ===== 遮罩 ===== */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
}

.overlay.show { display: block; }

/* ===== 弹窗 ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1100;
  align-items: center;
  justify-content: center;
}

.modal.show { display: flex; }

.modal-box {
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  width: 88%;
  max-width: 340px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  animation: popIn 0.25s ease;
}

@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-title {
  text-align: center;
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 20px;
  color: var(--text);
}

.modal-input, .modal-textarea {
  width: 100%;
  border: 1px solid #e8e0d0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  margin-bottom: 12px;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.2s;
}

.modal-input:focus, .modal-textarea:focus {
  border-color: var(--gold);
}

.modal-textarea {
  height: 90px;
  resize: none;
}

.modal-btns {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.modal-cancel, .modal-confirm {
  flex: 1;
  padding: 12px 0;
  border: none;
  border-radius: 30px;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.2s;
}

.modal-cancel {
  background: #f5f5f5;
  color: var(--sub);
}

.modal-confirm {
  background: linear-gradient(135deg, var(--gold), #e8c88a);
  color: #fff;
  box-shadow: 0 3px 10px rgba(201,169,110,0.35);
}

.modal-cancel:active, .modal-confirm:active { transform: scale(0.96); }

/* ===== 页脚 ===== */
body::after {
  content: '❤ 董坡 & 崔锦渝 ❤';
  display: block;
  text-align: center;
  padding: 24px 70px 24px 24px; /* 右侧留出操作栏空间 */
  color: var(--pink);
  font-size: 14px;
  letter-spacing: 3px;
  background: #fff;
}
