:root {
    --bg-deep: #040b14;
    --bg-main: #07111f;
    --bg-panel: rgba(10, 26, 44, 0.82);
    --bg-card: rgba(13, 32, 53, 0.78);
    --bg-soft: rgba(255, 255, 255, 0.035);
    --border: rgba(143, 201, 255, 0.14);
    --border-strong: rgba(78, 195, 255, 0.34);
    --text-main: #f4f9ff;
    --text-soft: #a7b9cd;
    --text-muted: #6f849b;
    --accent-blue: #35c9ff;
    --accent-cyan: #00efff;
    --accent-green: #42f5a7;
    --accent-purple: #9b7cff;
    --accent-red: #ff4f70;
    --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--bg-deep);
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--text-main);
    background:
        radial-gradient(circle at 50% -10%, rgba(34, 175, 255, 0.20), transparent 34%),
        radial-gradient(circle at 8% 72%, rgba(94, 67, 255, 0.12), transparent 30%),
        linear-gradient(155deg, #030913 0%, #071322 50%, #04101b 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.ambient {
    position: fixed;
    z-index: -3;
    width: 460px;
    height: 460px;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.2;
    pointer-events: none;
}

.ambient-one {
    top: -180px;
    right: -100px;
    background: #00b7ff;
}

.ambient-two {
    bottom: -220px;
    left: -150px;
    background: #5947ff;
}

.grid-overlay {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    opacity: 0.14;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.app-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 24px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--text-main);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: var(--accent-cyan);
    border: 1px solid rgba(53, 201, 255, 0.32);
    border-radius: 13px;
    background: linear-gradient(145deg, rgba(53, 201, 255, 0.14), rgba(53, 201, 255, 0.03));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 24px rgba(0, 209, 255, 0.1);
}

.brand-mark svg {
    width: 27px;
    height: 27px;
}

.brand-copy {
    font-size: 22px;
    font-weight: 850;
    letter-spacing: -0.55px;
}

.brand-copy span {
    color: var(--accent-blue);
}

.connection-pill {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    color: var(--text-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(7, 20, 34, 0.65);
    font-size: 12px;
    font-weight: 700;
    backdrop-filter: blur(16px);
}

.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 12px var(--accent-green);
}

.test-panel {
    position: relative;
    overflow: hidden;
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: 30px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent 35%),
        var(--bg-panel);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(24px);
}

.test-panel::before {
    content: "";
    position: absolute;
    top: -160px;
    left: 50%;
    width: 580px;
    height: 320px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: rgba(0, 202, 255, 0.08);
    filter: blur(70px);
    pointer-events: none;
}

.panel-head {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--accent-cyan);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 1.8px;
}

.panel-head h1 {
    margin: 0;
    font-size: clamp(25px, 4vw, 38px);
    line-height: 1.1;
    letter-spacing: -1.25px;
}

.panel-intro {
    max-width: 410px;
    margin: 0;
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.65;
}

.latency-row {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 190px));
    justify-content: center;
    gap: 14px;
}

.mini-card,
.result-card {
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.mini-card {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 78px;
    padding: 15px 17px;
    border-radius: 18px;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.metric-icon {
    display: grid;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 900;
}

.ping-icon {
    color: #c0aeff;
    background: rgba(155, 124, 255, 0.13);
}

.jitter-icon {
    color: #65e3ff;
    background: rgba(53, 201, 255, 0.13);
}

.card-label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 1.3px;
}

.card-value {
    color: var(--text-main);
    font-size: 25px;
    font-weight: 850;
    letter-spacing: -0.65px;
    line-height: 1;
}

.card-value small {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
}

.mini-card.active-ping {
    transform: translateY(-2px);
    border-color: rgba(155, 124, 255, 0.58);
    box-shadow: 0 0 30px rgba(155, 124, 255, 0.15);
}

.meter-zone {
    position: relative;
    display: grid;
    justify-items: center;
    margin: 22px auto 2px;
}

.meter-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 380px;
    height: 260px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(0, 206, 255, 0.11);
    filter: blur(55px);
}

.meter-shell {
    position: relative;
    display: grid;
    width: min(410px, 78vw);
    aspect-ratio: 1;
    place-items: center;
    border-radius: 50%;
}

.meter-shell::before,
.meter-shell::after {
    content: "";
    position: absolute;
    inset: 5%;
    border-radius: 50%;
}

.meter-shell::before {
    border: 1px solid rgba(132, 211, 255, 0.13);
    box-shadow: inset 0 0 45px rgba(0, 208, 255, 0.035);
}

.meter-shell::after {
    inset: 17%;
    border: 1px solid rgba(132, 211, 255, 0.08);
}

