.public-community-chat {
    --community-bg: #050a08;
    --community-panel: #0b1210;
    --community-panel-soft: #101815;
    --community-line: #27342f;
    --community-text: #f2f7f4;
    --community-muted: #93a29a;
    --community-green: #28e879;
    width: min(1180px, calc(100% - 36px));
    margin: 20px auto 42px;
    color: var(--community-text);
    font-family: Arial, Helvetica, sans-serif;
}

#publicChatHome {
    display: none;
}

[data-public-chat-slot] .public-community-chat {
    width: 100%;
    margin: 0;
}

[data-public-chat-slot] .public-chat-shell {
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.38);
}

[data-public-chat-slot] .public-chat-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
}

[data-public-chat-slot] .public-chat-counts {
    justify-content: flex-start;
}

[data-public-chat-slot] .public-chat-history {
    height: 300px;
}

[data-public-chat-slot] .public-chat-message {
    grid-template-columns: minmax(76px, 112px) minmax(0, 1fr);
    gap: 5px 9px;
}

[data-public-chat-slot] .public-chat-message-time {
    grid-column: 1;
    grid-row: 2;
}

.public-community-chat,
.public-community-chat * {
    box-sizing: border-box;
}

.public-community-chat [hidden] {
    display: none !important;
}

.public-chat-shell {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--community-line);
    border-radius: 8px;
    background: var(--community-bg);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.32);
}

.public-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 76px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--community-line);
    background: #0a110e;
}

.public-chat-kicker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 5px;
    color: var(--community-green);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.public-chat-header h2 {
    margin: 0;
    color: var(--community-text);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0;
}

.public-chat-counts {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.public-chat-header-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.public-chat-collapse {
    display: none;
}

.public-chat-counts span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 6px 9px;
    color: #b8c6be;
    font-size: 11px;
    border: 1px solid #26342e;
    border-radius: 4px;
    background: #0e1713;
}

.public-chat-counts strong {
    color: #ffffff;
}

.public-chat-simulated {
    display: none;
}

html[data-ui-theme="next"] .public-chat-simulated {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 4px 7px;
    color: #9fb0a7;
    font-size: 8px;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
    border: 1px dashed #395047;
    border-radius: 4px;
}

.public-chat-kicker i,
.public-chat-counts i {
    display: inline-block;
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: var(--community-green);
    box-shadow: 0 0 8px rgba(40, 232, 121, 0.65);
    animation: publicChatPulse 2.4s ease-in-out infinite;
}

.public-chat-status-row {
    display: flex;
    align-items: stretch;
    min-height: 30px;
    border-bottom: 1px solid #1d2924;
    background: #080e0b;
}

.public-chat-status {
    flex: 1 1 auto;
    min-height: 30px;
    padding: 8px 18px;
    color: var(--community-muted);
    font-size: 11px;
}

.public-chat-retry {
    flex: 0 0 auto;
    margin: 4px 6px 4px 0;
    padding: 3px 9px;
    color: #071006;
    font: inherit;
    font-size: 10px;
    font-weight: 850;
    border: 0;
    border-radius: 4px;
    background: var(--community-green);
    cursor: pointer;
}

.public-chat-status.is-error {
    color: #ff9e9e;
}

.public-chat-status.is-success {
    color: #81f4ac;
}

.public-chat-history {
    height: 330px;
    overflow-y: auto;
    padding: 8px 18px;
    scrollbar-width: thin;
    scrollbar-color: #395247 #0a110e;
}

.public-chat-message {
    display: grid;
    grid-template-columns: minmax(88px, 142px) minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 11px 0;
    border-bottom: 1px solid #1b2722;
}

html[data-ui-theme="next"] .public-chat-message {
    animation: publicChatEnter 240ms ease-out both;
}

.public-chat-message:last-child {
    border-bottom: 0;
}

