/* ==================== 基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0a0a1a;
    --text-light: #f5f5f5;
    --text-soft: rgba(255, 255, 255, 0.7);
    --accent: #e8b4b8;
    --accent-light: #f5d6d8;
    --accent-glow: rgba(232, 180, 184, 0.4);
    --gold: #d4af37;
    --gold-light: #f0d78c;
}

body {
    font-family: 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', serif;
    background: var(--bg-dark);
    color: var(--text-light);
    overflow-x: hidden;
    line-height: 1.8;
}

/* ==================== 星空背景 ==================== */
#starsCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ==================== 浮动光点 ==================== */
.floating-lights {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.light {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, rgba(232, 180, 184, 0.8), transparent);
    border-radius: 50%;
    animation: float 15s ease-in-out infinite;
}

.light:nth-child(1) { top: 20%; left: 10%; animation-delay: 0s; }
.light:nth-child(2) { top: 60%; left: 85%; animation-delay: 2s; }
.light:nth-child(3) { top: 40%; left: 30%; animation-delay: 4s; }
.light:nth-child(4) { top: 80%; left: 60%; animation-delay: 6s; }
.light:nth-child(5) { top: 10%; left: 70%; animation-delay: 8s; }
.light:nth-child(6) { top: 50%; left: 5%; animation-delay: 10s; }
.light:nth-child(7) { top: 30%; left: 90%; animation-delay: 12s; }
.light:nth-child(8) { top: 70%; left: 40%; animation-delay: 14s; }

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translate(20px, -30px) scale(1.2);
        opacity: 0.6;
    }
    50% {
        transform: translate(-10px, 20px) scale(0.8);
        opacity: 0.4;
    }
    75% {
        transform: translate(30px, 10px) scale(1.1);
        opacity: 0.5;
    }
}

/* ==================== 流星 ==================== */
.meteors {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.meteor {
    position: absolute;
    width: 2px;
    height: 100px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.6), rgba(232,180,184,0.8));
    opacity: 0;
    transform: rotate(45deg);
}

.meteor:nth-child(1) {
    top: 5%;
    left: 25%;
    animation: meteor 5s ease-in-out infinite;
    animation-delay: 1s;
}

.meteor:nth-child(2) {
    top: 10%;
    left: 65%;
    animation: meteor 6s ease-in-out infinite;
    animation-delay: 3s;
}

.meteor:nth-child(3) {
    top: 3%;
    left: 85%;
    animation: meteor 5.5s ease-in-out infinite;
    animation-delay: 5s;
}

@keyframes meteor {
    0% {
        opacity: 0;
        transform: rotate(45deg) translate(0, 0);
    }
    5% {
        opacity: 1;
    }
    25% {
        opacity: 0;
        transform: rotate(45deg) translate(350px, 350px);
    }
    100% {
        opacity: 0;
        transform: rotate(45deg) translate(350px, 350px);
    }
}

/* ==================== 音乐按钮 ==================== */
.music-btn {
    position: fixed;
    top: 25px;
    right: 25px;
    z-index: 1000;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.music-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(232, 180, 184, 0.3);
}

.music-btn.playing span {
    animation: musicPulse 1s ease-in-out infinite;
}

@keyframes musicPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ==================== 页面通用 ==================== */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    position: relative;
    z-index: 10;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.page.active, .page.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==================== 页面1: 开场 ==================== */
.page-intro {
    text-align: center;
}

.intro-decor {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.decor-ring {
    position: absolute;
    border: 1px solid rgba(232, 180, 184, 0.1);
    border-radius: 50%;
}

.decor-ring:nth-child(1) {
    width: 400px;
    height: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: ringPulse 4s ease-in-out infinite;
}

.decor-ring:nth-child(2) {
    width: 500px;
    height: 500px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: ringPulse 4s ease-in-out infinite 0.5s;
}

@keyframes ringPulse {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.1; transform: translate(-50%, -50%) scale(1.1); }
}

.intro-content {
    margin-bottom: 80px;
    position: relative;
}

.intro-hearts {
    margin-bottom: 30px;
    opacity: 0;
    animation: fadeIn 1s ease forwards;
}

.heart {
    display: inline-block;
    color: var(--accent);
    font-size: 16px;
    margin: 0 8px;
    animation: heartFloat 2s ease-in-out infinite;
}

.heart:nth-child(2) { animation-delay: 0.3s; }
.heart:nth-child(3) { animation-delay: 0.6s; }

@keyframes heartFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.intro-line {
    font-size: 32px;
    letter-spacing: 6px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1s ease forwards;
    text-shadow: 0 0 40px rgba(255, 255, 255, 0.1);
}

.intro-line.line1 { animation-delay: 0.5s; }
.intro-line.line2 { animation-delay: 1.5s; }
.intro-line.line3 { animation-delay: 2.5s; }

