body {
    background-color: #ffe6f0;
    text-align: center;
    font-family: "微软雅黑", sans-serif;
    margin: 0;
    padding: 0;
    position: relative;
    min-height: 100vh;
    overflow: hidden !important; /* 强制隐藏滚动 */
    padding-bottom: 150px;
}

h1 {
    padding-top: 50px;
    color: #ff5c8d;
    margin: 0;
}

.date {
    color: #666;
    margin: 10px 0 10px;
}

.countdown {
    font-size: 24px;
    color: #ff5c8d;
    margin: 20px 0;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cake-container {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
    perspective: 1000px;
    transform-style: preserve-3d;
}

.cake-container::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 10px;
    background: rgba(0,0,0,0.1);
    border-radius: 50%;
    bottom: -15px;
    filter: blur(5px);
    z-index: -1;
    transition: transform 0.5s ease;
}

img {
    width: 300px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.5s ease, box-shadow 0.3s ease;
    transform: translateZ(0);
}

img:hover {
    transform: translateZ(20px) rotateX(5deg) rotateY(5deg);
    box-shadow: 0 20px 30px rgba(0,0,0,0.15);
}

#cake {
    animation: breathe 3s infinite ease-in-out;
}

.cake-container:hover::before {
    transform: scale(1.1);
}

.rotate {
    animation: spin 3s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

.music-btn {
    background: #ff5c8d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    margin: 20px auto;
    display: block;
    box-shadow: 0 6px 12px rgba(255, 92, 141, 0.4);
    transition: transform 0.3s ease, background-color 0.3s ease; /* 仅保留必要过渡 */
    min-width: 80px; /* 确保最小宽度 */
}

.music-btn:hover {
    transform: scale(1.05);
    background: #ffb6c1;
    box-shadow: 0 6px 12px rgba(255, 182, 193, 0.5);
}

.music-btn.playing {
    background: #d64573;
}

.music-btn.playing::before {
    content: '♫ ';
    font-size: 20px;
}

/* 引导按钮基础样式（默认隐藏） */
#guideButton {
    /* 改用 id 选择器，优先级更高 */
    background-color: #ff85a2;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 25px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255, 133, 162, 0.3);
    transition: all 0.3s;
    margin: 20px auto;
    display: none; /* 默认隐藏 */
}

/* 按钮显示状态（用 id 确保优先级） */
#guideButton.show {
    display: block;
    animation: bounce 1.5s infinite;
}

/* 按钮悬停效果 */
#guideButton:hover {
    transform: scale(1.05);
    background-color: #ff6b8f;
}

/* 弹跳动画 */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}



/* 气泡计数器样式 */
.bubble-counter {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* 新增：弹窗样式 */
.puzzle-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000; /* 确保在其他元素之上 */
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* 修改背景为渐变效果 */
    background: linear-gradient(135deg, #fff0f5 0%, #ffe6f0 100%);
    padding: 25px;
    border-radius: 15px;
    max-width: 90%;
    max-height: 80vh;
    overflow: auto;
    /* 添加阴影和边框效果 */
    box-shadow: 0 10px 30px rgba(255, 92, 141, 0.3);
    border: 1px solid rgba(255, 182, 193, 0.5);
    /* 添加顶部装饰条 */
    border-top: 5px solid #ff5c8d;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #ff5c8d;
    font-weight: bold;
    transition: all 0.3s;
}

.modal-close:hover {
    color: #d64573;
    transform: scale(1.2);
}

.puzzle-piece img {
    width: 100%;
    max-width: 200px;
    height: auto;
    /* 添加图片边框和阴影 */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.puzzle-piece img:hover {
    transform: scale(1.05);
}
.puzzle-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px; /* 增加间距 */
    padding: 20px;
}

.puzzle-piece {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    /* 添加装饰性边框 */
    border: 8px solid white;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    /* 增加旋转效果 */
    transition: transform 0.5s ease;
}

.puzzle-piece:nth-child(odd) {
    transform: rotate(-2deg);
}

.puzzle-piece:nth-child(even) {
    transform: rotate(2deg);
}

.puzzle-piece:hover {
    transform: rotate(0deg) scale(1.08);
    z-index: 10;
}

.puzzle-piece img {
    width: 100%;
    max-width: 200px;
    height: auto;
    display: block;
    transition: all 0.4s ease;
    filter: saturate(1.1);
}

/* 添加图片悬停效果 */
.puzzle-piece:hover img {
    filter: saturate(1.3) brightness(1.05);
    transform: scale(1.1);
}

/* 添加图片角落装饰 */
.puzzle-piece::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ff5c8d"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8 8zm-1-13h2v6h-2zm0 8h2v2h-2zm0 8h2v2h-2z"/></svg>');
    opacity: 0.7;
    transition: all 0.3s ease;
}

