* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #0a0e27;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    position: relative;
    overflow: hidden;
}

body::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.3), transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(168, 85, 247, 0.2), transparent 50%);
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-5%, -5%) rotate(120deg); }
    66% { transform: translate(-10%, 5%) rotate(240deg); }
}

.container {
    background: rgba(15, 23, 42, 0.8);
    border-radius: 24px;
    padding: 50px 40px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    box-shadow:
        0 0 60px rgba(99, 102, 241, 0.3),
        0 20px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    position: relative;
    z-index: 1;
}

.title {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    letter-spacing: 1px;
    text-shadow: 0 0 40px rgba(99, 102, 241, 0.5);
}

.subtitle {
    font-size: 1.5rem;
    color: #e2e8f0;
    margin-bottom: 8px;
    font-weight: 500;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.description {
    font-size: 1rem;
    color: #94a3b8;
    margin-bottom: 40px;
    line-height: 1.6;
}

.loading-container {
    margin: 30px 0;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top: 4px solid #6366f1;
    border-right: 4px solid #a855f7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.4);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.speed-test-results {
    margin-top: 35px;
}

.node-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    margin: 12px 0;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 14px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.node-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: linear-gradient(180deg, #6366f1, #a855f7);
    opacity: 0;
    transition: opacity 0.3s;
}

.node-item:hover {
    transform: translateX(5px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
    border-color: rgba(99, 102, 241, 0.6);
}

.node-item:hover::before {
    opacity: 1;
}

.node-name {
    font-weight: 500;
    color: #e2e8f0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.node-name::before {
    content: '●';
    color: #6366f1;
    font-size: 0.8rem;
    animation: pulse 2s ease-in-out infinite;
}

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

.node-speed {
    font-family: 'SF Mono', 'Monaco', 'Consolas', 'Courier New', monospace;
    font-weight: 600;
    color: #a78bfa;
    font-size: 1rem;
    padding: 6px 14px;
    background: rgba(168, 85, 247, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.redirect-message {
    margin-top: 35px;
    padding: 25px;
    background: rgba(34, 197, 94, 0.1);
    border: 2px solid rgba(34, 197, 94, 0.5);
    border-radius: 16px;
    color: #86efac;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.2);
}

.redirect-message p {
    margin: 8px 0;
    font-weight: 500;
    font-size: 1.1rem;
}

.redirect-message button {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.redirect-message button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

/* Responsive design */
@media (max-width: 600px) {
    .container {
        padding: 35px 25px;
        margin: 20px;
    }

    .title {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1.3rem;
    }

    .node-item {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 16px 20px;
    }

    .node-name, .node-speed {
        font-size: 0.9rem;
    }
}

/* Animation for successful speed tests */
.node-item.success {
    animation: successGlow 0.6s ease;
}

@keyframes successGlow {
    0% {
        box-shadow: 0 0 0 rgba(99, 102, 241, 0);
        border-color: rgba(99, 102, 241, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(99, 102, 241, 0.6);
        border-color: rgba(99, 102, 241, 0.8);
    }
    100% {
        box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
        border-color: rgba(99, 102, 241, 0.6);
    }
}

/* Loading animation for speed test items */
.node-item[data-loading="true"] {
    position: relative;
    overflow: hidden;
}

.node-item[data-loading="true"]::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(99, 102, 241, 0.3),
        transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}