@property --bg-gradient-1 {
    syntax: '<color>';
    inherits: true;
    initial-value: rgba(4, 6, 12, 0.25);
}

@property --bg-gradient-2 {
    syntax: '<color>';
    inherits: true;
    initial-value: rgba(4, 6, 12, 0.35);
}

: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);
    --bg-gradient-1: rgba(4, 6, 12, 0.25);
    --bg-gradient-2: rgba(4, 6, 12, 0.35);
}

body.theme-black {
    --bg-gradient-1: rgba(0, 0, 0, 0.6);
    --bg-gradient-2: rgba(0, 0, 0, 0.8);
}

body.theme-blue {
    --bg-gradient-1: rgba(0, 20, 60, 0.5);
    --bg-gradient-2: rgba(0, 10, 40, 0.8);
}

body.theme-red {
    --bg-gradient-1: rgba(60, 0, 0, 0.5);
    --bg-gradient-2: rgba(40, 0, 0, 0.8);
}

body.theme-white {
    --bg-gradient-1: rgba(245, 248, 255, 0.72);
    --bg-gradient-2: rgba(216, 224, 238, 0.88);
    --panel: rgba(255, 255, 255, 0.68);
    --panel-2: rgba(247, 249, 252, 0.72);
    --text: #111827;
    --muted: #4b5563;
    --line: rgba(0, 0, 0, 0.1);
    --border-color: rgba(0, 0, 0, 0.16);
}

body.theme-ocean-sunset {
    --bg-gradient-1: rgba(15, 32, 39, 0.65);
    --bg-gradient-2: rgba(44, 83, 100, 0.8);
}

body.theme-indigo-steel {
    --bg-gradient-1: rgba(44, 62, 80, 0.65);
    --bg-gradient-2: rgba(76, 161, 175, 0.8);
}

body.theme-bronze-eclipse {
    --bg-gradient-1: rgba(60, 42, 33, 0.65);
    --bg-gradient-2: rgba(142, 115, 91, 0.8);
}

body.theme-mocha-mist {
    --bg-gradient-1: rgba(183, 152, 145, 0.65);
    --bg-gradient-2: rgba(148, 113, 107, 0.8);
}

body.theme-velvet-smoke {
    --bg-gradient-1: rgba(173, 169, 150, 0.65);
    --bg-gradient-2: rgba(242, 242, 242, 0.8);
    --text: #111111;
    --muted: #555555;
    --border-color: rgba(0, 0, 0, 0.15);
    --line: rgba(0, 0, 0, 0.1);
    --panel: rgba(255, 255, 255, 0.4);
    --panel-2: rgba(240, 240, 240, 0.4);
}

body.theme-emerald-dusk {
    --bg-gradient-1: rgba(19, 78, 94, 0.65);
    --bg-gradient-2: rgba(113, 178, 128, 0.8);
}

body.theme-royal-aurora {
    --bg-gradient-1: rgba(62, 47, 91, 0.65);
    --bg-gradient-2: rgba(233, 69, 96, 0.8);
}

body.theme-royal-charcoal {
    --bg-gradient-1: rgba(35, 37, 38, 0.65);
    --bg-gradient-2: rgba(65, 67, 69, 0.8);
}

body.theme-champagne-blush {
    --bg-gradient-1: rgba(252, 234, 187, 0.65);
    --bg-gradient-2: rgba(248, 181, 0, 0.8);
    --text: #111111;
    --muted: #555555;
    --border-color: rgba(0, 0, 0, 0.15);
    --line: rgba(0, 0, 0, 0.1);
    --panel: rgba(255, 255, 255, 0.4);
    --panel-2: rgba(240, 240, 240, 0.4);
}

body.theme-crimson-velvet {
    --bg-gradient-1: rgba(90, 42, 39, 0.65);
    --bg-gradient-2: rgba(154, 77, 66, 0.8);
}

