.language-switcher {
    position: relative;
    flex-shrink: 0;
    z-index: 1001;
    color: var(--text-dark);
    font-size: 0.85rem;
}

.language-switcher summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0 10px;
    border-radius: 22px;
    cursor: pointer;
    list-style: none;
    font-weight: 500;
}

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

.language-switcher summary:hover,
.language-switcher[open] summary {
    background: var(--background-light);
}

.language-switcher summary:focus-visible,
.language-options a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.language-options {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 196px;
    max-height: min(440px, 70vh);
    overflow-y: auto;
    margin: 0;
    padding: 8px;
    list-style: none;
    border: 1px solid rgba(147, 52, 221, 0.12);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(40, 16, 64, 0.16);
    transform-origin: top right;
    animation: language-menu-in 0.16s ease-out;
}

@keyframes language-menu-in {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.language-options a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
}

.language-check {
    display: flex;
    color: #9334dd;
}

.language-options a:hover {
    background: #f8f2fe;
    color: #7022b5;
}

.language-options a[aria-current] {
    background: #f1e6fd;
    color: #9334dd;
}

.language-options::-webkit-scrollbar {
    width: 8px;
}

.language-options::-webkit-scrollbar-thumb {
    background: rgba(147, 52, 221, 0.28);
    border-radius: 8px;
}

@media (prefers-color-scheme: dark) {
    .language-switcher {
        color-scheme: dark;
        color: #f5f5f5;
    }

    .language-switcher summary:hover,
    .language-switcher[open] summary {
        background: #343434;
    }

    .language-options {
        background: #1f1c24;
        border-color: #454545;
        box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    }

    .language-options a {
        color: #f5f5f5;
    }

    .language-options a:hover {
        background: #343434;
        color: #e2c4ff;
    }

    .language-options a[aria-current] {
        background: #3b294b;
        color: #e2c4ff;
    }

    .language-check {
        color: #e2c4ff;
    }

    .language-switcher summary:focus-visible,
    .language-options a:focus-visible {
        outline-color: #d4b3f3;
    }
}

@media (max-width: 800px) {
    .header .support-btn {
        display: none;
    }

    .header .nav {
        padding-left: 12px;
        padding-right: 12px;
        gap: 8px;
    }

    .header .nav-actions {
        gap: 4px;
    }

    .header .nav-brand .logo {
        max-width: 150px;
        height: auto;
        max-height: 48px;
    }
}

@media (max-width: 480px) {
    .language-options {
        position: fixed;
        right: 12px;
        top: 60px;
        width: min(196px, calc(100vw - 24px));
    }

    .language-switcher summary {
        padding: 0 6px;
        gap: 4px;
        min-width: 44px;
    }

    .language-switcher summary > span,
    .language-chevron {
        display: none;
    }

    .header .nav-brand .logo {
        max-width: 85px;
        height: auto;
        max-height: 42px;
    }

    .header .nav-brand span {
        font-size: 1.5rem;
        margin-left: 4px;
        letter-spacing: 0;
    }

    .header .download-btn {
        width: auto;
        min-width: 120px;
        font-size: 0.75rem;
    }
}

@media (min-width: 360px) and (max-width: 480px) {
    .header .nav-brand .logo {
        max-width: 120px;
    }
}
