:root {
    --lily-primary: #c0392b;
    --lily-primary-dark: #a93226;
    --lily-bg: #ffffff;
    --lily-user-bg: #c0392b;
    --lily-user-text: #ffffff;
    --lily-bot-bg: #f1f1f1;
    --lily-bot-text: #333333;
    --lily-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    --lily-radius: 16px;
}
#lily-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--lily-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: var(--lily-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
    padding: 0;
}
#lily-toggle:hover {
    background: var(--lily-primary-dark);
    transform: scale(1.08);
}
#lily-toggle svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}
#lily-toggle .lily-close-icon { display: none; }
#lily-toggle.lily-open .lily-chat-icon { display: none; }
#lily-toggle.lily-open .lily-close-icon { display: block; }
#lily-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: 99998;
    width: 370px;
    max-width: calc(100vw - 32px);
    height: 500px;
    max-height: calc(100vh - 140px);
    background: var(--lily-bg);
    border-radius: var(--lily-radius);
    box-shadow: var(--lily-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#lily-window.lily-visible {
    display: flex;
    animation: lilySlideUp 0.3s ease;
}
@keyframes lilySlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
#lily-header {
    background: var(--lily-primary);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
#lily-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
#lily-header-text h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff !important;
    line-height: 1.2;
}
#lily-header-text p {
    margin: 0;
    font-size: 12px;
    opacity: 0.85;
    color: #fff !important;
    line-height: 1.3;
}
#lily-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.lily-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}
.lily-msg a { color: inherit; text-decoration: underline; }
.lily-msg-bot {
    background: var(--lily-bot-bg);
    color: var(--lily-bot-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.lily-msg-user {
    background: var(--lily-user-bg);
    color: var(--lily-user-text);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.lily-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    align-self: flex-start;
    background: var(--lily-bot-bg);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}
.lily-typing span {
    width: 7px;
    height: 7px;
    background: #999;
    border-radius: 50%;
    animation: lilyBounce 1.4s infinite both;
}
.lily-typing span:nth-child(2) { animation-delay: 0.2s; }
.lily-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes lilyBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}
#lily-input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid #eee;
    gap: 8px;
    flex-shrink: 0;
    background: #fff;
}
#lily-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: none;
    max-height: 80px;
    line-height: 1.4;
}
#lily-input:focus { border-color: var(--lily-primary); }
#lily-input::placeholder { color: #aaa; }
#lily-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--lily-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
    padding: 0;
}
#lily-send:hover { background: var(--lily-primary-dark); }
#lily-send:disabled { opacity: 0.5; cursor: not-allowed; }
#lily-send svg { width: 18px; height: 18px; fill: #fff; }
#lily-powered {
    text-align: center;
    font-size: 10px;
    color: #bbb;
    padding: 4px 0 8px;
    flex-shrink: 0;
}
@media (max-width: 480px) {
    #lily-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 120px);
        right: 8px;
        bottom: 90px;
        border-radius: 12px;
    }
}