* {
    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(var(--bg-gradient-1), var(--bg-gradient-2)),
        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;
    transition: --bg-gradient-1 1s ease-in-out, --bg-gradient-2 1s ease-in-out, color 0.5s ease;
}

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;
    background-color: #000;
    border-radius: 12px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.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;
}

.settings-dropdown-container {
    position: relative;
}

.settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    transition: background 0.3s ease;
    border-radius: 8px;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.settings-popover {
    position: absolute;
    top: 120%;
    right: 0;
    width: 200px;
    background: var(--panel-2);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.settings-popover.hidden {
    opacity: 0;
    transform: translateY(-10px);
    visibility: hidden;
    pointer-events: none;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-title {
    font-size: 12px;
    font-weight: bold;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    color: var(--text);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mode-btn.active {
    background: rgba(255, 42, 42, 0.2);
    border-color: rgba(255, 42, 42, 0.5);
}

.theme-switcher {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}

.theme-dot {
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    appearance: none;
    transition: transform 0.2s, border-color 0.2s;
}

.theme-dot:hover,
.theme-dot.active {
    transform: scale(1.2);
    border-color: rgba(255, 255, 255, 0.8);
}

.theme-dot-black {
    background: #111;
}

.theme-dot-blue {
    background: #002b5e;
}

.theme-dot-red {
    background: #8a0000;
}

.theme-dot-white {
    background: #f5f7fb;
    border-color: rgba(0, 0, 0, 0.2);
}

.theme-dot-ocean-sunset { background: linear-gradient(135deg, #0F2027, #2C5364); }
.theme-dot-indigo-steel { background: linear-gradient(135deg, #2C3E50, #4CA1AF); }
.theme-dot-bronze-eclipse { background: linear-gradient(135deg, #3C2A21, #8E735B); }
.theme-dot-mocha-mist { background: linear-gradient(135deg, #B79891, #94716B); }
.theme-dot-velvet-smoke { background: linear-gradient(135deg, #ADA996, #F2F2F2); border-color: rgba(0,0,0,0.2); }
.theme-dot-emerald-dusk { background: linear-gradient(135deg, #134E5E, #71B280); }
.theme-dot-royal-aurora { background: linear-gradient(135deg, #3E2F5B, #E94560); }
.theme-dot-royal-charcoal { background: linear-gradient(135deg, #232526, #414345); }
.theme-dot-champagne-blush { background: linear-gradient(135deg, #FCEABB, #F8B500); border-color: rgba(0,0,0,0.2); }
.theme-dot-crimson-velvet { background: linear-gradient(135deg, #5A2A27, #9A4D42); }

.navbar {
    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: var(--panel);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    box-shadow: 0 8px 14px 0 rgba(0, 0, 0, 0.2);
    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;
}

.sidebar.sidebar-youtube-host {
    flex-basis: clamp(150px, 15vw, 260px);
    justify-content: stretch;
    align-items: stretch;
}

.youtube-sidebar-card {
    position: relative;
    isolation: isolate;
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 8px;
    text-align: left;
    overflow: hidden;
}

.kzn-ad-layer {
    background: transparent;
    pointer-events: none;
}

.kzn-ad-unit {
    display: block;
    width: 100%;
    min-width: 0;
    background: transparent;
    pointer-events: auto;
}

.kzn-ad-placeholder {
    width: 100%;
    min-height: 100%;
    background: transparent;
}

.kzn-sidebar-ad {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    z-index: 4;
    min-height: 82px;
    border-radius: 10px;
    overflow: hidden;
    background: transparent;
}

.kzn-sidebar-ad .kzn-ad-unit {
    min-height: 82px;
}

.kzn-sidebar-ad-left {
    bottom: 44%;
}

.server-test {
    position: relative;
}

.kzn-server-select-ad {
    position: absolute;
    inset: 4px auto auto 50%;
    z-index: 3;
    width: min(360px, 52%);
    min-height: 40px;
    border-radius: 12px;
    overflow: hidden;
    transform: translateX(-50%);
    background: transparent;
}

.kzn-server-select-ad .kzn-ad-unit {
    min-height: 40px;
}

.youtube-frame-shell {
    flex: 0 0 42%;
    width: 100%;
    min-height: 180px;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.36);
}

.sidebar-right .youtube-frame-shell {
    flex: 1 1 100%;
    min-height: 120px;
}

.youtube-sidebar-player,
.youtube-sidebar-player iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}

.youtube-volume-popover {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 5px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(9, 10, 14, 0.78);
    backdrop-filter: blur(14px);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.34);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.22s ease;
}

.youtube-sidebar-card:hover .youtube-volume-popover,
.youtube-sidebar-card:focus-within .youtube-volume-popover {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.youtube-volume-toggle {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.youtube-volume-icon {
    position: relative;
    width: 14px;
    height: 14px;
    display: block;
}

.youtube-volume-icon::before {
    content: "";
    position: absolute;
    left: 1px;
    top: 4px;
    width: 5px;
    height: 6px;
    border-radius: 2px 0 0 2px;
    background: currentColor;
}

.youtube-volume-icon::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 1px;
    width: 8px;
    height: 12px;
    border-right: 2px solid currentColor;
    border-radius: 50%;
}

.youtube-volume-toggle.is-muted .youtube-volume-icon::after {
    width: 9px;
    height: 2px;
    top: 6px;
    left: 6px;
    border-right: 0;
    border-radius: 2px;
    background: currentColor;
    transform: rotate(45deg);
}

.youtube-volume-slider-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 6px 3px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.22);
}

.youtube-volume-slider-shell input {
    width: 18px;
    height: 88px;
    accent-color: var(--primary);
    cursor: pointer;
    writing-mode: vertical-lr;
    direction: rtl;
}

.youtube-volume-slider-shell output {
    min-width: 28px;
    color: #fff;
    font-size: 10px;
    line-height: 1;
    text-align: center;
}

.youtube-playlist-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 2px 2px 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 42, 42, 0.65) rgba(255, 255, 255, 0.08);
}

.youtube-playlist-item {
    width: 100%;
    display: grid;
    grid-template-columns: 18px 72px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.24);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.youtube-playlist-item:hover,
.youtube-playlist-item.active {
    border-color: rgba(255, 42, 42, 0.32);
    background: rgba(255, 42, 42, 0.12);
}

.youtube-playlist-index {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.youtube-playlist-item img {
    width: 72px;
    aspect-ratio: 16 / 9;
    border-radius: 7px;
    object-fit: cover;
    background: #000;
}

.youtube-playlist-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.youtube-playlist-title {
    color: var(--text);
    font-size: 12px;
    font-weight: bold;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.youtube-playlist-channel {
    color: var(--muted);
    font-size: 11px;
    line-height: 1;
}

@media (min-width: 768px) and (max-width: 991px) {
    .sidebar.sidebar-youtube-host {
        flex-basis: 118px;
    }

    .youtube-sidebar-card {
        gap: 6px;
    }

    .kzn-sidebar-ad {
        left: 5px;
        right: 5px;
        bottom: 5px;
        min-height: 64px;
    }

    .kzn-sidebar-ad-left {
        bottom: 45%;
    }

    .kzn-sidebar-ad .kzn-ad-unit {
        min-height: 64px;
    }

    .kzn-server-select-ad {
        width: min(260px, 50%);
        min-height: 34px;
    }

    .youtube-frame-shell {
        flex-basis: 38%;
        min-height: 130px;
    }

    .sidebar-right .youtube-frame-shell {
        flex-basis: 100%;
        min-height: 100px;
    }

    .youtube-volume-popover {
        top: 6px;
        left: 6px;
        gap: 4px;
        padding: 4px;
    }

    .youtube-volume-toggle {
        width: 24px;
        height: 24px;
    }

    .youtube-volume-slider-shell input {
        height: 72px;
    }

    .youtube-playlist-item {
        grid-template-columns: 16px 52px minmax(0, 1fr);
        gap: 5px;
        padding: 5px;
    }

    .youtube-playlist-item img {
        width: 52px;
    }

    .youtube-playlist-title {
        font-size: 11px;
        -webkit-line-clamp: 2;
    }

    .youtube-playlist-channel {
        display: none;
    }

}

.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;
    transition: border-color 0.5s ease, box-shadow 0.5s ease;
}

.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: var(--text);
    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%;
    height: auto;
    aspect-ratio: 420 / 300;
    object-fit: contain;
    flex-shrink: 0;
    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: var(--text);
    font-size: var(--value-font);
    font-weight: 500;
}

.gauge-speed small {
    color: var(--text);
    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: var(--panel);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    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 var(--border-color);
    background: var(--panel-2);
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
    text-align: left;
    margin-top: 10px;
}

.history-table th,
.history-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.history-table th {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    background: var(--panel-2);
}

.history-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.history-table tbody tr:hover {
    background: var(--panel-2);
}

.history-empty {
    text-align: center;
    color: var(--muted);
    padding: 20px !important;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.history-detail-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-modal-large {
    width: min(1200px, 100%) !important;
}

.detail-content-test {
    margin-top: 0 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 40px !important;
}

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

.history-stat {
    padding: 8px;
    border-radius: 10px;
    background: var(--panel-2);
    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);
}

.page-loading {
    opacity: 0.72;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

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

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

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

.page-card {
    width: min(100%, 980px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    top: 0;
    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;
}

.login-card {
    max-width: 460px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: start;
    top: 0;
    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);
}

.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);
}

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

.dashboard-card {
    align-items: stretch;
    justify-content: flex-start;
    max-height: 100%;
    overflow: auto;
}

.dashboard-card > h1,
.dashboard-card > p {
    text-align: center;
}

.admin-flashes {
    width: 100%;
}

.admin-content-panel {
    display: none;
}

.admin-content-panel.is-active {
    display: flex;
    margin-top: 0;
    margin-bottom: 0;
}

.admin-content-heading {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    width: 100%;
    margin-bottom: 12px;
}

.admin-content-heading h1 {
    margin: 0;
}

.admin-content-heading button {
    padding: 9px 12px;
    color: var(--text);
    font-weight: bold;
    border-radius: 10px;
    border: 1px solid rgba(255, 42, 42, 0.28);
    background: rgba(255, 42, 42, 0.14);
    cursor: pointer;
}

.admin-profile-widget {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 1800;
}

.admin-panel-input,
.admin-profile-tab-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.admin-profile-button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: var(--text);
    font-weight: bold;
    border-radius: 50%;
    border: 1px solid rgba(255, 42, 42, 0.38);
    background: rgba(255, 42, 42, 0.24);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

.admin-profile-menu {
    position: absolute;
    left: 0;
    bottom: 54px;
    padding: 16px;
    color: var(--text);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: rgba(10, 10, 10, 0.94);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: grid;
    gap: 8px;
    width: min(240px, calc(100vw - 36px));
}

#adminPanelMenu:checked ~ .admin-profile-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.admin-profile-session,
.admin-popup-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.admin-popup-heading h2 {
    margin: 0;
    font-size: clamp(18px, 2vw, 26px);
}

.admin-popup-heading label {
    padding: 7px 10px;
    color: var(--text);
    font-weight: bold;
    border-radius: 10px;
    border: 1px solid rgba(255, 42, 42, 0.28);
    background: rgba(255, 42, 42, 0.14);
    cursor: pointer;
}

.admin-profile-session span {
    color: var(--muted);
}

.admin-profile-session {
    display: grid;
    gap: 2px;
    margin-bottom: 4px;
}

.admin-profile-menu-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    color: var(--text);
    font: inherit;
    text-decoration: none;
    text-align: left;
    font-weight: bold;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
}

.admin-profile-menu-item:hover {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
}

.admin-profile-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.admin-profile-tabs label {
    padding: 9px 10px;
    text-align: center;
    color: var(--text);
    font-weight: bold;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
}

.admin-profile-tab {
    display: none;
}

#adminSettingInfo:checked ~ .admin-profile-tabs label[for="adminSettingInfo"],
#adminSettingAddUser:checked ~ .admin-profile-tabs label[for="adminSettingAddUser"],
#adminSettingRoles:checked ~ .admin-profile-tabs label[for="adminSettingRoles"] {
    border-color: rgba(255, 42, 42, 0.4);
    background: rgba(255, 42, 42, 0.16);
}

#adminSettingInfo:checked ~ .admin-setting-tab-info,
#adminSettingAddUser:checked ~ .admin-setting-tab-add-user,
#adminSettingRoles:checked ~ .admin-setting-tab-roles {
    display: block;
}

.admin-profile-form {
    display: grid;
    gap: 10px;
    padding-top: 10px;
}

.admin-profile-form + .admin-profile-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.admin-profile-form label {
    display: grid;
    gap: 6px;
    font-weight: bold;
    color: var(--text);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

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

.admin-profile-form input[readonly] {
    color: var(--muted);
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.12);
}

.admin-profile-form button,
.admin-access-rule button {
    padding: 11px 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;
}

.admin-profile-check {
    display: flex !important;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
}

.admin-profile-check input {
    width: auto;
}

.admin-profile-users {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.admin-profile-users div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--panel);
}

.admin-profile-users span,
.admin-profile-users small {
    color: var(--muted);
}

.admin-role-list {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.admin-role-list form {
    display: grid;
    grid-template-columns: minmax(90px, 1fr) 100px auto auto;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--panel);
}

.admin-role-list select {
    min-width: 0;
    padding: 9px 10px;
    color: var(--text);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.35);
}

.admin-role-list button {
    padding: 9px 11px;
    color: var(--text);
    font-weight: bold;
    border-radius: 10px;
    border: 1px solid rgba(255, 42, 42, 0.28);
    background: rgba(255, 42, 42, 0.18);
    cursor: pointer;
}

.admin-access-heading {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.admin-access-heading h2 {
    margin: 0;
    font-size: clamp(18px, 2vw, 26px);
}

.admin-access-heading p {
    margin: 0;
    font-size: 14px;
    text-align: right;
}

.admin-access-rules {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.admin-access-rule {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--panel);
}

.admin-access-rule div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.admin-access-rule small {
    color: var(--muted);
}

.admin-access-action {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.admin-access-action-allow {
    background: rgba(42, 255, 146, 0.16);
}

.admin-access-action-deny {
    background: rgba(255, 42, 42, 0.16);
}

@media (max-width: 900px) {
    .admin-access-heading,
    .admin-access-rule {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-access-heading p {
        text-align: left;
    }

    .admin-profile-widget {
        left: 12px;
        bottom: 12px;
    }

    .admin-role-list form {
        grid-template-columns: 1fr;
    }
}

@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;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
    }

    .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;
    }

}

@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;
    }
}

/* Final Learning page overrides: keep the page title visible and responsive. */
.learning-content {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 12px;
    padding: 0 12px;
    overflow-y: auto !important;
    overflow-x: hidden;
    background: none;
    border: none;
    box-shadow: none;
    backdrop-filter: blur(16px);
}

.learning-title {
    position: sticky;
    display: flex;
    justify-content: center;
    align-items: center;
    top: 0;
    z-index: 3;
    width: 100%;
    padding: 12px 0;
    margin: 0;
    border-bottom: 1px solid rgba(244, 24, 24, 0.18);
    border-radius: 14px;
    background: var(--panel);
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 24px rgba(244, 24, 24, 0.12);
    color: var(--text);
    font-size: clamp(18px, 1.6vw, 26px);
    line-height: 1.05;
    text-align: left;
    text-shadow: 0 0 12px rgba(255, 42, 42, 0.24);
}

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

.learning-card {
    display: block;
    text-decoration: none;
    color: var(--text);
    min-height: 118px;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background-color: var(--panel);
    backdrop-filter: blur(12px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.learning-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    background-color: var(--panel-2);
}

.learning-card h3 {
    margin: 0 0 10px;
    font-size: clamp(12px, 1vw, 18px);
    line-height: 1.05;
    font-weight: bold;
    background: var(--panel-2);
    padding: 8px;
    border-radius: 14px;
    text-align: center;
}

.learning-card p {
    color: var(--text);
    font-size: clamp(13px, 0.9vw, 16px);
    line-height: 1.15;
}

.learning-content.learning-popup-active {
    overflow: hidden !important;
}

.learning-content.learning-popup-active > .learning-title,
.learning-content.learning-popup-active > .learning-grid {
    visibility: hidden;
}

.learning-popup {
    position: absolute;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    background: var(--panel);
    backdrop-filter: blur(18px);
}

body.learning-popup-open {
    overflow: hidden;
}

.learning-popup-card {
    width: 100%;
    height: 100%;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45), 0 0 34px rgba(244, 24, 24, 0.16);
}

.learning-popup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--panel-2);
}

.learning-popup-head h3 {
    min-width: 0;
    margin: 0;
    color: var(--text);
    font-size: clamp(16px, 1.4vw, 24px);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.learning-popup-close {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--panel);
    color: var(--text);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.learning-popup-close:hover,
.learning-popup-close:focus-visible {
    border-color: var(--primary);
    outline: none;
}

.learning-popup-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 18px;
    color: var(--text);
}

.learning-popup-state {
    padding: 28px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--panel-2);
    color: var(--text);
    text-align: center;
}

.learning-topic {
    display: grid;
    gap: 16px;
}

.learning-topic h2,
.learning-topic h3,
.learning-topic p {
    margin: 0;
}

.learning-topic h2 {
    font-size: clamp(20px, 1.8vw, 30px);
    line-height: 1.1;
}

.learning-topic section {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--panel-2);
}

.learning-topic h3 {
    font-size: clamp(15px, 1.2vw, 20px);
}

.learning-topic p,
.learning-topic li {
    color: var(--text);
    font-size: clamp(13px, 0.95vw, 16px);
    line-height: 1.45;
}

.learning-topic pre {
    max-width: 100%;
    overflow-x: auto;
    margin: 0;
    padding: 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.32);
    color: var(--text);
}

@media (max-width: 1199px) {
    .learning-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991px) {
    .learning-main {
        gap: 0;
    }

    .learning-main .sidebar {
        display: none !important;
    }

    .learning-content {
        width: 100%;
        height: 100%;
        padding: 12px;
    }
}

@media (max-width: 767px) {
    .learning-content {
        gap: 10px;
        padding: 9px;
    }

    .learning-title {
        padding: 10px;
        border-radius: 12px;
        font-size: clamp(18px, 5vw, 24px);
        text-align: center;
    }

    .learning-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .learning-card {
        min-height: auto;
        padding: 10px;
        border-radius: 12px;
        overflow-wrap: anywhere;
    }

    .learning-card h3 {
        font-size: clamp(12px, 3.5vw, 16px);
        line-height: 1.12;
        padding: 7px;
        overflow-wrap: anywhere;
    }

    .learning-card p {
        font-size: clamp(11px, 3vw, 13px);
        line-height: 1.22;
        overflow-wrap: anywhere;
    }

    .learning-popup {
        padding: 0;
    }

    .learning-popup-card {
        max-height: none;
        border-radius: 13px;
    }

    .learning-popup-head {
        padding: 12px;
    }

    .learning-popup-close {
        width: 34px;
        height: 34px;
        font-size: 24px;
    }

    .learning-popup-body {
        padding: 12px;
    }
}

@media (max-height: 700px) {
    .learning-content {
        gap: 10px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .learning-title {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .learning-card {
        min-height: 105px;
        padding: 12px;
    }
}



/* IP Check Specific Styles */
.ipcheck-content {
    width: 100%;
    min-width: 0;
    /* max-width: 900px; */
    margin: 0 auto;
    padding: 10px;
    color: var(--text);
    background-color: var(--panel);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    overflow-x: hidden;
}

.content-header {
    text-align: center;
    margin-bottom: 30px;
}

.content-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--text);
}

.content-header p {
    color: var(--muted);
    font-size: 16px;
}

.ipcheck-form-container {
    margin-bottom: 30px;
    /* background: rgba(255, 255, 255, 0.03); */
    /* border: 1px solid rgba(255, 255, 255, 0.08); */
    border-radius: 14px;
    padding: 10px;
    overflow: visible;
}

.ipcheck-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    overflow: visible;
}

.ipcheck-autosync-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
}

.ipcheck-autosync-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: rgba(255, 42, 42, 0.8);
}

.ipcheck-autosync-wrapper label {
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.ipcheck-source-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    overflow: visible;
}

.agent-control-group {
    align-items: flex-end;
    display: inline-flex;
    gap: 8px;
    position: relative;
}

.agent-toggle-stack {
    align-items: center;
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
}

.agent-toggle-btn {
    min-width: 108px;
}

.has-tip {
    position: relative;
}

.has-tip::after {
    background: rgba(10, 10, 14, 0.96);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text);
    content: attr(data-tooltip);
    font-size: 13px;
    font-weight: 400;
    bottom: calc(100% + 10px);
    left: 50%;
    line-height: 1.35;
    opacity: 0;
    padding: 10px 12px;
    pointer-events: none;
    position: absolute;
    text-align: left;
    transform: translateX(-50%) translateY(4px);
    transition: opacity 0.2s ease, visibility 0.2s ease;
    visibility: hidden;
    width: min(320px, 70vw);
    z-index: 2000;
}

