html,
body {
    border: none;
    padding: 0;
    margin: 0;
    background: #FFFFFF;
    color: #202020;
}

body {
    text-align: center;
    font-family: "Roboto", sans-serif;

}

h1 {
    color: #404040;
}


html.dark #loading {
    background: #263c73;
    color: #F4F4F4;
    color-scheme: dark;
}

span.loadCircle {
    display: inline-block;
    width: 2em;
    height: 2em;
    vertical-align: middle;
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAAP1BMVEUAAAB2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZyFzwnAAAAFHRSTlMAEvRFvX406baecwbf0casimhSHyiwmqgAAADpSURBVHja7dbJbQMxAENRahnN5lkc//5rDRAkDeRgHszXgACJoKiIiIiIiIiIiIiIiIiIiIj4HHspsrpAVhdVVguzrA4OWc10WcEqpwKbnBo0OU1Q5NSpsoJFTgOecrrdEag85DRgktNqfoEdTjnd7hrEHMEJvmRUYJbTYk5Agy6nau6Abp5Cm7mDBtRdPi9gyKdU7w4p1fsLvyqs8hl4z9/w3n/Hmr9WoQ65lAU4d7lMYOz//QboRR5jBZibLMZdAR6O/Vfa1PlxNr3XdS3HzK/HVPRu/KnLs8iAOh993VpRRERERMT/fAN60wwWaVyWwAAAAABJRU5ErkJggg==');
    background-size: 2em 2em;
    margin-right: 0.5em;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(359deg);
    }
}

#startStopBtn {
    display: inline-block;
    margin: 0 auto;
    color: #fff;
    background-color: #6060FF;
    border: 0.15em solid #6060FF;
    border-radius: 0.3em;
    transition: all 0.3s;
    box-sizing: border-box;
    width: 8em;
    height: 3em;
    line-height: 2.7em;
    cursor: pointer;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.1), inset 0 0 0 rgba(0, 0, 0, 0.1);
}


#serverArea {
    margin-top: 1em;
}

#server {
    font-size: 1em;
    padding: 0.2em;
}

#test {
    margin-top: 2em;

}

div.testArea {
    display: inline-block;
    width: 25em;
    height: 21em;
    position: relative;
    box-sizing: border-box;
}



div.testArea div.testName {
    position: absolute;
    top: 0.1em;
    left: 0;
    width: 100%;
    font-size: 1.4em;
    z-index: 9;
}



div.testArea div.meterText {
    position: absolute;
    bottom: 1.55em;
    left: 0;
    width: 100%;
    font-size: 2.5em;
    z-index: 9;
}



div.meterText:empty:before {
    content: "0.00";
}

div.testArea div.unit {
    position: absolute;
    bottom: 2em;
    left: 0;
    width: 100%;
    z-index: 9;
}



div.testArea canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}


#shareArea {
    width: 95%;
    max-width: 40em;
    margin: 0 auto;
    margin-top: 2em;
}

#shareArea>* {
    display: block;
    width: 100%;
    height: auto;
    margin: 0.25em 0;
}



@media all and (max-width:40em) {
    body {
        font-size: 0.8em;
    }
}

div.visible {
    animation: fadeIn 0.4s;
    display: block;
}

div.hidden {
    animation: fadeOut 0.4s;
    display: none;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes fadeOut {
    0% {
        display: block;
        opacity: 1;
    }

    100% {
        display: block;
        opacity: 0;
    }
}

@media all and (prefers-color-scheme: dark) {

    html,
    body,
    #loading {
        background-color: #dededead;
        color: #111;
        text-align: center;
        border-radius: 10px;
    }

    h1 {
        color: #E0E0E0;
    }

    a {
        color: #9090FF;
    }

    #privacyPolicy {
        background: #000000;
    }

    #resultsImg {
        filter: invert(1);
    }
}

.hidden {
    display: none;
}

/* شاشة البداية */
#startScreen {
    height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* أنيميشن ظهور test */
#test.show {
    animation: fadeUp .5s ease forwards;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#startScreen {
    animation: fadeIn .5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

#shareArea {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
    display: none;
}

#shareArea.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.meter {
    width: 920px;
    height: 680px;
}


@media (max-width: 600px) {
    .meter {
        width: 360px;
        height: 220px;
    }
}


.meterText {
    font-size: 72px;
    margin-top: -160px;
}

.testName {
    font-size: 22px;
}




