:root {
    --bg: #05070d;
    --panel: rgba(10, 12, 20, 0.78);
    --panel-2: rgba(20, 24, 35, 0.72);
    --primary: #ff2a2a;
    --text: #f5f7fa;
    --muted: #c1c7d0;
    --line: rgba(255, 255, 255, 0.08);
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    --radius: 18px;
    --text-font-default: 16px;
    --main-gap: 10px;
    --gauge-width: 320px;
    --gauge-max-width: 430px;
    --button-font: 16px;
    --title-font: 18px;
    --value-font: 34px;
    --border-color: rgba(244, 24, 24, 0.1);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    background:
        linear-gradient(rgba(4, 6, 12, 0.25), rgba(4, 6, 12, 0.35)),
        url("/static/images/background.png") center center / cover no-repeat fixed;
    color: var(--text);
    font-family: "Times New Roman", Times, serif;
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    overflow: hidden;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
}

.topheader {
    width: 100%;
    flex: 0 0 auto;
    position: relative;
    font-size: var(--text-font-default);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--radius);
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    background-color: rgba(244, 24, 24, 0.01);
    backdrop-filter: blur(2px);
    box-shadow: 0 8px 14px 0 rgba(244, 24, 24, 0.1);
    z-index: 20;
}

.branddefault {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
    min-width: 0;
}

.logodefault {
    width: 100px;
    height: 55px;
    flex-shrink: 0;
}

.logoimgdefault {
    width: 100%;
    height: 100%;
    cursor: pointer;
    object-fit: contain;
}

.logotextdefault {
    font-size: 18px;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}

.nav-toggle-checkbox {
    display: none;
}

.nav-toggle-button {
    display: none;
    width: 42px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    transition: all 0.25s ease;
}

.nav-toggle-button span {
    width: 20px;
    height: 2px;
    border-radius: 20px;
    background-color: var(--text);
    display: block;
    transition: all 0.25s ease;
}

.nav-toggle-button:hover {
    background: rgba(255, 42, 42, 0.12);
    border-color: rgba(255, 42, 42, 0.25);
}

