/* Стили элементов спидтеста */

/* Начальный экран с большой кнопкой START */
.initial-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 40vh;
    width: 100%;
    margin-top: 20px;
}

/* Управление видимостью начального экрана */
.initial-screen.visible {
    display: flex !important;
}

.initial-screen.hidden {
    display: none !important;
}

.start-button {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: transparent;
    border: 3px solid #00d4ff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.7);
    animation: pulse 2s infinite;
    margin: 0 auto;
}

.start-button:hover {
    transform: scale(1.05);
    border-color: #00e6ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

.start-button span {
    font-size: 3em;
    font-weight: bold;
    color: #00d4ff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: color 0.3s ease;
}

.start-button:hover span {
    color: #00e6ff;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(0, 212, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 212, 255, 0);
    }
}

/* Маленькая кнопка START после завершения теста */
.start-button-small {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: transparent;
    border: 3px solid #00d4ff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    margin: 20px auto 40px auto;
    transition: all 0.3s ease;
}

.start-button-small:hover {
    transform: scale(1.05);
    border-color: #00e6ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

.start-button-small span {
    font-size: 1.5em;
    font-weight: bold;
    color: #00d4ff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: color 0.3s ease;
}

.start-button-small:hover span {
    color: #00e6ff;
}

/* Кнопка STOP */
.stop-button {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: transparent;
    border: 3px solid #ff6b7a;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    margin: 20px auto;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 0 rgba(255, 107, 122, 0.7);
    animation: pulse-stop 2s infinite;
}

.stop-button:hover {
    transform: scale(1.05);
    border-color: #ff8a9b;
    box-shadow: 0 0 20px rgba(255, 107, 122, 0.4);
}

.stop-button span {
    font-size: 1.5em;
    font-weight: bold;
    color: #ff6b7a;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: color 0.3s ease;
}

.stop-button:hover span {
    color: #ff8a9b;
}

@keyframes pulse-stop {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 107, 122, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(255, 107, 122, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 122, 0);
    }
}

/* Спидометры */
#speedometers {
    display: flex;
    justify-content: center;
    gap: 80px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.speedometer-wrapper {
    position: relative;
    width: 250px;
    height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.speedometer {
    width: 100%;
    height: 100%;
}

/* ИЗМЕНЕНО: Новый стиль для больших цифр датчиков */
.speed-value {
    position: absolute;
    top: 65%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5em;
    font-weight: 300;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    color: #00d4ff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 15px;
}

/* ИЗМЕНЕНО: Новый стиль для меток ЗАГРУЗКА/ОТДАЧА - сдвинуто ниже */
.speed-label {
    position: absolute;
    top: 77%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9em;
    font-weight: 400;
    font-family: 'Arial', 'Helvetica Neue', sans-serif;
    color: #ffffff;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.speed-unit {
    position: absolute;
    top: 85%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8em;
    color: #cccccc;
}

/* Графики */
.desktop-charts {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.mobile-chart {
    display: none;
    margin-top: 15px;
}

.chart-container {
    border-radius: 0;
    padding: 0;
    background: transparent;
}

.chart-container h3 {
    display: none;
}

.speed-chart {
    width: 250px;
    height: 80px;
    background: transparent;
    border-radius: 0;
}

/* Дополнительные метрики */
#additionalMetrics {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.metric {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px 30px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 120px;
    position: relative;
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.metric-name {
    font-size: 1.1em;
    color: #cccccc;
    font-weight: 500;
}

.info-icon {
    position: relative;
    cursor: pointer;
    color: #00d4ff;
    font-size: 0.9em;
    transition: color 0.3s ease;
}

.info-icon:hover {
    color: #00e6ff;
}

/* ИЗМЕНЕНО: Исправлено позиционирование всплывающего окна джиттера */
.info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85em;
    line-height: 1.4;
    white-space: normal;
    width: 280px;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.info-icon::before {
    content: '';
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1001;
}

.info-icon:hover::after,
.info-icon:hover::before {
    opacity: 1;
    visibility: visible;
}

/* ИЗМЕНЕНО: Стиль цифр для пинга и джиттера - только целые числа */
.metric-value {
    font-size: 2em;
    font-weight: 300;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    color: #00d4ff;
    margin-bottom: 8px;
}

.metric-unit {
    font-size: 0.9em;
    color: #cccccc;
}

/* IP область - показывается только во время теста */
#ipArea {
    margin: 30px 0;
    font-size: 1.1em;
    color: #cccccc;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#ipArea i {
    color: #00d4ff;
    font-size: 1.2em;
}

/* Показываем IP область только во время теста */
.test-interface #ipArea {
    display: flex;
}

