.posterpal-launcher-avatar {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 1200;
    transform-origin: bottom left;
    display: flex;
    align-items: flex-end;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.posterpal-launcher-avatar:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 4px;
}

.posterpal-launcher-avatar .posterpal-avatar {
    width: 220px;
    height: 260px;
    transform: scale(0.3);
    transform-origin: bottom left;
    pointer-events: none;
}

.posterpal-launcher-avatar .sleep-toggle {
    margin-top: 8px;
}

.posterpal-launcher-avatar:hover .posterpal-avatar {
    transform: scale(0.35);
}

/* PosterPal Widget Container */
#posterpal-widget,
.posterpal-widget {
    position: fixed !important;
    bottom: 20px !important;
    left: 20px !important;
    right: auto !important;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.posterpal-widget.posterpal-open .posterpal-launcher-avatar {
    opacity: 0;
    transform: scale(0.45);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
    pointer-events: none;
}

/* Chat Card Styles */
.posterpal-chat {
    width: 330px;
    max-height: 570px;
    background-color: #ffffff;
    border-radius: 14px;
    box-shadow: 0 7px 21px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.85) translateY(12px);
    transform-origin: bottom left;
    transition: opacity 0.28s ease, visibility 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.posterpal-chat.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}

.posterpal-header {
    padding: 14px 18px;
    background: #0d1428;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.posterpal-header-left {
    display: flex;
    align-items: center;
    gap: 11px;
}

.posterpal-header-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
}

.posterpal-header-gif {
    width: 70px;
    height: auto;
    display: block;
}

.posterpal-header-info {
    display: flex;
    flex-direction: column;
}

.posterpal-header .h2 {
    font-size: 14px;
    color: #ffffff;
    margin: 0;
    font-weight: 600;
}

.posterpal-header-tagline {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.posterpal-status {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 3px 9px;
    border-radius: 11px;
    font-size: 10px;
    font-weight: 500;
}

.posterpal-close,
.posterpal-copy {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 7px;
    margin: 0;
    transition: color 0.2s, opacity 0.2s;
}

.posterpal-close {
    font-size: 16px;
    opacity: 0.9;
}

.posterpal-close:hover {
    opacity: 1;
}

.posterpal-copy:hover {
    color: #ffffff;
}

.posterpal-messages {
    padding: 18px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(570px - 160px);
    min-height: 180px;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
}

.posterpal-messages::-webkit-scrollbar {
    width: 6px;
}

.posterpal-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.posterpal-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.posterpal-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.posterpal-message {
    margin-bottom: 14px;
    padding: 11px 14px;
    border-radius: 16px;
    animation: chatAnimation 0.3s ease-in-out;
    animation-fill-mode: both;
    max-width: 80%;
    word-wrap: break-word;
    position: relative;
}

.posterpal-message.incoming {
    background-color: #f1f5f9;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

.posterpal-message.outgoing {
    background-color: #3b82f6;
    color: #ffffff;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 3px;
}

.posterpal-message p {
    font-size: 14px;
    margin: 0;
    line-height: 1.55;
}

.posterpal-quick-replies {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 7px;
    margin-bottom: 0;
    width: 100%;
    justify-content: flex-start;
}

.posterpal-quick-reply {
    padding: 7px 14px;
    background-color: transparent;
    border: 1.5px solid #3b82f6;
    border-radius: 18px;
    cursor: pointer;
    font-size: 11px;
    color: #3b82f6;
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.posterpal-quick-reply:hover {
    background-color: #eff6ff;
    border-color: #2563eb;
    color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.posterpal-quick-reply:active {
    transform: translateY(0);
    background-color: #dbeafe;
}

.posterpal-rating {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 7px;
    font-size: 11px;
    color: #64748b;
}

.posterpal-rating-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 7px;
    border-radius: 5px;
    transition: background-color 0.2s;
    color: #64748b;
    font-size: 14px;
}

.posterpal-rating-button:hover {
    background-color: #f1f5f9;
}

.posterpal-rating-button.active {
    color: #3b82f6;
    background-color: #eff6ff;
}

.posterpal-footer {
    padding: 14px 18px;
    border-top: 1px solid #e2e8f0;
    background-color: #f8fafc;
}

.posterpal-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.posterpal-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 18px;
    padding: 8px 14px;
    font-size: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.posterpal-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.posterpal-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background-color: #3b82f6;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.posterpal-send:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
}

.posterpal-send:active {
    transform: translateY(0);
}

.posterpal-typing {
    display: none;
    margin-bottom: 10px;
}

.posterpal-typing.show {
    display: block;
}

.posterpal-typing-bubble {
    background-color: #f1f5f9;
    border-radius: 20px;
    padding: 8px 12px;
    display: inline-flex;
}

.posterpal-typing-dots {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 28px;
}

.posterpal-typing-dot {
    width: 6px;
    height: 6px;
    background-color: #94a3b8;
    border-radius: 50%;
    animation: typingDot 1.2s infinite ease-in-out both;
}

.posterpal-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.posterpal-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

@keyframes chatAnimation {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 640px) {
    #posterpal-widget,
    .posterpal-widget {
        left: 16px !important;
        bottom: 16px !important;
        right: auto !important;
    }

    .posterpal-chat {
        width: calc(100vw - 32px);
        max-height: calc(100vh - 100px);
    }

    .posterpal-icon {
        position: fixed !important;
        bottom: 16px !important;
        left: 16px !important;
        width: 52px;
        height: 52px;
        font-size: 22px;
        box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
        z-index: 1100 !important;
    }
}

