body {
    margin: 0;
    padding: 0;
    /* Deep, magical night sky gradient */
    background: radial-gradient(circle at center, #0f172a 0%, #000000 100%);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: white;
    font-family: 'Nunito', sans-serif;
}

/* --- Countdown Gate --- */
#countdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 2001;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.92) 0%, rgba(0, 0, 0, 0.92) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

body.unlocked #countdown-overlay {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.countdown-card {
    width: min(600px, 90vw);
    padding: 40px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5),
                inset 0 0 30px rgba(255, 255, 255, 0.02);
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: translateY(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.countdown-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6),
                inset 0 0 30px rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.countdown-title {
    font-family: 'Pinyon Script', cursive;
    font-size: 52px;
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    margin-bottom: 10px;
}

.countdown-time {
    font-family: 'Nunito', monospace;
    font-weight: 800;
    font-size: 60px;
    background: linear-gradient(180deg, #ffffff 0%, #00f6ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 25px rgba(0, 246, 255, 0.6));
    margin: 20px 0;
    letter-spacing: 2px;
    line-height: 1.2;
    animation: pulse-neon 2s infinite ease-in-out;
}

@keyframes pulse-neon {
    0%, 100% { filter: drop-shadow(0 0 25px rgba(0, 246, 255, 0.6)); }
    50% { filter: drop-shadow(0 0 40px rgba(0, 246, 255, 0.9)); }
}

.countdown-date {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 300;
    margin-bottom: 30px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.countdown-hint {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 246, 255, 0.1);
}

/* Aurora Borealis Effect */
body::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(100, 255, 218, 0.15) 0%, transparent 60%),
                radial-gradient(circle, rgba(124, 77, 255, 0.15) 0%, transparent 50%),
                radial-gradient(circle, rgba(255, 215, 0, 0.08) 0%, transparent 40%); 
    animation: aurora 25s infinite linear; 
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: screen; /* Better blending */
}

/* Cinematic Vignette & Noise */
body::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Vignette + Noise Texture */
    background: 
        radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.4) 100%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1000; /* On top of everything */
    mix-blend-mode: overlay;
}

@keyframes aurora {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

#container {
    position: relative;
    width: 100vw;
    height: 100vh;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

body.unlocked #container {
    opacity: 1;
    pointer-events: auto;
}

#input_video {
    display: none; 
}

#output_canvas {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* Add a subtle vignette via CSS to focus attention on center */
    mask-image: radial-gradient(circle, white 60%, rgba(255,255,255,0.8) 100%);
}

#loading, #prompt-text {
    position: absolute;
    width: 100%;
    text-align: center;
    z-index: 10;
    pointer-events: none;
    text-shadow: 0 0 15px rgba(100, 255, 218, 0.8);
    transition: opacity 0.5s ease;
    /* Use Mountains of Christmas for English, KaiTi for Chinese */
    font-family: 'Mountains of Christmas', 'STKaiti', 'KaiTi', cursive;
    letter-spacing: 2px;
}

#loading {
    top: 50%;
    transform: translateY(-50%);
    font-size: 42px;
    color: #64ffda;
}

#prompt-text {
    bottom: 15%;
    font-size: 32px;
    opacity: 0; 
    color: #e0f7fa;
}

/* Gallery Styles */
#gallery-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
}

.gallery-photo {
    /* Legacy style for photos, kept just in case but not used */
    position: absolute;
    width: 130px;
    height: 130px;
    object-fit: cover;
    border-radius: 50%; 
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6), 0 0 50px rgba(255, 215, 0, 0.3);
    border: 4px solid #fff;
    opacity: 0;
    transform: scale(0);
    transition: all 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gallery-photo.visible {
    opacity: 1;
    transform: scale(1);
    animation: float 6s ease-in-out infinite;
}