.has-tip::before {
    border: 6px solid transparent;
    border-top-color: rgba(10, 10, 14, 0.96);
    bottom: calc(100% - 2px);
    content: "";
    left: 50%;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transform: translateX(-50%) translateY(4px);
    transition: opacity 0.2s ease, visibility 0.2s ease;
    visibility: hidden;
    z-index: 2001;
}

.has-tip:hover::after,
.has-tip:focus-visible::after,
.has-tip:focus-within::after,
.has-tip:hover::before,
.has-tip:focus-visible::before,
.has-tip:focus-within::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    visibility: visible;
}

.ipcheck-icon-btn {
    align-items: center;
    background: var(--panel-2);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    height: 38px;
    justify-content: center;
    line-height: 1;
    transition: all 0.25s ease;
    width: 38px;
}

.ipcheck-icon-btn:hover {
    border-color: rgba(255, 42, 42, 0.35);
    color: var(--primary);
}

.agent-status-badge {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 0 4px;
    white-space: nowrap;
}

.agent-status-badge.online {
    color: #00ff88;
}

.agent-status-badge.offline {
    color: #ff9f9f;
}

.agent-status-badge.checking {
    color: #ffd166;
}

@media (max-width: 760px) {
    .has-tip::after {
        left: 50%;
        width: min(300px, 82vw);
    }
}

