.avci-chat-root {
    --avci-gold: #d6a63d;
    --avci-gold-soft: #f0c86c;
    --avci-panel: rgba(8, 10, 14, .985);
    --avci-border: rgba(214, 166, 61, .28);
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 1040;
    font-family: 'Outfit', Arial, sans-serif;
    color: #f8fafc;
}

.avci-chat-root *, .avci-chat-root *::before, .avci-chat-root *::after { box-sizing: border-box; }
.avci-chat-root [hidden] { display: none !important; }
.avci-chat-root .sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
body.avci-chat-is-open > .vertical-social-bar { opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; }

.avci-chat-launcher {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 178px;
    min-height: 52px;
    padding: 7px 16px 7px 8px;
    border: 1px solid var(--avci-border);
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(26, 22, 15, .98), rgba(7, 9, 12, .98));
    color: #fff;
    box-shadow: 0 16px 42px rgba(0, 0, 0, .55), 0 0 28px rgba(214, 166, 61, .08);
    cursor: pointer;
    text-align: left;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.avci-chat-launcher:hover {
    transform: translateY(-3px);
    border-color: rgba(240, 200, 108, .65);
    box-shadow: 0 20px 48px rgba(0, 0, 0, .65), 0 0 30px rgba(214, 166, 61, .16);
}

.avci-launcher-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 1px solid rgba(240, 200, 108, .35);
    border-radius: 11px;
    background: linear-gradient(145deg, #d6a63d, #845d15);
    color: #0a0b0e;
    font-size: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 6px 18px rgba(214, 166, 61, .2);
    overflow: hidden;
}

.avci-launcher-icon img {
    display: block;
    max-width: 32px;
    max-height: 32px;
    object-fit: contain;
}

