:root {
    --primary-color: #6a11cb;
    --secondary-color: #2575fc;
    --background-color: #f0f2f5;
    --card-background: #ffffff;
    --text-color: #333333;
    --header-color: #ffffff;
    --success-color: #2ecc71;
    --error-color: #e74c3c;
}

[data-theme="dark"] {
    --primary-color: #bb86fc;
    --secondary-color: #03dac6;
    --background-color: #121212;
    --card-background: #1e1e1e;
    --text-color: #ffffff;
    --header-color: #121212;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--header-color);
    text-align: center;
    padding: 2rem 1rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from, to {
        text-shadow: 0 0 5px #fff, 0 0 10px var(--secondary-color);
    }
}

.site-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.site-item {
    background-color: var(--card-background);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    transform: translateY(0);
    will-change: transform;
}

.site-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.site-item h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.4rem;
}

.latency {
    font-weight: bold;
    color: var(--secondary-color);
}

.status-icon {
    font-size: 1.2rem;
    margin-left: 10px;
}

.status-icon.success {
    color: var(--success-color);
}

.status-icon.error {
    color: var(--error-color);
}

.btn {
    display: inline-block;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 1rem;
    margin-top: 15px;
    text-align: center;
}

.btn:hover {
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.best-route {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-align: center;
    padding: 20px;
    border-radius: 15px;
    margin-top: 2rem;
    font-size: 1.2rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.best-route.show {
    opacity: 1;
    transform: translateY(0);
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.theme-switch-wrapper {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
}

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 26px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 26px;
}

input:checked + .slider {
    background-color: var(--secondary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.static-resource-section {
    margin-top: 2rem;
}

.static-resource-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

footer {
    text-align: center;
    padding: 20px;
    margin-top: 2rem;
    background-color: var(--card-background);
    color: var(--text-color);
}

@media (max-width: 600px) {
    h1 {
        font-size: 1.8rem;
    }

    .site-list {
        grid-template-columns: 1fr;
    }

    .btn {
        display: block;
        width: 100%;
    }

    .best-route {
        font-size: 1rem;
    }
}

/* 保留之前的所有CSS，并用以下内容替换重复的部分 */

.best-route-container {
    position: relative;
    margin-top: 2rem;
}

.countdown {
    position: absolute;
    top: -30px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
    color: var(--primary-color);
    background-color: var(--background-color);
    padding: 5px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: var(--card-background);
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 10px;
    text-align: center;
}

#alertMessage {
    color: var(--text-color);
    font-size: 1.1rem;
}
