/* Netflix 風格載入動畫 */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeOut 0.8s ease-in-out 3.5s forwards;
}

.loading-container {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-direction: row;
}

/* 網路類型提示 */
.network-hint {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    opacity: 0;
    animation: networkHintFadeIn 1s ease-out 0.5s forwards;
}

.network-emoji {
    font-size: 2rem;
    margin-bottom: 10px;
    animation: networkEmojiPulse 2s ease-in-out 1.5s infinite;
}

.network-text {
    font-size: clamp(0.7rem, 3vw, 1.2rem);
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: clamp(0, 1vw, 2px);
    white-space: nowrap;
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;
}

.network-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

@keyframes networkHintFadeIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes networkEmojiPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.loading-screen.hide {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease-in-out, visibility 0s 0.8s;
}

.loading-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e50914;
    opacity: 0;
    transform: scale(0.5);
    animation: iconAppear 0.8s ease-out 0.2s forwards;
}

.loading-icon.animate {
    animation: iconAppear 0.8s ease-out 0.2s forwards, iconBounce 2s ease-in-out 1s infinite;
}

@keyframes iconAppear {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-180deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes iconBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: scale(1);
    }
    40% {
        transform: scale(1.1);
    }
    60% {
        transform: scale(1.05);
    }
}

/* SVG 圖標特定樣式 */
.loading-icon-svg {
    width: 4rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    animation: iconAppear 0.8s ease-out 0.2s forwards;
}

.loading-icon-svg.animate {
    animation: iconAppear 0.8s ease-out 0.2s forwards, iconBounce 2s ease-in-out 1s infinite;
}

.loading-icon-svg img {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 50%;
    filter: drop-shadow(0 0 10px rgba(125, 70, 152, 0.3));
}

/* Tor SVG 特殊效果 */
.loading-icon-svg img[src*="tor.svg"] {
    filter: drop-shadow(0 0 15px rgba(125, 70, 152, 0.5));
}

/* I2P SVG 特殊效果 */
.loading-icon-svg img[src*="i2p.svg"] {
    filter: drop-shadow(0 0 15px rgba(0, 102, 204, 0.5));
}

.loading-logo {
    position: relative;
    font-size: clamp(1.5rem, 8vw, 4rem);
    font-weight: bold;
    color: #e50914;
    font-family: 'Arial Black', Arial, sans-serif;
    letter-spacing: clamp(-0.05em, 0.5vw, 0.1em);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: visible;
    max-width: 90vw;
}

/* Logo 文字動畫 */
.loading-logo .letter {
    display: inline-block;
    animation: letterDrop 0.6s ease-out forwards;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50px) scale(1.2);
}

.loading-logo .letter:nth-child(1) { animation-delay: 0.1s; }
.loading-logo .letter:nth-child(2) { animation-delay: 0.2s; }
.loading-logo .letter:nth-child(3) { animation-delay: 0.3s; }
.loading-logo .letter:nth-child(4) { animation-delay: 0.4s; }
.loading-logo .letter:nth-child(5) { animation-delay: 0.5s; }
.loading-logo .letter:nth-child(6) { animation-delay: 0.6s; }
.loading-logo .letter:nth-child(7) { animation-delay: 0.7s; }
.loading-logo .letter:nth-child(8) { animation-delay: 0.8s; }
.loading-logo .letter:nth-child(9) { animation-delay: 0.9s; }
.loading-logo .letter:nth-child(10) { animation-delay: 1.0s; }
.loading-logo .letter:nth-child(11) { animation-delay: 1.1s; }
.loading-logo .letter:nth-child(12) { animation-delay: 1.2s; }
.loading-logo .letter:nth-child(13) { animation-delay: 1.3s; }
.loading-logo .letter:nth-child(14) { animation-delay: 1.4s; }
.loading-logo .letter:nth-child(15) { animation-delay: 1.5s; }
.loading-logo .letter:nth-child(16) { animation-delay: 1.6s; }
.loading-logo .letter:nth-child(17) { animation-delay: 1.7s; }
.loading-logo .letter:nth-child(18) { animation-delay: 1.8s; }
.loading-logo .letter:nth-child(19) { animation-delay: 1.9s; }
.loading-logo .letter:nth-child(20) { animation-delay: 2.0s; }
.loading-logo .letter:nth-child(21) { animation-delay: 2.1s; }
.loading-logo .letter:nth-child(22) { animation-delay: 2.2s; }
.loading-logo .letter:nth-child(23) { animation-delay: 2.3s; }
.loading-logo .letter:nth-child(24) { animation-delay: 2.4s; }
.loading-logo .letter:nth-child(25) { animation-delay: 2.5s; }
.loading-logo .letter:nth-child(26) { animation-delay: 2.6s; }
.loading-logo .letter:nth-child(27) { animation-delay: 2.7s; }
.loading-logo .letter:nth-child(28) { animation-delay: 2.8s; }
.loading-logo .letter:nth-child(29) { animation-delay: 2.9s; }
.loading-logo .letter:nth-child(30) { animation-delay: 3.0s; }


