/* ===== PurrPixels floating chat ===== */
.purr-chat-window {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: min(440px, calc(100vw - 32px));
    height: 430px;
    display: none;
    flex-direction: column;
    background: rgba(255, 250, 255, 0.98);
    border: 1px solid rgba(212, 183, 233, 0.85);
    border-radius: 22px;
    box-shadow: 0 20px 55px rgba(74, 48, 91, 0.28);
    overflow: hidden;
    z-index: 30000;
    color: #5b4b63;
    backdrop-filter: blur(14px);
}

.purr-chat-window.open {
    display: flex;
}

.purr-chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px 10px;
    border-bottom: 1px solid rgba(216, 190, 232, 0.62);
    background: linear-gradient(135deg, rgba(255,255,255,0.94), rgba(249,238,255,0.96));
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.purr-chat-topbar:active {
    cursor: grabbing;
}

.purr-chat-heading {
    font-size: 15px;
    line-height: 1.2;
    font-weight: 900;
    color: #77476f;
}

.purr-chat-close {
    appearance: none;
    border: 0;
    background: transparent;
    color: #715d76;
    font-size: 21px;
    line-height: 1;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    flex: 0 0 auto;
}

.purr-chat-close:hover {
    background: rgba(128, 89, 145, 0.10);
}

.purr-chat-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 10px;
    min-height: 48px;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 1px solid rgba(216, 190, 232, 0.55);
    background: rgba(255, 250, 255, 0.96);
    scrollbar-width: thin;
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
}

.purr-chat-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: 1px solid rgba(205, 177, 227, 0.78);
    background: rgba(255,255,255,0.76);
    border-radius: 999px;
    padding: 6px 10px;
    min-height: 30px;
    font-size: 12px;
    line-height: 1.15;
    font-weight: 800;
    color: #67566d;
    cursor: pointer;
    white-space: nowrap;
}

.purr-chat-tab.active {
    background: rgba(244, 229, 255, 0.98);
    color: #8a3f70;
    border-color: rgba(183, 133, 211, 0.82);
}

.purr-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 12px 8px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.purr-chat-line {
    position: relative;
    font-size: 13px;
    line-height: 1.5;
    padding: 4px 0;
    overflow-wrap: anywhere;
    color: #5d5260;
}

.purr-chat-time {
    color: #96869a;
    font-variant-numeric: tabular-nums;
}

.purr-chat-user {
    border: 0;
    background: none;
    padding: 0;
    margin: 0;
    font: inherit;
    font-weight: 900;
    color: #87476f;
    cursor: pointer;
}

.purr-chat-user:hover {
    text-decoration: underline;
}

.purr-chat-empty,
.purr-chat-status {
    text-align: center;
    padding: 26px 12px;
    font-size: 13px;
    color: #928493;
}

.purr-chat-composer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid rgba(216, 190, 232, 0.6);
    background: rgba(255,255,255,0.78);
}

.purr-chat-input {
    min-width: 0;
    height: 38px;
    border: 1px solid rgba(205, 177, 227, 0.82);
    border-radius: 12px;
    padding: 0 11px;
    outline: none;
    font: inherit;
    font-size: 13px;
    color: #554a59;
    background: #fff;
}

.purr-chat-input:focus {
    border-color: rgba(168, 111, 197, 0.96);
    box-shadow: 0 0 0 3px rgba(168, 111, 197, 0.10);
}

.purr-chat-send {
    border: 1px solid rgba(185, 140, 211, 0.82);
    border-radius: 12px;
    min-width: 72px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 900;
    color: #71466d;
    background: linear-gradient(135deg, rgba(252,241,255,1), rgba(238,247,255,1));
    cursor: pointer;
}

.purr-chat-send:disabled {
    opacity: 0.55;
    cursor: default;
}

.purr-chat-user-menu {
    position: fixed;
    min-width: 180px;
    padding: 6px;
    border: 1px solid rgba(205, 177, 227, 0.86);
    border-radius: 14px;
    background: rgba(255,255,255,0.99);
    box-shadow: 0 12px 34px rgba(67, 45, 79, 0.22);
    z-index: 30050;
}

.purr-chat-user-menu button {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 9px;
    padding: 8px 10px;
    text-align: left;
    font-size: 12px;
    font-weight: 800;
    color: #625367;
    cursor: pointer;
}

.purr-chat-user-menu button:hover {
    background: rgba(244, 232, 252, 0.9);
}

.purr-chat-user-menu button.danger {
    color: #a34855;
}

.purr-chat-toast {
    position: absolute;
    left: 50%;
    bottom: 60px;
    transform: translateX(-50%);
    max-width: calc(100% - 28px);
    border-radius: 999px;
    padding: 7px 11px;
    background: rgba(80, 61, 88, 0.92);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    pointer-events: none;
    z-index: 4;
}

@media (max-width: 700px) {
    .purr-chat-window {
        width: calc(100vw - 20px);
        height: min(430px, calc(100vh - 130px));
        right: 10px;
        bottom: 76px;
        border-radius: 20px;
    }

    .purr-chat-topbar {
        padding: 11px 12px 9px;
    }

    .purr-chat-heading {
        font-size: 14px;
    }

    .purr-chat-tab {
        font-size: 11px;
        padding: 6px 9px;
    }

    .purr-chat-line {
        font-size: 12px;
    }

    .purr-chat-composer {
        grid-template-columns: minmax(0, 1fr) auto;
        padding: 9px;
    }

    .purr-chat-input {
        font-size: 16px; /* prevents iOS zoom */
    }
}

.purr-chat-clear-global { margin-left: auto; flex: 0 0 auto; white-space: nowrap; border: 1px solid #eac6cf; background: #fff4f6; color: #a64261; padding: 6px 8px; font-size: 11px; font-weight: 800; border-radius: 9px; cursor: pointer; }
.purr-chat-clear-global:hover {background:#ffe6ec;}

/* Official global chat messages. Applies to both username and message text. */
.purr-chat-line.purr-chat-role-admin,
.purr-chat-line.purr-chat-role-admin .purr-chat-user,
.purr-chat-line.purr-chat-role-admin .purr-chat-time { color: #bc3544 !important; }
.purr-chat-line.purr-chat-role-moderator,
.purr-chat-line.purr-chat-role-moderator .purr-chat-user,
.purr-chat-line.purr-chat-role-moderator .purr-chat-time { color: #287b47 !important; }
