/* 星汇 — 语言选择器（截图风格） */
.xh-lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--lux-text, #e8eaf0);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.xh-lang-trigger:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: var(--lux-border-accent, rgba(201, 162, 39, 0.45));
}

.xh-lang-trigger-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
    background: #fff;
}

.xh-lang-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.xh-lang-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.xh-lang-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.xh-lang-panel {
    position: relative;
    width: min(720px, 96vw);
    max-height: min(85vh, 720px);
    overflow: auto;
    padding: 24px 22px 28px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.xh-lang-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.xh-lang-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
}

.xh-lang-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: #f1f5f9;
    color: #334155;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.xh-lang-close:hover {
    background: #e2e8f0;
}

.xh-lang-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.xh-lang-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 10px 14px;
    border: 1px solid #e8ecf1;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.xh-lang-item:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
}

.xh-lang-item.is-active {
    border-color: #2563eb;
    background: #f0f7ff;
    box-shadow: 0 0 0 1px #2563eb;
}

.xh-lang-flag {
    position: relative;
    width: 48px;
    height: 48px;
}

.xh-lang-flag img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    background: #fff;
}

.xh-lang-code {
    position: absolute;
    right: -4px;
    bottom: -2px;
    min-width: 22px;
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
    font-size: 9px;
    font-weight: 800;
    color: #475569;
    text-align: center;
    line-height: 1.3;
}

.xh-lang-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
    line-height: 1.35;
}

body.xh-rtl {
    direction: rtl;
}

/* Header 保持 LTR：Logo 在左、语言切换在右，与其他语言一致 */
body.xh-rtl .header-area,
body.xh-rtl .header-area .nav-wrap,
body.xh-rtl .header-area .nav-wrap .purchase-button {
    direction: ltr;
}

body.xh-rtl .xh-lang-trigger {
    margin-left: 12px;
    margin-right: 0;
}

body.xh-rtl .xh-bg-trigger {
    margin-left: 8px;
    margin-right: 0;
}

body.xh-rtl .header-area .nav-wrap .purchase-button .navbar-toggler {
    margin-right: 20px;
    margin-left: 0;
}

@media (max-width: 640px) {
    .xh-lang-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .xh-lang-trigger-label {
        display: none;
    }
}

@media (max-width: 1199px) {
    .purchase-button {
        display: flex;
        align-items: center;
        gap: 6px;
    }
}
