/* Randly language menu (generated by patch_lang_menu.py) */
.lm {
    --lm-bg: #17181b;
    --lm-line: rgba(255, 255, 255, .12);
    --lm-text: #e8e8e8;
    --lm-hover: rgba(255, 255, 255, .06);
    --lm-sel-bg: rgba(18, 184, 134, .14);
    --lm-accent: #12b886;
    display: inline-flex;
    flex-shrink: 0;
}
html[data-theme="light"] .lm,
html[data-theme="light"] .lm-pop {
    --lm-bg: #ffffff;
    --lm-line: #dedee3;
    --lm-text: #111114;
    --lm-hover: #f1f2f4;
    --lm-sel-bg: #e6f8f2;
    --lm-accent: #00805f;
}
.lm-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    margin: 0;
    background: var(--lm-bg);
    border: 1.5px solid var(--lm-accent);
    border-radius: 12px;
    color: var(--lm-accent);
    font: 700 15px/1 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
    letter-spacing: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.lm-btn:focus-visible,
.lm-item:focus-visible {
    outline: 2px solid var(--lm-accent);
    outline-offset: 2px;
}
.lm-btn svg { flex: none; }
.lm-btn .lm-flag { width: 24px; height: 24px; }
.lm-btn .lm-flag svg { width: 24px; height: 24px; }
/* chat home pages: the language control sits in the second header row next to the online badge */
.rl-top-row2 .lm { flex: 1 1 auto; min-width: 0; }
.rl-top-row2 .lm-btn { width: 100%; max-width: 170px; justify-content: flex-start; }
.rl-top-row2 .lm-btn .lm-chev { margin-inline-start: auto; }
.lm-chev { transition: transform .15s ease; }
.lm-btn[aria-expanded="true"] .lm-chev { transform: rotate(180deg); }

.lm-pop {
    --lm-bg: #17181b;
    --lm-line: rgba(255, 255, 255, .12);
    --lm-text: #e8e8e8;
    --lm-hover: rgba(255, 255, 255, .06);
    --lm-sel-bg: rgba(18, 184, 134, .14);
    --lm-accent: #12b886;
    position: fixed;
    z-index: 3000;
    box-sizing: border-box;
    width: 280px;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 6px;
    background: var(--lm-bg);
    border: 1px solid var(--lm-line);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
    direction: ltr;
}
.lm-pop[hidden] { display: none; }
.lm-item {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 46px;
    padding: 0 10px;
    border-radius: 10px;
    color: var(--lm-text);
    text-decoration: none;
    font: 500 16px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
    -webkit-tap-highlight-color: transparent;
}
.lm-item:hover { background: var(--lm-hover); }
.lm-item[aria-current="true"] {
    background: var(--lm-sel-bg);
    color: var(--lm-accent);
    font-weight: 700;
}
.lm-name { flex: 1; min-width: 0; text-align: left; unicode-bidi: isolate; }
.lm-flag {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(128, 128, 128, .35);
}
.lm-flag svg { display: block; }
.lm-check { flex: none; color: var(--lm-accent); }