#gallery-center-text {
    font-family: 'Pinyon Script', 'Italianno', 'Great Vibes', 'Mountains of Christmas', cursive;
    font-size: 160px; /* 更厚实一点 */
    font-weight: 600;
    letter-spacing: 2px;
    /* 霓虹循环：首尾颜色重复，避免接缝 */
    background: linear-gradient(90deg,
        #00f6ff,
        #00ffa3,
        #c4ff0e,
        #fffd5e,
        #ff9a3c,
        #ff4d8d,
        #b04bff,
        #00f6ff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent; /* Fallback */
    -webkit-text-stroke: 1.4px rgba(255, 255, 255, 0.35);
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.45))
            drop-shadow(0 0 22px rgba(255, 255, 255, 0.95))
            drop-shadow(0 0 32px rgba(255, 255, 255, 0.45));
    opacity: 0;
    transform: translateY(-80px) rotate(-2deg);
    transition: all 2s ease 1s; 
    z-index: 30; /* Ensure above vignette if possible, or adjust vignette z-index */
    animation: text-glow 6s ease-in-out infinite alternate,
               text-rainbow 8s linear infinite,
               text-float 7s ease-in-out infinite;
}

@keyframes text-glow {
    0% { filter: drop-shadow(0 12px 28px rgba(0,0,0,0.45)) drop-shadow(0 0 14px rgba(255,255,255,0.5)); }
    50% { filter: drop-shadow(0 12px 28px rgba(0,0,0,0.45)) drop-shadow(0 0 28px rgba(255,255,255,0.95)); }
    100% { filter: drop-shadow(0 12px 28px rgba(0,0,0,0.45)) drop-shadow(0 0 18px rgba(210,230,255,0.9)); }
}

@keyframes text-rainbow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

@keyframes text-float {
    0%, 100% { transform: translateY(-80px) rotate(-2deg) scale(1); }
    50% { transform: translateY(-62px) rotate(-1deg) scale(1.02); }
}

#gallery-center-text.visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes float {
    0% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-15px) scale(1.05); }
    100% { transform: translateY(0px) scale(1); }
}

/* --- Music Player UI --- */
#music-player {
    position: absolute;
    bottom: 40px;
    left: 40px;
    width: 420px;
    height: 110px;
    /* Premium Glassmorphism */
    background: rgba(255, 255, 255, 0.05); 
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 1001; /* Above vignette */
    display: flex;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
    opacity: 0; 
    transform: translateY(30px) scale(0.95);
    overflow: hidden;
}

#music-player.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Shine effect - more subtle */
#music-player::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.08),
        transparent
    );
    transition: 0.6s;
    pointer-events: none;
}

#music-player:hover::before {
    left: 100%;
}

#music-player:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

.album-cover {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    position: relative;
    border-radius: 50%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.vinyl-record {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* Realistic vinyl grooves */
    background: 
        repeating-radial-gradient(
            #111 0, 
            #111 2px, 
        #222 3px, 
        #222 4px
    );
    position: relative;
    animation: spin 8s linear infinite;
    animation-play-state: paused;
    border: 1px solid #000;
    cursor: pointer;
    transition: box-shadow 0.3s ease, filter 0.3s ease;
}

.vinyl-record.playing {
    animation-play-state: running;
}

.vinyl-record:hover {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.35);
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.45));
}

.vinyl-label {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 55%;
    height: 55%;
    background-position: center;
    background-size: cover;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 2px #111, 0 0 0 4px rgba(255,255,255,0.1);
    animation: pulse-glow 2s infinite alternate;
}