.puzzle-piece:hover::before {
    transform: rotate(15deg) scale(1.3);
    opacity: 1;
}

/* 添加底部渐变遮罩 */
.puzzle-piece::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(transparent, rgba(0,0,0,0.15));
    pointer-events: none;
}
.puzzle-piece img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.5s ease;
    filter: brightness(0.9);
    animation: subtleMove 8s infinite alternate;
}

.puzzle-piece:hover img {
    transform: scale(1.1);
    filter: brightness(1.1) saturate(1.05);
}

.puzzle-piece {
    width: 22%;
    height: 15vw;
    max-height: 200px;
    min-height: 100px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: rotateY(45deg) translateZ(-50px);
    opacity: 0.7;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.puzzle-piece::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.puzzle-piece:hover::after {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 15px rgba(255, 182, 193, 0.7);
}

@keyframes subtleMove {
    0% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(1px, -1px) scale(1.01); }
    50% { transform: translate(-1px, 1px) scale(0.99); }
    75% { transform: translate(1px, 1px) scale(1.01); }
    100% { transform: translate(-1px, -1px) scale(1); }
}

@keyframes borderPulse {
    0% { box-shadow: 0 0 0 rgba(255, 182, 193, 0); }
    50% { box-shadow: 0 0 15px rgba(255, 182, 193, 0.8); }
    100% { box-shadow: 0 0 0 rgba(255, 182, 193, 0); }
}

.puzzle-piece.assembled {
    transform: rotateY(0) translateZ(0);
    opacity: 1;
    animation: borderPulse 3s infinite;
}

/* 为每个拼图添加不同的初始位置 */
.puzzle-piece[data-index="1"] {
    transform: translateX(-50px) rotate(-10deg);
}

.puzzle-piece[data-index="2"] {
    transform: translateY(30px) rotate(5deg);
}

.puzzle-piece[data-index="3"] {
    transform: translateY(-20px) rotate(-8deg);
}

.puzzle-piece[data-index="4"] {
    transform: translateX(50px) rotate(12deg);
}
.message {
    background-color: rgba(255, 255, 255, 0.8);
    width: 80%;
    max-width: 600px;
    margin: 0 auto 50px;
    padding: 20px;
    border-radius: 10px;
    color: #333;
    line-height: 1.6;
}

@keyframes confetti {
    0% {
        transform: translateY(-10vh) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(110vh) rotate(720deg) scale(0.8);
        opacity: 0.2;
    }
}

.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    animation: confetti 5s infinite;
    pointer-events: none;
}

/* 祝福气泡样式 */
.bubble {
    position: absolute;
    padding: 10px 15px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    animation: floatUp 4s ease-in-out forwards;
    font-size: 14px;
    color: #333;
    max-width: 200px;
}

/* 气泡漂浮动画 */
@keyframes floatUp {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-150px) rotate(10deg);
        opacity: 0;
    }
}

/* 吹蜡烛相关动画 */
.candle.blown .flame {
    animation: flameOut 0.5s forwards;
}

@keyframes flameOut {
    0% { opacity: 1; transform: translateX(-50%) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) scale(0.3); }
}

