html:lang(en) body,
html:lang(es) body,
html:lang(fr) body,
html:lang(de) body,
html:lang(ru) body,
html:lang(pt) body,
html:lang(vi) body,
html:lang(id) body,
html:lang(it) body,
html:lang(tr) body,
html:lang(pl) body,
html:lang(nl) body,
html:lang(uk) body {
    font-family: "Noto Sans", Arial, sans-serif;
}

html:lang(ja) body {
    font-family: "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
}

html:lang(ko) body {
    font-family: "Noto Sans KR", "Malgun Gothic", sans-serif;
}

html:lang(zh-CN) body {
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans", sans-serif;
}

html:lang(zh-TW) body {
    font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans", sans-serif;
}

html:lang(th) body {
    font-family: "Noto Sans Thai", Tahoma, sans-serif;
}

html:lang(hi) body {
    font-family: "Noto Sans Devanagari", "Nirmala UI", sans-serif;
}

html:lang(ar) body {
    font-family: "Noto Sans Arabic", Tahoma, Arial, sans-serif;
}

.language-switcher {
    position: relative;
    display: flex;
    justify-content: flex-end;
    margin: 0 0 12px;
    z-index: 30;
}

.language-switcher details {
    position: relative;
}

.language-switcher summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary, #f5f5f7);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.language-switcher summary::-webkit-details-marker {
    display: none;
}

.language-switcher summary::after {
    content: "▾";
    color: var(--text-secondary, #a6a6ad);
    font-size: 11px;
}

.language-switcher details[open] summary::after {
    transform: rotate(180deg);
}

.language-switcher-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 4px;
    width: min(360px, calc(100vw - 32px));
    max-height: min(480px, 70vh);
    padding: 10px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    background: rgba(18, 18, 22, 0.98);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(18px);
}

.language-switcher-menu a {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 9px;
    color: var(--text-secondary, #c5c5ca);
    font-size: 13px;
    text-decoration: none;
}

.language-switcher-menu a:hover,
.language-switcher-menu a:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #fff);
    outline: none;
}

.language-switcher-menu a[aria-current="true"] {
    background: rgba(97, 119, 255, 0.18);
    color: #fff;
    font-weight: 700;
}

html[dir="rtl"] .language-switcher {
    justify-content: flex-start;
}

html[dir="rtl"] .language-switcher-menu {
    right: auto;
    left: 0;
    text-align: right;
}

@media (max-width: 640px) {
    .language-switcher {
        margin-bottom: 10px;
    }

    .language-switcher-menu {
        grid-template-columns: 1fr;
        width: min(260px, calc(100vw - 28px));
    }
}