.meter-ring {
    position: absolute;
    inset: 9%;
    border-radius: 50%;
    background: conic-gradient(
        from 225deg,
        transparent 0deg,
        var(--accent-blue) 40deg,
        var(--accent-cyan) 175deg,
        var(--accent-green) 270deg,
        transparent 270deg 360deg
    );
    filter: drop-shadow(0 0 13px rgba(0, 221, 255, 0.38));
    mask: radial-gradient(circle, transparent 60%, #000 61% 67%, transparent 68%);
    opacity: 0.85;
}

.meter-ticks {
    position: absolute;
    inset: 1.5%;
    border-radius: 50%;
    background: repeating-conic-gradient(
        from 225deg,
        rgba(176, 225, 255, 0.46) 0deg 0.8deg,
        transparent 0.8deg 8deg
    );
    mask: radial-gradient(circle, transparent 72%, #000 73% 75%, transparent 76%);
    opacity: 0.52;
}

.meter-core {
    position: relative;
    z-index: 2;
    display: flex;
    width: 58%;
    aspect-ratio: 1;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: 1px solid rgba(117, 207, 255, 0.15);
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 30%, rgba(66, 197, 255, 0.09), transparent 45%),
        rgba(4, 15, 27, 0.88);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        inset 0 -25px 60px rgba(0, 0, 0, 0.22),
        0 20px 45px rgba(0, 0, 0, 0.25);
}

.live-label {
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 1.7px;
}

.primary-result {
    text-align: center;
    transition: filter 0.25s ease, transform 0.25s ease;
}

.primary-result .card-label {
    color: var(--accent-blue);
}

.primary-result .card-value {
    font-size: clamp(34px, 7vw, 55px);
    letter-spacing: -2px;
}

.primary-result .card-value small {
    display: block;
    margin-top: 8px;
    font-size: 13px;
}

.primary-result.active-dl {
    transform: scale(1.035);
    filter: drop-shadow(0 0 18px rgba(0, 213, 255, 0.42));
}

.progress-percent {
    margin-top: 16px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.6px;
}

.meter-scale {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Για να μην εμποδίζει τα clicks */
}

/* --- 2. Κυκλική τοποθέτηση των αριθμών --- */
.meter-scale span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 20px;
    margin-top: -10px;
    margin-left: -16px;
    
    color: var(--text-main);     /* Πιο φωτεινό λευκό/σιέλ χρώμα αντί για muted */
    font-size: 14px;             /* Αυξημένο μέγεθος (από 11px) */
    font-weight: 850;            /* Πιο παχύ/bold πέρασμα (από 700) */
    text-shadow: 0 0 10px rgba(53, 201, 255, 0.4); /* Μπλε διακριτική λάμψη (glow) */
    text-align: center;
    line-height: 24px;

    /* 
       1. Rotate: Στρέφει τον άξονα προς τη γωνία του αριθμού
       2. Translate: Σπρώχνει τον αριθμό προς τα έξω στην περιφέρεια (140px ακτίνα)
       3. Rotate (αντίστροφο): Ξε-περιστρέφει το κείμενο ώστε να μένει πάντα όρθιο
    */
    transform: 
        rotate(var(--angle)) 
        translateY(-140px) 
        rotate(calc(-1 * var(--angle)));
        
    transition: transform 0.3s ease;
}

.progress-section {
    width: min(590px, 100%);
    margin: 8px auto 22px;
    text-align: center;
}

.progress-container {
    width: 100%;
    height: 7px;
    overflow: hidden;
    border: 1px solid rgba(133, 203, 255, 0.08);
    border-radius: 999px;
    background: rgba(2, 10, 18, 0.8);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.28);
}

.progress-bar {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
    box-shadow: 0 0 16px currentColor;
    transition: width 0.1s linear, background-color 0.25s ease;
}

.status-text {
    min-height: 20px;
    margin-top: 12px;
    color: var(--text-soft);
    font-size: 13px;
}

.result-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    width: min(720px, 100%);
    margin: 0 auto 24px;
}

