.pboot-translate-switcher {
    position: relative;
    display: inline-block;
    margin-left: 16px;
    vertical-align: middle;
    z-index: 20;
}

/* Keep the existing dark locale button stable for every configured label. */
.yy-locale.language-switcher .yy-locale__trigger {
    box-sizing: border-box;
    gap: 4px;
    width: 128px;
    min-width: 128px;
    padding-right: 8px;
    padding-left: 8px;
    font-size: 14px;
    line-height: 1;
}

.yy-locale.language-switcher .yy-locale__trigger .pboot-translate-trigger-text {
    display: block;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: 80px;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pboot-translate-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 5px 10px;
    border: 1px solid #dfe4ea;
    border-radius: 4px;
    background: #ffffff;
    color: #39434e;
    font: inherit;
    line-height: 1.25;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.pboot-translate-trigger:hover,
.pboot-translate-trigger:focus-visible {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, .12);
    outline: 0;
}

.pboot-translate-trigger-globe {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.pboot-translate-trigger-arrow {
    width: 7px;
    height: 7px;
    margin-left: 2px;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
}

.pboot-translate-overlay {
    position: fixed;
    z-index: 1050;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 20px 40px;
    background: rgba(17, 24, 39, .48);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, visibility .18s ease;
}

.pboot-translate-overlay[hidden] {
    display: none;
}

.pboot-translate-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.pboot-translate-dialog {
    width: min(560px, 100%);
    max-height: min(560px, 76vh);
    overflow: auto;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 54px rgba(15, 23, 42, .2);
    transform: translateY(-8px);
    transition: transform .18s ease;
}

.pboot-translate-overlay.is-open .pboot-translate-dialog {
    transform: translateY(0);
}

.pboot-translate-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 14px;
    border-bottom: 1px solid #edf0f3;
}

.pboot-translate-dialog-title {
    margin: 0;
    color: #202832;
    font-size: 18px;
    font-weight: 600;
}

.pboot-translate-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.pboot-translate-close:hover,
.pboot-translate-close:focus-visible {
    background: #f1f3f5;
    color: #202832;
    outline: 0;
}

.pboot-translate-language-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(52px, auto);
    gap: 10px;
    padding: 20px 22px 24px;
}

.pboot-translate-language {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 52px;
    padding: 9px 12px;
    border: 1px solid #e3e7eb;
    border-radius: 6px;
    background: #ffffff;
    color: #27313b;
    text-align: left;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, color .18s ease;
}

.pboot-translate-language:hover,
.pboot-translate-language:focus-visible,
.pboot-translate-language.is-current {
    border-color: #0d6efd;
    background: #f4f8ff;
    color: #0b5ed7;
    outline: 0;
}

.pboot-translate-language img {
    flex: 0 0 auto;
    width: 28px;
    height: 20px;
    object-fit: cover;
    border-radius: 2px;
}

.pboot-translate-language-name {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.pboot-translate-open {
    overflow: hidden;
}

@media (max-width: 576px) {
    .yy-locale.language-switcher .yy-locale__trigger {
        width: 112px;
        min-width: 112px;
    }

    .yy-locale.language-switcher .yy-locale__trigger .pboot-translate-trigger-text {
        max-width: 68px;
    }

    .pboot-translate-switcher {
        margin-left: 8px;
    }

    .pboot-translate-trigger {
        padding-right: 8px;
        padding-left: 8px;
    }

    .pboot-translate-trigger-text {
        max-width: 70px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .pboot-translate-overlay {
        align-items: flex-start;
        padding: 72px 10px 20px;
    }

    .pboot-translate-dialog-header {
        padding: 16px 16px 12px;
    }

    .pboot-translate-language-list {
        grid-template-columns: 1fr;
        padding: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pboot-translate-trigger,
    .pboot-translate-overlay,
    .pboot-translate-dialog,
    .pboot-translate-language {
        transition: none;
    }
}
