.buddy-assistant {
    --buddy-ai-ink: #161322;
    --buddy-ai-muted: #6d687c;
    --buddy-ai-purple: #7357f6;
    --buddy-ai-purple-dark: #5b3fe4;
    --buddy-ai-lavender: #f0edff;
    --buddy-ai-line: #e8e4f3;
    --buddy-ai-paper: #fbfaff;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 80;
    font-family: Helvetica, Arial, sans-serif;
}

.buddy-assistant *,
.buddy-assistant *::before,
.buddy-assistant *::after {
    box-sizing: border-box;
}

.buddy-assistant [hidden] {
    display: none !important;
}

.buddy-assistant-launcher {
    min-width: 176px;
    min-height: 60px;
    padding: 8px 17px 8px 9px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 18px;
    color: #fff;
    background:
        radial-gradient(circle at 22% 10%, rgba(255, 255, 255, .2), transparent 32%),
        linear-gradient(135deg, #826bff, #6648ed 72%, #5535dc);
    box-shadow:
        0 17px 42px rgba(63, 39, 166, .33),
        inset 0 1px rgba(255, 255, 255, .16);
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: transform .2s ease, box-shadow .2s ease;
}

.buddy-assistant-launcher:hover,
.buddy-assistant-launcher:focus-visible {
    transform: translateY(-2px);
    box-shadow:
        0 21px 50px rgba(63, 39, 166, .4),
        inset 0 1px rgba(255, 255, 255, .18);
}

.buddy-assistant-launcher-icon {
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .23);
    border-radius: 13px;
    background: rgba(255, 255, 255, .14);
}

.buddy-assistant-launcher-icon svg {
    width: 25px;
    height: 25px;
    fill: #fff;
}

.buddy-assistant-launcher-copy {
    display: grid;
    gap: 3px;
}

.buddy-assistant-launcher-copy strong {
    color: #fff;
    font-size: 14px;
    font-weight: 760;
    letter-spacing: -.01em;
}

.buddy-assistant-launcher-copy small,
.buddy-assistant-heading small {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, .71);
    font-size: 10px;
    font-weight: 600;
}

.buddy-assistant-launcher-copy i,
.buddy-assistant-heading i {
    width: 6px;
    height: 6px;
    display: inline-block;
    border-radius: 50%;
    background: #80edb0;
    box-shadow: 0 0 0 3px rgba(128, 237, 176, .13);
}

.buddy-assistant-panel {
    position: absolute;
    right: 0;
    bottom: 74px;
    width: min(390px, calc(100vw - 32px));
    height: min(610px, calc(100vh - 120px));
    min-height: 470px;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
    border: 1px solid rgba(93, 66, 232, .16);
    border-radius: 24px;
    color: var(--buddy-ai-ink);
    background: rgba(251, 250, 255, .98);
    box-shadow:
        0 34px 90px rgba(25, 17, 66, .25),
        0 8px 28px rgba(25, 17, 66, .12);
    transform-origin: right bottom;
    animation: buddy-assistant-enter .2s ease-out both;
    backdrop-filter: blur(16px);
}

.buddy-assistant-header {
    position: relative;
    min-height: 79px;
    padding: 15px 16px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    color: #fff;
    background:
        radial-gradient(circle at 85% -30%, rgba(169, 149, 255, .45), transparent 48%),
        linear-gradient(135deg, #171326, #2a1f55 63%, #3a277d);
}

.buddy-assistant-header::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(169, 149, 255, .55), transparent);
}

.buddy-assistant-avatar {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #8b76ff, #684bec);
    box-shadow: 0 9px 22px rgba(73, 46, 188, .35);
    font-size: 18px;
    font-weight: 800;
}