.public-chat-message-name {
    min-width: 0;
    color: #64ef9a;
    font-size: 12px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.public-chat-message.is-account .public-chat-message-name {
    color: #8fd9ff;
}

.public-chat-message.is-demo .public-chat-message-name {
    color: #d6ff70;
}

.public-chat-demo-badge {
    display: inline-flex;
    align-items: center;
    min-height: 16px;
    margin-left: 6px;
    padding: 2px 5px;
    color: #071006;
    font-size: 8px;
    font-weight: 900;
    border-radius: 3px;
    background: #b7ff45;
    vertical-align: middle;
}

.public-chat-message-body {
    min-width: 0;
    color: #e9f0ec;
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.public-chat-message-body a {
    color: #81f4ac;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.public-chat-message-time {
    color: #6f8077;
    font-size: 10px;
    white-space: nowrap;
}

.public-chat-empty {
    display: grid;
    min-height: 100%;
    place-items: center;
    color: var(--community-muted);
    font-size: 13px;
    text-align: center;
}

.public-chat-skeleton {
    display: none;
}

html[data-ui-theme="next"] .public-community-chat.is-loading .public-chat-empty {
    display: none;
}

html[data-ui-theme="next"] .public-community-chat.is-loading .public-chat-skeleton {
    display: grid;
    gap: 12px;
    padding: 10px 0;
}

html[data-ui-theme="next"] .public-chat-skeleton span {
    display: block;
    height: 44px;
    border-radius: 5px;
    background: linear-gradient(90deg, #0c1511 0%, #17241e 48%, #0c1511 100%);
    background-size: 220% 100%;
    animation: publicChatSkeleton 1.35s ease-in-out infinite;
}

.public-chat-new {
    display: block;
    min-height: 30px;
    margin: -42px auto 10px;
    padding: 6px 11px;
    color: #06110b;
    font-size: 11px;
    font-weight: 800;
    border: 0;
    border-radius: 4px;
    background: var(--community-green);
    cursor: pointer;
}

.public-chat-compose {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--community-line);
    background: var(--community-panel);
}

.public-chat-compose textarea {
    width: 100%;
    min-height: 48px;
    max-height: 120px;
    resize: vertical;
    padding: 12px 13px;
    color: var(--community-text);
    font: inherit;
    font-size: 13px;
    line-height: 1.4;
    border: 1px solid #33433c;
    border-radius: 5px;
    outline: 0;
    background: var(--community-panel-soft);
}

.public-chat-compose textarea:focus {
    border-color: #2ed879;
    box-shadow: 0 0 0 3px rgba(40, 232, 121, 0.11);
}

.public-chat-compose button {
    min-width: 92px;
    min-height: 48px;
    padding: 10px 17px;
    color: #041009;
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    border: 0;
    border-radius: 5px;
    background: var(--community-green);
    cursor: pointer;
}

.public-chat-compose button:disabled {
    opacity: 0.5;
    cursor: wait;
}

.public-chat-compose-meta {
    grid-column: 1;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--community-muted);
    font-size: 10px;
}

.public-chat-note {
    margin: 0;
    padding: 0 18px 14px;
    color: #718078;
    font-size: 10px;
    line-height: 1.45;
    background: var(--community-panel);
}

.public-community-chat .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes publicChatPulse {
    0%, 100% { opacity: 0.72; }
    50% { opacity: 1; }
}

@keyframes publicChatSkeleton {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

@keyframes publicChatEnter {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .public-chat-kicker i,
    .public-chat-counts i,
    html[data-ui-theme="next"] .public-chat-skeleton span,
    html[data-ui-theme="next"] .public-chat-message { animation: none; }
}

@media (min-width: 641px) and (max-width: 980px) {
    html[data-ui-theme="next"] [data-public-chat-slot] .public-chat-history {
        height: 260px;
    }

    html[data-ui-theme="next"] [data-public-chat-slot] .public-chat-header,
    html[data-ui-theme="next"] [data-public-chat-slot] .public-chat-compose {
        padding-right: 14px;
        padding-left: 14px;
    }
}

@media (max-width: 640px) {
    .public-community-chat {
        width: calc(100% - 20px);
        margin: 12px auto 28px;
    }

    .public-chat-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px;
    }

    html[data-ui-theme="next"] .public-chat-header {
        flex-direction: row;
        align-items: center;
    }

    html[data-ui-theme="next"] .public-chat-header-tools {
        justify-content: flex-end;
    }

    html[data-ui-theme="next"] .public-chat-collapse {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 34px;
        padding: 7px 10px;
        color: #dff9e8;
        font: inherit;
        font-size: 10px;
        font-weight: 850;
        border: 1px solid #355247;
        border-radius: 4px;
        background: #101a16;
        cursor: pointer;
    }

    html[data-ui-theme="next"] .public-community-chat.is-collapsed .public-chat-content {
        display: none;
    }

    html[data-ui-theme="next"] .public-community-chat.is-collapsed .public-chat-header {
        border-bottom: 0;
    }

    .public-chat-counts {
        justify-content: flex-start;
    }

    .public-chat-history {
        height: 310px;
        padding: 7px 14px;
    }

    .public-chat-message {
        grid-template-columns: minmax(76px, 108px) minmax(0, 1fr);
        gap: 5px 9px;
    }

    .public-chat-message-time {
        grid-column: 1;
        grid-row: 2;
    }

    .public-chat-compose {
        grid-template-columns: 1fr;
        padding: 12px 14px;
    }

    .public-chat-compose-meta {
        grid-row: 2;
    }

    .public-chat-compose button {
        width: 100%;
    }

    .public-chat-note {
        padding: 0 14px 13px;
    }
}

@media (max-width: 350px) {
    .public-chat-message {
        grid-template-columns: 1fr;
    }

    .public-chat-message-time {
        grid-column: 1;
        grid-row: auto;
    }
}
