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

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #0c0c0c, #1a1a2e, #16213e);
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}

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

/* Animated Background */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: radial-gradient(circle, rgba(100, 100, 255, 0.3) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: float 20s infinite linear;
}

.particle:nth-child(1) { top: 10%; left: 20%; animation-delay: 0s; }
.particle:nth-child(2) { top: 60%; left: 80%; animation-delay: -5s; }
.particle:nth-child(3) { top: 30%; left: 40%; animation-delay: -10s; }
.particle:nth-child(4) { top: 80%; left: 60%; animation-delay: -15s; }
.particle:nth-child(5) { top: 40%; left: 90%; animation-delay: -20s; }

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(100px, 50px) rotate(90deg); }
    50% { transform: translate(50px, 100px) rotate(180deg); }
    75% { transform: translate(-50px, 50px) rotate(270deg); }
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
}

.title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(45deg, #00ffff, #ff00ff, #ffff00);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
    margin-bottom: 10px;
    text-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
}

.subtitle {
    font-size: 1.2rem;
    color: #ccc;
    font-weight: 300;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Connection Info */
.connection-info {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin: 0 auto 30px;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ip-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1rem;
    color: #fff;
    font-weight: 500;
    margin-bottom: 15px;
}

.flag {
    width: 24px;
    height: 16px;
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Server Selection */
.server-selection {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.server-selection label {
    font-size: 0.9rem;
    color: #ccc;
    font-weight: 500;
}

.server-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.server-select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

.server-select:focus {
    outline: none;
    border-color: #4ecdc4;
    box-shadow: 0 0 0 2px rgba(78, 205, 196, 0.2);
}

.server-select option {
    background: #1a1a2e;
    color: #fff;
    padding: 10px;
}

/* Start Button */
.start-btn {
    position: relative;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    border: none;
    padding: 20px 40px;
    font-size: 1.3rem;
    font-weight: bold;
    color: white;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 auto 40px;
    display: block;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-height: 60px;
}

.start-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

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

.start-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.start-btn:hover .btn-glow {
    left: 100%;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.test-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.test-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1);
}

.test-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    color: #fff;
}

.card-header .icon {
    font-size: 1.5rem;
}

.card-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 15px;
    font-family: 'Orbitron', sans-serif;
}

.unit {
    font-size: 1rem;
    color: #ccc;
    margin-left: 5px;
}

/* Progress Bars */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ecdc4, #44a08d);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

/* Main Progress Bar */
.progress-container {
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
}

.progress-bar-main {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill-main {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

/* Speed Gauges */
.speed-gauge {
    text-align: center;
    margin-top: 15px;
}

/* Status */
.status {
    text-align: center;
    font-size: 1.1rem;
    color: #ccc;
    margin: 20px 0;
    min-height: 24px;
    font-weight: 500;
}

/* Animation classes */
.pulse {
    animation: pulse 2s infinite;
}

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

.glow {
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.5);
}

.hidden {
    display: none !important;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .test-card {
        padding: 20px;
    }
    
    .card-value {
        font-size: 2rem;
    }
    
    .start-btn {
        padding: 18px 30px;
        font-size: 1.2rem;
        min-height: 55px;
    }
    
    .connection-info {
        max-width: 350px;
        padding: 15px;
    }
    
    .server-selection {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.8rem;
    }
    
    .test-card {
        padding: 15px;
    }
    
    .card-value {
        font-size: 1.8rem;
    }
    
    .start-btn {
        padding: 16px 25px;
        font-size: 1.1rem;
        min-height: 50px;
    }
    
    .header {
        margin-bottom: 20px;
        padding: 10px;
    }
    
    .connection-info {
        max-width: 320px;
        padding: 12px;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .start-btn:hover {
        transform: none;
    }
    
    .start-btn:active {
        transform: scale(0.98);
    }
    
    .server-select:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}