.buddy-assistant-heading {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.buddy-assistant-heading strong {
    overflow: hidden;
    color: #fff;
    font-size: 14px;
    font-weight: 760;
    letter-spacing: -.015em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.buddy-assistant-close {
    width: 36px;
    height: 36px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 11px;
    color: #fff;
    background: rgba(255, 255, 255, .07);
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.buddy-assistant-close:hover,
.buddy-assistant-close:focus-visible {
    border-color: rgba(255, 255, 255, .3);
    background: rgba(255, 255, 255, .14);
    transform: rotate(2deg);
}

.buddy-assistant-close svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.buddy-assistant-messages {
    overflow-x: hidden;
    overflow-y: auto;
    padding: 20px 16px 11px;
    display: flex;
    flex-direction: column;
    gap: 13px;
    scroll-behavior: smooth;
    scrollbar-color: #cdc5f8 transparent;
    scrollbar-width: thin;
}

.buddy-assistant-messages::-webkit-scrollbar {
    width: 5px;
}

.buddy-assistant-messages::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: #cdc5f8;
}

.buddy-assistant-message {
    max-width: 88%;
    display: grid;
    gap: 6px;
    animation: buddy-message-enter .18s ease-out both;
}

.buddy-assistant-message.is-buddy {
    align-self: flex-start;
}

.buddy-assistant-message.is-user {
    align-self: flex-end;
}

.buddy-assistant-message-label {
    padding: 0 4px;
    color: #898398;
    font-size: 9px;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.buddy-assistant-message.is-user .buddy-assistant-message-label {
    text-align: right;
}

.buddy-assistant-bubble {
    padding: 12px 13px;
    border-radius: 16px 16px 16px 5px;
    border: 1px solid var(--buddy-ai-line);
    color: #373243;
    background: #fff;
    box-shadow: 0 8px 22px rgba(38, 27, 88, .055);
    font-size: 13px;
    line-height: 1.56;
}

.buddy-assistant-message.is-user .buddy-assistant-bubble {
    border-color: transparent;
    border-radius: 16px 16px 5px 16px;
    color: #fff;
    background: linear-gradient(135deg, #8067fa, var(--buddy-ai-purple-dark));
    box-shadow: 0 9px 22px rgba(93, 66, 232, .18);
}

.buddy-assistant-message.is-typing .buddy-assistant-bubble {
    min-height: 43px;
    padding: 11px 14px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--buddy-ai-muted);
    background: linear-gradient(135deg, #fff, #faf8ff);
}

.buddy-assistant-typing-copy {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -.005em;
}

.buddy-assistant-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.buddy-assistant-typing-dots i {
    width: 5px;
    height: 5px;
    display: block;
    border-radius: 50%;
    background: var(--buddy-ai-purple);
    animation: buddy-typing-dot .95s ease-in-out infinite;
}

.buddy-assistant-typing-dots i:nth-child(2) {
    animation-delay: .14s;
}

.buddy-assistant-typing-dots i:nth-child(3) {
    animation-delay: .28s;
}

.buddy-assistant-bubble strong {
    display: block;
    margin-bottom: 4px;
    color: var(--buddy-ai-ink);
    font-size: 13px;
    font-weight: 780;
}

.buddy-assistant-bubble > span {
    white-space: pre-line;
}

.buddy-assistant-message.is-user .buddy-assistant-bubble strong {
    color: #fff;
}

.buddy-assistant-links {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.buddy-assistant-links a {
    min-height: 31px;
    padding: 7px 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #dcd5ff;
    border-radius: 9px;
    color: var(--buddy-ai-purple-dark);
    background: #f8f6ff;
    text-decoration: none;
    font-size: 10px;
    font-weight: 750;
    transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.buddy-assistant-links a:hover,
.buddy-assistant-links a:focus-visible {
    border-color: #ae9dfd;
    background: var(--buddy-ai-lavender);
    transform: translateY(-1px);
}

.buddy-assistant-prompts {
    padding: 8px 15px 10px;
    display: flex;
    gap: 7px;
    overflow-x: auto;
    scrollbar-width: none;
}

.buddy-assistant-prompts::-webkit-scrollbar {
    display: none;
}

.buddy-assistant-prompts button {
    min-height: 32px;
    padding: 7px 11px;
    flex: 0 0 auto;
    border: 1px solid #ded8f8;
    border-radius: 999px;
    color: #554e68;
    background: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.buddy-assistant-prompts button:hover,
.buddy-assistant-prompts button:focus-visible {
    color: var(--buddy-ai-purple-dark);
    border-color: #bcaeff;
    background: var(--buddy-ai-lavender);
}

.buddy-assistant-form {
    margin: 0 14px;
    padding: 5px 5px 5px 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    border: 1px solid #ded9ec;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 8px 26px rgba(35, 24, 80, .06);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.buddy-assistant-form:focus-within {
    border-color: #a694fb;
    box-shadow: 0 0 0 4px rgba(115, 87, 246, .09);
}

.buddy-assistant-form input {
    width: 100%;
    min-width: 0;
    height: 38px;
    padding: 0;
    border: 0;
    outline: 0;
    color: var(--buddy-ai-ink);
    background: transparent;
    font: inherit;
    font-size: 12px;
}

.buddy-assistant-form input::placeholder {
    color: #9b96a7;
}

.buddy-assistant-form button {
    width: 38px;
    height: 38px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(135deg, #836bff, var(--buddy-ai-purple-dark));
    box-shadow: 0 7px 16px rgba(93, 66, 232, .22);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.buddy-assistant-form button:hover,
.buddy-assistant-form button:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 9px 20px rgba(93, 66, 232, .31);
}

.buddy-assistant-form button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.buddy-assistant-privacy {
    min-height: 35px;
    padding: 8px 16px 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #9791a3;
    font-size: 9px;
    font-weight: 600;
}

.buddy-assistant-privacy svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.buddy-assistant-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.buddy-assistant :focus-visible {
    outline: 3px solid rgba(169, 149, 255, .78);
    outline-offset: 2px;
}

@keyframes buddy-assistant-enter {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes buddy-message-enter {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes buddy-typing-dot {
    0%,
    60%,
    100% {
        opacity: .35;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

@media (max-width: 540px) {
    .buddy-assistant {
        right: 14px;
        bottom: 14px;
    }

    .buddy-assistant-launcher {
        min-width: 0;
        min-height: 56px;
        padding: 7px;
        border-radius: 17px;
    }

    .buddy-assistant-launcher-icon {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }

    .buddy-assistant-launcher-copy {
        display: none;
    }

    .buddy-assistant-panel {
        position: fixed;
        right: 10px;
        bottom: 80px;
        left: 10px;
        width: auto;
        height: min(620px, calc(100svh - 94px));
        min-height: 420px;
        border-radius: 21px;
        transform-origin: right bottom;
    }

    .buddy-assistant-message {
        max-width: 92%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .buddy-assistant *,
    .buddy-assistant *::before,
    .buddy-assistant *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