.candle.blown {
    background: linear-gradient(to bottom, #f0f0f0, #ff8fa3);
}

@media (max-width: 768px) {
    img {
        max-width: 90%;
    }
    .message {
        width: 90%;
    }
    .music-btn {
        font-size: 14px;
        padding: 8px 16px;
    }
    .music-btn {
        /* 确保没有display: none或opacity: 0等隐藏属性 */
        display: block !important;
        opacity: 1 !important;
    }
}


/* 时光胶囊按钮样式 */
#timeCapsuleBtn {
    margin-top: 10px;
    background-color: #ff85a2;
}

/* 照片墙样式 */
.photo-gallery {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.gallery-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 1001;
}

.gallery-container {
    position: relative;
    width: 80%;
    max-width: 800px;
}

.gallery-slides {
    height: 600px;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.gallery-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

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

.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
}

.photo-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px;
    font-size: 18px;
    box-sizing: border-box;
}

.gallery-prev, .gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
    border: none;
    font-size: 30px;
    padding: 15px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.gallery-prev:hover, .gallery-next:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.gallery-prev {
    left: 0;
    border-radius: 0 5px 5px 0;
}

.gallery-next {
    right: 0;
    border-radius: 5px 0 0 5px;
}

/* 照片放大查看样式 */
.photo-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1002;
}

.viewer-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

.viewer-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .gallery-slides {
        height: 400px;
    }
    .photo-caption {
        font-size: 14px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .gallery-slides {
        height: 300px;
    }
    .gallery-prev, .gallery-next {
        font-size: 20px;
        padding: 10px;
    }
    /* 新增超小屏适配 */
    .puzzle-piece {
        width: 45%; /* 在超小屏幕上显示2列 */
        height: 30vw;
    }
    .collapsible-container {
        width: 120px; /* 减小容器宽度 */
    }
}

/* 新增更小屏幕适配 */
@media (max-width: 320px) {
    .float-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
        bottom: 20px;
        right: 20px;
    }
    .message {
        padding: 15px 10px;
        font-size: 14px;
    }
}

/* 密码输入错误抖动动画 */
@keyframes shake {
    0%, 100% { transform: translateX(-50%); }
    20%, 60% { transform: translateX(-55%); }
    40%, 80% { transform: translateX(-45%); }
}

.password-input.shake {
    animation: shake 0.5s ease;
    border: 2px solid #ff4d4f;
}


/* 新增：漂浮按钮样式 */
.float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #ff5c8d;
    color: white;
    font-size: 24px;
    border: none;
    box-shadow: 0 4px 12px rgba(255, 92, 141, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.float-btn:hover {
    transform: scale(1.1);
    background-color: #ff85a2;
}

/* 新增：留言表单样式 */
.message-form {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    width: 80%;
    max-width: 400px;
    display: none;
    z-index: 1001;
}

.message-form h3 {
    color: #ff5c8d;
    margin-top: 0;
}

#messageContent {
    width: 100%;
    height: 120px;
    padding: 10px;
    margin: 15px 0;
    border: 1px solid #ffccd5;
    border-radius: 8px;
    resize: none;
    box-sizing: border-box;
}

.form-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding: 0 10px;
    width: calc(100% - 20px);
    box-sizing: border-box;
}

/* 提交和取消按钮样式 */
#submitMessage, #cancelMessage {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    width: 48%;
    transition: all 0.3s ease;
    height: 40px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin: 0;
    vertical-align: middle;
}

#submitMessage {
    background-color: #ff5c8d;
    color: white;
}

#cancelMessage {
    background-color: #e0e0e0;
    color: #333;
    /* 确保与提交按钮样式完全一致 */
}

#submitMessage:hover {
    background-color: #ff4081;
}

#cancelMessage:hover {
    background-color: #cccccc;
}

/* 新增：留言展示区域样式 */
.messages-container {
    max-width: 800px;
    margin: 30px auto;
    padding: 0 20px;
}

