:root {
    --header-bg: #f8fcffcc;
    --header-border: 1px solid #ffffff4d;
    --header-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    --header-top: 40px;
    --header-clamp: clamp(0.5px, 0.225vw, 1px);
    --accent: #391c36;
    --menu-box-shadows: rgba(0, 0, 0, 0.1);
    --menu-dropdown-bg: #fff;
    --dropdown-el-hover: #f0f0f0;
    --sidebar-dropdown: rgba(255, 255, 255, 0.4);
    --sidebar-dropdown-shadow: rgba(0, 0, 0, 0.02);
    --sidebar-dropdown-el-hover: rgba(0, 0, 0, 0.05);

}

@media (prefers-color-scheme: dark) {
    :root {
        --header-bg: #000000cc; /* Dark, semi-transparent background with blur support */
        --header-border: 1px solid #ffffff10; /* Subtle, soft border for dark interfaces */
        --header-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); /* Stronger shadow to stand out against dark backgrounds */
        --header-top: 40px;
        --header-clamp: clamp(0.5px, 0.225vw, 1px);
        --accent: #f9d8f7; /* Brightened, vibrant purple/pink accent to pop on dark backgrounds */
        --menu-box-shadows: rgba(0, 0, 0, 0.5); /* Deeper shadow for menu items */
        --menu-dropdown-bg: #1a1a1a; /* Dark solid background for dropdowns */
        --dropdown-el-hover: #2a2a2a; /* Slightly lighter dark tone for hover states */
        --sidebar-dropdown: rgba(30, 30, 30, 0.6); /* Semi-transparent dark background for sidebar dropdowns */
        --sidebar-dropdown-shadow: rgba(0, 0, 0, 0.2);
        --sidebar-dropdown-el-hover: rgba(255, 255, 255, 0.08); /* Soft white highlight on hover */
    }
}

header {
    position: fixed;
    top: calc(var(--header-clamp) * 40);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2 * var(--header-clamp) * 40);
    max-width: var(--max-width-content);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: calc(var(--header-clamp) * 24);
    padding: calc(var(--header-clamp) * 16) calc(var(--header-clamp) * 40);
    background-color: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--heder-border);
    box-shadow: var(--header-shadow);
    z-index: 100;
    transition: all 0.3s ease;
}

.rankLiveHeaderTitle {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--accent);
    font-size: 24px;
    letter-spacing: 1.5px;
}


.menuLinksDiv {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

.menuLinksDiv>a,
.menuLinksDiv>div>span {
    padding: 8px 16px;
    color: var(--accent);
    text-decoration: none;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.25;
    position: relative;
    cursor: pointer;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.menuLinksDiv .menu-icon {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    opacity: 0.85;
}

.menuLinksDiv>div {
    position: relative;
}

.menuLinksDiv>a::after,
.menuLinksDiv>div>span::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 2px;
    height: 2px;
    background-color: var(--accent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.menuLinksDiv>div>span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.menuLinksDiv>div>span>svg.menu-chevron {
    transition: transform 0.3s ease;
}

.menuLinksDiv>div>span:hover>svg.menu-chevron,
.menuLinksDiv>div.open>span>svg.menu-chevron {
    transform: rotate(180deg);
}

.menuLinksDiv>a:hover::after,
.menuLinksDiv>div>span:hover::after,
.menuLinksDiv>div.open>span::after {
    transform: scaleX(1);
}

.menuLinksDiv .dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--menu-dropdown-bg);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--menu-box-shadows);
    padding: 8px 0;
    display: none;
    min-width: 160px;
    z-index: 101;
}

.menuLinksDiv .dropdown::before {
    content: "";
    position: absolute;
    top: -15px;
    left: 0;
    right: 0;
    height: 15px;
    background: transparent;
}

.menuLinksDiv .dropdown a {
    display: block;
    padding: 8px 16px;
    color: var(--accent);
    text-decoration: none;
    font-size: 16px;
    transition: background-color 0.2s ease;
}

.dropdown a:hover, .dropdown form:hover  {
    background-color: var(--dropdown-el-hover);
}

.sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: var(--header-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.06);
    padding: calc(var(--header-clamp) * 60) 24px 32px 24px;
    gap: 8px;
    width: 288px;
}

.sidebar>a,
.sidebar>div>.menu-item {
    color: var(--accent);
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
    padding: 14px 16px;
    border-radius: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.sidebar>a:hover,
.sidebar>a:active,
.sidebar>div>.menu-item:hover,
.sidebar>div.open>.menu-item {
    background-color: rgba(0, 0, 0, 0.014);
    transform: translateX(4px);
}

.sidebar .menu-icon {
    margin-right: 14px;
    opacity: 0.85;
    flex-shrink: 0;
}

.sidebar>div>.menu-item>.menu-chevron {
    height: 16px;
    width: 16px;
    transition: transform 0.3s ease;
}

.sidebar>div.open>.menu-item>.menu-chevron {
    transform: rotate(180deg);
}

.sidebar .dropdown {
    background-color: var(--sidebar-dropdown);
    border-radius: 12px;
    box-shadow: inset 0 2px 8px var(--sidebar-dropdown-shadow);
    padding: 8px;
    margin: 4px 16px 8px 16px;
    display: none;
    min-width: 160px;
}

.sidebar .dropdown a, .sidebar button {
    display: block;
    padding: 10px 16px;
    color: var(--accent);
    text-decoration: none;
    font-size: 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar .dropdown a:hover {
    background-color: var(--sidebar-dropdown-el-hover);
    transform: translateX(2px);
}

.sidebar a,
.sidebar>div {
    -webkit-tap-highlight-color: transparent !important;
    outline: none;
}

@media (max-width: 920px) {

    .burgerMenuDiv {
        display: flex !important;
        flex-direction: column;
        justify-content: space-between;
        width: calc(var(--header-clamp) * 30);
        height: calc(var(--header-clamp) * 21);
        cursor: pointer;
        z-index: 99;
        -webkit-tap-highlight-color: transparent;
        position: relative;
    }

    .burgerMenuLine {
        height: calc(var(--header-clamp) * 3);
        width: 100%;
        background-color: var(--accent);
        border-radius: calc(var(--header-clamp) * 3);
        transition: all 0.3s ease;
    }

    .burgerMenuDiv.active .burgerMenuLine:nth-child(1) {
        transform: translateY(calc(var(--header-clamp) * 9)) rotate(45deg);
    }

    .burgerMenuDiv.active .burgerMenuLine:nth-child(2) {
        opacity: 0;
    }

    .burgerMenuDiv.active .burgerMenuLine:nth-child(3) {
        transform: translateY(calc(var(--header-clamp) * -9)) rotate(-45deg);
    }

    .sidebar {
        position: fixed;
        left: 0px;
        top: 0px;
        height: 100vh;
        opacity: 0;
        transform: translateX(-100%);
        transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
        z-index: 1000;
    }

    .sidebar.active {
        opacity: 1;
        transform: translateX(0%);
    }

    .menuLinksDiv {
        display: none;
    }
}

@media (min-width: 921px) {
    .burgerMenuDiv {
        display: none;
    }

    .sidebar {
        display: none;
    }
}