:root {
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: white;
  /* 动态渐变背景 */
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
}
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* 防止出现滚动条导致视觉偏移 */
}

.container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative; /* 为绝对定位的场景提供参考 */
}


@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 评论墙容器：确保在屏幕中占据合适位置 */
#comments-wall {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: clamp(15px, 3vw, 30px);
    width: 100%;
    max-width: 1000px;
    margin: 40px auto;
    perspective: 1000px; /* 为子元素提供3D视距 */
}

/* 评论卡片：信封便签风格 */
.comment-box {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: clamp(12px, 2vw, 20px) clamp(18px, 3vw, 30px);
    color: white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    
    /* 文字自适应 */
    font-size: clamp(1rem, 2.2vw, 1.4rem);
    line-height: 1.5;
    
    /* 进场动画：由小变大并淡入 */
    opacity: 0;
    transform: scale(0.5) translateY(20px);
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* 发送者名字高亮 */
.comment-box strong {
    display: block; /* 名字换行显示，更有信件感 */
    color: #ffeaa7; /* 温暖的淡黄色 */
    font-size: 0.85em;
    margin-bottom: 5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 鼠标悬停交互：卡片浮起并变亮 */
.comment-box:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05) translateY(-5px) !important; /* 强制覆盖JS生成的随机旋转 */
    transition: all 0.3s ease;
    z-index: 10;
}

/* 进场关键帧 */
@keyframes popIn {
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 持续漂浮动画：增加画面的生命感 */
.comment-floating {
    animation: gentleWobble 4s ease-in-out infinite alternate;
}

@keyframes gentleWobble {
    from { transform: translate(0, 0) rotate(-2deg); }
    to { transform: translate(5px, -10px) rotate(2deg); }
}

/* 场景一、二的大标题 */
h1 {
    /* 最小 2rem(32px)，最大 5rem(80px)，随屏幕宽度自动缩放 */
    font-size: clamp(2rem, 8vw, 5rem);
    line-height: 1.2;
    margin-bottom: 20px;
}

/* 姓名与年龄高亮 */
.highlight {
    /* 比普通 H1 更显著 */
    font-size: clamp(2.2rem, 10vw, 6rem);
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 165, 0, 0.5);
    display: inline-block;
    margin: 0 5px;
}

/* 场景二的副标题（多句祝福语） */
#sub-wishes {
    font-size: clamp(1.2rem, 4vw, 2.5rem);
    font-weight: 300;
    opacity: 0.8;
}

/* 场景四的评论内容 */
.comment-box {
    /* 评论字号也要适中 */
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    max-width: 85vw; /* 防止卡片在手机上溢出 */
}

.comment-box strong {
    font-size: 1.1em; /* 名字比内容稍大 */
}

/* 场景五：最终祝福 */
#scene-5 h1 {
    font-size: clamp(2.5rem, 8vw, 7rem);
    letter-spacing: 2px;
}

.scene {
    position: absolute;
    width: 100%;
    max-width: 1200px; /* 限制最大宽度，防止大屏上文字拉得太开 */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%); /* 完美的绝对中心算法 */
    
    display: none; /* 默认隐藏 */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center; /* 确保文字行内居中 */
    
    padding: 0 20px;
    box-sizing: border-box;
    transition: opacity 0.8s ease;
}

.scene.active {
    display: flex; /* 激活时使用 flex 布局 */
}

/* 字体高亮 */
.highlight {
  font-size: 2.5rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 10px rgba(255,215,0, 0.8), 0 0 20px rgba(255,165,0, 0.6);
  display: inline-block;
  margin: 0 10px;
}


@keyframes floatUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* 输入框样式 */
input, button {
  padding: 10px 20px;
  border-radius: 20px;
  border: none;
  margin-top: 20px;
}
button { background: rgba(255,255,255,0.3); color: white; cursor: pointer; font-weight: bold;}
button:hover { background: rgba(255,255,255,0.5); }

.click-hint {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.5);
  animation: pulse 2s infinite;
  pointer-events: none; /* 防止干扰点击 */
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

/* 相册容器 */
.photo-album {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px;
    perspective: 1000px; /* 增加 3D 透视感 */
}

/* 单张照片样式 */
.album-img {
    width: clamp(150px, 30vw, 300px); /* 响应式宽度 */
    height: auto;
    border: 8px solid white;
    border-bottom: 30px solid white; /* 拍立得风格 */
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    border-radius: 2px;
    transition: transform 0.3s ease, z-index 0.3s;
    cursor: pointer;
}

.album-img:hover {
    transform: scale(1.1) rotate(0deg) !important;
    z-index: 10;
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
}

    /* 轮播容器 */
.photo-carousel {
    position: relative;
    width: clamp(280px, 80vw, 800px);
    height: clamp(350px, 60vh, 600px);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 照片基础样式 */
.carousel-img {
    position: absolute;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* 保持比例，不拉伸 */
    border: 10px solid white;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    border-radius: 4px;
    
    /* 默认隐藏 */
    opacity: 0;
    transform: scale(0.95) rotate(2deg);
    transition: opacity 1s ease-in-out, transform 1s ease-in-out;
}

/* 激活状态 */
.carousel-img.active {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    z-index: 2;
}

/* 音乐按钮样式 */
.music-control {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 9999; /* 确保在所有场景之上 */
    transition: all 0.3s ease;
}

.music-icon {
    font-size: 20px;
    transition: transform 0.3s ease;
}

/* 播放时的旋转动画 */
.music-control.playing .music-icon {
    animation: discRotate 3s linear infinite;
}

@keyframes discRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 暂停时的视觉反馈 */
.music-control.paused {
    opacity: 0.6;
}

.music-control.paused::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 2px;
    background: rgba(255, 255, 255, 0.8);
    transform: rotate(45deg);
}

