/* Language selector (app/site/LanguageMenu.tsx) and script-aware typography, shared by every page. */
.lm { position: relative; display: inline-block; flex: none; margin-left: auto; font: 600 13px/1 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: #e8f1f7; }
.lm > summary { list-style: none; display: flex; align-items: center; gap: 7px; min-width: 44px; min-height: 44px; padding: 0 10px;
  border: 1px solid rgba(214, 178, 96, .55); border-radius: 4px; background: rgba(2, 16, 27, .62); color: #f1c36d; cursor: pointer; user-select: none; }
.lm > summary::-webkit-details-marker { display: none; }
.lm > summary::marker { content: ""; }
.lm > summary:hover { border-color: #f1c36d; }
.lm > summary:focus-visible, .lm-list a:focus-visible { outline: 2px solid #f0d79b; outline-offset: 2px; }
.lm img { width: 20px; height: 15px; flex: none; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .28); }
.lm-caret { font-size: 10px; opacity: .85; transition: transform .15s ease; }
.lm[open] .lm-caret { transform: rotate(180deg); }
.lm-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 80; min-width: 210px; max-width: calc(100vw - 24px); margin: 0; padding: 6px;
  list-style: none; translate: var(--lm-shift, 0px) 0; background: #041828; border: 1px solid rgba(160, 230, 255, .25); border-radius: 6px; box-shadow: 0 14px 34px rgba(0, 0, 0, .5); }
.lm-list li { margin: 0; padding: 0; }
.lm-list a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 4px; color: #e8f1f7 !important;
  font-size: 14px; font-weight: 500; letter-spacing: normal; text-decoration: none; white-space: nowrap; background: none; border: 0; }
.lm-list a:hover { background: rgba(255, 255, 255, .08); }
.lm-list a[aria-current="page"] { background: rgba(214, 178, 96, .16); color: #f1c36d !important; font-weight: 700; }
.lm-list .lm-code { min-width: 2.6em; font-weight: 700; }
.lm-list .lm-name { opacity: .9; }
@media (max-width: 380px) { .lm > summary { padding: 0 8px; gap: 5px; } .lm-caret { display: none; } }
/* 404 page: the menu is the last item of a centred, full-height block, so its list opens centred and upward. */
.not-found-page .lm { margin-left: 0; }
.not-found-page .lm-list { right: auto; left: 50%; top: auto; bottom: calc(100% + 6px); transform: translateX(-50%); }
@media (prefers-reduced-motion: reduce) { .lm-caret { transition: none; } }

/* Scripts: system fonts that carry Simplified Chinese and Devanagari on every major platform (no web-font download). */
html[lang="zh-Hans"] body, html[lang="zh-Hans"] h1, html[lang="zh-Hans"] h2, html[lang="zh-Hans"] h3, html[lang="zh-Hans"] h4 {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", system-ui, sans-serif; }
html[lang="hi"] body, html[lang="hi"] h1, html[lang="hi"] h2, html[lang="hi"] h3, html[lang="hi"] h4 {
  font-family: "Kohinoor Devanagari", "Noto Sans Devanagari", "Nirmala UI", "Mangal", system-ui, sans-serif; }
/* Latin tracking and tight display leading damage CJK and Devanagari (matras sit above the line). */
html[lang="zh-Hans"] *, html[lang="hi"] * { letter-spacing: normal !important; }
html[lang="zh-Hans"] :is(h1, h2, h3, h4) { line-height: 1.3 !important; }
html[lang="hi"] :is(h1, h2, h3, h4) { line-height: 1.4 !important; }
html[lang="hi"] body { line-height: 1.75; }
html[lang="zh-Hans"] { line-break: strict; word-break: normal; }
/* Long Greek / Russian compounds: allow hyphenation instead of overflow. */
html[lang="el"] :is(h1, h2, h3, h4, p, li), html[lang="ru"] :is(h1, h2, h3, h4, p, li) { hyphens: auto; overflow-wrap: break-word; }
/* Han and Devanagari headings break between any characters/aksharas; balance the lines so a heading never ends on a
   one- or two-character orphan such as "下，" (falls back to normal wrapping where text-wrap is unsupported). */
html[lang="zh-Hans"] :is(h1, h2, h3, h1 > span), html[lang="hi"] :is(h1, h2, h3, h1 > span) { text-wrap: balance; }