/* Стили для экрана результатов */
.test-results {
    display: none;
}

.test-results.visible {
    display: block !important;
}

/* Спидометры результатов */
#speedometersResult {
    display: flex;
    justify-content: center;
    gap: 80px;
    margin: 40px 0;
    flex-wrap: wrap;
}

/* Графики результатов для десктопа */
#speedChartsResult {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin: 40px 0;
    flex-wrap: wrap;
}

/* Дополнительные метрики результатов */
#additionalMetricsResult {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin: 40px 0;
    flex-wrap: wrap;
}

/* IP область результатов */
#ipAreaResult {
    margin: 30px 0;
    font-size: 1.1em;
    color: #cccccc;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#ipAreaResult i {
    color: #00d4ff;
    font-size: 1.2em;
}

/* Адаптивный дизайн для элементов спидтеста */
@media (max-width: 768px) {
    .initial-screen {
        min-height: 30vh;
        margin-top: 10px;
    }
    
    .start-button {
        width: 150px;
        height: 150px;
    }
    
    .start-button span {
        font-size: 2em;
    }
    
    .start-button-small {
        width: 100px;
        height: 100px;
    }
    
    .start-button-small span {
        font-size: 1.2em;
    }
    
    .stop-button {
        width: 100px;
        height: 100px;
    }
    
    .stop-button span {
        font-size: 1.2em;
    }
    
    #speedometers {
        gap: 30px;
        flex-direction: column;
        align-items: center;
    }
    
    .speedometer-wrapper {
        width: 200px;
        height: 200px;
    }
    
    /* ИЗМЕНЕНО: Размер шрифта для мобильных устройств */
    .speed-value {
        font-size: 1em;
        top: 65%;
    }
    
    /* ИЗМЕНЕНО: Улучшенное позиционирование меток в мобильной версии */
    .speed-label {
        top: 77%;
    }
    
    .speed-unit {
        top: 85%;
    }
    
    .desktop-charts {
        display: none;
    }
    
    .mobile-chart {
        display: block;
    }
    
    .speed-chart {
        width: 200px;
        height: 60px;
    }
    
    #additionalMetrics {
        gap: 20px;
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }
    
    .metric {
        min-width: 100px;
        padding: 15px 20px;
        flex: 1;
        max-width: 140px;
    }
    
    /* ИЗМЕНЕНО: Исправлено позиционирование всплывающего окна для мобильных */
    .info-icon::after {
        width: 200px;
        font-size: 0.8em;
        left: -200px;
        transform: translateX(0);
    }
    
    .info-icon::before {
        left: -25%;
        transform: translateX(-50%);
    }
    
    /* Адаптивные стили для результатов */
    #speedometersResult {
        gap: 30px;
        flex-direction: column;
        align-items: center;
    }
    
    #speedChartsResult {
        display: none;
    }
    
    #additionalMetricsResult {
        gap: 20px;
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .start-button {
        width: 120px;
        height: 120px;
    }
    
    .start-button span {
        font-size: 1.8em;
    }
    
    .speedometer-wrapper {
        width: 180px;
        height: 180px;
    }
    
    .speed-chart {
        width: 180px;
        height: 50px;
    }
    
    /* ИЗМЕНЕНО: Максимальное смещение влево для очень маленьких экранов */
    .info-icon::after {
        width: 160px;
        font-size: 0.75em;
        left: -120px;
    }
    
    .info-icon::before {
        left: -10%;
    }
    
    #additionalMetrics {
        gap: 15px;
    }
    
    .metric {
        min-width: 80px;
        padding: 12px 15px;
        max-width: 120px;
    }
    
    .metric-name {
        font-size: 1em;
    }
    
    .metric-value {
        font-size: 1.6em;
    }
    
    #additionalMetricsResult {
        gap: 15px;
    }
}