@keyframes pulse-glow {
    from { box-shadow: 0 0 0 2px #111, 0 0 0 4px rgba(255,255,255,0.1); }
    to { box-shadow: 0 0 0 2px #111, 0 0 10px 4px rgba(255,215,0,0.4); }
}

/* Center hole */
.vinyl-label::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: #000;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.3);
}

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

.player-content {
    flex-grow: 1;
    margin-left: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.song-info {
    margin-bottom: 12px;
}

.song-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.artist-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.artist {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

/* Mini Visualizer */
.mini-visualizer {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
    margin-bottom: 2px;
}

.mini-visualizer .bar {
    width: 3px;
    background: #FFD700; /* Gold */
    border-radius: 1px;
    animation: equalizer 1s ease-in-out infinite;
    height: 3px; /* Default paused height */
    transition: height 0.3s;
    animation-play-state: paused;
}

#music-player.playing .mini-visualizer .bar {
    animation-play-state: running;
}

.mini-visualizer .bar:nth-child(1) { animation-duration: 1.0s; }
.mini-visualizer .bar:nth-child(2) { animation-duration: 1.2s; }
.mini-visualizer .bar:nth-child(3) { animation-duration: 0.8s; }
.mini-visualizer .bar:nth-child(4) { animation-duration: 1.1s; }

@keyframes equalizer {
    0%, 100% { height: 30%; }
    50% { height: 100%; }
}

.player-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.download-btn {
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.08), rgba(100, 255, 218, 0.35));
    color: #eafcff;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease, border-color 0.2s ease, background 0.3s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
}

.download-btn:hover {
    transform: translateY(-1px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.35);
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.15), rgba(100, 255, 218, 0.5));
    box-shadow: 0 12px 28px rgba(100, 255, 218, 0.25);
}

.control-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    outline: none;
    transition: transform 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-family: monospace;
    width: 35px;
    text-align: center;
}

.progress-bar-container {
    flex-grow: 1;
    height: 3px; /* Thinner */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    transition: height 0.2s ease;
    overflow: hidden;
}

.progress-bar-container:hover {
    height: 5px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #64ffda, #00FFFF);
    border-radius: 2px;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* Remove handle for cleaner look, or make it glowy dot */
.progress-handle {
    display: none; 
}

#play-pause-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

#play-pause-btn:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
}

/* --- Photo Modal --- */
#photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#photo-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#photo-modal.visible .modal-content {
    transform: scale(1);
}

#modal-image {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 16px;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.3),
        0 0 0 4px #fff,
        0 20px 50px rgba(0,0,0,0.5);
    display: block;
}

#close-modal {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 40px;
    height: 40px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}

#close-modal:hover {
    transform: scale(1.1) rotate(90deg);
    background: #FFD700;
}

/* --- Wish Modal --- */
#wish-modal {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255, 215, 0, 0.12), transparent 35%),
                radial-gradient(circle at 70% 70%, rgba(124, 77, 255, 0.12), transparent 30%),
                rgba(0, 6, 20, 0.8);
    backdrop-filter: blur(10px) saturate(140%);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#wish-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.wish-dialog {
    position: relative;
    padding: 28px 30px 32px;
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 25px rgba(255, 215, 0, 0.25);
    min-width: 360px;
    transform: translateY(20px);
    animation: float-modal 4s ease-in-out infinite;
}

.wish-dialog::before {
    content: '';
    position: absolute;
    inset: -30px -40px -10px;
    background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.12), transparent 40%);
    filter: blur(18px);
    z-index: -1;
}

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

.wish-title {
    font-size: 22px;
    color: #fff;
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.4;
}

.wish-actions {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 10px auto 14px;
    width: 320px;
    height: 120px;
}

.wish-btn {
    min-width: 120px;
    padding: 12px 18px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #0f172a;
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
    transition: transform 0.25s ease, background 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.wish-btn.yes {
    background: linear-gradient(120deg, #7cf1d4, #64ffda, #b3ffe9);
}

.wish-btn.yes:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 10px 30px rgba(100, 255, 218, 0.35);
}

.wish-btn.no {
    background: linear-gradient(120deg, #ffc0cb, #ff8fb1);
    color: #5c0a28;
}

.wish-btn.no:hover {
    box-shadow: 0 12px 25px rgba(255, 143, 177, 0.4);
}

.wish-note {
    text-align: center;
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    letter-spacing: 0.5px;
    line-height: 1.6;
}

.wish-note .note-en {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #e7f5ff;
    letter-spacing: 0.4px;
    font-size: 12px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.25);
}
