:root {
    --bg: #050b14;
    --bg-2: #081321;
    --panel: rgba(10, 21, 36, .78);
    --panel-2: rgba(13, 26, 44, .9);
    --border: rgba(255,255,255,.09);
    --border-strong: rgba(255,255,255,.14);
    --text: #f7fbff;
    --muted: #8391a5;
    --muted-2: #566477;
    --cyan: #35c9ff;
    --violet: #7666ff;
    --pink: #df52ff;
    --green: #43e6a8;
    --danger: #ff6579;
    --shadow: 0 32px 90px rgba(0,0,0,.42);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 50% -20%, rgba(65, 108, 255, .18), transparent 35%),
        linear-gradient(180deg, #091728 0%, var(--bg) 48%, #02060b 100%);
    color: var(--text);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255,255,255,.014) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.014) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), transparent 80%);
}

.ambient {
    position: fixed;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    filter: blur(110px);
    pointer-events: none;
    opacity: .11;
}
.ambient-left { left: -180px; top: 20%; background: var(--violet); }
.ambient-right { right: -190px; top: 42%; background: var(--cyan); }

button { font: inherit; }
button { color: inherit; }

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 28px 0 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 24px;
    min-height: 54px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.45px;
}
.brand strong { color: var(--cyan); }
.brand-symbol {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(53, 201, 255, .5);
    display: grid;
    place-items: center;
    box-shadow: 0 0 28px rgba(53, 201, 255, .12), inset 0 0 20px rgba(53,201,255,.04);
}
.brand-symbol span {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 3px solid var(--cyan);
    border-left-color: transparent;
    transform: rotate(-45deg);
}


.hero {
    text-align: center;
    padding: 70px 20px 34px;
}
.eyebrow {
    color: var(--cyan);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2.4px;
    text-transform: uppercase;
}
.eyebrow.small { font-size: 9px; letter-spacing: 1.9px; }
.hero h1 {
    margin: 15px auto 0;
    max-width: 800px;
    font-size: clamp(36px, 6vw, 64px);
    line-height: 1.01;
    letter-spacing: -3.5px;
    font-weight: 800;
}
.hero h1 span {
    background: linear-gradient(90deg, var(--cyan), #8d7cff 55%, var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero-copy {
    max-width: 620px;
    margin: 16px auto 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

.test-panel,
.network-panel,
.history-panel {
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(13, 29, 49, .78), rgba(5, 14, 25, .88));
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.025);
    backdrop-filter: blur(18px);
}

.test-panel {
    position: relative;
    overflow: hidden;
    border-radius: 30px;
    padding: 26px 32px 30px;
}
.test-panel::before {
    content: "";
    position: absolute;
    width: 620px;
    height: 210px;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(ellipse, rgba(91, 85, 255, .13), transparent 67%);
    pointer-events: none;
}

