.mwx-language-switch {
    --language-touch-target: 0px;
    --language-target-width: max(34px, var(--language-touch-target));
    --language-target-height: max(28px, var(--language-touch-target));
    /* Keep the visible control at 72 × 28px when touch targets grow. */
    --language-extra-inline: calc((var(--language-target-width) - 34px) / 2);
    --language-extra-block: calc((var(--language-target-height) - 28px) / 2);
    position: relative;
    display: inline-flex;
    flex: none;
    align-items: center;
    padding-inline: 2px;
    vertical-align: middle;
}

.mwx-language-switch::before {
    position: absolute;
    inset: var(--language-extra-block) calc(2 * var(--language-extra-inline));
    border: 1px solid #504846;
    border-radius: 5px;
    background: #181513;
    content: "";
    pointer-events: none;
}

.mwx-language-switch .mwx-language-option {
    --language-label-offset: var(--language-extra-inline);
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: var(--language-target-width);
    min-height: var(--language-target-height);
    border-radius: 4px;
    color: #c7c1be;
    font: 12px/1.25 system-ui, "Microsoft YaHei", sans-serif;
    text-decoration: none;
    white-space: nowrap;
}

.mwx-language-switch .mwx-language-option:last-child {
    --language-label-offset: calc(-1 * var(--language-extra-inline));
}

.mwx-language-switch .mwx-language-option > span,
.mwx-language-switch .mwx-language-option::before {
    transform: translateX(var(--language-label-offset));
}

.mwx-language-switch .mwx-language-option::before {
    position: absolute;
    z-index: -1;
    inset: calc(3px + var(--language-extra-block)) calc(1px + var(--language-extra-inline));
    border-radius: 3px;
    content: "";
    pointer-events: none;
}

.mwx-language-switch .mwx-language-option[aria-current] {
    color: #211b19;
    font-weight: 650;
}

.mwx-language-switch .mwx-language-option[aria-current]::before {
    background: #eee9e5;
}

.mwx-language-switch a.mwx-language-option:hover,
.mwx-language-switch a.mwx-language-option:focus-visible {
    color: #f7f5f4;
    text-decoration: none;
}

.mwx-language-switch a.mwx-language-option:hover::before {
    background: #2f2825;
}

.mwx-language-switch a.mwx-language-option:focus-visible {
    outline: 2px solid #f0a2b0;
    outline-offset: 2px;
}

#mwx-primary-nav .mwx-language-mobile {
    display: none;
}

#mwx-primary-nav .navbar-nav > .mwx-language-desktop {
    display: flex;
    align-items: center;
    min-height: 50px;
    margin-left: 8px;
}

.hui-header .mwx-language-switch {
    --language-touch-target: 44px;
    align-self: center;
}

.hui-header .mwx-language-switch + #hui-search {
    flex: none;
}

@media (max-width: 991px), (pointer: coarse) {
    .mwx-language-switch {
        --language-touch-target: 44px;
    }
}

@media (max-width: 991px) {
    #mwx-primary-nav .navbar-header {
        display: flex;
        align-items: center;
        gap: 4px;
        padding-inline: 15px;
    }

    #mwx-primary-nav .navbar-header::before,
    #mwx-primary-nav .navbar-header::after {
        content: none;
    }

    #mwx-primary-nav .navbar-header .site-brand {
        flex: 0 1 200px;
        min-width: 0;
        height: auto;
        margin: 0 auto 0 0;
        padding: 0;
    }

    #mwx-primary-nav .site-brand img {
        width: 100%;
        height: auto;
        margin-top: 0;
    }

    #mwx-primary-nav .mwx-language-mobile {
        display: flex;
        flex: none;
    }

    #mwx-primary-nav .navbar-header .navbar-toggle {
        flex: none;
        width: 44px;
        min-height: 44px;
        margin: 0;
    }

    #mwx-primary-nav .navbar-nav > .mwx-language-desktop {
        display: none;
    }
}
