:root {
    --bg-color: #0f172a;
    --accent-color: #f472b6;
    --text-color: #f8fafc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none; 
}

body, html {
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
}

.app-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.scene.active {
    opacity: 1;
    pointer-events: auto;
}

/* Music Control */
.music-control {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: rotate 10s linear infinite paused;
}

.music-control.playing {
    animation-play-state: running;
}

@keyframes rotate { to { transform: rotate(360deg); } }

/* Scene 1: Intro */
.sky-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0; /* Behind text */
}

.title-container {
    margin-bottom: 60px;
    text-align: center;
    position: relative; /* Ensure above sky */
    z-index: 10;
}

.main-title {
    font-size: 2.4rem;
    font-weight: 300;
    letter-spacing: 4px;
    margin-bottom: 10px;
    background: linear-gradient(to bottom, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.sub-title {
    font-size: 1rem;
    color: rgba(255,255,255,0.6);
    letter-spacing: 2px;
}

.touch-trigger {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.finger-print {
    width: 50px;
    height: 50px;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 50%;
    position: relative;
    z-index: 2;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 1px solid var(--accent-color);
    border-radius: 50%;
    animation: ripple 2s infinite;
    opacity: 0;
}

@keyframes ripple {
    0% { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(2); opacity: 0; }
}

.hint {
    margin-top: 15px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
}

/* Scene 2: Particles */
#mobileCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.text-overlay {
    position: absolute;
    bottom: 15%;
    left: 0;
    width: 100%;
    text-align: center;
    pointer-events: none;
    padding: 0 20px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

#photoTitle {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: #fff;
}

#photoSub {
    font-size: 1rem;
    color: rgba(255,255,255,0.9);
}

.status-hint {
    position: absolute;
    bottom: 20px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.3);
}

/* 场景2：下一张按钮 */
.next-photo-btn {
    position: absolute;
    bottom: 6%;
    right: 6%;
    padding: 12px 20px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 30px;
    color: #fff;
    font-size: 0.9rem;
    backdrop-filter: blur(8px);
    z-index: 100;  /* 提高 z-index，确保在最上层 */
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    pointer-events: auto;  /* 确保可以接收点击事件 */
}

.next-photo-btn:active {
    transform: scale(0.95);
    background: rgba(255,255,255,0.3);
}

/* Scene 3: Flower */
#scene3 {
    background: linear-gradient(to bottom, #2e0235, #0f172a);
    overflow: hidden;
}

.flower-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle at 50% 50%, rgba(244,114,182,0.1) 0%, transparent 60%);
    z-index: 0;
}

#flowerTreeCanvas {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.petal {
    position: absolute;
    background: #fbcfe8;
    border-radius: 100% 0 100% 0;
    opacity: 0.8;
    z-index: 2;
    animation: fall linear infinite;
}

@keyframes fall {
    0% { transform: translate(0, -10vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translate(50px, 110vh) rotate(360deg); opacity: 0; }
}

.content-card {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    padding: 30px 20px;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    z-index: 10;
    opacity: 0;
    transition: opacity 1s ease;
}

.content-card h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: var(--accent-color);
}

.blessing-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.9);
}

.next-scene-btn {
    position: absolute;
    bottom: 15%;
    padding: 12px 30px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    border-radius: 25px;
    font-size: 1rem;
    z-index: 10;
    opacity: 0;
    transition: opacity 1s ease;
}

/* Scene 4: Moon Sea */
#scene4 {
    background: #000;
}

.moon-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #0f172a, #1e293b);
}

.moon {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 50px rgba(255,255,255,0.4);
}

.ocean {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 35%;
    background: #020617;
    z-index: 2;
}

.reflection {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.3), transparent);
    filter: blur(8px);
}

.end-card {
    width: 100%;
    height: 100%; /* Fill screen */
    background: transparent;
    text-align: center;
    position: absolute;
    top: 0;
    left: 0;
    transform: none;
    z-index: 10; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.wish-text {
    font-family: "Songti SC", serif;
    font-size: 1.6rem;
    line-height: 2;
    margin-top: -60px; /* Adjust vertical position */
    text-shadow: 0 0 15px rgba(255,255,255,0.6);
    letter-spacing: 2px;
}

/* Bottom Buttons */
.btn-group {
    position: absolute;
    bottom: 8%; /* Place at bottom, below reflections */
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 15px;
    z-index: 20;
}

.replay-btn {
    padding: 8px 20px; /* Smaller size */
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    border-radius: 20px;
    font-size: 0.9rem;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    min-width: auto; /* Allow shrink */
}

.replay-btn:active {
    background: rgba(255,255,255,0.3);
    transform: scale(0.95);
}

/* Hide old visualizer */
.wave-visualizer, .vis-bar {
    display: none !important;
}

