/* 元旦献礼项目 - CSS样式包 */
/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 颜色变量定义 */
    --primary-pink: #ff9a9e;
    --pink-light: #fad0c4;
    --pink-gradient: linear-gradient(135deg, var(--primary-pink) 0%, var(--pink-light) 100%);
    
    --dark-blue: #1a1a2e;
    --dark-blue-light: #16213e;
    --dark-gradient: linear-gradient(135deg, var(--dark-blue) 0%, var(--dark-blue-light) 100%);
    
    --night-blue: #000428;
    --night-blue-light: #004e92;
    --night-gradient: linear-gradient(180deg, var(--night-blue) 0%, var(--night-blue-light) 100%);
    
    --gold: #ffd700;
    --gold-light: #fff9c4;
    --red: #ff6b6b;
    --text-light: rgba(255, 255, 255, 0.9);
    --text-lighter: rgba(255, 255, 255, 0.7);
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: #0a0a1a;
    color: #fff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    line-height: 1.6;
}

/* 页面容器样式 */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
}

.page:not(.active) {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

/* 画布基础样式 */
canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ===== 页面1：启动页样式 ===== */
#page1 {
    background: var(--pink-gradient);
    z-index: 10;
}

.welcome-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    border-radius: 25px;
    padding: 3rem 2.5rem;
    text-align: center;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    max-width: 600px;
    margin: 0 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 2;
    animation: cardFloat 6s ease-in-out infinite;
}

@keyframes cardFloat {
    0%, 100% { transform: translateY(0px) rotate(0.5deg); }
    50% { transform: translateY(-10px) rotate(-0.5deg); }
}

.year-text {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #ff0844, #ffb199);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    animation: textGlow 3s ease-in-out infinite alternate;
}

@keyframes textGlow {
    from { text-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); }
    to { text-shadow: 0 5px 25px rgba(255, 107, 107, 0.3); }
}

.subtitle {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--text-light);
    font-weight: 300;
}

.welcome-card h2 {
    font-size: 2.5rem;
    margin: 1rem 0;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.welcome-message {
    font-size: 1.1rem;
    margin: 1.5rem 0;
    color: var(--text-lighter);
}

.start-button {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    border: none;
    border-radius: 50px;
    color: white;
    padding: 1.2rem 3rem;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s ease;
    box-shadow: 
        0 8px 20px rgba(255, 107, 107, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 2.5rem auto 1rem;
    position: relative;
    overflow: hidden;
}

.start-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.start-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 
        0 15px 30px rgba(255, 107, 107, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.2);
}

.start-button:hover::before {
    left: 100%;
}

.start-button:active {
    transform: translateY(-2px) scale(1.02);
}

/* ===== 页面2：主题页样式 ===== */
#page2 {
    background: var(--dark-gradient);
    z-index: 20;
}

/* 倒计时容器样式 */
.countdown-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(10, 10, 26, 1); /* 完全不透明背景确保不漏内容 */
    z-index: 100; /* 提高层级确保在最上层 */
    transition: opacity 0.8s ease;
}

.countdown-number {
    font-size: 15rem;
    font-weight: 900;
    color: var(--red);
    text-shadow: 
        0 0 30px rgba(255, 107, 107, 0.8),
        0 0 60px rgba(255, 107, 107, 0.4);
    position: absolute;
    opacity: 0;
    transform: scale(0.3) rotate(-30deg);
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.countdown-number.active {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* 主内容区域样式 */
.main-content {
    text-align: center;
    z-index: 22;
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.blessing-title {
    font-size: 4.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #ffd89b, #19547b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: titlePulse 4s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.special-person {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
    gap: 1rem;
}

.person-name {
    font-size: 2.8rem;
    font-weight: 600;
    color: var(--gold);
    text-shadow: 
        0 0 20px rgba(255, 215, 0, 0.7),
        0 0 40px rgba(255, 215, 0, 0.3);
    animation: nameGlow 3s ease-in-out infinite alternate;
}

@keyframes nameGlow {
    from { text-shadow: 0 0 20px rgba(255, 215, 0, 0.7); }
    to { text-shadow: 0 0 30px rgba(255, 215, 0, 0.9), 0 0 60px rgba(255, 215, 0, 0.5); }
}

.decorative-left, .decorative-right {
    font-size: 2.5rem;
    color: var(--red);
    animation: decorSpin 8s linear infinite;
}

@keyframes decorSpin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

.blessing-subtitle {
    font-size: 1.4rem;
    margin-top: 1.5rem;
    color: var(--text-lighter);
    font-weight: 300;
}

/* 烟花按钮样式 - 缩小版 */
.to-fireworks-btn {
    background: transparent;
    border: 2px solid var(--gold);
    border-radius: 25px; /* 减小圆角半径 */
    color: var(--gold);
    padding: 0.7rem 1.8rem; /* 减小内边距 */
    font-size: 0.95rem; /* 减小字体大小 */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s ease;
    margin-top: 2rem; /* 减小上边距 */
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    display: inline-flex; /* 改为行内弹性布局 */
    align-items: center;
    gap: 8px; /* 减小图标与文字间距 */
}

.to-fireworks-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.1), transparent);
    transition: left 0.6s;
}

.to-fireworks-btn:hover {
    background: rgba(255, 215, 0, 0.1);
    box-shadow: 
        0 0 15px rgba(255, 215, 0, 0.3), /* 减小阴影大小 */
        inset 0 0 10px rgba(255, 215, 0, 0.1); /* 减小内阴影 */
    transform: translateY(-2px); /* 减小悬停上移距离 */
}

.to-fireworks-btn:hover::before {
    left: 100%;
}

