/* Public chat widget – fixed bubble bottom-right */
.chat-minimized {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1040;
    width: 3.5rem;
    height: 3.5rem;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #8b0000, #5c0000);
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-minimized:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 24px rgba(139, 0, 0, 0.5);
}

.chat-container {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1045;
    width: 360px;
    max-width: calc(100vw - 1.5rem);
    height: 480px;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    background-color: #212529;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}

.chat-container.chat-blur .chat-header,
.chat-container.chat-blur .chat-body {
    filter: blur(3px);
    pointer-events: none;
}

.chat-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 2;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.55);
}

.nickname-form-container {
    width: 100%;
    padding: 1.25rem;
    background: #1a1a1a;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nickname-form-container h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #f5f5f5;
}

.chat-rules-consent-content {
    max-height: min(50vh, 320px);
    overflow-y: auto;
    margin-bottom: 1rem;
    padding-right: 0.25rem;
    font-size: 0.85rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.88);
}

.chat-rules-consent-content ul {
    padding-left: 1.15rem;
    margin-bottom: 0.75rem;
}

.chat-rules-consent-content .chat-rules-lead,
.chat-rules-consent-content .chat-rules-note,
.chat-rules-consent-content p {
    margin-bottom: 0.65rem;
}

.chat-rules-consent-content .chat-rules-subheading {
    font-size: 0.9rem;
    margin: 0.85rem 0 0.45rem;
    color: #f5f5f5;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    background: linear-gradient(145deg, #5c0000, #370000);
    color: #fff;
    flex-shrink: 0;
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0.25rem;
    cursor: pointer;
    opacity: 0.85;
}

.chat-close-btn:hover {
    opacity: 1;
}

.chat-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background-color: #1a1a1a;
}

.chat-main-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.chat-footer {
    flex-shrink: 0;
    padding: 0.5rem 0.75rem 0.65rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background-color: #212529;
    text-align: center;
}

.chat-rules-link {
    background: none;
    border: none;
    padding: 0;
    color: rgba(242, 110, 110, 0.95);
    font-size: 0.8rem;
    text-decoration: underline;
    cursor: pointer;
}

.chat-rules-link:hover {
    color: #f26e6e;
}

.chat-rules-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.chat-rules-view[hidden] {
    display: none !important;
}

.chat-rules-toolbar {
    flex-shrink: 0;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background-color: #212529;
}

.chat-rules-back {
    background: none;
    border: none;
    color: rgba(242, 110, 110, 0.95);
    font-size: 0.85rem;
    padding: 0;
    cursor: pointer;
}

.chat-rules-back:hover {
    color: #f26e6e;
}

.chat-rules-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem 0.9rem 1rem;
    font-size: 0.82rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

.chat-rules-content ul {
    padding-left: 1.1rem;
    margin-bottom: 0.75rem;
}

.chat-rules-content li {
    margin-bottom: 0.25rem;
}

.chat-rules-content p {
    margin-bottom: 0.65rem;
}

.chat-rules-heading {
    font-size: 0.95rem;
    color: #f5f5f5;
    margin-bottom: 0.75rem;
}

.chat-rules-subheading {
    font-size: 0.88rem;
    color: rgba(242, 110, 110, 0.95);
    margin-top: 0.85rem;
    margin-bottom: 0.5rem;
}

.chat-rules-lead {
    margin-bottom: 0.35rem;
}

.chat-rules-note {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
}

.chat-rules-content a {
    color: rgba(242, 110, 110, 0.95);
}

.chat-rules-content a:hover {
    color: #f26e6e;
}

.chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-form {
    flex-shrink: 0;
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background-color: #212529;
}

.chat-form .input-group {
    align-items: flex-end;
}

.chat-write,
.chat-write-1 {
    background-color: #2b2f33;
    border-color: rgba(255, 255, 255, 0.15);
    color: #f5f5f5;
    resize: none;
}

.chat-write:focus,
.chat-write-1:focus {
    background-color: #2b2f33;
    border-color: rgba(242, 110, 110, 0.6);
    color: #f5f5f5;
    box-shadow: 0 0 0 0.2rem rgba(242, 110, 110, 0.15);
}

.chat-form .send-button,
.nickname-form-container .send-button {
    background-color: #8b0000;
    border-color: #8b0000;
}

.chat-form .send-button:hover,
.nickname-form-container .send-button:hover {
    background-color: #a00000;
    border-color: #a00000;
}

.message {
    background-color: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.9rem;
    line-height: 1.45;
    word-wrap: break-word;
}

.message strong {
    display: block;
    color: rgba(242, 110, 110, 0.95);
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.message-text {
    display: block;
    color: rgba(255, 255, 255, 0.92);
}

.message-time {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    font-variant-numeric: tabular-nums;
}

.message-admin {
    background: linear-gradient(145deg, rgba(92, 0, 0, 0.85), rgba(55, 0, 0, 0.85));
    border: 1px solid rgba(242, 110, 110, 0.25);
}

.message-admin strong {
    color: #fff;
}

.message-admin .message-time {
    color: rgba(255, 255, 255, 0.65);
}

@media (max-width: 575px) {
    .chat-container {
        right: 0.75rem;
        bottom: 0.75rem;
        width: calc(100vw - 1.5rem);
        height: min(70vh, 520px);
    }

    .chat-minimized {
        right: 1rem;
        bottom: 1rem;
    }
}