.topnavbar {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.navbar {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 2px;
}

.navitem {
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.navlink {
    display: block;
    text-decoration: none;
    color: var(--text);
    padding: 10px 16px;
    border-radius: 12px;
    font-size: var(--text-font-default);
    background-color: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--line);
    transition: all 0.25s ease;
    white-space: nowrap;
}

.navlink:hover {
    transform: translateX(1px);
    background: rgba(255, 42, 42, 0.12);
    border-color: rgba(255, 42, 42, 0.25);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

main {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    height: 0;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    backdrop-filter: blur(2px);
    border-radius: var(--radius);
    padding: 0;
    gap: var(--main-gap);
    margin: 0;
    overflow: hidden;
}

footer {
    width: 100%;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    background-color: rgba(244, 24, 24, 0.08);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    box-shadow: 0 8px 14px 0 rgba(244, 24, 24, 0.1);
    font-size: 12px;
    padding: 24px 10px;
    margin: 0;
    overflow: hidden;
}

.sidebar {
    flex: 0 0 12.5%;
    width: auto;
    height: 100%;
    min-height: 0;
    background-color: rgba(244, 24, 24, 0.01);
    backdrop-filter: blur(2px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 8px 14px 0 rgba(244, 24, 24, 0.12);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 10px;
    overflow: hidden;
}

.sidebar-left,
.sidebar-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

aside {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.main-content {
    flex: 1 1 auto;
    width: auto;
    height: 100%;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: rgba(244, 24, 24, 0.01);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 8px 14px 0 rgba(244, 24, 24, 0.12);
    gap: 5px;
    padding: 8px;
    overflow: hidden;
}

.server-test {
    width: 100%;
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: rgba(244, 24, 24, 0.01);
    border-radius: var(--radius);
    gap: 20px;
    padding: 8px;
    overflow: hidden;
}

.server-select {
    font-size: var(--text-font-default);
    font-weight: bold;
    color: var(--text);
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(15px);
    transition: all 0.25s ease;
    cursor: pointer;
    padding: 7px 5px;
    min-width: 170px;
    max-width: 100%;
}

.latency-test {
    width: min(70%, 850px);
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: space-between;
    align-items: center;
    text-align: center;
    backdrop-filter: blur(2px);
    border-radius: var(--radius);
    padding: 5px 10px;
    gap: 10px;
    margin: 0 auto;
    overflow: hidden;
}

.latency-card {
    min-height: 58px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    border-radius: 14px;
    text-align: center;
    padding: 5px;
    overflow: hidden;
}

.latency-download {
    border: 1px solid rgba(17, 0, 255, 0.15);
    background-color: rgba(17, 0, 255, 0.12);
}

.latency-ping {
    border: 1px solid rgba(218, 244, 24, 0.1);
    background-color: rgba(218, 244, 24, 0.08);
}

.latency-upload {
    border: 1px solid rgba(255, 0, 0, 0.1);
    background-color: rgba(255, 0, 0, 0.08);
}

.latency-card-title {
    font-size: var(--text-font-default);
    font-weight: bold;
    color: var(--text);
    white-space: nowrap;
}

.latency-card-value {
    font-size: 16px;
    font-weight: bold;
    color: var(--text);
    white-space: nowrap;
}

.content-test {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px minmax(0, 1fr);
    justify-content: space-around;
    align-items: stretch;
    text-align: center;
    border-radius: var(--radius);
    padding: 2px 0;
    margin: 0;
    gap: 10px;
    overflow: hidden;
}

.footer-test {
    width: 100%;
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    text-align: center;
    backdrop-filter: blur(2px);
    border-radius: var(--radius);
    padding: 15px;
    margin: 0;
    overflow: hidden;
}

.footer-test button {
    font-size: var(--text-font-default);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
    transition: all 0.25s ease;
    margin: 0 5px;
    white-space: nowrap;
}

.footer-test button:hover {
    cursor: pointer;
    transform: translateX(1px);
    background: rgba(255, 42, 42, 0.12);
    border-color: rgba(255, 42, 42, 0.25);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.footer-test button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.start-test {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 12px 6px;
    border-radius: 15px;
    gap: 14px;
    overflow: hidden;
}

.start-test-button {
    font-size: var(--button-font);
    font-weight: bold;
    width: 100px;
    height: 100px;
    flex: 0 0 auto;
    color: var(--text);
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(15px);
    transition: all 0.25s ease;
    position: relative;
}

.start-test-button:hover {
    cursor: pointer;
    background-color: rgba(255, 42, 42, 0.15);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 14px 0 rgba(244, 24, 24, 0.12);
    font-weight: bolder;
}

.start-test-button.running {
    border-color: transparent;
    color: #ff4a4a;
}

.start-test-button.running::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid transparent;
    border-top-color: #ff2a2a;
    border-right-color: #ff2a2a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.duration-test {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 10px;
    width: 100%;
    max-width: 170px;
    overflow: hidden;
}

.duration-test-label {
    font-size: var(--text-font-default);
    font-weight: bold;
    color: var(--text);
    padding: 5px 0;
    white-space: nowrap;
}

.duration-test-inner {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    text-align: center;

}

.duration-test-inner input {
    font-size: var(--text-font-default);
    font-weight: bold;
    color: var(--text);
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(15px);
    transition: all 0.25s ease;
    cursor: pointer;
    padding: 3px;
    max-width: 80px;
}

.duration-test-ms {
    font-size: var(--text-font-default);
    font-weight: bold;
    color: var(--text);
    padding: 5px;
}

.infor-test {
    width: 100%;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: space-around;
    align-items: center;
    text-align: center;
    padding: 8px 25px;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.info-value {
    font-size: var(--text-font-default);
    font-weight: bold;
    color: var(--text);
    text-align: center;
    word-break: break-word;
}

.server-icon-circle {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 42, 42, 0.14);
    border: 1px solid rgba(255, 42, 42, 0.28);
    flex-shrink: 0;
}

.server-globe-icon {
    width: 100%;
    height: 100%;
    stroke: #ffffff;
    fill: none;
    stroke-width: 1.8;
}

.gauge-box {
    width: 100%;
    max-width: var(--gauge-max-width);
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 0;
    margin: 0 auto;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: var(--radius);
    overflow: hidden;
}

.gauge-title {
    color: #ffffff;
    font-size: var(--title-font);
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 4px;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(255, 60, 60, 0.25);
    white-space: nowrap;
}

.gauge-box canvas {
    width: var(--gauge-width);
    max-width: 100%;
    max-height: 65%;
    height: auto;
    display: block;
}

.gauge-speed {
    padding-top: 15px;
    margin-top: -8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.05;
}

.gauge-speed span {
    color: #ffffff;
    font-size: var(--value-font);
    font-weight: 500;
}

.gauge-speed small {
    color: #f1f1f1;
    font-size: 16px;
    font-weight: 400;
}

.history-modal {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.hidden {
    display: none !important;
}

.history-modal-card {
    width: min(900px, 100%);
    max-height: 80vh;
    overflow: auto;
    background: rgba(10, 12, 20, 0.96);
    border: 1px solid rgba(244, 24, 24, 0.25);
    border-radius: 18px;
    padding: 20px;
}

.history-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.history-close-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(244, 24, 24, 0.25);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.history-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.history-stat {
    padding: 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    text-align: center;
}

.history-empty {
    color: var(--muted);
}

/* 8K and very large display */
@media (min-width: 3800px) {
    :root {
        --text-font-default: 28px;
        --gauge-width: 700px;
        --gauge-max-width: 820px;
        --button-font: 28px;
        --title-font: 34px;
        --value-font: 72px;
        --radius: 28px;
        --main-gap: 18px;
    }

    body {
        padding: 20px;
        gap: 18px;
    }

    .topheader {
        padding: 14px 24px;
    }

    .logodefault {
        width: 160px;
        height: 90px;
    }

    .logotextdefault {
        font-size: 34px;
    }

    .navlink {
        font-size: 26px;
        padding: 16px 24px;
        border-radius: 16px;
    }

    .server-icon-circle {
        width: 58px;
        height: 58px;
    }

    .server-select {
        font-size: 24px;
        padding: 15px;
        min-width: 360px;
    }

    .latency-card {
        min-height: 120px;
    }

    .latency-card-value {
        font-size: 34px;
    }

    .content-test {
        grid-template-columns: minmax(0, 1fr) 360px minmax(0, 1fr);
    }

    .start-test-button {
        width: 180px;
        height: 180px;
    }

    .duration-test {
        max-width: 260px;
    }
}

/* 4K display */
@media (min-width: 2560px) and (max-width: 3799px) {
    :root {
        --text-font-default: 22px;
        --gauge-width: 520px;
        --gauge-max-width: 620px;
        --button-font: 22px;
        --title-font: 26px;
        --value-font: 52px;
        --main-gap: 14px;
    }

    .logodefault {
        width: 130px;
        height: 76px;
    }

    .logotextdefault {
        font-size: 28px;
    }

    .navlink {
        font-size: 20px;
        padding: 14px 20px;
    }

    .server-select {
        min-width: 300px;
        font-size: 20px;
    }

    .latency-card {
        min-height: 90px;
    }

    .latency-card-value {
        font-size: 28px;
    }

    .content-test {
        grid-template-columns: minmax(0, 1fr) 300px minmax(0, 1fr);
    }

    .start-test-button {
        width: 140px;
        height: 140px;
    }
}

/* 2K / QHD */
@media (min-width: 1600px) and (max-width: 2559px) {
    :root {
        --gauge-width: 380px;
        --gauge-max-width: 470px;
        --value-font: 40px;
        --title-font: 20px;
    }

    .content-test {
        grid-template-columns: minmax(0, 1fr) 210px minmax(0, 1fr);
    }
}

/* Full HD / laptop */
@media (min-width: 1200px) and (max-width: 1599px) {
    :root {
        --gauge-width: 300px;
        --gauge-max-width: 390px;
        --value-font: 32px;
        --title-font: 18px;
    }

    .content-test {
        grid-template-columns: minmax(0, 1fr) 190px minmax(0, 1fr);
    }

    .sidebar {
        flex-basis: 14%;
    }
}

/* tablet landscape / small laptop */
@media (min-width: 992px) and (max-width: 1199px) {
    :root {
        --gauge-width: 250px;
        --gauge-max-width: 300px;
        --value-font: 28px;
        --title-font: 16px;
        --text-font-default: 14px;
    }

    body {
        padding: 8px;
        gap: 8px;
    }

    .sidebar {
        flex-basis: 13%;
        font-size: 14px;
    }

    .content-test {
        grid-template-columns: minmax(0, 1fr) 170px minmax(0, 1fr);
        gap: 8px;
        padding: 8px 0;
    }

    .start-test-button {
        width: 82px;
        height: 82px;
    }

    .duration-test {
        max-width: 140px;
    }

    .latency-card-value {
        font-size: 18px;
    }
}

/* iPad / tablet portrait */
@media (min-width: 768px) and (max-width: 991px) {
    :root {
        --gauge-width: 210px;
        --gauge-max-width: 260px;
        --value-font: 26px;
        --title-font: 15px;
        --text-font-default: 13px;
        --main-gap: 6px;
    }

    body {
        padding: 7px;
        gap: 7px;
    }

    .topheader {
        padding: 5px 8px;
    }

    .logodefault {
        width: 80px;
        height: 48px;
    }

    .logotextdefault {
        font-size: 16px;
    }

    .navlink {
        padding: 8px 12px;
    }

    .sidebar {
        flex-basis: 10%;
        padding: 6px;
        font-size: 12px;
    }

    .main-content {
        padding: 6px;
    }

    .content-test {
        grid-template-columns: minmax(0, 1fr) 140px minmax(0, 1fr);
        gap: 6px;
        padding: 6px 0;
    }

    .latency-test {
        width: 100%;
        gap: 6px;
        padding: 4px;
    }

    .latency-card {
        min-height: 48px;
    }

    .infor-test {
        padding: 6px;
        gap: 6px;
    }

    .start-test-button {
        width: 70px;
        height: 70px;
    }

    .duration-test {
        max-width: 120px;
        padding: 7px;
    }
}

/* mobile phone */
/* mobile phone - keep desktop-like layout */
@media (max-width: 767px) {
    :root {
        --gauge-width: clamp(125px, 31vw, 210px);
        --gauge-max-width: 230px;
        --value-font: clamp(20px, 5vw, 30px);
        --title-font: clamp(12px, 3vw, 16px);
        --text-font-default: clamp(12px, 3vw, 14px);
        --button-font: clamp(11px, 3vw, 14px);
        --main-gap: 6px;
        --radius: 14px;
    }

    html,
    body {
        overflow: hidden;
    }

    body {
        height: 100vh;
        height: 100dvh;
        padding: 6px;
        gap: 6px;
    }

    .topheader {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 8px 10px;
        gap: 8px;
        border-radius: 14px;
    }

    .branddefault {
        justify-content: flex-start;
        flex: 1 1 auto;
        min-width: 0;
    }

    .logodefault {
        width: 78px;
        height: 48px;
    }

    /* remove KZN-APP text on mobile */
    .logotextdefault {
        display: none;
    }

    .nav-toggle-button {
        display: flex;
        flex: 0 0 auto;
        width: 46px;
        height: 42px;
    }

    .topnavbar {
        display: none;
        position: absolute;
        top: calc(100% + 6px);
        right: 10px;
        width: 155px;
        padding: 8px;
        border-radius: 14px;
        border: 1px solid var(--border-color);
        background-color: rgba(10, 12, 20, 0.96);
        backdrop-filter: blur(15px);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    }

    .nav-toggle-checkbox:checked~.topnavbar {
        display: block;
    }

    .nav-toggle-checkbox:checked+.nav-toggle-button span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle-checkbox:checked+.nav-toggle-button span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle-checkbox:checked+.nav-toggle-button span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .navbar {
        width: 100%;
        flex-direction: column;
        gap: 6px;
    }

    .navitem {
        width: 100%;
    }

    .navlink {
        width: 100%;
        padding: 10px 12px;
        font-size: 13px;
        text-align: center;
    }

    main {
        width: 100%;
        flex: 1 1 auto;
        height: 0;
        min-height: 0;
        gap: 0;
        padding: 0;
        overflow: hidden;
    }

    /* remove both sidebars on mobile */
    .sidebar,
    .sidebar-left,
    .sidebar-right {
        display: none !important;
    }

    .main-content {
        width: 100%;
        height: 100%;
        flex: 1 1 auto;
        padding: 7px;
        gap: 5px;
        border-radius: 14px;
        overflow: hidden;
    }

    .server-test {
        flex: 0 0 auto;
        width: 100%;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 8px;
        padding: 6px;
    }

    .server-icon-circle {
        width: 34px;
        height: 34px;
    }

    /* do not fill full width on mobile */
    .server-select {
        width: auto;
        min-width: 180px;
        max-width: 260px;
        flex: 0 1 auto;
        font-size: 14px;
        padding: 8px 12px;
        border-radius: 12px;
    }

    .latency-test {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        padding: 4px;
    }

    .latency-card {
        min-height: 58px;
        padding: 6px 4px;
        gap: 3px;
        border-radius: 12px;
    }

    .latency-card-title {
        font-size: 12px;
    }

    .latency-card-value {
        font-size: 13px;
    }

    /* keep desktop style: download | start | upload */
    .content-test {
        flex: 1 1 auto;
        min-height: 0;
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) clamp(82px, 20vw, 130px) minmax(0, 1fr);
        align-items: stretch;
        gap: 7px;
        padding: 6px 0;
        overflow: hidden;
    }

    .gauge-box {
        width: 100%;
        height: 100%;
        max-width: none;
        min-height: 0;
        justify-content: center;
        padding: 8px 4px;
        border-radius: 14px;
    }

    .gauge-title {
        font-size: var(--title-font);
        margin-bottom: 4px;
        letter-spacing: 0.5px;
    }

    .gauge-box canvas {
        width: var(--gauge-width);
        max-width: 100%;
        max-height: 58%;
        height: auto;
    }

    .gauge-speed {
        margin-top: -4px;
    }

    .gauge-speed span {
        font-size: var(--value-font);
    }

    .gauge-speed small {
        font-size: 12px;
    }

    .start-test {
        height: 100%;
        min-height: 0;
        padding: 7px 4px;
        gap: 8px;
        border-radius: 14px;
        justify-content: center;
    }

    .start-test-button {
        width: clamp(58px, 15vw, 86px);
        height: clamp(58px, 15vw, 86px);
        font-size: var(--button-font);
    }

    .duration-test {
        width: 100%;
        max-width: 95px;
        padding: 6px 4px;
        border-radius: 10px;
    }

    .duration-test-label {
        font-size: 12px;
        padding: 2px 0 4px;
    }

    .duration-test-inner {
        gap: 3px;
    }

    .duration-test-inner select {
        max-width: 54px;
        font-size: 12px;
        padding: 3px;
        border-radius: 8px;
    }

    .duration-test-ms {
        font-size: 10px;
        padding: 2px;
    }

    .infor-test {
        flex: 0 0 auto;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding: 6px 4px;
        gap: 5px;
        border-radius: 10px;
    }

    .info-value {
        font-size: 12px;
        line-height: 1.15;
        word-break: break-word;
    }

    .footer-test {
        flex: 0 0 auto;
        padding: 4px;
        gap: 5px;
    }

    .footer-test button {
        flex: 1 1 0;
        min-width: 0;
        margin: 0;
        padding: 8px 4px;
        font-size: 12px;
        border-radius: 10px;
    }

    footer {
        flex: 0 0 auto;
        padding: 7px;
        font-size: 11px;
        border-radius: 14px;
    }

    .history-modal {
        padding: 10px;
    }

    .history-modal-card {
        max-height: 86vh;
        padding: 12px;
    }

    .history-stats {
        grid-template-columns: 1fr;
    }
}

/* very small mobile */
@media (max-width: 400px) {
    :root {
        --gauge-width: clamp(105px, 30vw, 150px);
        --value-font: 18px;
        --title-font: 11px;
    }

    .logodefault {
        width: 68px;
        height: 42px;
    }

    .server-select {
        min-width: 160px;
        max-width: 210px;
        font-size: 13px;
    }

    .content-test {
        grid-template-columns: minmax(0, 1fr) 76px minmax(0, 1fr);
        gap: 5px;
    }

    .start-test-button {
        width: 56px;
        height: 56px;
        font-size: 10px;
    }

    .duration-test {
        max-width: 72px;
    }

    .duration-test-label {
        font-size: 10px;
    }

    .duration-test-inner select {
        max-width: 44px;
        font-size: 10px;
    }

    .duration-test-ms {
        font-size: 9px;
    }

    .info-value {
        font-size: 10px;
    }

    .footer-test button {
        font-size: 10px;
        padding: 6px 3px;
    }
}

/* short-height screens: reduce only a little, not too much */
@media (max-height: 700px) {
    body {
        gap: 5px;
        padding-top: 5px;
        padding-bottom: 5px;
    }

    .topheader {
        padding-top: 5px;
        padding-bottom: 5px;
    }

    .logodefault {
        height: 42px;
    }

    .server-test {
        padding: 4px;
    }

    .latency-card {
        min-height: 46px;
    }

    .content-test {
        padding: 4px 0;
    }

    .infor-test {
        padding-top: 4px;
        padding-bottom: 4px;
    }

    .footer-test {
        padding: 3px;
    }

    footer {
        padding-top: 5px;
        padding-bottom: 5px;
    }
}

@media (max-width: 767px) and (max-height: 700px) {
    :root {
        --gauge-width: clamp(100px, 28vw, 170px);
        --value-font: clamp(17px, 4vw, 24px);
    }

    .start-test-button {
        width: 54px;
        height: 54px;
    }

    .latency-card {
        min-height: 42px;
    }

    .footer-test button {
        padding: 5px 3px;
    }
}

/* =========================================================
   LIVE READY OVERRIDES - KAIZEN NET MULTI-PURPOSE WEBSITE
   ========================================================= */
.logodefault {
    display: block;
}

.navlink.active {
    background: rgba(255, 42, 42, 0.12);
    border-color: rgba(255, 42, 42, 0.28);
}

.gauge-download-box {
    box-shadow: 1px 1px 2px rgba(25, 0, 124, 0.5);
    background-color: rgba(25, 0, 124, 0.2);
    border-radius: 15px;
}

.gauge-upload-box {
    box-shadow: 1px 1px 2px rgba(244, 24, 24, 0.5);
    background-color: rgba(244, 24, 24, 0.07);
    border-radius: 15px;
}

.page-content {
    justify-content: center;
    align-items: center;
    overflow: auto;
}

.page-card {
    width: min(100%, 980px);
    margin: auto;
    padding: 28px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.28);
    box-shadow: 0 8px 14px 0 rgba(244, 24, 24, 0.12);
}

.page-card h1 {
    margin: 0 0 12px;
    font-size: clamp(28px, 4vw, 48px);
}

.page-card p {
    color: var(--muted);
    font-size: clamp(15px, 1.4vw, 20px);
    line-height: 1.5;
}

.learning-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.learning-card {
    display: block;
    text-decoration: none;
    color: var(--text);
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.035);
}

.learning-card h3 {
    margin: 0 0 10px;
}

.learning-card p {
    font-size: 15px;
}

.login-card {
    max-width: 460px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.login-form label {
    font-weight: bold;
}

.login-form input {
    width: 100%;
    padding: 12px 14px;
    color: var(--text);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.35);
    outline: none;
}

.login-form button {
    margin-top: 10px;
    padding: 12px 14px;
    color: var(--text);
    font-weight: bold;
    border-radius: 12px;
    border: 1px solid rgba(255, 42, 42, 0.28);
    background: rgba(255, 42, 42, 0.18);
    cursor: pointer;
}

.flash {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.flash-error {
    background: rgba(255, 42, 42, 0.12);
}

@media (max-width: 767px) {
    :root {
        --gauge-width: clamp(125px, 31vw, 210px);
        --gauge-max-width: 230px;
        --value-font: clamp(20px, 5vw, 30px);
        --title-font: clamp(12px, 3vw, 16px);
        --text-font-default: clamp(12px, 3vw, 14px);
        --button-font: clamp(11px, 3vw, 14px);
        --main-gap: 6px;
        --radius: 14px;
    }

    body {
        height: 100vh;
        height: 100dvh;
        padding: 6px;
        gap: 6px;
        overflow: hidden;
    }

    .topheader {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 8px 10px;
        gap: 8px;
        border-radius: 14px;
    }

    .branddefault {
        justify-content: flex-start;
        flex: 1 1 auto;
        min-width: 0;
    }

    .logodefault {
        width: 78px;
        height: 48px;
    }

    .logotextdefault {
        display: none !important;
    }

    .nav-toggle-button {
        display: flex;
        flex: 0 0 auto;
        width: 46px;
        height: 42px;
    }

    .topnavbar {
        display: none;
        position: absolute;
        top: calc(100% + 6px);
        right: 10px;
        width: 170px;
        padding: 8px;
        border-radius: 14px;
        border: 1px solid var(--border-color);
        background-color: rgba(10, 12, 20, 0.96);
        backdrop-filter: blur(15px);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    }

    .nav-toggle-checkbox:checked~.topnavbar {
        display: block;
    }

    .nav-toggle-checkbox:checked+.nav-toggle-button span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle-checkbox:checked+.nav-toggle-button span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle-checkbox:checked+.nav-toggle-button span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .navbar {
        width: 100%;
        flex-direction: column;
        gap: 6px;
    }

    .navitem,
    .navlink {
        width: 100%;
    }

    .navlink {
        padding: 10px 12px;
        font-size: 13px;
        text-align: center;
    }

    main {
        width: 100%;
        flex: 1 1 auto;
        height: 0;
        min-height: 0;
        gap: 0;
        padding: 0;
        overflow: hidden;
    }

    .sidebar,
    .sidebar-left,
    .sidebar-right {
        display: none !important;
    }

    .main-content {
        width: 100%;
        height: 100%;
        flex: 1 1 auto;
        padding: 7px;
        gap: 5px;
        border-radius: 14px;
        overflow: hidden;
    }

    .page-content {
        overflow: auto;
    }

    .server-test {
        flex: 0 0 auto;
        width: 100%;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 8px;
        padding: 6px;
    }

    .server-icon-circle {
        width: 34px;
        height: 34px;
    }

    .server-select {
        width: auto !important;
        min-width: 180px;
        max-width: 260px;
        flex: 0 1 auto;
        font-size: 14px;
        padding: 8px 12px;
        border-radius: 12px;
    }

    .latency-test {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        padding: 4px;
    }

    .latency-card {
        min-height: 58px;
        padding: 6px 4px;
        gap: 3px;
        border-radius: 12px;
    }

    .latency-card-title {
        font-size: 12px;
    }

    .latency-card-value {
        font-size: 13px;
    }

    .content-test {
        flex: 1 1 auto;
        min-height: 0;
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) clamp(82px, 20vw, 130px) minmax(0, 1fr);
        align-items: stretch;
        gap: 7px;
        padding: 6px 0;
        overflow: hidden;
    }

    .gauge-box {
        width: 100%;
        height: 100%;
        max-width: none;
        min-height: 0;
        justify-content: center;
        padding: 8px 4px;
        border-radius: 14px;
    }

    .gauge-title {
        font-size: var(--title-font);
        margin-bottom: 4px;
        letter-spacing: 0.5px;
    }

    .gauge-box canvas {
        width: var(--gauge-width);
        max-width: 100%;
        max-height: 58%;
        height: auto;
    }

    .gauge-speed {
        margin-top: -4px;
    }

    .gauge-speed span {
        font-size: var(--value-font);
    }

    .gauge-speed small {
        font-size: 12px;
    }

    .start-test {
        height: 100%;
        min-height: 0;
        padding: 7px 4px;
        gap: 8px;
        border-radius: 14px;
        justify-content: center;
    }

    .start-test-button {
        width: clamp(58px, 15vw, 86px);
        height: clamp(58px, 15vw, 86px);
        font-size: var(--button-font);
    }

    .duration-test {
        width: 100%;
        max-width: 95px;
        padding: 6px 4px;
        border-radius: 10px;
    }

    .duration-test-label {
        font-size: 12px;
        padding: 2px 0 4px;
    }

    .duration-test-inner select {
        max-width: 54px;
        font-size: 12px;
        padding: 3px;
        border-radius: 8px;
    }

    .duration-test-ms {
        font-size: 10px;
        padding: 2px;
    }

    .infor-test {
        flex: 0 0 auto;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding: 6px 4px;
        gap: 5px;
        border-radius: 10px;
    }

    .info-value {
        font-size: 12px;
        line-height: 1.15;
        word-break: break-word;
    }

    .footer-test {
        flex: 0 0 auto;
        padding: 4px;
        gap: 5px;
    }

    .footer-test button {
        flex: 1 1 0;
        min-width: 0;
        margin: 0;
        padding: 8px 4px;
        font-size: 12px;
        border-radius: 10px;
    }

    footer {
        flex: 0 0 auto;
        padding: 7px;
        font-size: 11px;
        border-radius: 14px;
    }

    .page-card {
        padding: 18px;
    }

    .learning-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

@media (max-width: 400px) {
    :root {
        --gauge-width: clamp(105px, 30vw, 150px);
        --value-font: 18px;
        --title-font: 11px;
    }

    .logodefault {
        width: 68px;
        height: 42px;
    }

    .server-select {
        min-width: 160px;
        max-width: 210px;
        font-size: 13px;
    }

    .content-test {
        grid-template-columns: minmax(0, 1fr) 76px minmax(0, 1fr);
        gap: 5px;
    }

    .start-test-button {
        width: 56px;
        height: 56px;
        font-size: 10px;
    }

    .duration-test {
        max-width: 72px;
    }

    .duration-test-label {
        font-size: 10px;
    }

    .duration-test-inner select {
        max-width: 44px;
        font-size: 10px;
    }

    .duration-test-ms {
        font-size: 9px;
    }

    .info-value {
        font-size: 10px;
    }

    .footer-test button {
        font-size: 10px;
        padding: 6px 3px;
    }
}