/* ===== 基础与重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --pink: #FFB7B2;
    --pink-light: #FFF0F0;
    --mint: #B5EAD7;
    --mint-light: #EFFFF7;
    --lavender: #C7CEEA;
    --lavender-light: #F0F1FF;
    --peach: #FFDAC1;
    --peach-light: #FFF5ED;
    --cream: #E2F0CB;
    --cream-light: #F8FFF0;
    --text: #6B5B5B;
    --text-light: #9B8B8B;
    --white: rgba(255, 255, 255, 0.85);
    --shadow: 0 8px 32px rgba(107, 91, 91, 0.08);
    --radius: 24px;
    --radius-sm: 16px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, var(--pink-light) 0%, var(--lavender-light) 25%, var(--mint-light) 50%, var(--peach-light) 75%, var(--cream-light) 100%);
    background-attachment: fixed;
    color: var(--text);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ===== 粒子画布 ===== */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ===== 开场 Hero ===== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 1;
    padding: 40px 20px;
}

.hero-content {
    animation: fadeInUp 1.2s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.heart-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: heartbeat 2s ease-in-out infinite;
    display: inline-block;
}

.title-520 {
    font-size: 96px;
    font-weight: 800;
    letter-spacing: 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.title-520 .num {
    display: inline-block;
    background: linear-gradient(135deg, var(--pink), var(--lavender));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0;
    animation: numberPop 0.8s ease-out forwards;
}

.title-520 .num:nth-child(1) { animation-delay: 0.3s; }
.title-520 .num:nth-child(2) { animation-delay: 0.6s; }
.title-520 .num:nth-child(3) { animation-delay: 0.9s; }

.couple-name {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 8px;
    color: var(--text);
    margin-bottom: 8px;
    opacity: 0;
    animation: fadeIn 1s ease-out 1.0s forwards;
}

.subtitle {
    font-size: 16px;
    color: var(--text-light);
    letter-spacing: 3px;
    opacity: 0;
    animation: fadeIn 1s ease-out 1.4s forwards;
}

/* ===== 翻页计时器 ===== */
.flip-clock {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    margin: 28px 0 12px;
    opacity: 0;
    animation: fadeIn 1s ease-out 1.6s forwards;
    flex-wrap: wrap;
}

.flip-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.flip-digits {
    display: flex;
    gap: 4px;
}

.flip-digit {
    position: relative;
    width: 42px;
    height: 58px;
    perspective: 200px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(107, 91, 91, 0.15);
}

.flip-top, .flip-bottom {
    position: absolute;
    left: 0;
    width: 100%;
    height: 50%;
    overflow: hidden;
    background: var(--text);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 700;
    backface-visibility: hidden;
}

.flip-top {
    top: 0;
    border-radius: 8px 8px 0 0;
    transform-origin: bottom;
    z-index: 1;
}

.flip-bottom {
    bottom: 0;
    border-radius: 0 0 8px 8px;
    transform-origin: top;
    z-index: 1;
}

/* 中间分割线 */
.flip-top::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(0,0,0,0.25);
    z-index: 5;
}

.flip-top-flip, .flip-bottom-flip {
    position: absolute;
    left: 0;
    width: 100%;
    height: 50%;
    overflow: hidden;
    background: var(--text);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 700;
    backface-visibility: hidden;
    opacity: 0;
    z-index: 3;
}

.flip-top-flip {
    top: 0;
    border-radius: 8px 8px 0 0;
    transform-origin: bottom;
}

.flip-bottom-flip {
    bottom: 0;
    border-radius: 0 0 8px 8px;
    transform-origin: top;
}

/* 伪元素显示数字内容 */
.flip-top::before, .flip-top-flip::before {
    content: attr(data-value);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 200%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flip-bottom::before, .flip-bottom-flip::before {
    content: attr(data-value);
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flip-digit.flipping .flip-top-flip {
    animation: flipTopDown 0.6s ease-in forwards;
    opacity: 1;
}

.flip-digit.flipping .flip-bottom-flip {
    animation: flipBottomUp 0.6s ease-out forwards;
    opacity: 1;
}

@keyframes flipTopDown {
    from { transform: rotateX(0deg); }
    to { transform: rotateX(-90deg); }
}

@keyframes flipBottomUp {
    from { transform: rotateX(90deg); }
    to { transform: rotateX(0deg); }
}

.flip-separator {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-top: 8px;
    padding: 0 2px;
    animation: pulse 2s ease-in-out infinite;
}

.flip-label {
    font-size: 11px;
    color: var(--text-light);
    letter-spacing: 2px;
}

.timer-since {
    font-size: 12px;
    color: var(--text-light);
    letter-spacing: 2px;
    opacity: 0;
    animation: fadeIn 1s ease-out 1.8s forwards;
}

.scroll-hint {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    animation: fadeIn 1s ease-out 2.2s forwards;
}

.scroll-hint small {
    color: var(--text-light);
    font-size: 12px;
    letter-spacing: 2px;
}

.mouse {
    width: 22px;
    height: 36px;
    border: 2px solid var(--pink);
    border-radius: 12px;
    position: relative;
}

.mouse::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 8px;
    background: var(--pink);
    border-radius: 2px;
    animation: scrollWheel 2s ease-in-out infinite;
}

/* ===== 时光画廊 ===== */
.gallery-section {
    position: relative;
    z-index: 1;
    padding: 60px 20px 40px;
    max-width: 800px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
    opacity: 0;
    transform: translateY(30px);
}

.section-header.visible {
    animation: fadeInUp 0.8s ease-out forwards;
}

.section-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text), var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header p {
    font-size: 14px;
    color: var(--text-light);
    letter-spacing: 2px;
}

