/* ========== 基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #ffafbd, #ffc3a0);
}

/* 页面切换基础 */
.page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    overflow: hidden;
}

.page.active {
    display: block;
}

.hidden {
    display: none !important;
}

/* ========== 音乐控制 ========== */
.music-control {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.music-control:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.5);
}

.music-note {
    font-size: 24px;
    color: #ff6b93;
    animation: rotate 2s linear infinite;
    animation-play-state: paused; /* 新增：默认暂停 */
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 可选：添加暂停状态的视觉反馈 */
.music-control.paused .music-note {
    opacity: 0.6;
}
/* ========== 页面1: 入口页 ========== */
/* ========== 页面1: 入口页 ========== */
#page-index {
    background: linear-gradient(135deg, #ffafbd, #ffc3a0);
}

#page-index .container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

#page-index .birthday-text {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeIn 2s ease-in-out;
}

#page-index .birthday-text h1 {
    font-size: 4rem;
    color: #ff6b93;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
}

#page-index .birthday-text p {
    font-size: 1.8rem;
    color: #ff8fab;
}

.gift-btn {
    padding: 15px 40px;
    font-size: 1.5rem;
    background: linear-gradient(45deg, #ff6b93, #ff8fab);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(255, 107, 147, 0.4);
}

.gift-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 107, 147, 0.6);
}

/* 密码模态框 */
.password-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    min-width: 300px;
}

.modal-content h3 {
    color: #ff6b93;
    margin-bottom: 20px;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #ffafbd;
    border-radius: 10px;
    font-size: 1.1rem;
    text-align: center;
}

.modal-content button {
    padding: 10px 30px;
    background: #ff6b93;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
}

.error-msg {
    color: red;
    margin-top: 10px;
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
/* ========== 页面2: 主页面 ========== */
#page-main {
    background: linear-gradient(135deg, #ffafbd, #ffc3a0);
}

#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.countdown-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    background: rgba(255, 182, 193, 0.1);
}

