/* ========================================
   丫丫诱捕器 - 样式表
   ======================================== */

/* --- 全局设置 --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body, html {
    width: 100%; 
    min-height: 100%;
    font-family: 'Noto Serif SC', serif;
    background-color: #000;
    -webkit-overflow-scrolling: touch;
}

/* --- 加载界面 --- */
#loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1a0a1a 0%, #3a1c3a 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999;
    transition: opacity 1s ease-out;
    color: #fff;
}

.loading-text {
    font-size: 1.2rem;
    margin-bottom: 20px;
    letter-spacing: 2px;
    opacity: 0.8;
}

.progress-container {
    width: 70%;
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    overflow: hidden;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ff8a00, #e52e71);
    border-radius: 10px;
    transition: width 0.1s linear;
}

#start-button-text {
    display: none;
    margin-top: 30px;
    font-size: 1.1rem;
    color: #ffb6c1;
    animation: pulse 1.5s infinite;
    cursor: pointer;
}

/* --- 主界面 --- */
#main-content {
    position: relative;
    width: 100%;
    min-height: 100vh;
    opacity: 0; 
    transition: opacity 2s ease-in; 
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000;
}

/* 分层背景容器 */
#background-layers {
    position: relative;
    width: 100%;
    height: auto;
    overflow: hidden; /* 隐藏溢出，防止树木晃到画布外 */
}

.bg-layer {
    width: 100%;
    height: auto;
    display: block;
}

/* 除了第一层外，其他层绝对定位叠加 */
.bg-layer:not(:first-child) {
    position: absolute;
    top: 0;
    left: 0;
}

/* 树木摇晃动画 - 底部固定，中上部轻微拉伸 */
#layer-trees {
    /* 变换原点在底部 1/6 处（地面位置），让地面几乎不动 */
    transform-origin: center 83.3%;
    animation: treeSway 5s ease-in-out infinite;
    /* 稍微放大避免边缘缝隙 */
    transform: scale(1.01);
}

@keyframes treeSway {
    0%, 100% { 
        transform: scale(1.01) skewX(0deg); 
    }
    33% { 
        transform: scale(1.01) skewX(0.6deg); 
    }
    66% { 
        transform: scale(1.01) skewX(-0.6deg); 
    }
}

/* 烟花闪烁效果 */
#layer-firework {
    animation: fireworkGlow 2s ease-in-out infinite;
}

@keyframes fireworkGlow {
    0%, 100% { 
        opacity: 1; 
        filter: brightness(1) saturate(1); 
    }
    50% { 
        opacity: 0.7; 
        filter: brightness(1.4) saturate(1.3); 
    }
}

@media (min-aspect-ratio: 1/1) {
    #background-layers {
        width: auto;
        height: 100vh;
        max-width: 100vw;
    }
    
    .bg-layer {
        width: auto;
        height: 100vh;
        max-width: 100vw;
    }
}

#overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.3);
    z-index: 3;
}

/* --- 漂浮爱心 --- */
#hearts-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    overflow: hidden;
}

.heart {
    position: absolute;
    bottom: -20px;
    width: 20px;
    height: 20px;
    background: rgba(255, 182, 193, 0.6);
    transform: rotate(45deg);
    animation: floatUp 4s linear forwards;
    pointer-events: none;
}

.heart::before, .heart::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 182, 193, 0.6);
}
.heart::before { top: -10px; left: 0; }
.heart::after { top: 0; left: -10px; }

/* --- 弹出照片 --- */
#photo-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

.popup-photo {
    position: absolute;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(255, 150, 180, 0.5), 0 0 40px rgba(255, 100, 150, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.8);
    animation: photoPopup 3s ease-out forwards;
    pointer-events: none;
    transform-origin: center;
}

/* --- 彩蛋爱心 --- */
.easter-egg-heart {
    position: absolute;
    font-size: 80px;
    color: rgba(255, 80, 100, 0.4);
    pointer-events: none;
    z-index: 200;
    animation: floatUpAndGrow 10s ease-out forwards;
}

/* --- UI 元素 --- */
#copyright {
    position: fixed;
    bottom: 12px;
    right: 15px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Georgia', serif;
    letter-spacing: 0.5px;
    z-index: 100;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

#music-toggle {
    position: absolute;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    cursor: pointer;
    z-index: 15;
    transition: all 0.3s ease;
    display: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#music-toggle:hover { background: rgba(255, 255, 255, 0.25); transform: scale(1.1); }
#music-toggle:active { transform: scale(0.95); }
#music-toggle.paused { color: rgba(255, 100, 100, 0.8); }

#worldmap-btn {
    position: absolute;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    cursor: pointer;
    z-index: 2000;
    pointer-events: auto;
    transition: all 0.3s ease;
    display: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    line-height: 36px;
    text-align: center;
}
#worldmap-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 2px 12px rgba(255, 182, 193, 0.3);
}
#worldmap-btn:active { transform: scale(0.95); }

#visit-counter {
    position: absolute;
    font-size: 11px;
    font-family: 'Georgia', serif;
    color: rgba(0, 0, 0, 0.4);
    z-index: 15;
    cursor: pointer;
    transition: color 0.3s ease;
    display: none;
    user-select: none;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.3);
}

#visit-counter.visible {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* --- 动画 --- */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}

@keyframes floatUp {
    0% { transform: translateY(0) rotate(45deg) scale(0.5); opacity: 0; }
    20% { opacity: 0.8; }
    100% { transform: translateY(-80vh) rotate(45deg) scale(1); opacity: 0; }
}

@keyframes photoPopup {
    0% { transform: translate(-50%, -50%) scale(0) rotate(-10deg); opacity: 0; }
    15% { transform: translate(-50%, -50%) scale(1.1) rotate(3deg); opacity: 1; }
    25% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); opacity: 1; }
    45% { transform: translate(-50%, -50%) scale(1) rotate(1deg); opacity: 1; }
    100% { transform: translate(-50%, -70%) scale(0.85) rotate(5deg); opacity: 0; }
}

@keyframes floatUpAndGrow {
    0% { opacity: 0.4; transform: translate(-50%, 0) scale(0.3); }
    40% { opacity: 0.5; transform: translate(-50%, -150px) scale(1.5); }
    100% { opacity: 0; transform: translate(-50%, -350px) scale(2.5); }
}
