#lsu-library-chat {
    position: fixed;
    left: 22px;
    right: auto;
    bottom: 22px;
    z-index: 10050;
    font-family: "Poppins", "Open Sans", sans-serif;
}

.lsu-chat-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: #fff;
    animation: lsu-float 2.8s ease-in-out infinite;
}

.lsu-chat-orb {
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.55), transparent 42%),
        linear-gradient(160deg, #ff3b4e 0%, #cc0014 48%, #8f000c 100%);
    box-shadow:
        0 10px 28px rgba(204, 0, 20, 0.42),
        0 0 0 6px rgba(255, 204, 0, 0.16),
        inset 0 -8px 14px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    overflow: visible;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.lsu-chat-orb i {
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
    animation: lsu-wiggle 4.5s ease-in-out infinite;
}

.lsu-chat-orb-shine {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.45) 50%, transparent 65%);
    background-size: 220% 100%;
    animation: lsu-shine 3.2s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

.lsu-chat-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(255, 204, 0, 0.7);
    animation: lsu-ping 2.2s ease-out infinite;
    pointer-events: none;
}

.lsu-chat-pulse.is-delayed {
    animation-delay: 1.1s;
    border-color: rgba(204, 0, 20, 0.45);
}

.lsu-chat-hint {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    padding: 10px 16px 10px 18px;
    background: linear-gradient(180deg, #fffdf6 0%, #ffe27a 100%);
    color: #7a0710;
    border-radius: 22px 22px 22px 8px;
    box-shadow:
        0 10px 24px rgba(16, 1, 2, 0.16),
        0 0 0 2px rgba(255, 204, 0, 0.35);
    animation: lsu-hint-pop 5.5s ease-in-out infinite;
    transform-origin: left center;
    white-space: nowrap;
}

.lsu-chat-hint::after {
    content: "";
    position: absolute;
    left: -7px;
    bottom: 14px;
    width: 14px;
    height: 14px;
    background: #ffe27a;
    transform: rotate(45deg);
    border-radius: 3px;
    box-shadow: -1px 1px 0 rgba(255, 204, 0, 0.35);
}

.lsu-chat-hint strong {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1.1;
}

.lsu-chat-hint em {
    font-style: normal;
    font-size: 0.72rem;
    font-weight: 600;
    opacity: 0.8;
}

.lsu-chat-toggle:hover .lsu-chat-orb,
.lsu-chat-toggle:focus-visible .lsu-chat-orb {
    transform: scale(1.08);
    box-shadow:
        0 14px 32px rgba(204, 0, 20, 0.5),
        0 0 0 8px rgba(255, 204, 0, 0.22),
        inset 0 -8px 14px rgba(0, 0, 0, 0.18);
}

.lsu-chat-toggle:hover .lsu-chat-hint,
.lsu-chat-toggle:focus-visible .lsu-chat-hint {
    animation: none;
    opacity: 1;
    transform: translateX(4px) scale(1.04);
}

.lsu-chat-toggle:focus-visible {
    outline: none;
}

.lsu-chat-toggle:focus-visible .lsu-chat-orb {
    outline: 3px solid #ffcc00;
    outline-offset: 4px;
}

#lsu-library-chat.is-open .lsu-chat-toggle {
    animation: none;
}

#lsu-library-chat.is-open .lsu-chat-hint,
#lsu-library-chat.is-open .lsu-chat-pulse {
    display: none;
}

#lsu-library-chat.is-open .lsu-chat-orb i {
    animation: none;
}

.lsu-chat-panel {
    display: none;
    position: absolute;
    left: 0;
    right: auto;
    bottom: 86px;
    width: min(400px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 120px));
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 18px 44px rgba(16, 1, 2, 0.24);
    overflow: hidden;
    flex-direction: column;
    transform-origin: bottom left;
}

#lsu-library-chat.is-open .lsu-chat-panel {
    display: flex;
    animation: lsu-panel-in 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes lsu-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-9px); }
}

@keyframes lsu-ping {
    0% { transform: scale(1); opacity: 0.65; }
    100% { transform: scale(1.9); opacity: 0; }
}

@keyframes lsu-shine {
    0% { background-position: 120% 0; }
    100% { background-position: -40% 0; }
}

@keyframes lsu-wiggle {
    0%, 78%, 100% { transform: rotate(0deg); }
    84% { transform: rotate(-14deg); }
    90% { transform: rotate(12deg); }
    95% { transform: rotate(-7deg); }
}

@keyframes lsu-hint-pop {
    0%, 12% { opacity: 0; transform: translateX(-10px) scale(0.82); }
    18%, 62% { opacity: 1; transform: translateX(0) scale(1); }
    72%, 100% { opacity: 0.15; transform: translateX(8px) scale(0.94); }
}

@keyframes lsu-panel-in {
    from { opacity: 0; transform: translateY(18px) scale(0.94); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .lsu-chat-toggle,
    .lsu-chat-orb i,
    .lsu-chat-orb-shine,
    .lsu-chat-pulse,
    .lsu-chat-hint,
    #lsu-library-chat.is-open .lsu-chat-panel {
        animation: none !important;
    }
}

.lsu-chat-head {
    background: #cc0014;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lsu-chat-head strong {
    display: block;
    font-size: 0.95rem;
}

.lsu-chat-head span {
    display: block;
    font-size: 0.75rem;
    opacity: 0.9;
}

.lsu-chat-head-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.lsu-chat-clear,
.lsu-chat-close {
    background: transparent;
    border: 0;
    color: #fff;
    cursor: pointer;
}

.lsu-chat-clear {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.45);
}

.lsu-chat-close {
    font-size: 1.4rem;
    line-height: 1;
}

.lsu-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f8fafc;
}

.lsu-chat-bubble {
    max-width: 92%;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.45;
    white-space: pre-wrap;
}

.lsu-chat-bubble.bot {
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

.lsu-chat-bubble.user {
    background: #cc0014;
    color: #fff;
    margin-left: auto;
}

.lsu-chat-bubble.is-error {
    border-color: #fca5a5;
    color: #7f1d1d;
}

.lsu-chat-starters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px 10px;
    background: #f8fafc;
}

.lsu-chat-starters button {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #1e293b;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.75rem;
    cursor: pointer;
}

.lsu-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.lsu-chat-form input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
}

.lsu-chat-form button[type="submit"] {
    border: 0;
    background: #cc0014;
    color: #fff;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
}

.lsu-chat-form button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: wait;
}

@media (max-width: 576px) {
    #lsu-library-chat {
        left: 12px;
        right: auto;
        bottom: 12px;
    }

    .lsu-chat-hint {
        padding: 8px 12px;
        border-radius: 18px 18px 18px 8px;
    }

    .lsu-chat-hint em {
        display: none;
    }

    .lsu-chat-orb {
        width: 62px;
        height: 62px;
    }
}