.countdown-number {
    font-size: 20rem;
    font-weight: bold;
    color: #ff3366;
    text-shadow: 0 0 30px rgba(255, 51, 102, 0.7);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.main-content {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3;
}

.content-wrapper {
    text-align: center;
    transform: translateY(-20px);
}

.age-transition {
    margin-bottom: 30px;
    font-size: 5rem;
    color: #ff3366;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
}

.age-18, .age-19 {
    font-weight: bold;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    backdrop-filter: blur(5px);
}

.age-18 {
    animation: fadeOutAge 1s ease-in 3s forwards;
}

.age-19 {
    opacity: 0;
    animation: fadeInAge 1s ease-out 3s forwards;
}

.transition-arrow {
    font-size: 4rem;
    color: #ff3366;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes fadeOutAge {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes fadeInAge {
    from { opacity: 0; }
    to { opacity: 1; }
}

.birthday-title {
    font-size: 4rem;
    color: #fff;
    margin: 20px 0;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
    animation: colorChange 5s infinite alternate;
    background: linear-gradient(45deg, #ff3366, #ff6699);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes colorChange {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.name-title {
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 40px;
    animation: slideIn 1s ease-out;
    text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.3);
}

@keyframes slideIn {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.adventure-btn {
    padding: 15px 50px;
    font-size: 1.8rem;
    background: linear-gradient(45deg, #ff3366, #ff6699);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(233, 138, 200, 0.5);
    position: relative;
    overflow: hidden;
    z-index: 20;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    font-weight: bold;
    letter-spacing: 2px;
}

.adventure-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 25px rgba(255, 51, 102, 0.7);
    background: linear-gradient(45deg, #ff6699, #ff3366);
}

.adventure-btn:active {
    transform: translateY(-2px) scale(1.02);
}

.barrage-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.barrage-item {
    position: absolute;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    font-weight: 500;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    animation: barrageMove linear forwards;
    padding: 5px 10px;
    border-radius: 20px;
    background: rgba(220, 130, 225, 0.2);
    backdrop-filter: blur(2px);
    z-index: 1;
}

@keyframes barrageMove {
    from { transform: translateX(100vw); }
    to { transform: translateX(-100%); }
}

/* ========== 页面3: 故事页 ========== */
#page-story {
    font-family: "Work Sans", sans-serif;
    background: linear-gradient(135deg, #ffafbd, #ffc3a0, #ffdde1);
}



.story-container {
    height: 100vh;
    width: 100vw;
    margin: 0 auto;
    text-align: center;
    visibility: visible; /* 容器本身可见 */
    position: relative;
    overflow: hidden;
}

.story-container div.six {
    top: 10vh;
    z-index: 1;
}

.story-container div.seven,
.story-container div.eight {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
}

.story-container > div {
    position: absolute;
    left: 0;
    right: 0;
    top: 20vh;
}

.story-container .one {
    font-size: 4.5rem;
    color: #ff6b93;
}

.story-container .one > img {
    vertical-align: middle;
    margin-bottom: 10px;
    max-width: 100%;
    height: auto;
}

.story-container .two {
    font-size: 1.2rem;
    font-weight: lighter;
    color: #ff8fab;
}

.story-container .three {
    font-size: 3rem;
    color: #ff6b93;
}

.four .text-box {
    width: 600px;
    margin: 0 auto;
    border: 3px solid #ffafbd;
    border-radius: 15px;
    padding: 15px;
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 5px 15px rgba(255, 107, 147, 0.3);
}

.text-box p {
    margin: 0;
    text-align: left;
    color: #666;
}

.text-box span {
    visibility: hidden;
}

.text-box .fake-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    color: #fff;
    background: linear-gradient(45deg, #ff6b93, #ff8fab);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.text-box .fake-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(255, 107, 147, 0.5);
}

.five p {
    font-size: 2rem;
    position: absolute;
    left: 0;
    right: 0;
    color: #ff6b93;
}

.idea-3 strong {
    padding: 3px 8px;
    border-radius: 5px;
    display: inline-block;
    background: linear-gradient(45deg, #ff6b93, #ff8fab);
    color: white;
}

.five .idea-5 {
    font-size: 4rem;
    color: #ff6b93;
}

.idea-5 span,
.idea-6 span,
.wish-hbd span {
    display: inline-block;
}

.idea-6 span {
    font-size: 15rem;
    color: #ff6b93;
    text-shadow: 3px 3px 10px rgba(255, 107, 147, 0.5);
}

.six {
    position: relative;
}

.six img {
    display: inline-block;
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.six .hat {
    position: absolute;
    width: 80px;
    top: -35px;
    left: 41.5%;
    z-index: 10;
}

.baloons img {
    display: inline-block;
    position: absolute;
    z-index: -1;
}

.baloons img:nth-child(even) {
    left: -10%;
}

.baloons img:nth-child(odd) {
    right: -10%;
}

.baloons img:nth-child(3n + 0) {
    left: 30%;
}

.eight svg {
    width: 25px;
    position: absolute;
    top: 0;
    left: 0;
    visibility: hidden;
    z-index: -1;
    fill: #ff6b93;
}

.eight svg:nth-child(1) { top: 7vh; left: 5vw; fill: #ffafbd; }
.eight svg:nth-child(2) { top: 23vh; left: 35vw; fill: #ffc3a0; }
.eight svg:nth-child(3) { top: 33vh; left: 23vw; fill: #ff8fab; }
.eight svg:nth-child(4) { top: 43vh; left: 57vw; fill: #ff6b93; }
.eight svg:nth-child(5) { top: 68vh; left: 7vw; fill: #ffafbd; }
.eight svg:nth-child(6) { top: 42vh; left: 77vw; fill: #ffc3a0; }
.eight svg:nth-child(7) { top: 68vh; left: 83vw; fill: #ff8fab; }
.eight svg:nth-child(8) { top: 86vh; left: 37vw; fill: #ff6b93; }
.eight svg:nth-child(9) { top: 94vh; left: 87vw; fill: #ffafbd; }

.wish-hbd {
    font-size: 3em;
    margin: 0;
    text-transform: uppercase;
    color: #ff6b93;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
}

.wish h5 {
    font-weight: lighter;
    font-size: 2rem;
    margin: 10px 0 0;
    color: #ff8fab;
}

.nine p {
    font-size: 2rem;
    font-weight: lighter;
    color: #ff6b93;
}

#replay {
    z-index: 3;
    cursor: pointer;
}

.story-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
    flex-wrap: wrap;
}

/* 按钮禁用状态样式 - 解决提前可点击问题 */
.story-controls.disabled {
    pointer-events: none; /* 禁用所有点击事件 */
   
}

.story-controls.disabled .control-btn {
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.control-btn {
    padding: 12px 25px;
    font-size: 1.1rem;
    background: linear-gradient(45deg, #ff6b93, #ff8fab);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(255, 107, 147, 0.4);
}

.control-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 107, 147, 0.6);
}

.hearts-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}
/* ========== 页面4: 照片墙 ========== */
#page-gallery {
    background: linear-gradient(135deg, #ffafbd, #ffc3a0);
}

.gallery-normal {
    width: 100%;
    min-height: 100vh;
    padding: 20px;
}

.gallery-header {
    text-align: center;
    margin-bottom: 30px;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.gallery-header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
}

.gallery-container {
    position: relative;
    max-width: 900px;
    margin: 0 auto 40px;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.photo-slider {
    display: flex;
    transition: transform 0.5s ease;
    height: 500px;
}

.photo-slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

.photo-item {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.photo-caption {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px;
    text-align: center;
    border-radius: 0 0 10px 10px;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.7);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.prev-btn { left: 15px; }
.next-btn { right: 15px; }

.photo-indicators {
    display: flex;
    justify-content: center;
    padding: 15px;
    gap: 10px;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    background: white;
    transform: scale(1.2);
}

/* 控制按钮 - 使用原始逻辑：初始隐藏，最后一张显示 */
.gallery-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.gallery-controls.hidden {
    display: none !important;
}

/* 全屏模式 */
.gallery-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gallery-fullscreen.hidden {
    display: none !important;
}

.heart-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.bg-text {
    font-size: 4rem;
    color: rgba(255, 107, 147, 0.3);
    text-align: center;
    line-height: 1.5;  /* 增加行高 */
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* 方式二需要这个 */
.bg-text div {
    margin: 10px 0;
}

.heart-container {
    position: relative;
    width: 80vmin;
    height: 80vmin;
    z-index: 2;
}

.heart-photo {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 5px;
    overflow: hidden;
    opacity: 0.7;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.heart-photo:hover {
    opacity: 1;
    transform: scale(1.1);
    z-index: 3;
}

.heart-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.exit-fullscreen {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    z-index: 101;
    transition: all 0.3s ease;
}

.exit-fullscreen:hover {
    background: rgba(255, 255, 255, 0.3);
}

.fullscreen-control-btn {
    position: fixed;
    bottom: 70px;
    right: 20px;
    padding: 10px 20px;
    background: rgba(255, 107, 147, 0.7);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    z-index: 101;
    transition: all 0.3s ease;
}

.fullscreen-control-btn:hover {
    background: rgba(255, 107, 147, 0.9);
}

/* 照片模态框 */
.photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 15px;
    max-width: 80%;
    max-height: 80%;
    text-align: center;
    overflow-y: auto;
}

.modal-photo {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.modal-caption {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.5;
}

.modal-close {
    padding: 8px 20px;
    background: #ff6b93;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
}

/* ========== 页面5: 烟花页 ========== */
#page-fireworks {
    background: #000;
}

#fireworksCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.birthday-text-fireworks {
    position: fixed;
    bottom: 50px;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 2;
    pointer-events: none;
}

.birthday-text-fireworks h1 {
    font-size: 3.5rem;
    color: #fff;
    text-shadow: 0 0 10px #ff6b93, 0 0 20px #ff6b93, 0 0 30px #ff6b93;
    animation: glow 2s ease-in-out infinite alternate;
    margin: 0;
}

@keyframes glow {
    from {
        text-shadow: 0 0 10px #ff6b93, 0 0 20px #ff6b93, 0 0 30px #ff6b93;
    }
    to {
        text-shadow: 0 0 15px #ff6b93, 0 0 25px #ff6b93, 0 0 35px #ff6b93, 0 0 45px #ff6b93;
    }
}

.fireworks-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 3;
}

.fireworks-controls .control-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.fireworks-controls .control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* ========== 响应式设计 ========== */
@media screen and (max-width: 768px) {
    #index .birthday-text h1 { font-size: 2.5rem; }
    
    .countdown-number { font-size: 12rem; }
    .age-transition { font-size: 3.5rem; }
    .age-18, .age-19 { width: 70px; height: 70px; }
    .birthday-title { font-size: 2.8rem; }
    .name-title { font-size: 2rem; }
    .adventure-btn { padding: 12px 30px; font-size: 1.5rem; }
    
    .story-container .one { font-size: 3rem; }
    .story-container .three { font-size: 2.5rem; }
    .four .text-box { width: 90%; }
    .idea-6 span { font-size: 10rem; }
    .wish-hbd { font-size: 2.2em; }
    
    .gallery-header h1 { font-size: 2rem; }
    .photo-slider { height: 400px; }
    .nav-btn { width: 40px; height: 40px; font-size: 20px; }
    .bg-text { font-size: 2.5rem; }
    .heart-photo { width: 60px; height: 60px; }
    
    .birthday-text-fireworks h1 { font-size: 2.5rem; }
}

@media screen and (max-width: 480px) {
    .countdown-number { font-size: 8rem; }
    .age-transition { font-size: 2.5rem; gap: 10px; }
    .age-18, .age-19 { width: 50px; height: 50px; }
    .transition-arrow { font-size: 2.5rem; }
    .birthday-title { font-size: 2.2rem; }
    .name-title { font-size: 1.6rem; }
    .adventure-btn { padding: 10px 25px; font-size: 1.3rem; }
    
    .story-controls { flex-direction: column; align-items: center; }
    .control-btn { width: 80%; margin-bottom: 10px; }
}

/* 全局预加载进度条 */
#global-preload-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(to right, #ff6b93, #00bfff);
    z-index: 99999;
    transition: width 0.3s ease;
    pointer-events: none;
    opacity: 0.8;
}

/* 完成时隐藏 */
#global-preload-progress.complete {
    opacity: 0;
    transition: opacity 0.5s ease 1s;
}