/*
 * LG_SPEEDTEST_UI_V1
 * Interface Speedtest du Looking Glass.
 */

.lg-view-switch {
    display: flex;
    gap: 0.5rem;
    margin: 0 0 1rem;
}

.lg-view-button {
    border: 1px solid rgba(100, 116, 139, 0.35);
    background: var(--panel, #fff);
    color: inherit;
    border-radius: 999px;
    padding: 0.65rem 1.15rem;
    font-weight: 700;
    cursor: pointer;
}

.lg-view-button.active {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

.speedtest-panel {
    display: none;
}

body.lg-speedtest-view #diagnostic-panel,
body.lg-speedtest-view #progress-panel,
body.lg-speedtest-view #summary-panel,
body.lg-speedtest-view #details-panel,
body.lg-speedtest-view #error-panel {
    display: none !important;
}

body.lg-speedtest-view .speedtest-panel {
    display: block;
}

.st-shell {
    max-width: 960px;
    margin: 0 auto;
}

.st-intro {
    margin-bottom: 1.4rem;
    color: var(--muted, #64748b);
}

.st-controls {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) 1fr 1fr;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.2rem;
}

.st-control-group {
    min-width: 0;
}

.st-control-label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted, #64748b);
}

.st-server-select {
    width: 100%;
    min-height: 42px;
}

.st-segmented {
    display: flex;
    min-height: 42px;
    padding: 3px;
    border: 1px solid rgba(100, 116, 139, 0.3);
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.08);
}

.st-segmented button {
    flex: 1;
    min-width: 0;
    border: 0;
    border-radius: 7px;
    padding: 0.45rem 0.65rem;
    background: transparent;
    color: inherit;
    font-size: 0.87rem;
    font-weight: 700;
    cursor: pointer;
}

.st-segmented button.active {
    background: var(--panel, #fff);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}

.st-segmented button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.st-stack-state {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 0.6rem 0 0;
    font-size: 0.82rem;
    color: var(--muted, #64748b);
}

.st-stack-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    margin-right: 0.3rem;
    border-radius: 50%;
    background: #94a3b8;
}

.st-stack-dot.ok {
    background: #16a34a;
}

.st-stack-dot.no {
    background: #dc2626;
}

.st-stage {
    display: grid;
    justify-items: center;
    padding: 0.5rem 0 1.5rem;
}

.st-gauge {
    position: relative;
    width: min(100%, 520px);
    aspect-ratio: 360 / 225;
}

.st-gauge svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.st-gauge-track,
.st-gauge-value {
    fill: none;
    stroke-width: 13;
    stroke-linecap: round;
}

.st-gauge-track {
    stroke: rgba(148, 163, 184, 0.25);
}

.st-gauge-value {
    stroke: currentColor;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 180ms linear;
}

.st-needle {
    stroke: currentColor;
    stroke-width: 4;
    stroke-linecap: round;
    transition: transform 180ms linear;
    transform-origin: 180px 180px;
}

.st-needle-hub {
    fill: currentColor;
}

.st-gauge-label {
    fill: currentColor;
    opacity: 0.58;
    font-size: 12px;
    font-weight: 600;
}

.st-readout {
    position: absolute;
    left: 50%;
    top: 54%;
    transform: translate(-50%, -50%);
    text-align: center;
    min-width: 220px;
}

.st-speed {
    display: block;
    font-size: clamp(2.8rem, 8vw, 5.2rem);
    line-height: 0.95;
    font-weight: 700;
    letter-spacing: -0.055em;
    font-variant-numeric: tabular-nums;
}

.st-unit {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--muted, #64748b);
}

.st-phase {
    display: block;
    margin-top: 0.3rem;
    min-height: 1.3em;
    font-size: 0.9rem;
    color: var(--muted, #64748b);
}

.st-action-row {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-top: -0.3rem;
}

.st-go {
    width: 92px;
    height: 92px;
    border: 3px solid currentColor;
    border-radius: 50%;
    background: var(--panel, #fff);
    color: inherit;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    cursor: pointer;
    box-shadow:
        0 8px 28px rgba(15, 23, 42, 0.12),
        inset 0 0 0 6px rgba(148, 163, 184, 0.08);
}

.st-go:hover {
    transform: scale(1.035);
}

.st-stop {
    align-self: center;
}

.st-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.8rem;
}

.st-metric {
    padding: 1rem;
    border: 1px solid rgba(100, 116, 139, 0.2);
    border-radius: 12px;
    text-align: center;
    background: rgba(148, 163, 184, 0.05);
}

.st-metric-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.045em;
    color: var(--muted, #64748b);
}

.st-metric-value {
    font-size: 1.35rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.st-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(100, 116, 139, 0.18);
}

.st-meta-item {
    min-width: 0;
}

.st-meta-label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted, #64748b);
}

.st-meta-value {
    display: block;
    overflow-wrap: anywhere;
    font-weight: 650;
}

.st-message {
    margin-top: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.1);
}

.st-message.error {
    background: rgba(220, 38, 38, 0.08);
    color: #b91c1c;
}

.st-hidden {
    display: none !important;
}

@media (max-width: 760px) {
    .st-controls {
        grid-template-columns: 1fr;
    }

    .st-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .st-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .st-gauge {
        width: min(100%, 430px);
    }
}

@media (max-width: 430px) {
    .lg-view-switch {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .st-metrics,
    .st-meta {
        grid-template-columns: 1fr 1fr;
    }

    .st-readout {
        top: 56%;
    }

    .st-go {
        width: 82px;
        height: 82px;
    }
}