.messages-container h3 {
    color: #ff5c8d;
}

#messagesList {
    margin-top: 20px;
}

.message-item {
    background-color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
}

.message-item .message-text {
    color: #333;
    line-height: 1.6;
}

.message-item .message-time {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
    text-align: right;
}

.message-item .delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #ff5c8d;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.7;
}

.message-item:hover .delete-btn {
    opacity: 1;
}
/* 拼图回忆区域样式 */
.puzzle-memory {
    padding: 40px 20px;
    text-align: center;
}

.puzzle-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    perspective: 1000px;
}

.puzzle-piece {
    width: 22%;
    height: 15vw;
    max-height: 200px;
    min-height: 100px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: rotateY(45deg) translateZ(-50px);
    opacity: 0.7;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 新增媒体查询，优化移动端显示 */
@media (max-width: 768px) {
    .puzzle-container {
        gap: 8px; /* 减小移动端间距 */
        padding: 0 5px; /* 添加左右内边距，防止边缘被截断 */
    }
    
    .puzzle-piece {
        width: 23%; /* 略微增加移动端宽度占比 */
        height: 20vw; /* 增加移动端高度占比 */
    }
}

/* 小屏手机额外适配 */
@media (max-width: 480px) {
    .puzzle-piece {
        height: 25vw;
    }
}
.puzzle-piece img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.5s ease;
    filter: brightness(0.9);
    animation: subtleMove 8s infinite alternate;
}

.puzzle-piece:hover img {
    transform: scale(1.1);
    filter: brightness(1.1) saturate(1.05);
}

.puzzle-piece {
    width: 22%;
    height: 15vw;
    max-height: 200px;
    min-height: 100px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: rotateY(45deg) translateZ(-50px);
    opacity: 0.7;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.puzzle-piece::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.puzzle-piece:hover::after {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 15px rgba(255, 182, 193, 0.7);
}

@keyframes subtleMove {
    0% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(1px, -1px) scale(1.01); }
    50% { transform: translate(-1px, 1px) scale(0.99); }
    75% { transform: translate(1px, 1px) scale(1.01); }
    100% { transform: translate(-1px, -1px) scale(1); }
}

@keyframes borderPulse {
    0% { box-shadow: 0 0 0 rgba(255, 182, 193, 0); }
    50% { box-shadow: 0 0 15px rgba(255, 182, 193, 0.8); }
    100% { box-shadow: 0 0 0 rgba(255, 182, 193, 0); }
}

.puzzle-piece.assembled {
    transform: rotateY(0) translateZ(0);
    opacity: 1;
    animation: borderPulse 3s infinite;
}

/* 为每个拼图添加不同的初始位置 */
.puzzle-piece[data-index="1"] {
    transform: translateX(-50px) rotate(-10deg);
}

.puzzle-piece[data-index="2"] {
    transform: translateY(30px) rotate(5deg);
}

.puzzle-piece[data-index="3"] {
    transform: translateY(-20px) rotate(-8deg);
}

.puzzle-piece[data-index="4"] {
    transform: translateX(50px) rotate(12deg);
}
/* 新增：左下角折叠菜单样式 */
.collapsible-container {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 999;
}

.memory-collapsible {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    width: 150px; /* 宽度从200px调整为150px */
    min-height: 60px; /* 增加最小高度 */
}

.memory-collapsible summary {
    padding: 15px 20px; /* 增加内边距，提高高度 */
    font-weight: bold;
    color: #ff5c8d;
    cursor: pointer;
    list-style: none;
    position: relative;
    background-color: white;
}

.memory-collapsible summary::-webkit-details-marker {
    display: none;
}

.memory-collapsible summary::after {
    content: '▼';
    position: absolute;
    right: 20px;
    font-size: 14px;
    transition: transform 0.3s ease;
}

.memory-collapsible[open] summary::after {
    transform: rotate(180deg);
}