.intro-names {
    margin-top: 60px;
    font-size: 26px;
    opacity: 0;
    animation: fadeInUp 1s ease forwards;
    animation-delay: 3.5s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.name-her, .name-him {
    color: var(--accent-light);
    letter-spacing: 4px;
    text-shadow: 0 0 20px var(--accent-glow);
}

.name-heart {
    font-size: 20px;
    animation: heartBeat 1.5s ease-in-out infinite;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.2); }
    40% { transform: scale(1); }
    60% { transform: scale(1.15); }
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scroll-hint {
    position: absolute;
    bottom: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-soft);
    font-size: 14px;
    letter-spacing: 2px;
    opacity: 0;
    animation: fadeIn 1s ease forwards;
    animation-delay: 4.5s;
}

.scroll-arrow {
    width: 20px;
    height: 20px;
    border-right: 2px solid var(--text-soft);
    border-bottom: 2px solid var(--text-soft);
    transform: rotate(45deg);
    margin-top: 10px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

@keyframes bounce {
    0%, 100% { transform: rotate(45deg) translate(0, 0); }
    50% { transform: rotate(45deg) translate(5px, 5px); }
}

/* ==================== 页面2: 信 ==================== */
.page-letter {
    background: transparent;
}

.letter-container {
    position: relative;
    perspective: 1000px;
}

.letter-decor {
    position: absolute;
    font-size: 24px;
    color: var(--gold);
    opacity: 0.5;
    text-shadow: 0 0 10px var(--gold);
}

.letter-decor.left {
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
}

.letter-decor.right {
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
}

.letter {
    max-width: 600px;
    padding: 60px 50px;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.letter::before {
    content: '';
    position: absolute;
    top: 25px;
    left: 25px;
    right: 25px;
    bottom: 25px;
    border: 1px solid rgba(232, 180, 184, 0.15);
    border-radius: 2px;
    pointer-events: none;
}

.letter-seal {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--accent) 0%, #d4a5a9 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 5px 20px rgba(232, 180, 184, 0.4);
}

.letter-header {
    text-align: right;
    margin-bottom: 35px;
}

.letter-date {
    font-size: 13px;
    color: var(--text-soft);
    letter-spacing: 1px;
}

.letter-body p {
    margin-bottom: 22px;
    font-size: 17px;
    line-height: 2;
    text-indent: 2em;
}

.letter-body .greeting {
    text-indent: 0;
    font-size: 22px;
    color: var(--accent-light);
    margin-bottom: 35px;
}

.letter-sign {
    text-align: right;
    margin-top: 45px;
    color: var(--accent);
    font-size: 18px;
    text-indent: 0 !important;
}

/* ==================== 页面3: 照片墙 ==================== */
.page-photos {
    padding-top: 100px;
    min-height: auto;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 50px;
}

.header-line {
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.section-title {
    font-size: 28px;
    font-weight: 400;
    letter-spacing: 8px;
    color: var(--accent-light);
    text-shadow: 0 0 30px rgba(232, 180, 184, 0.3);
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1100px;
    width: 90%;
    padding-bottom: 80px;
}

.photo-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.photo-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 60%);
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s;
}

.photo-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4),
                0 0 30px rgba(232, 180, 184, 0.15);
    border-color: rgba(232, 180, 184, 0.3);
}

.photo-card:hover::before {
    opacity: 1;
}

.photo-card img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.photo-card:hover img {
    transform: scale(1.08);
}