/* V16 ORBITAL GAUGE */
.gauge-wrap {
    position: relative;
    width: min(660px, 100%);
    aspect-ratio: 1 / 1;
    margin: -10px auto -54px;
    isolation: isolate;
}
.gauge-aura {
    position: absolute;
    inset: 12% 10% 10%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 42%, rgba(77, 141, 255, .14), transparent 42%),
        radial-gradient(circle at 35% 62%, rgba(39, 231, 255, .08), transparent 36%),
        radial-gradient(circle at 68% 62%, rgba(255, 79, 216, .06), transparent 35%);
    filter: blur(12px);
    pointer-events: none;
    z-index: -1;
}
.gauge {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}
.gauge-orbit {
    fill: none;
    pointer-events: none;
}
.orbit-outer {
    stroke: rgba(130, 160, 200, .09);
    stroke-width: 1;
    stroke-dasharray: 2 10;
}
.orbit-inner {
    stroke: rgba(103, 143, 197, .11);
    stroke-width: 1.2;
}
.gauge-track,
.gauge-glow-path,
.gauge-progress {
    fill: none;
    stroke-linecap: round;
    stroke-dasharray: 100;
    pointer-events: none;
}
.gauge-track {
    stroke: rgba(25, 45, 70, .9);
    stroke-width: 23;
    filter: drop-shadow(0 9px 14px rgba(0,0,0,.24));
}
.gauge-glow-path {
    stroke: url(#gaugeGradient);
    stroke-width: 31;
    stroke-dashoffset: 100;
    opacity: .16;
    filter: url(#meterGlow);
    transition: stroke-dashoffset .22s cubic-bezier(.2,.75,.25,1);
}
.gauge-progress {
    stroke: url(#gaugeGradient);
    stroke-width: 15;
    stroke-dashoffset: 100;
    filter: drop-shadow(0 0 7px rgba(72, 157, 255, .28));
    transition: stroke-dashoffset .22s cubic-bezier(.2,.75,.25,1);
}
.tick {
    stroke: rgba(143, 164, 194, .25);
    stroke-width: 2.2;
    stroke-linecap: round;
}
.tick.medium {
    stroke: rgba(165, 187, 218, .38);
    stroke-width: 3;
}
.tick.major {
    stroke: rgba(228, 239, 255, .70);
    stroke-width: 5.5;
}
.scale-label {
    fill: rgba(194, 208, 229, .52);
    font-size: 7.4px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    user-select: none;
}
.scale-label.major-label {
    fill: rgba(249, 252, 255, .96);
    font-size: 10.8px;
    font-weight: 800;
}
.meter-head {
    transform: translate(0, 0);
    transition: transform .22s cubic-bezier(.2,.75,.25,1), opacity .2s ease;
    opacity: .25;
    pointer-events: none;
}
.meter-head.active { opacity: 1; }
.meter-head-halo {
    fill: rgba(48, 222, 255, .16);
    filter: url(#headGlow);
}
.meter-head-core {
    fill: url(#headGradient);
    stroke: rgba(255,255,255,.92);
    stroke-width: 2;
    filter: drop-shadow(0 0 8px rgba(45, 224, 255, .78));
}
.gauge-core {
    position: absolute;
    left: 50%;
    top: 49%;
    transform: translate(-50%, -50%);
    width: 270px;
    height: 270px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background:
        radial-gradient(circle at 50% 35%, rgba(25, 54, 88, .58), rgba(5, 16, 29, .78) 63%, rgba(3, 10, 19, .86) 100%);
    border: 1px solid rgba(135, 178, 230, .11);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.035),
        inset 0 -22px 55px rgba(0,0,0,.22),
        0 22px 70px rgba(0,0,0,.18);
    backdrop-filter: blur(10px);
}
.gauge-core::before,
.gauge-core::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}
.gauge-core::before {
    inset: 13px;
    border: 1px solid rgba(77, 171, 255, .10);
}
.gauge-core::after {
    inset: 30px;
    border: 1px dashed rgba(113, 145, 191, .08);
}
.gauge-core .phase {
    position: relative;
    z-index: 1;
    min-height: 16px;
    color: #8ea2bc;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 3px;
}
.speed-readout {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 6px;
}
.speed-readout strong {
    font-size: clamp(72px, 10vw, 102px);
    line-height: .90;
    letter-spacing: -7px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 6px 24px rgba(0,0,0,.26);
}
.speed-readout .unit {
    margin-top: 14px;
    color: #a7b5c8;
    font-size: 13px;
    font-weight: 700;
}
.scale-badge {
    position: relative;
    z-index: 1;
    margin-top: 11px;
    padding: 5px 10px;
    border: 1px solid rgba(118, 160, 214, .12);
    border-radius: 999px;
    background: rgba(10, 24, 41, .54);
    color: #5f7693;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 1.1px;
}
.start-button {
    position: absolute;
    left: 50%;
    bottom: 45px;
    transform: translateX(-50%);
    z-index: 3;
    min-width: 134px;
    height: 46px;
    padding: 0 20px;
    border: 1px solid rgba(90, 184, 255, .24);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(23, 52, 82, .94), rgba(10, 25, 44, .96));
    color: #f4fbff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.08),
        0 12px 28px rgba(0,0,0,.28),
        0 0 0 5px rgba(53, 201, 255, .025);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.start-button:hover {
    transform: translateX(-50%) translateY(-2px);
    border-color: rgba(72, 213, 255, .48);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.1),
        0 16px 34px rgba(0,0,0,.30),
        0 0 24px rgba(53,201,255,.08);
}
.start-button:active { transform: translateX(-50%) translateY(0); }
.start-button:disabled { cursor: wait; opacity: .75; }
.start-button strong { font-size: 9px; letter-spacing: 1.6px; }
.start-icon {
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid #40dcff;
    filter: drop-shadow(0 0 6px rgba(64,220,255,.7));
}
.start-button.testing .start-icon {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,.2);
    border-top-color: #40dcff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
.phase-progress {
    width: min(560px, 82%);
    height: 2px;
    margin: 0 auto 28px;
    background: rgba(255,255,255,.035);
}
@media (max-width: 720px) {
    .gauge-wrap { margin: -8px auto -42px; }
    .gauge-core { width: 230px; height: 230px; }
    .speed-readout strong { font-size: 74px; letter-spacing: -5px; }
    .start-button { bottom: 35px; }
}
@media (max-width: 520px) {
    .gauge-wrap { margin: 0 auto -24px; }
    .gauge-core { width: 190px; height: 190px; }
    .speed-readout strong { font-size: 60px; }
    .speed-readout .unit { margin-top: 9px; font-size: 11px; }
    .scale-badge { margin-top: 8px; }
    .start-button { bottom: 21px; height: 42px; min-width: 120px; }
    .scale-label { font-size: 6px; }
    .scale-label.major-label { font-size: 8.5px; }
}


.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 930px;
    margin: 0 auto;
}
.result-card {
    min-height: 100px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 19px;
    background: rgba(255,255,255,.025);
}
.result-icon {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    font-size: 25px;
    font-weight: 500;
}
.ping-card .result-icon { color: #a495ff; background: rgba(118,102,255,.12); }
.download-card .result-icon { color: var(--cyan); background: rgba(53,201,255,.1); }
.upload-card .result-icon { color: var(--pink); background: rgba(223,82,255,.1); }
.result-card small { display: block; margin-bottom: 7px; color: #8d9cb1; font-size: 10px; font-weight: 800; letter-spacing: 1.4px; }
.result-card strong { font-size: 25px; font-variant-numeric: tabular-nums; }
.result-card em { color: var(--muted); font-size: 10px; font-style: normal; font-weight: 600; }

.network-panel,
.history-panel {
    margin-top: 16px;
    border-radius: 24px;
    padding: 25px;
}
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}
.compact-heading { margin-bottom: 15px; }
.section-heading h2 { margin: 6px 0 0; font-size: 20px; letter-spacing: -.7px; }

.network-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.35fr 1fr;
    gap: 10px;
}
.network-card {
    min-width: 0;
    min-height: 112px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: rgba(255,255,255,.022);
    padding: 16px;
}
.network-card small { display: block; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: 1.35px; margin-bottom: 9px; }
.network-card strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.network-card span { display: block; margin-top: 7px; color: var(--muted-2); font-size: 9px; line-height: 1.35; }

.ghost-button {
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 9px 12px;
    background: rgba(255,255,255,.025);
    color: #8594a8;
    font-size: 9px;
    font-weight: 700;
    cursor: pointer;
}
.ghost-button:hover { border-color: rgba(255,255,255,.17); color: var(--text); }

.history-empty {
    border: 1px dashed rgba(255,255,255,.09);
    border-radius: 16px;
    padding: 28px;
    color: var(--muted);
    text-align: center;
    font-size: 11px;
}
.history-table-wrap { overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; min-width: 520px; }
.history-table th,
.history-table td { padding: 13px 14px; border-bottom: 1px solid rgba(255,255,255,.055); text-align: left; }
.history-table th { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: 1.2px; }
.history-table td { color: #8190a4; font-size: 10px; }
.history-table td strong { color: var(--text); font-size: 11px; font-variant-numeric: tabular-nums; }
.history-table tbody tr:last-child td { border-bottom: 0; }

footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
    margin-top: 24px;
    color: #526074;
    font-size: 9px;
    text-align: center;
}
.footer-separator { color: #2c394a; }
footer a { color: #f7fbff; text-decoration: none; font-weight: 700; transition: color .18s ease; }
footer a:hover { color: var(--cyan); }
footer a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 960px) {
    .network-grid { grid-template-columns: repeat(2, 1fr); }
    .network-card.wide { grid-column: auto; }
}

@media (max-width: 720px) {
    .page-shell { width: min(100% - 20px, 700px); padding-top: 17px; }
    .topbar { align-items: flex-start; }
    .hero { padding: 52px 10px 26px; }
    .hero h1 { letter-spacing: -2.4px; }
    .test-panel { padding: 22px 14px 20px; border-radius: 24px; }
    .gauge-value { bottom: 13px; }
    .results-grid { grid-template-columns: 1fr; gap: 9px; }
    .result-card { min-height: 76px; padding: 14px 16px; }
    .network-panel, .history-panel { padding: 18px 14px; border-radius: 20px; }
    .section-heading { align-items: flex-end; }
}

@media (max-width: 520px) {
    .topbar { flex-direction: row; }
    .hero h1 { font-size: 40px; }
    .gauge-wrap { margin-top: 6px; }
    .gauge-value { bottom: 4px; }
    .gauge-value strong { font-size: 58px; letter-spacing: -4px; }
    .start-button { margin-top: 13px; }
    .network-grid { grid-template-columns: 1fr; }
    .network-card.wide { grid-column: auto; }
    .section-heading { align-items: flex-start; flex-direction: column; }
    .ghost-button { align-self: flex-start; }
    footer { flex-wrap: wrap; }
}