.gallery {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.memory-card {
    background: var(--white);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(40px);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.memory-card.visible {
    animation: cardEnter 0.8s ease-out forwards;
}

.memory-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(107, 91, 91, 0.12);
}

.memory-card:nth-child(4n+1) { border-top: 4px solid var(--pink); }
.memory-card:nth-child(4n+2) { border-top: 4px solid var(--mint); }
.memory-card:nth-child(4n+3) { border-top: 4px solid var(--lavender); }
.memory-card:nth-child(4n+4) { border-top: 4px solid var(--peach); }

/* 修改：图片完整显示 */
.memory-media {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    cursor: pointer;
    transition: transform 0.4s ease;
    background: linear-gradient(135deg, var(--pink-light) 0%, var(--lavender-light) 40%, var(--mint-light) 100%);
}

.memory-card:hover .memory-media {
    transform: scale(1.01);
}

.memory-content {
    padding: 20px 24px 24px;
}

.memory-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.memory-content p {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.8;
}

.memory-badge {
    display: inline-block;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    margin-top: 12px;
    font-weight: 500;
}

.memory-card:nth-child(4n+1) .memory-badge { background: var(--pink-light); color: #E08080; }
.memory-card:nth-child(4n+2) .memory-badge { background: var(--mint-light); color: #5BA88E; }
.memory-card:nth-child(4n+3) .memory-badge { background: var(--lavender-light); color: #7A82B8; }
.memory-card:nth-child(4n+4) .memory-badge { background: var(--peach-light); color: #C9956B; }

/* ===== 上传区域 ===== */
.upload-section {
    position: relative;
    z-index: 1;
    padding: 40px 20px 60px;
    max-width: 800px;
    margin: 0 auto;
}

.upload-card {
    background: var(--white);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 32px 24px;
    box-shadow: var(--shadow);
    text-align: center;
    border: 2px dashed var(--pink);
    opacity: 0;
    transform: translateY(30px);
}

.upload-card.visible {
    animation: fadeInUp 0.8s ease-out forwards;
}

.upload-card h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text);
}

.upload-card > p {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
}

.upload-area {
    border: 2px dashed var(--lavender);
    border-radius: var(--radius-sm);
    padding: 32px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--lavender-light);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--pink);
    background: var(--pink-light);
    transform: scale(1.01);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-icon {
    font-size: 36px;
    margin-bottom: 4px;
}

.upload-placeholder span {
    font-size: 15px;
    color: var(--text);
    font-weight: 500;
}

.upload-placeholder small {
    font-size: 12px;
    color: var(--text-light);
}

.upload-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.preview-item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    animation: scaleIn 0.4s ease-out;
}

.preview-item img,
.preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: none;
    color: var(--text);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Lightbox ===== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
}

.lightbox-media img,
.lightbox-media video {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-sm);
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}

.lightbox-caption {
    margin-top: 16px;
    font-size: 16px;
    color: var(--text);
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 24px;
    background: var(--white);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 28px;
    color: var(--text);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.lightbox-close:hover {
    transform: rotate(90deg);
}

/* ===== Footer ===== */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 14px;
}

.footer-hearts {
    margin-top: 12px;
    font-size: 18px;
    letter-spacing: 8px;
}

/* ===== 动画定义 ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes numberPop {
    0% { opacity: 0; transform: translateY(20px) scale(0.8); }
    60% { transform: translateY(-5px) scale(1.05); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.15); }
    28% { transform: scale(1); }
    42% { transform: scale(1.15); }
    70% { transform: scale(1); }
}

@keyframes scrollWheel {
    0% { top: 6px; opacity: 1; }
    100% { top: 18px; opacity: 0; }
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== 响应式 ===== */
@media (min-width: 768px) {
    .title-520 {
        font-size: 140px;
        letter-spacing: 20px;
    }
    
    .couple-name {
        font-size: 28px;
        letter-spacing: 12px;
    }
    
    .subtitle {
        font-size: 20px;
    }
    
    .flip-digit {
        width: 52px;
        height: 72px;
    }
    
    .flip-top, .flip-bottom,
    .flip-top-flip, .flip-bottom-flip {
        font-size: 38px;
    }
    
    .flip-separator {
        font-size: 36px;
        margin-top: 10px;
    }
    
    .flip-label {
        font-size: 13px;
    }
    
    .section-header h2 {
        font-size: 36px;
    }
    
    .gallery-section,
    .upload-section {
        padding-left: 40px;
        padding-right: 40px;
    }
    
    .memory-content {
        padding: 24px 32px 32px;
    }
    
    .upload-card {
        padding: 40px 48px;
    }
}

@media (max-width: 380px) {
    .title-520 {
        font-size: 72px;
        letter-spacing: 8px;
    }
    
    .couple-name {
        font-size: 18px;
        letter-spacing: 6px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .flip-digit {
        width: 34px;
        height: 46px;
    }
    
    .flip-top, .flip-bottom,
    .flip-top-flip, .flip-bottom-flip {
        font-size: 22px;
    }
    
    .flip-separator {
        font-size: 20px;
        margin-top: 4px;
    }
    
    .section-header h2 {
        font-size: 24px;
    }
}