.collapsible-content {
    padding: 15px 10px; /* 调整内边距 */
    background-color: rgba(255, 255, 255, 0.8);
    border-top: 1px solid #f0f0f0;
}

.memory-btn {
    width: 100%;
    margin: 10px 0; /* 增加按钮间距，提高整体高度 */
    padding: 10px 16px; /* 增加按钮内边距，提高单个按钮高度 */
    box-sizing: border-box;
}
.puzzle-piece {
    width: 22%;
    height: 15vw;
    max-height: 200px;
    min-height: 100px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: rotateY(45deg) translateZ(-50px);
    opacity: 0.7;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 新增媒体查询，优化移动端显示 */
@media (max-width: 768px) {
    .puzzle-container {
        gap: 8px; /* 减小移动端间距 */
        padding: 0 5px; /* 添加左右内边距，防止边缘被截断 */
    }
    
    .puzzle-piece {
        width: 23%; /* 略微增加移动端宽度占比 */
        height: 20vw; /* 增加移动端高度占比 */
    }
}

/* 小屏手机额外适配 */
@media (max-width: 480px) {
    .puzzle-piece {
        height: 25vw;
    }
}
.puzzle-piece img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.5s ease;
    filter: brightness(0.9);
    animation: subtleMove 8s infinite alternate;
}

.puzzle-piece:hover img {
    transform: scale(1.1);
    filter: brightness(1.1) saturate(1.05);
}

.puzzle-piece {
    width: 22%;
    height: 15vw;
    max-height: 200px;
    min-height: 100px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: rotateY(45deg) translateZ(-50px);
    opacity: 0.7;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.puzzle-piece::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.puzzle-piece:hover::after {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 15px rgba(255, 182, 193, 0.7);
}

@keyframes subtleMove {
    0% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(1px, -1px) scale(1.01); }
    50% { transform: translate(-1px, 1px) scale(0.99); }
    75% { transform: translate(1px, 1px) scale(1.01); }
    100% { transform: translate(-1px, -1px) scale(1); }
}

@keyframes borderPulse {
    0% { box-shadow: 0 0 0 rgba(255, 182, 193, 0); }
    50% { box-shadow: 0 0 15px rgba(255, 182, 193, 0.8); }
    100% { box-shadow: 0 0 0 rgba(255, 182, 193, 0); }
}

.puzzle-piece.assembled {
    transform: rotateY(0) translateZ(0);
    opacity: 1;
    animation: borderPulse 3s infinite;
}

/* 为每个拼图添加不同的初始位置 */
.puzzle-piece[data-index="1"] {
    transform: translateX(-50px) rotate(-10deg);
}

.puzzle-piece[data-index="2"] {
    transform: translateY(30px) rotate(5deg);
}

.puzzle-piece[data-index="3"] {
    transform: translateY(-20px) rotate(-8deg);
}

.puzzle-piece[data-index="4"] {
    transform: translateX(50px) rotate(12deg);
}
.message {
    background-color: rgba(255, 255, 255, 0.8);
    width: 80%;
    max-width: 600px;
    margin: 0 auto 50px;
    padding: 20px;
    border-radius: 10px;
    color: #333;
    line-height: 1.6;
}

@keyframes confetti {
    0% {
        transform: translateY(-10vh) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(110vh) rotate(720deg) scale(0.8);
        opacity: 0.2;
    }
}

.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    animation: confetti 5s infinite;
    pointer-events: none;
}

/* 祝福气泡样式 */
.bubble {
    position: absolute;
    padding: 10px 15px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    animation: floatUp 4s ease-in-out forwards;
    font-size: 14px;
    color: #333;
    max-width: 200px;
}

/* 气泡漂浮动画 */
@keyframes floatUp {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-150px) rotate(10deg);
        opacity: 0;
    }
}

/* 吹蜡烛相关动画 */
.candle.blown .flame {
    animation: flameOut 0.5s forwards;
}

@keyframes flameOut {
    0% { opacity: 1; transform: translateX(-50%) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) scale(0.3); }
}