.photo-date {
    position: absolute;
    bottom: 15px;
    left: 20px;
    z-index: 2;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    letter-spacing: 1px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.photo-card:hover .photo-date {
    opacity: 1;
    transform: translateY(0);
}

/* ==================== 页面4: 计时器 + 烟花 ==================== */
.page-final {
    position: relative;
    overflow: hidden;
}

#fireworksCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.final-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 50px 60px;
    background: linear-gradient(135deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.3) 100%);
    backdrop-filter: blur(30px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.final-content * {
    pointer-events: none;
}

.final-decor {
    color: var(--gold);
    font-size: 14px;
    letter-spacing: 15px;
    opacity: 0.6;
}

.final-decor.top {
    margin-bottom: 30px;
}

.final-decor.bottom {
    margin-top: 30px;
    margin-bottom: 25px;
}

.timer-label {
    font-size: 24px;
    color: var(--accent-light);
    margin-bottom: 8px;
    letter-spacing: 6px;
    text-shadow: 0 0 20px var(--accent-glow);
}

.timer-sublabel {
    font-size: 16px;
    color: var(--text-soft);
    margin-bottom: 25px;
    letter-spacing: 3px;
}

.timer-display {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.timer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.timer-sep {
    font-size: 32px;
    color: var(--accent);
    opacity: 0.5;
    margin-bottom: 15px;
}

.timer-num {
    font-size: 44px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--gold-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.timer-unit {
    font-size: 13px;
    color: var(--text-soft);
    margin-top: 5px;
    letter-spacing: 2px;
}

.final-message {
    margin-top: 15px;
    font-size: 15px;
    color: var(--text-soft);
    letter-spacing: 1px;
}

.final-wish {
    margin-top: 20px;
    font-size: 20px;
    color: var(--accent);
    letter-spacing: 4px;
    text-shadow: 0 0 20px var(--accent-glow);
}

/* ==================== 照片查看器 ==================== */
.photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.photo-viewer.active {
    opacity: 1;
    visibility: visible;
}

.viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
}

.viewer-content {
    position: relative;
    max-width: 90%;
    max-height: 85%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    text-align: center;
}

.photo-viewer.active .viewer-content {
    transform: scale(1);
}

.viewer-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.viewer-date {
    margin-top: 20px;
    font-size: 16px;
    color: var(--accent-light);
    letter-spacing: 2px;
}

.viewer-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s;
}

.viewer-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* ==================== 导航点 ==================== */
.page-nav {
    position: fixed;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.nav-dot::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid transparent;
    transition: all 0.3s;
}

.nav-dot:hover {
    background: rgba(255, 255, 255, 0.4);
}

.nav-dot.active {
    background: var(--accent);
    box-shadow: 0 0 15px rgba(232, 180, 184, 0.5);
}

.nav-dot.active::before {
    border-color: rgba(232, 180, 184, 0.3);
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .page {
        padding: 40px 15px;
    }
    
    .intro-line {
        font-size: 22px;
        letter-spacing: 3px;
        margin-bottom: 8px;
    }
    
    .intro-names {
        font-size: 20px;
        gap: 12px;
        margin-top: 40px;
    }
    
    .intro-hearts .heart {
        font-size: 12px;
        margin: 0 5px;
    }
    
    .scroll-hint {
        bottom: 30px;
        font-size: 12px;
    }
    
    .letter-container {
        width: 100%;
    }
    
    .letter {
        padding: 40px 25px;
        margin: 0 10px;
    }
    
    .letter::before {
        top: 15px;
        left: 15px;
        right: 15px;
        bottom: 15px;
    }
    
    .letter-seal {
        width: 40px;
        height: 40px;
        font-size: 16px;
        top: -15px;
    }
    
    .letter-body p {
        font-size: 14px;
        margin-bottom: 18px;
        line-height: 1.9;
    }
    
    .letter-body .greeting {
        font-size: 18px;
        margin-bottom: 25px;
    }
    
    .letter-sign {
        font-size: 16px;
        margin-top: 35px;
    }
    
    .letter-decor {
        display: none;
    }
    
    .section-header {
        margin-bottom: 30px;
    }
    
    .header-line {
        width: 30px;
    }
    
    .section-title {
        font-size: 20px;
        letter-spacing: 4px;
    }
    
    .photo-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        width: 95%;
    }
    
    .photo-card img {
        aspect-ratio: 4/3;
    }
    
    .photo-date {
        font-size: 12px;
        bottom: 12px;
        left: 15px;
    }
    
    .final-content {
        padding: 30px 20px;
        margin: 0 15px;
        border-radius: 16px;
    }
    
    .final-decor {
        font-size: 12px;
        letter-spacing: 10px;
    }
    
    .final-decor.top {
        margin-bottom: 20px;
    }
    
    .final-decor.bottom {
        margin-top: 20px;
        margin-bottom: 15px;
    }
    
    .timer-label {
        font-size: 18px;
        letter-spacing: 4px;
        margin-bottom: 5px;
    }
    
    .timer-sublabel {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .timer-display {
        gap: 6px;
    }
    
    .timer-num {
        font-size: 28px;
    }
    
    .timer-item {
        min-width: 50px;
        padding: 6px;
        border-radius: 8px;
    }
    
    .timer-unit {
        font-size: 11px;
    }
    
    .timer-sep {
        font-size: 20px;
        margin-bottom: 12px;
    }
    
    .final-message {
        font-size: 13px;
        margin-top: 12px;
    }
    
    .final-wish {
        font-size: 16px;
        margin-top: 15px;
        letter-spacing: 3px;
    }
    
    .page-nav {
        right: 10px;
        gap: 12px;
    }
    
    .nav-dot {
        width: 8px;
        height: 8px;
    }
    
    .music-btn {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
        font-size: 14px;
    }
    
    .decor-ring {
        display: none;
    }
    
    .viewer-date {
        font-size: 14px;
        margin-top: 15px;
    }
    
    .viewer-close {
        top: -40px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

/* 超小屏幕 */
@media (max-width: 380px) {
    .intro-line {
        font-size: 18px;
        letter-spacing: 2px;
    }
    
    .intro-names {
        font-size: 18px;
        gap: 10px;
    }
    
    .letter {
        padding: 30px 20px;
    }
    
    .letter-body p {
        font-size: 13px;
    }
    
    .timer-num {
        font-size: 24px;
    }
    
    .timer-item {
        min-width: 42px;
    }
    
    .timer-sep {
        font-size: 16px;
    }
}

/* ==================== 滚动条 ==================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}