.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.result-box {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 14px;
    padding: 18px;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.result-box .label {
    font-size: 14px;
    color: #666;
}

.result-box .value {
    font-size: 32px;
    font-weight: bold;
    margin: 8px 0;
    color: #111;
}

.result-box .unit {
    font-size: 13px;
    color: #888;
}

.result-box {
    transition: all 0.3s ease;
    border: 2px solid transparent;
    border-radius: 16px;
}

/* أثناء الفحص */
.result-box.active {
    border-color: #2196f3;
    background: linear-gradient(135deg, #e3f2fd, #ffffff);
    transform: scale(1.03);
}

/* عند الانتهاء */
.result-box.done {
    border-color: #4caf50;
    background: linear-gradient(135deg, #e8f5e9, #ffffff);
}

/* القيم */
.result-box .value {
    transition: color 0.3s ease;
}

.result-box.active .value {
    color: #1976d2;
}

.result-box.done .value {
    color: #2e7d32;
}

/* ===== ACTIVE STATE ===== */
#boxDownload.active>div,
#boxUpload.active>div,
#boxPing.active>div,
#boxJitter.active>div {
    border-radius: 16px;
    border: 2px solid #2196f3;
    background: linear-gradient(135deg, #e3f2fd, #ffffff);
    transform: scale(1.05);
}

/* ===== DONE STATE ===== */
#boxDownload.done>div,
#boxUpload.done>div,
#boxPing.done>div,
#boxJitter.done>div {
    border-radius: 16px;
    /* background: linear-gradient(135deg, #e8f5e9, #ffffff);*/
}

/* النص */
#boxDownload.active .font-bold,
#boxUpload.active .font-bold,
#boxPing.active .font-bold,
#boxJitter.active .font-bold {
    color: #1976d2;
}

#boxDownload.done .font-bold,
#boxUpload.done .font-bold,
#boxPing.done .font-bold,
#boxJitter.done .font-bold {
    color: #2e7d32;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.6);
        transform: scale(1);
    }

    70% {
        box-shadow: 0 0 0 16px rgba(33, 150, 243, 0);
        transform: scale(1.05);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(33, 150, 243, 0);
        transform: scale(1);
    }
}

.pulsing {
    animation: pulseGlow 1.4s infinite;
    border: 2px solid #2196f3 !important;
    border-radius: 16px;
    /* ⬅️ نفس انحناء البوكس */
    overflow: hidden;
    /* ⬅️ يمنع الزوايا الحادة */
    /* background: linear-gradient(135deg, #828282, #ffffff);*/
}

.done {
    border: 2px solid #4caf50 !important;
    border-radius: 16px;
    /* ⬅️ نفس انحناء البوكس */
    overflow: hidden;
    /* ⬅️ يمنع الزوايا الحادة */
    /*background: linear-gradient(135deg, #e8f5e9, #ffffff);*/
}

/* =========================================
   CUSTOM SCROLLBAR STYLES
   ========================================= */

/* --- Default (Light Mode) --- */

/* Firefox */
html {
    scrollbar-width: thin;
    scrollbar-color: #a0aec0 #f1f1f1;
    /* Thumb Track */
}

/* WebKit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background-color: #a0aec0;
    /* Cool Gray */
    border-radius: 6px;
    border: 3px solid #f1f1f1;
    /* Creates padding effect */
}

::-webkit-scrollbar-thumb:hover {
    background-color: #718096;
}

/* --- Dark Mode --- */

/* Firefox */
.dark html,
html.dark {
    scrollbar-color: #4b5563 #111827;
    /* Thumb Track */
}

/* WebKit */
.dark ::-webkit-scrollbar-track,
html.dark ::-webkit-scrollbar-track {
    background: #111827;
    /* Matches dark:bg-gray-900 */
}

.dark ::-webkit-scrollbar-thumb,
html.dark ::-webkit-scrollbar-thumb {
    background-color: #4b5563;
    /* Gray-600 */
    font-size: 22px;
}




.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.result-box {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 14px;
    padding: 10px 16px; /* Reduced height */
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.result-box .label {
    font-size: 13px;
    color: #666;
}

.result-box .value {
    font-size: 26px;
    font-weight: bold;
    margin: 2px 0;
    color: #111827 !important; /* Force original dark color */
}

.dark .result-box .value {
    color: #ffffff !important;
}

.result-box .unit {
    font-size: 12px;
    color: #888;
}

/* Status Highlights without colors */
.result-box.active {
    border-color: #2196f3;
    transform: scale(1.02);
}
.result-box.done {
    border-color: #e5e7eb;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.6);
        transform: scale(1);
    }

    70% {
        box-shadow: 0 0 0 16px rgba(33, 150, 243, 0);
        transform: scale(1.05);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(33, 150, 243, 0);
        transform: scale(1);
    }
}