.ping-options-wrapper {
    align-items: center;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    overflow: visible;
}

.ping-option-field {
    align-items: center;
    background: var(--panel-2);
    border: 1px solid rgba(255, 42, 42, 0.18);
    border-radius: 10px;
    color: var(--muted);
    display: inline-flex;
    gap: 6px;
    padding: 5px 7px;
}

.ping-option-field span {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.ping-option-field input {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    padding: 5px 7px;
    width: 70px;
}

.ipcheck-select {
    background: var(--panel-2);
    border: 1px solid rgba(255, 42, 42, 0.25);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    padding: 10px 12px;
}

.ipcheck-select option {
    background-color: #111;
    color: #fff;
}

.ipcheck-agent-action-btn,
.ipcheck-stop-agent-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    padding: 10px 12px;
    transition: all 0.25s ease;
}

.ipcheck-agent-action-btn:hover,
.ipcheck-stop-agent-btn:hover {
    border-color: rgba(255, 42, 42, 0.35);
    color: var(--text);
}

.ipcheck-input {
    flex: 1;
    min-width: 250px;
    background: var(--panel-2);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 5px;
    color: var(--text);
    font-size: 16px;
    outline: none;
    transition: all 0.25s ease;
}

.ipcheck-input:focus {
    border-color: rgba(255, 42, 42, 0.5);
    background: rgba(255, 42, 42, 0.05);
}