@keyframes letterDrop {
    0% {
        opacity: 0;
        visibility: hidden;
        transform: translateY(-50px) scale(1.2);
    }
    1% {
        visibility: visible;
    }
    50% {
        transform: translateY(10px) scale(1.05);
    }
    100% {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
    }
}

/* Logo 發光效果 */
.loading-logo::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    color: inherit;
    filter: blur(10px);
    opacity: 0.6;
    z-index: -1;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 
            0 0 5px #e50914,
            0 0 10px #e50914,
            0 0 15px #e50914;
    }
    to {
        text-shadow: 
            0 0 10px #e50914,
            0 0 20px #e50914,
            0 0 30px #e50914,
            0 0 40px #e50914;
    }
}

/* 載入進度條 */
.loading-progress {
    position: absolute;
    bottom: 30%;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #e50914, #ff6b6b);
    border-radius: 2px;
    width: 0;
    animation: progressLoad 3s ease-in-out forwards;
    animation-delay: 1s;
}

@keyframes progressLoad {
    0% { width: 0; }
    20% { width: 30%; }
    50% { width: 60%; }
    80% { width: 90%; }
    100% { width: 100%; }
}

/* 背景粒子效果 */
.loading-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #e50914;
    border-radius: 50%;
    animation: particleFloat 4s infinite ease-in-out;
}

.particle:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 3s;
}

.particle:nth-child(2) {
    left: 20%;
    animation-delay: 0.5s;
    animation-duration: 4s;
}

.particle:nth-child(3) {
    left: 30%;
    animation-delay: 1s;
    animation-duration: 3.5s;
}

.particle:nth-child(4) {
    left: 40%;
    animation-delay: 1.5s;
    animation-duration: 4.5s;
}

.particle:nth-child(5) {
    left: 50%;
    animation-delay: 2s;
    animation-duration: 3.2s;
}

.particle:nth-child(6) {
    left: 60%;
    animation-delay: 0.3s;
    animation-duration: 4.2s;
}

.particle:nth-child(7) {
    left: 70%;
    animation-delay: 0.8s;
    animation-duration: 3.8s;
}

.particle:nth-child(8) {
    left: 80%;
    animation-delay: 1.3s;
    animation-duration: 4.3s;
}

.particle:nth-child(9) {
    left: 90%;
    animation-delay: 1.8s;
    animation-duration: 3.3s;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-10vh) scale(1);
    }
}

/* 響應式設計 */
@media (max-width: 1200px) {
    .loading-logo {
        font-size: 3.5rem;
    }
    
    .network-text {
        font-size: 1.1rem;
    }
    
    .network-emoji {
        font-size: 1.8rem;
    }
}

@media (max-width: 768px) {
    .loading-container {
        flex-direction: column;
        gap: 20px;
        padding: 0 20px;
    }
    
    .loading-logo {
        font-size: 2.8rem;
        letter-spacing: 0.05em;
    }
    
    .loading-icon, .loading-icon-svg {
        width: 2.5rem;
        height: 2.5rem;
    }
    
    .loading-progress {
        width: 250px;
    }
    
    .network-text {
        font-size: 1rem;
        letter-spacing: 1.5px;
    }
    
    .network-emoji {
        font-size: 1.6rem;
    }
    
    .network-desc {
        font-size: 0.8rem;
    }
}

@media (max-width: 640px) {
    .loading-logo {
        font-size: 2.3rem;
        letter-spacing: 0.02em;
    }
    
    .loading-container {
        padding: 0 15px;
    }
    
    .network-text {
        font-size: 0.9rem;
        letter-spacing: 1px;
    }
}

@media (max-width: 480px) {
    .loading-container {
        gap: 15px;
        padding: 0 10px;
    }
    
    .loading-logo {
        font-size: 2rem;
        letter-spacing: 0;
    }
    
    .loading-icon, .loading-icon-svg {
        width: 2rem;
        height: 2rem;
    }
    
    .loading-progress {
        width: 200px;
    }
    
    .network-text {
        font-size: 0.8rem;
        letter-spacing: 0.5px;
    }
    
    .network-emoji {
        font-size: 1.4rem;
    }
    
    .network-desc {
        font-size: 0.7rem;
    }
}

@media (max-width: 375px) {
    .loading-logo {
        font-size: 1.8rem;
        letter-spacing: -0.02em;
    }
    
    .loading-container {
        padding: 0 8px;
    }
    
    .network-text {
        font-size: 0.75rem;
        letter-spacing: 0;
    }
}

@media (max-width: 320px) {
    .loading-logo {
        font-size: 1.5rem;
        letter-spacing: -0.05em;
    }
    
    .loading-container {
        padding: 0 5px;
    }
    
    .network-text {
        font-size: 0.7rem;
    }
    
    .network-emoji {
        font-size: 1.2rem;
    }
    
    .loading-progress {
        width: 180px;
    }
}