.result-card {
    display: flex;
    min-height: 88px;
    align-items: center;
    gap: 14px;
    padding: 17px 19px;
    border-radius: 19px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.result-symbol {
    display: grid;
    flex: 0 0 auto;
    width: 45px;
    height: 45px;
    place-items: center;
    border-radius: 14px;
    font-size: 24px;
    font-weight: 800;
}

.download-summary .result-symbol {
    color: var(--accent-blue);
    background: rgba(53, 201, 255, 0.12);
}

.upload-summary .result-symbol {
    color: var(--accent-green);
    background: rgba(66, 245, 167, 0.12);
}

.result-card p {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
}

.upload-summary.active-ul {
    transform: translateY(-2px);
    border-color: rgba(66, 245, 167, 0.48);
    box-shadow: 0 0 30px rgba(66, 245, 167, 0.12);
}

.control-area {
    display: flex;
    justify-content: center;
}

.btn {
    display: inline-flex;
    min-width: 230px;
    min-height: 58px;
    align-items: center;
    justify-content: center;
    gap: 11px;
    padding: 15px 30px;
    border: 0;
    border-radius: 18px;
    color: #03111b;
    background: linear-gradient(135deg, #7be7ff 0%, #25c8ff 50%, #00f0ff 100%);
    box-shadow: 0 14px 34px rgba(0, 203, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn:hover {
    transform: translateY(-3px);
    filter: brightness(1.04);
    box-shadow: 0 18px 40px rgba(0, 203, 255, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

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

.btn.cancel {
    color: #fff;
    background: linear-gradient(135deg, #ff6680, var(--accent-red));
    box-shadow: 0 14px 34px rgba(255, 79, 112, 0.22);
}

.btn.cancel .btn-icon {
    transform: rotate(90deg);
}

.btn:focus-visible,
.share-btn:focus-visible,
.brand:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 4px;
}

.info-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    width: min(720px, 100%);
    margin: 28px auto 0;
    padding: 16px 19px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(5, 17, 29, 0.56);
}

.info-item {
    min-width: 0;
}

.info-item-right {
    text-align: right;
}

.info-label {
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 1.1px;
}

.info-item strong {
    display: block;
    overflow: hidden;
    color: var(--text-soft);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-divider {
    width: 1px;
    height: 32px;
    background: var(--border);
}

.share-section {
    display: none;
    width: min(720px, 100%);
    margin: 18px auto 0;
    padding: 19px;
    border: 1px solid rgba(66, 245, 167, 0.2);
    border-radius: 19px;
    background: rgba(20, 58, 50, 0.28);
}

.share-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.share-check {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    color: #032317;
    background: var(--accent-green);
    font-weight: 900;
}

.share-heading h2 {
    margin: 0 0 3px;
    font-size: 15px;
}

.share-heading p {
    margin: 0;
    color: var(--text-soft);
    font-size: 12px;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 9px;
}

.share-btn {
    min-width: 105px;
    padding: 11px 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.share-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.share-btn.whatsapp { background: #20bd67; }
.share-btn.facebook { background: #1769d3; }
.share-btn.x { background: #15191f; }
.share-btn.generic { background: #526478; }

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 19px 6px 0;
    color: var(--text-muted);
    font-size: 11px;
}

.site-footer a {
    color: var(--text-soft);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--accent-blue);
}

@media (max-width: 780px) {
    .app-shell {
        width: min(100% - 22px, 720px);
        padding-top: 18px;
    }

    .test-panel {
        padding: 24px 18px;
        border-radius: 24px;
    }

    .panel-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .panel-intro {
        max-width: 100%;
    }

    .meter-shell {
        width: min(390px, 94vw);
    }
}

@media (max-width: 560px) {
    .connection-pill {
        display: none;
    }

    .topbar {
        justify-content: center;
    }

    .panel-head {
        text-align: center;
    }

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

    .mini-card {
        min-height: 72px;
        gap: 9px;
        padding: 13px 11px;
    }

    .metric-icon {
        width: 32px;
        height: 32px;
        border-radius: 10px;
        font-size: 15px;
    }

    .mini-card .card-value {
        font-size: 20px;
    }

    .meter-zone {
        margin-top: 12px;
    }

    .meter-scale {
        margin-top: -30px;
    }

    .meter-scale span {
        font-size: 10px;
        transform: 
            rotate(var(--angle)) 
            translateY(-125px) 
            rotate(calc(-1 * var(--angle)));
    }

    .result-strip {
        grid-template-columns: 1fr;
    }

    .download-summary {
        display: none;
    }

    .btn {
        width: 100%;
    }

    .info-bar {
        grid-template-columns: 1fr;
        gap: 13px;
        text-align: center;
    }

    .info-item-right {
        text-align: center;
    }

    .info-divider {
        width: 100%;
        height: 1px;
    }

    .site-footer {
        align-items: center;
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 390px) {
    .brand-copy {
        font-size: 20px;
    }

    .test-panel {
        padding-inline: 13px;
    }

    .panel-head h1 {
        font-size: 24px;
    }

    .meter-shell {
        width: 96vw;
        max-width: 330px;
    }

    .meter-scale {
        width: 92vw;
        max-width: 320px;
    }

    .meter-scale span {
        font-size: 9px;
        transform: 
            rotate(var(--angle)) 
            translateY(-105px) 
            rotate(calc(-1 * var(--angle)));
    }
    
    .primary-result .card-value {
        font-size: 37px;
    }

    .share-btn {
        flex: 1 1 calc(50% - 9px);
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
