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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 10px;
    color: #333;
}

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

/* Test Section */
.test-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.test-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.btn {
    padding: 12px 30px;
    font-size: 1em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: #dc2626;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #b91c1c;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.progress-container {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 25px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 12px;
}

.progress-text {
    text-align: center;
    font-size: 0.95em;
    color: #6b7280;
}

/* Grade Header */
.grade-header {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid #e5e7eb;
}

.grade-header h1 {
    font-size: 1.6em;
    margin-bottom: 15px;
    text-align: center;
    color: #1f2937;
}

.grade-header h1 span {
    color: #10b981;
    font-weight: bold;
    font-size: 1.2em;
}

.activity-indicators {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
}

.activity-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.activity-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

.activity-icon {
    font-size: 1.1em;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    font-weight: bold;
}

.activity-item.good .activity-icon {
    background: #10b981;
    color: white;
}

.activity-item.bad .activity-icon {
    background: #ef4444;
    color: white;
}

.activity-item.bad .activity-icon::before {
    content: "✗";
}

.activity-item.good .activity-icon::before {
    content: "✓";
}

.activity-label {
    font-size: 0.75em;
    color: #6b7280;
    font-weight: 500;
}

.info-link {
    text-align: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.info-link a {
    color: #2563eb;
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 500;
    transition: color 0.3s ease;
}

.info-link a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Results Section */
.results-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.summary-metrics {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.summary-item {
    text-align: center;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
}

.summary-label {
    font-size: 0.9em;
    color: #6b7280;
    margin-bottom: 10px;
}

.summary-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #1f2937;
}

.summary-value.positive {
    color: #10b981;
}

.summary-value.negative {
    color: #ef4444;
}

/* Combined Chart */
.combined-chart-container {
    margin: 15px 0;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
}

.combined-chart-container h3 {
    font-size: 1em;
    color: #1f2937;
    margin-bottom: 10px;
    text-align: center;
}

#combinedLatencyChart {
    width: 100%;
    height: 250px;
    display: block;
    margin: 0 auto;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.legend-label {
    font-size: 0.9em;
    color: #6b7280;
}

/* Compact Stats */
.compact-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.stat-group {
    background: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.stat-group h4 {
    font-size: 0.95em;
    color: #1f2937;
    margin-bottom: 10px;
    text-align: center;
    font-weight: 600;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.85em;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row span {
    color: #6b7280;
    font-size: 0.9em;
}

.stat-row strong {
    color: #1f2937;
    font-weight: 600;
}

/* Speed Section */
.speed-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.speed-section h2 {
    font-size: 1.4em;
    color: #1f2937;
    margin-bottom: 15px;
}

.speed-metrics {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.speed-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.speed-label {
    font-size: 1.1em;
    color: #6b7280;
}

.speed-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #1f2937;
}

/* Recommendations */
.recommendations-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.recommendations-card h2 {
    color: #1f2937;
    margin-bottom: 15px;
    font-size: 1.4em;
}

.recommendation-item {
    padding: 12px;
    margin-bottom: 10px;
    border-left: 4px solid #2563eb;
    background: #f9fafb;
    border-radius: 5px;
}

.recommendation-item.warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.recommendation-item.danger {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.recommendation-item.success {
    border-left-color: #10b981;
    background: #f0fdf4;
}

.recommendation-item h3 {
    margin-bottom: 8px;
    color: #1f2937;
    font-size: 0.95em;
}

.recommendation-item p {
    color: #6b7280;
    line-height: 1.5;
    font-size: 0.9em;
}

/* Info Section */
.info-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.info-section h2 {
    color: #1f2937;
    margin-bottom: 10px;
    font-size: 1.4em;
}

.info-section p {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 10px;
    font-size: 0.95em;
}

.info-section strong {
    color: #1f2937;
}

/* Responsive */
@media (max-width: 768px) {
    .summary-metrics {
        grid-template-columns: 1fr;
    }
    
    .compact-stats {
        grid-template-columns: 1fr;
    }
    
    .chart-legend {
        gap: 15px;
    }
    
    .activity-indicators {
        gap: 15px;
    }
    
    .grade-header h1 {
        font-size: 1.8em;
    }
    
    .test-controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    #combinedLatencyChart {
        height: 180px;
    }
}