.avci-launcher-copy { display: flex; flex-direction: column; line-height: 1.1; }
.avci-launcher-copy strong { color: #fff4d6; font: 800 13px 'Oxanium', sans-serif; letter-spacing: .2px; }
.avci-launcher-copy small { margin-top: 5px; color: #8e99aa; font-size: 10px; }
.avci-launcher-pulse { position: absolute; right: 9px; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: #3bea78; box-shadow: 0 0 0 4px rgba(59, 234, 120, .1), 0 0 10px rgba(59, 234, 120, .8); }

.avci-chat-panel {
    position: absolute;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    width: 390px;
    height: min(610px, calc(100vh - 36px));
    overflow: hidden;
    border: 1px solid var(--avci-border);
    border-radius: 18px;
    background: var(--avci-panel);
    box-shadow: 0 28px 80px rgba(0, 0, 0, .72), 0 0 45px rgba(214, 166, 61, .08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    animation: avciChatOpen .24s ease-out both;
}

@keyframes avciChatOpen {
    from { opacity: 0; transform: translateY(16px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.avci-chat-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 70px;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, .065);
    background: radial-gradient(circle at 15% 0, rgba(214, 166, 61, .16), transparent 48%), linear-gradient(90deg, rgba(20, 18, 14, .98), rgba(10, 12, 16, .98));
}

.avci-chat-header::after { content: ''; position: absolute; left: 15px; right: 15px; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--avci-gold), transparent); opacity: .55; }
.avci-chat-avatar, .avci-message-avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border: 1px solid rgba(214, 166, 61, .3); background: rgba(214, 166, 61, .11); color: var(--avci-gold-soft); }
.avci-chat-avatar { width: 43px; height: 43px; border-radius: 12px; font-size: 16px; }
.avci-chat-avatar img, .avci-message-avatar img { display: block; max-width: 80%; max-height: 80%; object-fit: contain; }
.avci-chat-heading { min-width: 0; display: flex; flex-direction: column; }
.avci-chat-heading strong { font: 800 15px 'Oxanium', sans-serif; color: #fff4d7; }
.avci-chat-heading span { display: flex; align-items: center; gap: 6px; margin-top: 5px; color: #8995a6; font-size: 10px; }
.avci-chat-heading span i { width: 6px; height: 6px; border-radius: 50%; background: #39dc74; box-shadow: 0 0 8px rgba(57, 220, 116, .75); }
.avci-chat-close { margin-left: auto; width: 34px; height: 34px; border: 1px solid rgba(255, 255, 255, .07); border-radius: 9px; background: rgba(255, 255, 255, .025); color: #8591a2; cursor: pointer; transition: .2s ease; }
.avci-chat-close:hover { border-color: rgba(255, 96, 96, .35); background: rgba(255, 96, 96, .1); color: #ff8181; }

.avci-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 17px 14px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(214, 166, 61, .35) transparent;
    background: radial-gradient(circle at 50% 0, rgba(214, 166, 61, .045), transparent 32%);
}
.avci-chat-messages::-webkit-scrollbar { width: 5px; }
.avci-chat-messages::-webkit-scrollbar-thumb { border-radius: 10px; background: rgba(214, 166, 61, .35); }

.avci-message { display: flex; align-items: flex-end; gap: 8px; margin: 0 0 13px; }
.avci-message-avatar { width: 28px; height: 28px; border-radius: 9px; font-size: 10px; }
.avci-message > div { max-width: calc(100% - 44px); }
.avci-message small { display: block; margin: 0 0 5px 3px; color: #6f7a89; font-size: 9px; }
.avci-message p { margin: 0; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, .065); border-radius: 5px 13px 13px 13px; background: rgba(255, 255, 255, .035); color: #d5dbe4; font-size: 12px; line-height: 1.58; white-space: pre-line; overflow-wrap: anywhere; }
.avci-message p strong { color: #f0c86c; }
.avci-message-user { justify-content: flex-end; }
.avci-message-user > div { display: flex; flex-direction: column; align-items: flex-end; }
.avci-message-user p { border-color: rgba(214, 166, 61, .22); border-radius: 13px 5px 13px 13px; background: linear-gradient(135deg, rgba(150, 102, 21, .34), rgba(72, 53, 20, .35)); color: #fff8e8; }
.avci-message-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.avci-message-actions a, .avci-message-actions button { display: inline-flex; align-items: center; gap: 6px; min-height: 29px; padding: 6px 9px; border: 1px solid rgba(214, 166, 61, .28); border-radius: 8px; background: rgba(214, 166, 61, .08); color: #e9c777; font: 700 9px 'Oxanium', sans-serif; text-decoration: none; cursor: pointer; }
.avci-message-actions a:hover, .avci-message-actions button:hover { background: var(--avci-gold); color: #111; }

.avci-chat-suggestions { display: flex; gap: 6px; padding: 9px 12px; overflow-x: auto; border-top: 1px solid rgba(255, 255, 255, .04); scrollbar-width: none; }
.avci-chat-suggestions::-webkit-scrollbar { display: none; }
.avci-chat-suggestions button { flex: 0 0 auto; min-height: 29px; padding: 6px 9px; border: 1px solid rgba(255, 255, 255, .075); border-radius: 9px; background: rgba(255, 255, 255, .025); color: #9ca7b7; font: 700 9px 'Oxanium', sans-serif; cursor: pointer; transition: .18s ease; }
.avci-chat-suggestions button:hover { border-color: rgba(214, 166, 61, .45); background: rgba(214, 166, 61, .09); color: #f0c86c; }
.avci-chat-suggestions button i { margin-right: 4px; }

.avci-chat-form { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(255, 255, 255, .055); background: rgba(3, 5, 8, .78); }
.avci-chat-form input { width: 100%; height: 42px; min-width: 0; padding: 0 13px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 11px; outline: 0; background: rgba(255, 255, 255, .035); color: #f7f7f7; font-size: 12px; transition: .2s ease; }
.avci-chat-form input::placeholder { color: #667181; }
.avci-chat-form input:focus { border-color: rgba(214, 166, 61, .55); box-shadow: 0 0 0 3px rgba(214, 166, 61, .08); }
.avci-chat-form button { width: 42px; height: 42px; flex: 0 0 42px; border: 0; border-radius: 11px; background: linear-gradient(145deg, #e2b34b, #a67620); color: #0b0d10; cursor: pointer; box-shadow: 0 7px 18px rgba(214, 166, 61, .18); transition: .2s ease; }
.avci-chat-form button:hover { transform: translateY(-1px); filter: brightness(1.1); }
.avci-chat-form button:disabled { cursor: wait; opacity: .55; transform: none; }
.avci-chat-note { padding: 0 12px 9px; background: rgba(3, 5, 8, .78); color: #596473; font-size: 8px; text-align: center; }
.avci-chat-note i { margin-right: 4px; color: #8e722e; }

.avci-typing p { display: flex; gap: 4px; align-items: center; min-height: 36px; }
.avci-typing p i { width: 5px; height: 5px; border-radius: 50%; background: #d6a63d; animation: avciTyping 1s infinite ease-in-out; }
.avci-typing p i:nth-child(2) { animation-delay: .14s; }
.avci-typing p i:nth-child(3) { animation-delay: .28s; }
@keyframes avciTyping { 0%, 70%, 100% { opacity: .3; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

@media (max-width: 520px) {
    .avci-chat-root { left: 10px; bottom: 10px; }
    .avci-chat-panel { position: fixed; left: 10px; right: 10px; bottom: 10px; width: auto; height: min(620px, calc(100dvh - 20px)); }
    .avci-chat-launcher { min-width: 54px; padding-right: 8px; border-radius: 14px; }
    .avci-launcher-copy { display: none; }
    .avci-launcher-pulse { right: 4px; top: 4px; }
}

/* 20260720-2: compact chat on mobile/tablet. */
@media (max-width: 820px) {
    .avci-chat-root {
        left: 12px;
        bottom: 12px;
        z-index: 1060;
    }

    .avci-chat-panel {
        width: min(330px, calc(100vw - 24px));
        height: min(460px, calc(100dvh - 96px));
        border-radius: 15px;
    }

    .avci-chat-header {
        min-height: 58px;
        padding: 10px 12px;
    }

    .avci-chat-avatar {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }

    .avci-chat-heading strong {
        font-size: 13px;
    }

    .avci-chat-heading span {
        margin-top: 3px;
        font-size: 9px;
    }

    .avci-chat-close {
        width: 30px;
        height: 30px;
    }

    .avci-chat-messages {
        padding: 12px 10px 7px;
    }

    .avci-message {
        gap: 7px;
        margin-bottom: 10px;
    }

    .avci-message-avatar {
        width: 24px;
        height: 24px;
        border-radius: 8px;
    }

    .avci-message > div {
        max-width: calc(100% - 34px);
    }

    .avci-message small {
        margin-bottom: 4px;
        font-size: 8px;
    }

    .avci-message p {
        padding: 8px 10px;
        font-size: 11px;
        line-height: 1.45;
    }

    .avci-chat-suggestions {
        padding: 7px 9px;
    }

    .avci-chat-suggestions button {
        min-height: 26px;
        padding: 5px 8px;
        font-size: 8px;
    }

    .avci-chat-form {
        gap: 7px;
        padding: 8px 9px;
    }

    .avci-chat-form input {
        height: 38px;
        padding: 0 11px;
        font-size: 11px;
    }

    .avci-chat-form button {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
        border-radius: 10px;
    }

    .avci-chat-note {
        padding-bottom: 7px;
        font-size: 7.5px;
    }
}

@media (max-width: 520px) {
    .avci-chat-panel {
        right: auto;
        width: min(320px, calc(100vw - 20px));
        height: min(430px, calc(100dvh - 82px));
    }
}

@media (max-width: 380px) {
    .avci-chat-panel {
        width: calc(100vw - 20px);
        height: min(400px, calc(100dvh - 76px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .avci-chat-panel, .avci-typing p i, .avci-chat-launcher { animation: none; transition: none; }
}
