/* 별자리 컨스텔레이션 로딩 애니메이션 */

.constellation-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a3e 50%, #0f0c29 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.constellation-loading.active {
    opacity: 1;
    visibility: visible;
}

.constellation-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    pointer-events: none; /* 클릭 방지 */
    z-index: 5; /* 로더보다는 뒤, 배경보다는 앞 */
}

/* 별들 */
.star {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.8),
                0 0 20px 4px rgba(135, 206, 250, 0.6);
    animation: twinkle 3s infinite ease-in-out;
}

/* 별 깜박임 애니메이션 */
@keyframes twinkle {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.3;
        transform: scale(0.8);
    }
}

/* 별자리 연결선 */
.constellation-line {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg,
        rgba(135, 206, 250, 0) 0%,
        rgba(135, 206, 250, 0.8) 50%,
        rgba(135, 206, 250, 0) 100%);
    transform-origin: left center;
    animation: drawLine 2s ease-in-out forwards;
}

@keyframes drawLine {
    0% {
        width: 0;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        width: var(--line-length);
        opacity: 0.6;
    }
}

/* 배경 반짝이는 작은 별들 */
.twinkle-stars {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.twinkle-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: twinkleFloat 6s infinite ease-in-out;
}

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

/* 로딩 텍스트 */
.loading-text {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 500;
    text-align: center;
    letter-spacing: 2px;
}

.loading-text::after {
    content: '';
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

/* 로딩 진행 바 */
.loading-progress {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #87CEEB);
    border-radius: 10px;
    animation: progressBar 3s ease-in-out infinite;
}

@keyframes progressBar {
    0% {
        width: 0%;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

/* 유성 효과 */
.shooting-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.8);
    animation: shootingStar 3s ease-out infinite;
}

@keyframes shootingStar {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(300px, 300px) scale(0);
        opacity: 0;
    }
}

/* 펄스 효과 (중앙) */
.pulse-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border: 2px solid rgba(135, 206, 250, 0.6);
    border-radius: 50%;
    animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Existing Styles... */

/* SVG Constellation Loader (from reference) */
.constellation-loader { width: 140px; height: 140px; position: relative; margin: 0 auto; z-index: 10; }
.star-dot { position: absolute; width: 4px; height: 4px; background: #fff; border-radius: 50%; box-shadow: 0 0 10px #fff, 0 0 20px #818cf8; animation: starPulse 2s infinite alternate; opacity: 0; }
.line-path { fill: none; stroke: rgba(129, 140, 248, 0.4); stroke-width: 1.5; stroke-dasharray: 200; stroke-dashoffset: 200; animation: drawLine 4s linear infinite; }
@keyframes starPulse { 0% { opacity: 0.3; transform: scale(0.7); } 100% { opacity: 1; transform: scale(1.3); } }
@keyframes drawLine { 0% { stroke-dashoffset: 200; opacity: 0; } 30% { opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }

.twinkle-text {
    background: linear-gradient(90deg, #818cf8, #fff, #c084fc, #818cf8);
    background-size: 200% auto; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    animation: shine 3s linear infinite; font-weight: 900;
}
@keyframes shine { to { background-position: 200% center; } }

/* Background Twinkle Stars */
.bg-star {
    position: absolute; background: white; border-radius: 50%;
    opacity: 0; animation: twinkleBg 2s infinite ease-in-out; pointer-events: none;
}
@keyframes twinkleBg {
    0%, 100% { opacity: 0; transform: scale(0.3); }
    50% { opacity: 0.8; transform: scale(1); box-shadow: 0 0 10px #fff; }
}

/* Modal Content Scroll Fix */
.modal-content::-webkit-scrollbar { display: none; }
.modal-content { scrollbar-width: none; overflow-y: auto; max-height: 90vh; width: 100%; max-width: 800px; }

/* 모바일 대응 */
@media (max-width: 768px) {
    .constellation-container {
        width: 300px;
        height: 300px;
    }

    .loading-text {
        font-size: 1rem;
        bottom: 40px;
    }

    .loading-progress {
        width: 150px;
        bottom: 20px;
    }
}
