/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 语言切换按钮 */
.language-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.language-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    padding: 8px 16px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.language-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.language-btn:active {
    transform: translateY(0);
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

/* Logo样式 */
.logo-container {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    transition: all 0.3s ease;
    animation: logoFloat 3s ease-in-out infinite;
}

.logo:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.3));
}

/* Logo浮动动画 */
@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 主要内容区域 */
main {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

/* 测试按钮区域 */
.test-section {
    text-align: center;
    margin-bottom: 40px;
}

.start-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border: none;
    border-radius: 50px;
    padding: 20px 40px;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(255, 107, 107, 0.4);
}

.start-btn:active {
    transform: translateY(0);
}

.start-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 加载指示器 */
.loading {
    text-align: center;
    margin: 20px 0;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* 结果区域 */
.results-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.result-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.result-header h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.result-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 15px;
}

.unit {
    font-size: 1rem;
    color: #6c757d;
    font-weight: normal;
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
}

/* 网络质量指示器 */
.quality-indicator {
    margin-top: 15px;
}

.quality-bar {
    height: 20px;
    border-radius: 10px;
    background: #e9ecef;
    position: relative;
    overflow: hidden;
}

.quality-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    border-radius: 10px;
    transition: all 0.5s ease;
}

.quality-bar.excellent::after {
    background: linear-gradient(90deg, #28a745, #20c997);
    width: 100%;
}

.quality-bar.good::after {
    background: linear-gradient(90deg, #ffc107, #fd7e14);
    width: 75%;
}

.quality-bar.fair::after {
    background: linear-gradient(90deg, #fd7e14, #dc3545);
    width: 50%;
}

.quality-bar.poor::after {
    background: linear-gradient(90deg, #dc3545, #6f42c1);
    width: 25%;
}

/* 详情和信息区域 */
.details-section, .info-section {
    margin-bottom: 30px;
}

.details-section h3, .info-section h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.test-details {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border-left: 4px solid #667eea;
}

.info-content p {
    margin-bottom: 10px;
    line-height: 1.6;
    color: #6c757d;
}

/* 底部 */
footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .language-switcher {
        top: 10px;
        right: 10px;
    }

    .language-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .logo {
        width: 60px;
        height: 60px;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 20px;
    }

    .results-section {
        grid-template-columns: 1fr;
    }

    .result-value {
        font-size: 2rem;
    }
}

/* 可访问性样式 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 焦点样式 */
*:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

button:focus,
.language-btn:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .container {
        background: white;
        color: black;
    }

    .start-btn {
        background: black;
        color: white;
        border: 2px solid black;
    }

    .result-card {
        border: 2px solid black;
        background: white;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .logo {
        animation: none;
    }

    .spinner {
        animation: none;
        border: 4px solid #667eea;
    }
}

/* 工具提示 */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.tooltip:hover::after,
.tooltip:focus::after {
    opacity: 1;
}

/* 定义列表样式 */
dl {
    margin: 0;
}

dt {
    margin-top: 15px;
    margin-bottom: 5px;
}

dd {
    margin-left: 0;
    margin-bottom: 10px;
    padding-left: 20px;
}
