/* HR Fiber Speed Test Page */
.speed-test-hero {
    background: linear-gradient(135deg, #1e0936 0%, #4f008c 45%, #6d28d9 100%);
    position: relative;
    overflow: hidden;
}

.speed-test-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(132, 204, 22, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 80% 70%, rgba(168, 85, 247, 0.2) 0%, transparent 40%);
    pointer-events: none;
}

.speed-test-app {
    max-width: 920px;
    margin: 0 auto;
}

.speed-gauge-wrap {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(79, 0, 140, 0.1);
    border-radius: 1.75rem;
    padding: 2rem 1.5rem 1.5rem;
    box-shadow: 0 25px 60px rgba(30, 9, 54, 0.12);
}

.dark .speed-gauge-wrap {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
}

#speedGauge {
    width: 100%;
    height: 220px;
    display: block;
}

.live-speed-display {
    position: absolute;
    left: 50%;
    top: 52%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.live-speed-display .speed-number {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, #4f008c, #84cc16);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.live-speed-display .speed-unit {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 600;
    margin-top: 0.25rem;
}

.dark .live-speed-display .speed-unit {
    color: #94a3b8;
}

.test-phase-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(79, 0, 140, 0.08);
    color: #4f008c;
}

.test-phase-badge[data-phase="ping"] { background: rgba(168, 85, 247, 0.15); color: #7c3aed; }
.test-phase-badge[data-phase="download"] { background: rgba(132, 204, 22, 0.15); color: #65a30d; }
.test-phase-badge[data-phase="upload"] { background: rgba(59, 130, 246, 0.15); color: #2563eb; }

.dark .test-phase-badge { background: rgba(255,255,255,0.08); color: #c4b5fd; }

#speedGraph {
    width: 100%;
    height: 80px;
    display: block;
    margin-top: 0.5rem;
    border-radius: 0.75rem;
    background: rgba(79, 0, 140, 0.03);
}

.dark #speedGraph {
    background: rgba(255, 255, 255, 0.03);
}

.result-card {
    background: white;
    border: 1px solid rgba(79, 0, 140, 0.08);
    border-radius: 1.25rem;
    padding: 1.25rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.dark .result-card {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.06);
}

.result-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(79, 0, 140, 0.1);
}

.result-card .result-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
}

.result-card .result-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
}

.dark .result-card .result-value {
    color: white;
}

.result-card .result-unit {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
}

.grade-card {
    background: linear-gradient(135deg, rgba(79,0,140,0.06), rgba(132,204,22,0.06));
    border: 2px solid rgba(79, 0, 140, 0.12);
    border-radius: 1.25rem;
    padding: 1.5rem;
    text-align: center;
}

.dark .grade-card {
    background: linear-gradient(135deg, rgba(79,0,140,0.15), rgba(132,204,22,0.08));
    border-color: rgba(255,255,255,0.08);
}

#gradeScore {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--grade-color, #4f008c);
}

.speed-test-btn {
    min-width: 180px;
    padding: 1rem 2rem;
    border-radius: 1rem;
    font-weight: 800;
    font-size: 1rem;
    transition: all 0.25s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.speed-test-btn-primary {
    background: linear-gradient(135deg, #4f008c, #7c3aed);
    color: white;
    box-shadow: 0 8px 25px rgba(79, 0, 140, 0.35);
}

.speed-test-btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 35px rgba(79, 0, 140, 0.45);
}

.speed-test-btn-stop {
    background: #ef4444;
    color: white;
}

.is-running .speed-gauge-wrap {
    box-shadow: 0 0 0 3px rgba(132, 204, 22, 0.3), 0 25px 60px rgba(30, 9, 54, 0.15);
}

.info-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 9999px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.9);
    backdrop-filter: blur(8px);
}

.tip-card {
    border-right: 4px solid #84cc16;
}

@media (max-width: 640px) {
    .live-speed-display .speed-number {
        font-size: 2.25rem;
    }

    #speedGauge {
        height: 180px;
    }
}
