.legacy-chat-launcher {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.legacy-chat-launcher:hover {
    transform: none;
}

.legacy-chat-launcher svg,
.legacy-chat-header svg,
.legacy-chat-composer svg {
    width: 1.5rem;
    height: 1.5rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.legacy-chat-launcher__count {
    position: absolute;
    top: -.375rem;
    right: -.375rem;
    min-width: 1.375rem;
    height: 1.375rem;
    padding: 0 .3rem;
    border: .125rem solid var(--color6, #071d39);
    border-radius: 999px;
    background: #ff4d5d;
    color: #ffffff;
    font-size: .6875rem;
    font-weight: 800;
    line-height: 1.125rem;
    text-align: center;
}

.legacy-chat-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10040;
    background: rgba(1, 10, 24, .62);
    opacity: 0;
    transition: opacity .22s ease;
}

.legacy-chat-backdrop.is-visible {
    opacity: 1;
}

.legacy-chat-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 10041;
    width: min(27rem, 100vw);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
    transform: translateX(105%);
    background: var(--color6, #071d39);
    background: linear-gradient(180deg, color-mix(in srgb, var(--color6, #071d39) 88%, #ffffff 12%), var(--color6, #071d39));
    border-left: 1px solid color-mix(in srgb, var(--color2, #ffc62e) 24%, transparent);
    color: #f7f9fd;
    box-shadow: -1.5rem 0 4rem rgba(0, 0, 0, .45);
    visibility: hidden;
    transition: transform .24s ease, visibility .24s ease;
}

.legacy-chat-drawer.is-open {
    transform: translateX(0);
    visibility: visible;
}

.legacy-chat-header {
    min-height: 5rem;
    padding: 1rem 1.125rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: linear-gradient(110deg, color-mix(in srgb, var(--color2, #ffc62e) 18%, transparent), transparent 58%);
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.legacy-chat-header__brand,
.legacy-chat-header__actions {
    display: flex;
    align-items: center;
}

.legacy-chat-header__brand {
    min-width: 0;
    gap: .75rem;
}

.legacy-chat-header__brand strong,
.legacy-chat-header__brand small {
    display: block;
}

.legacy-chat-header__brand strong {
    color: #ffffff;
    font-size: 1.0625rem;
    line-height: 1.3;
}

.legacy-chat-header__brand small {
    margin-top: .125rem;
    color: rgba(255, 255, 255, .62);
    font-size: .75rem;
}

.legacy-chat-header__icon {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: .75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color2, #ffc62e);
    color: var(--color6, #071d39);
}

.legacy-chat-header__actions {
    gap: .375rem;
}

.legacy-chat-icon-button {
    width: 2.375rem;
    height: 2.375rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: .75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .06);
    color: #ffffff;
    cursor: pointer;
}

.legacy-chat-icon-button:hover,
.legacy-chat-icon-button[aria-pressed="true"] {
    border-color: color-mix(in srgb, var(--color2, #ffc62e) 55%, transparent);
    background: color-mix(in srgb, var(--color2, #ffc62e) 16%, transparent);
    color: var(--color2, #ffc62e);
}

.legacy-chat-channels {
    padding: .75rem 1rem;
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    scrollbar-width: none;
}

.legacy-chat-channels::-webkit-scrollbar {
    display: none;
}

.legacy-chat-channel {
    flex: 0 0 auto;
    padding: .55rem .85rem;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
    background: rgba(255, 255, 255, .055);
    color: rgba(255, 255, 255, .72);
    font-size: .8125rem;
    font-weight: 700;
    cursor: pointer;
}

.legacy-chat-channel.is-active {
    border-color: var(--color2, #ffc62e);
    background: var(--color2, #ffc62e);
    color: var(--color6, #071d39);
}

.legacy-chat-panel,
.legacy-chat-rules {
    min-height: 0;
    overflow-y: auto;
}

.legacy-chat-panel {
    position: relative;
    padding: 1rem;
}

.legacy-chat-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: rgba(255, 255, 255, .52);
    font-size: .875rem;
    text-align: center;
}

.legacy-chat-state[hidden] {
    display: none;
}

.legacy-chat-messages {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.legacy-chat-message {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: .625rem;
    align-items: end;
}

.legacy-chat-message.is-mine {
    grid-template-columns: minmax(0, 1fr) 2rem;
}

.legacy-chat-message.is-mine .legacy-chat-avatar {
    grid-column: 2;
}

.legacy-chat-message.is-mine .legacy-chat-message__content {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
}

.legacy-chat-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: .625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(255, 255, 255, .1);
    color: var(--color2, #ffc62e);
    font-size: .6875rem;
    font-weight: 800;
}

.legacy-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.legacy-chat-message__content {
    min-width: 0;
    max-width: 85%;
}

.legacy-chat-message__meta {
    margin: 0 .375rem .25rem;
    display: flex;
    gap: .5rem;
    color: rgba(255, 255, 255, .5);
    font-size: .6875rem;
}

.legacy-chat-message.is-mine .legacy-chat-message__meta {
    justify-content: flex-end;
}

.legacy-chat-message__bubble {
    padding: .65rem .8rem;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: .9rem .9rem .9rem .25rem;
    background: var(--color6, #071d39);
    background: color-mix(in srgb, var(--color6, #071d39) 76%, #ffffff 24%);
    color: #f7f9fd;
    font-size: .875rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.legacy-chat-message.is-mine .legacy-chat-message__bubble {
    border-color: color-mix(in srgb, var(--color2, #ffc62e) 45%, transparent);
    border-radius: .9rem .9rem .25rem .9rem;
    background: var(--color6, #071d39);
    background: color-mix(in srgb, var(--color2, #ffc62e) 22%, var(--color6, #071d39));
}

.legacy-chat-rules {
    padding: 1.25rem;
}

.legacy-chat-rules[hidden] {
    display: none;
}

.legacy-chat-rules h3 {
    margin: 0 0 1rem;
    color: #ffffff;
    font-size: 1rem;
}

.legacy-chat-rules p {
    margin: 0 0 .625rem;
    padding: .75rem .875rem;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: .75rem;
    background: rgba(255, 255, 255, .05);
    color: rgba(255, 255, 255, .74);
    font-size: .8125rem;
    line-height: 1.45;
}

.legacy-chat-composer,
.legacy-chat-login {
    padding: .875rem 1rem calc(.875rem + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, .1);
    background: var(--color6, #071d39);
    background: color-mix(in srgb, var(--color6, #071d39) 94%, #000000 6%);
}

.legacy-chat-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2.75rem;
    gap: .625rem;
    align-items: end;
}

.legacy-chat-composer__error {
    grid-column: 1 / -1;
    margin: 0;
    color: #ff9aa5;
    font-size: .75rem;
    font-weight: 700;
    line-height: 1.35;
}

.legacy-chat-composer textarea {
    min-height: 2.75rem;
    max-height: 7rem;
    padding: .7rem .85rem;
    resize: none;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: .8rem;
    outline: none;
    background: rgba(255, 255, 255, .075);
    color: #ffffff;
    font: inherit;
    font-size: .875rem;
    line-height: 1.35;
}

.legacy-chat-composer textarea:focus {
    border-color: var(--color2, #ffc62e);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--color2, #ffc62e) 12%, transparent);
}

.legacy-chat-composer textarea::placeholder {
    color: rgba(255, 255, 255, .42);
}

.legacy-chat-composer button,
.legacy-chat-login button {
    border: 0;
    background: var(--color2, #ffc62e);
    color: var(--color6, #071d39);
    font-weight: 800;
    cursor: pointer;
}

.legacy-chat-composer button {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: .8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.legacy-chat-composer button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.legacy-chat-login {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: rgba(255, 255, 255, .72);
    font-size: .8125rem;
}

.legacy-chat-login button {
    flex: 0 0 auto;
    padding: .7rem 1rem;
    border-radius: .75rem;
}

body.legacy-chat-open {
    overflow: hidden;
}

@media (min-width: 48rem) {
    .legacy-chat-backdrop {
        background: rgba(1, 10, 24, .32);
    }
}

@media (max-width: 35rem) {
    .legacy-chat-drawer {
        width: 100vw;
        border-left: 0;
    }

}