/* ===== 页面3：烟花页样式 ===== */
#page3 {
    background: var(--night-gradient);
    z-index: 30;
}

.fireworks-message {
    position: absolute;
    bottom: 20%;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 2.8rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 
        0 0 10px rgba(255, 255, 255, 0.7),
        0 0 20px rgba(255, 255, 255, 0.4);
    z-index: 32;
    animation: messageFloat 5s ease-in-out infinite;
}

@keyframes messageFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.back-to-main {
    position: absolute;
    top: 2rem;
    left: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    color: white;
    padding: 0.8rem 1.8rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 35;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-to-main:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    transform: translateX(-5px);
}

/* 烟花文字样式 - 减少拖影效果 */
.firework-text {
    position: absolute;
    font-size: 1.5rem; /* 稍微减小字体大小 */
    font-weight: 600;
    color: var(--gold);
    opacity: 0;
    pointer-events: none;
    text-shadow: 
        0 0 5px rgba(255, 215, 0, 0.9), /* 减少阴影模糊度 */
        0 0 10px rgba(255, 215, 0, 0.7); /* 减少多层阴影 */
    z-index: 4;
    animation: textFade 2s ease-in-out forwards; /* 缩短动画时间 */
    will-change: transform, opacity; /* 优化性能 */
}

@keyframes textFade {
    0% { 
        opacity: 0; 
        transform: translateY(20px) scale(0.8); 
        text-shadow: 0 0 5px rgba(255, 215, 0, 0.5); /* 起始阴影更淡 */
    }
    20% { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
        text-shadow: 0 0 8px rgba(255, 215, 0, 0.8); /* 减少阴影强度 */
    }
    80% { 
        opacity: 1; 
        transform: translateY(-5px) scale(1); /* 减小上移距离 */
        text-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
    }
    100% { 
        opacity: 0; 
        transform: translateY(-15px) scale(0.9); /* 减小最终移动距离 */
        text-shadow: 0 0 5px rgba(255, 215, 0, 0.3); /* 结束阴影更淡 */
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .welcome-card {
        padding: 2rem 1.5rem;
        margin: 0 1rem;
    }
    
    .year-text {
        font-size: 2.8rem;
    }
    
    .blessing-title {
        font-size: 3.5rem;
    }
    
    .person-name {
        font-size: 2.2rem;
    }
    
    .countdown-number {
        font-size: 10rem;
    }
    
    .fireworks-message {
        font-size: 2.2rem;
        bottom: 15%;
    }
    
    .back-to-main {
        top: 1rem;
        left: 1rem;
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    /* 移动端进一步缩小烟花按钮 */
    .to-fireworks-btn {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
        border-radius: 20px;
    }
}

@media (max-width: 480px) {
    .welcome-card {
        padding: 1.5rem 1rem;
    }
    
    .year-text {
        font-size: 2.2rem;
    }
    
    .blessing-title {
        font-size: 2.8rem;
    }
    
    .person-name {
        font-size: 1.8rem;
    }
    
    .special-person {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .countdown-number {
        font-size: 8rem;
    }
    
    .start-button {
        padding: 1rem 2rem;
        font-size: 1.1rem;
    }
    
    .fireworks-message {
        font-size: 1.8rem;
    }
    
    /* 移动端最小尺寸的烟花按钮 */
    .to-fireworks-btn {
        padding: 0.5rem 1.2rem;
        font-size: 0.85rem;
        border-radius: 18px;
        margin-top: 1.5rem;
    }
}

/* 打印样式 */
@media print {
    .page:not(.active) {
        display: none;
    }
    
    .back-to-main,
    .start-button,
    .to-fireworks-btn {
        display: none;
    }
    
    canvas {
        display: none;
    }
}

/* 性能优化 - 减少动画对低端设备的影响 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
/* 浮动音符按钮 */
.floating-music-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(255, 107, 157, 0.85); /* 粉红色半透明 */
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
    transition: all 0.3s ease;
    animation: floatNote 3s ease-in-out infinite;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.floating-music-btn:hover {
    transform: scale(1.1);
    background-color: rgba(255, 107, 157, 0.95);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.6);
    animation: floatNote 1.5s ease-in-out infinite, rotateNote 2s linear infinite;
}

.floating-music-btn.playing {
    background-color: rgba(54, 209, 220, 0.85);
    box-shadow: 0 4px 15px rgba(54, 209, 220, 0.4);
    animation: floatNote 2s ease-in-out infinite, rotateNote 3s linear infinite;
}

.floating-music-btn.playing:hover {
    background-color: rgba(54, 209, 220, 0.95);
    box-shadow: 0 6px 20px rgba(54, 209, 220, 0.6);
}

.floating-music-btn i {
    transition: transform 0.3s ease;
}

.floating-music-btn.playing i {
    animation: bounce 0.5s infinite alternate;
}

@keyframes floatNote {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

@keyframes rotateNote {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes bounce {
    from { transform: scale(1); }
    to { transform: scale(1.2); }
}

/* 音乐提示文字 */
.music-tip {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    color: #ff6b9d;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    z-index: 999;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.5s ease;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 107, 157, 0.2);
    visibility: hidden;
    pointer-events: none;
    animation: waveText 2s ease-in-out infinite 2s;
}

@keyframes waveText {
    0%, 100% { 
        transform: translateY(0) scale(1);
    }
    50% { 
        transform: translateY(-2px) scale(1.05);
    }
}

/* 只在第一页显示提示文字 */
body:has(#page1.active) .music-tip {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .floating-music-btn {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .music-tip {
        top: 70px;
        right: 15px;
        font-size: 12px;
        padding: 6px 12px;
    }
}
