/**
 * Starfield Background - 星空背景样式
 * NovaGold Official Website
 */

/* === 星空容器 === */
#star-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    perspective: 1000px;
    transform-style: preserve-3d;
    animation: starfield-rotate 120s linear infinite;
}

@keyframes starfield-rotate {
    from { transform: rotateZ(0deg); }
    to { transform: rotateZ(360deg); }
}

/* === 白色星星 === */
.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
}

/* === 金色尘埃 === */
.gold-dust {
    position: absolute;
    background: #F59E0B;
    border-radius: 50%;
    opacity: 0.6;
    box-shadow: 0 0 4px #FCD34D;
    animation: starfield-twinkle 3s infinite ease-in-out;
}

@keyframes starfield-twinkle {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.5); }
}

/* === 流星 === */
.meteor {
    position: absolute;
    width: 1px;
    height: 120px;
    background: linear-gradient(to bottom, 
        rgba(255,255,255,0) 0%, 
        rgba(255,255,255,0.05) 20%,
        rgba(255,255,255,0.2) 60%,
        rgba(255,255,255,0.6) 90%,
        rgba(255,255,255,1) 100%
    );
    filter: blur(0.8px);
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

/* 流星头部（底部亮点） */
.meteor::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px 2px rgba(255,255,255,0.8), 0 0 12px 4px rgba(252,211,77,0.4);
}

.meteor.active {
    animation: starfield-shootingStar 1.5s linear forwards;
}

@keyframes starfield-shootingStar {
    0% {
        opacity: 0;
        top: -120px;
    }
    3% {
        opacity: 1;
    }
    85% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        top: 100vh;
    }
}

/* === 流星雨 === */
.meteor.meteor-shower.active {
    animation: starfield-shootingStarShower 2s linear forwards;
}

@keyframes starfield-shootingStarShower {
    0% {
        opacity: 0;
        top: -400px;
    }
    5% {
        opacity: 1;
    }
    80% {
        opacity: 0.9;
    }
    100% {
        opacity: 0;
        top: calc(100vh + 100px);
    }
}

/* === 超新星爆炸 === */
.supernova {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

/* 超新星光晕 */
.supernova::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: transparent;
    border-radius: 50%;
    box-shadow: 
        0 0 20px 10px rgba(255,255,255,0.8),
        0 0 40px 20px rgba(252,211,77,0.6),
        0 0 60px 30px rgba(245,158,11,0.4),
        0 0 80px 40px rgba(239,68,68,0.2);
}

/* 超新星扩散环 */
.supernova::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 50%;
    opacity: 0;
}

.supernova.active {
    animation: starfield-supernovaCore 2.5s ease-out forwards;
}

.supernova.active::before {
    animation: starfield-supernovaGlow 2.5s ease-out forwards;
}

.supernova.active::after {
    animation: starfield-supernovaRing 2.5s ease-out forwards;
}

@keyframes starfield-supernovaCore {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    10% {
        opacity: 1;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(2);
    }
    100% {
        opacity: 0;
        transform: scale(0.5);
    }
}

@keyframes starfield-supernovaGlow {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    15% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    40% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(6);
        opacity: 0;
    }
}

@keyframes starfield-supernovaRing {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
        border-width: 2px;
    }
    20% {
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(40);
        opacity: 0;
        border-width: 1px;
    }
}

/* === 星空隐藏状态 === */
#star-container.hidden {
    display: none !important;
}

/* === 移动端适配 === */
@media (max-width: 768px) {
    #star-container {
        animation-duration: 180s; /* 移动端旋转更慢，节省性能 */
    }
}