.candle.blown {
    background: linear-gradient(to bottom, #f0f0f0, #ff8fa3);
}

@media (max-width: 768px) {
    img {
        max-width: 90%;
    }
    .message {
        width: 90%;
    }
    .music-btn {
        font-size: 14px;
        padding: 8px 16px;
    }
    .music-btn {
        /* 确保没有display: none或opacity: 0等隐藏属性 */
        display: block !important;
        opacity: 1 !important;
    }
}


/* 时光胶囊按钮样式 */
#timeCapsuleBtn {
    margin-top: 10px;
    background-color: #ff85a2;
}

/* 照片墙样式 */
.photo-gallery {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.gallery-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 1001;
}

.gallery-container {
    position: relative;
    width: 80%;
    max-width: 800px;
}

.gallery-slides {
    height: 600px;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.gallery-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

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

.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
}

.photo-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px;
    font-size: 18px;
    box-sizing: border-box;
}

.gallery-prev, .gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
    border: none;
    font-size: 30px;
    padding: 15px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.gallery-prev:hover, .gallery-next:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.gallery-prev {
    left: 0;
    border-radius: 0 5px 5px 0;
}

.gallery-next {
    right: 0;
    border-radius: 5px 0 0 5px;
}

/* 照片放大查看样式 */
.photo-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1002;
}

.viewer-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

.viewer-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .gallery-slides {
        height: 400px;
    }
    .photo-caption {
        font-size: 14px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .gallery-slides {
        height: 300px;
    }
    .gallery-prev, .gallery-next {
        font-size: 20px;
        padding: 10px;
    }
}

/* 密码输入错误抖动动画 */
@keyframes shake {
    0%, 100% { transform: translateX(-50%); }
    20%, 60% { transform: translateX(-55%); }
    40%, 80% { transform: translateX(-45%); }
}

.password-input.shake {
    animation: shake 0.5s ease;
    border: 2px solid #ff4d4f;
}


/* 新增：漂浮按钮样式 */
.float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #ff5c8d;
    color: white;
    font-size: 24px;
    border: none;
    box-shadow: 0 4px 12px rgba(255, 92, 141, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.float-btn:hover {
    transform: scale(1.1);
    background-color: #ff85a2;
}

/* 新增：留言表单样式 */
.message-form {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    width: 80%;
    max-width: 400px;
    display: none;
    z-index: 1001;
}

.message-form h3 {
    color: #ff5c8d;
    margin-top: 0;
}

#messageContent {
    width: 100%;
    height: 120px;
    padding: 10px;
    margin: 15px 0;
    border: 1px solid #ffccd5;
    border-radius: 8px;
    resize: none;
    box-sizing: border-box;
}

.form-buttons {
    display: flex;
    justify-content: space-around;
}

.form-buttons button {
    padding: 8px 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

#submitMessage {
    background-color: #ff5c8d;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin: 20px auto 30px;
    display: block;
    box-shadow: 0 6px 12px rgba(255, 92, 141, 0.4);
    transition: all 0.3s ease;
}

.memory-btn:hover {
    transform: scale(1.05);
    background-color: #ff85a2;
    box-shadow: 0 6px 12px rgba(255, 133, 162, 0.5);
}

.memory-btn:active {
    transform: scale(0.98);
}

#cancelMessage {
    background-color: #e0e0e0;
    color: #333;
}

/* 新增：留言展示区域样式 */
.messages-container {
    max-width: 800px;
    margin: 30px auto;
    padding: 0 20px;
}

.messages-container h3 {
    color: #ff5c8d;
}

#messagesList {
    margin-top: 20px;
}

.message-item {
    background-color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
}

.message-item .message-text {
    color: #333;
    line-height: 1.6;
}

.message-item .message-time {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
    text-align: right;
}

.message-item .delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #ff5c8d;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.7;
}

.message-item:hover .delete-btn {
    opacity: 1;
}