.pulsing {
    animation: pulseGlow 1.4s infinite;
    border: 2px solid #2196f3 !important;
    border-radius: 16px;
    /* ⬅️ نفس انحناء البوكس */
    overflow: hidden;
    /* ⬅️ يمنع الزوايا الحادة */
    /* background: linear-gradient(135deg, #828282, #ffffff);*/
}

.done {
    border: 2px solid #4caf50 !important;
    border-radius: 16px;
    /* ⬅️ نفس انحناء البوكس */
    overflow: hidden;
    /* ⬅️ يمنع الزوايا الحادة */
    /*background: linear-gradient(135deg, #e8f5e9, #ffffff);*/
}

/* =========================================
   CUSTOM SCROLLBAR STYLES
   ========================================= */

/* --- Default (Light Mode) --- */

/* Firefox */
html {
    scrollbar-width: thin;
    scrollbar-color: #a0aec0 #f1f1f1;
    /* Thumb Track */
}

/* WebKit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background-color: #a0aec0;
    /* Cool Gray */
    border-radius: 6px;
    border: 3px solid #f1f1f1;
    /* Creates padding effect */
}

::-webkit-scrollbar-thumb:hover {
    background-color: #718096;
}

/* --- Dark Mode --- */

/* Firefox */
.dark html,
html.dark {
    scrollbar-color: #4b5563 #111827;
    /* Thumb Track */
}

/* WebKit */
.dark ::-webkit-scrollbar-track,
html.dark ::-webkit-scrollbar-track {
    background: #111827;
    /* Matches dark:bg-gray-900 */
}

.dark ::-webkit-scrollbar-thumb,
html.dark ::-webkit-scrollbar-thumb {
    background-color: #4b5563;
    /* Gray-600 */
    border: 3px solid #111827;
}

.dark ::-webkit-scrollbar-thumb:hover,
html.dark ::-webkit-scrollbar-thumb:hover {
    background-color: #6b7280;
    /* Gray-500 */
}

/* Animations */
@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes zoomOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(1.15); }
}

.zoom-in { animation: zoomIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.zoom-out { animation: zoomOut 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }

/* Premium GO Button */
#startButton .relative {
    width: 192px;
    height: 192px;
    background: #ffffff;
    border-radius: 9999px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 4px solid #f3f4f6;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 10;
}

.dark #startButton .relative {
    background: #1f2937 !important;
    border-color: #374151 !important;
}

#startButton:hover .relative {
    transform: scale(1.05);
}

#startButton:active .relative {
    transform: scale(0.95);
}

#startButton .absolute {
    inset: -4px;
    background: linear-gradient(to right, #2563eb, #06b6d4);
    border-radius: 9999px !important;
    filter: blur(8px);
    opacity: 0.25;
    transition: opacity 1s;
    z-index: 5;
}

#startButton:hover .absolute {
    opacity: 0.75;
}

#startButton .text-4xl, #startButton [data-i18n='go'] {
    font-size: 2.25rem !important;
    line-height: 2.5rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.1em !important;
    color: #111827;
}

.dark #startButton .text-4xl, .dark #startButton [data-i18n='go'] {
    color: #ffffff !important;
}

#startButton .text-xs, #startButton [data-i18n='startTest'] {
    font-size: 0.75rem !important;
    line-height: 1rem !important;
    font-weight: 600 !important;
    color: #9ca3af;
    text-transform: uppercase;
    margin-top: 4px;
}

@media (min-width: 640px) {
    #startButton .relative {
        width: 224px;
        height: 224px;
    }
    #startButton .text-4xl, #startButton [data-i18n='go'] {
        font-size: 3rem !important;
    }
}

.result-box {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 14px;
    padding: 10px 16px !important;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.result-box .label {
    font-size: 13px;
    color: #666;
}

.result-box .value {
    font-size: 26px;
    font-weight: bold;
    margin: 2px 0;
    color: #111827 !important;
}

.dark .result-box .value {
    color: #ffffff !important;
}

.result-box .unit {
    font-size: 12px;
    color: #888;
}

.result-box.active {
    border-color: #2196f3;
    transform: scale(1.02);
}

.result-box.done {
    border-color: #e5e7eb;
}