.ipcheck-submit-btn {
    align-items: center;
    background: rgba(255, 42, 42, 0.12);
    border: 1px solid rgba(255, 42, 42, 0.25);
    color: var(--text);
    border-radius: 10px;
    display: inline-flex;
    font-size: 16px;
    font-weight: bold;
    gap: 8px;
    justify-content: center;
    min-height: 44px;
    min-width: 104px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.ipcheck-submit-btn.is-loading::before {
    animation: spin 0.8s linear infinite;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;
    border-top-color: var(--text);
    content: "";
    flex: 0 0 auto;
    height: 15px;
    width: 15px;
}

.ipcheck-submit-btn:hover {
    background: rgba(255, 42, 42, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 42, 42, 0.2);
}

.ipcheck-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ipcheck-loading {
    text-align: center;
    padding: 40px;
    color: var(--muted);
}

.loader {
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top: 3px solid var(--primary);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.ipcheck-results {
    background-color: var(--panel);
    animation: fadeIn 0.3s ease;
}

.agent-download-prompt {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 42, 42, 0.3);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
}

.agent-download-copy {
    color: var(--muted);
    font-size: 15px;
    margin: 0 auto 14px auto;
    max-width: 560px;
}

.agent-trust-note {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 auto 20px auto;
    max-width: 760px;
    padding: 14px 16px;
    text-align: left;
}

.agent-trust-note strong,
.agent-trust-note code,
.agent-install-steps code {
    color: var(--text);
}

.agent-install-steps {
    counter-reset: agent-step;
    display: grid;
    gap: 10px;
    list-style: none;
    margin: 0 auto 24px auto;
    max-width: 760px;
    padding: 0;
    text-align: left;
}

.agent-install-steps li {
    align-items: flex-start;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    counter-increment: agent-step;
    display: grid;
    gap: 4px;
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 12px;
}

.agent-install-steps li::before {
    align-items: center;
    background: rgba(255, 42, 42, 0.14);
    border: 1px solid rgba(255, 42, 42, 0.28);
    border-radius: 50%;
    color: var(--text);
    content: counter(agent-step);
    display: inline-flex;
    font-size: 13px;
    font-weight: 700;
    height: 28px;
    justify-content: center;
    width: 28px;
}

.agent-install-steps span {
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

.agent-install-steps small {
    color: var(--muted);
    display: block;
    font-size: 13px;
    grid-column: 2;
    line-height: 1.45;
}

.agent-install-status {
    color: var(--muted);
    font-size: 14px;
    margin: 0 auto 25px auto;
    max-width: 560px;
}

.agent-install-status[data-state="pending"] {
    color: #ffd166;
}

.agent-install-status[data-state="success"] {
    color: #00ff88;
}

.agent-install-status[data-state="warning"] {
    color: #ff9f9f;
}

.agent-download-btn {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 0 auto;
    max-width: 280px;
}

.ipcheck-results .table-responsive {
    max-height: 400px;
    overflow-y: auto;
}

.ipcheck-table th {
    text-align: left;
}

.ip-copy-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 22px;
    margin-bottom: 4px;
}

.ip-copy-wrapper:last-child {
    margin-bottom: 0;
}

.ip-copy-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}

.ip-copy-wrapper:hover .ip-copy-btn {
    opacity: 1;
}

.ip-copy-btn:hover {
    color: var(--text);
}

body.theme-white .logodefault {
    background-color: #000;
    border-radius: 10px;
}

.terminal-output {
    background-color: #0f111a;
    color: #00ff41;
    font-family: 'Courier New', Courier, monospace;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
    margin: 0;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    white-space: pre !important;
    word-wrap: normal !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    max-width: 100%;
}

body.theme-white .terminal-output {
    background-color: #f5f7fa;
    color: #111;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
}
