:root {
    --yy-ai-primary: #1367e8;
    --yy-ai-primary-2: #6c5ce7;
    --yy-ai-text: #152033;
    --yy-ai-muted: #718096;
    --yy-ai-line: #e7ecf3;
    --yy-ai-bg: #f6f8fc
}

.AI {
    cursor: pointer;
    user-select: none
}

.AI:focus-visible {
    outline: 3px solid rgba(19, 103, 232, .28);
    outline-offset: 3px
}

.yy-ai-lock {
    overflow: hidden
}

.yy-ai-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: transparent;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease, visibility .22s ease;
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif
}

.yy-ai-overlay.open {
    opacity: 1;
    visibility: visible
}

.yy-ai-window {
    position: absolute;
    pointer-events: auto;
    right: 28px;
    bottom: 24px;
    width: min(430px, calc(100vw - 32px));
    height: min(690px, calc(100vh - 48px));
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 15px;
    box-shadow: 0 26px 80px rgba(15, 23, 42, .25), 0 8px 24px rgba(15, 23, 42, .12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(18px) scale(.97);
    opacity: 0;
    transition: transform .24s cubic-bezier(.2, .8, .2, 1), opacity .2s ease
}

.yy-ai-overlay.open .yy-ai-window {
    transform: none;
    opacity: 1
}

.yy-ai-window.dragging {
    transition: none !important;
    user-select: none
}

.yy-ai-header {
    height: 72px;
    padding: 0 16px 0 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    cursor: move;
    touch-action: none;
    user-select: none;
    background: linear-gradient(125deg, #0e66dc, #4753d8 58%, #7654d8);
    position: relative;
    flex: 0 0 auto
}

.yy-ai-header:after {
    content: "";
    position: absolute;
    right: 62px;
    top: -70px;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .09)
}

.yy-ai-avatar {
    width: 43px;
    height: 43px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .55);
    display: grid;
    place-items: center;
    position: relative;
    box-shadow: 0 5px 14px rgba(18, 42, 105, .18);
    padding: 5px;
    overflow: visible
}

.yy-ai-avatar span {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center
}

.yy-ai-avatar span img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain
}

.yy-ai-avatar i {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 10px;
    height: 10px;
    border: 2px solid #315ad8;
    border-radius: 50%;
    background: #35d07f
}

.yy-ai-title {
    min-width: 0;
    flex: 1;
    position: relative;
    z-index: 1
}

.yy-ai-title strong {
    display: block;
    font-size: 16px;
    line-height: 1.4
}

.yy-ai-title small {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    opacity: .88
}

.yy-ai-title small b {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #48e38c;
    box-shadow: 0 0 0 3px rgba(72, 227, 140, .16)
}

.yy-ai-close,
.yy-ai-clear {
    position: relative;
    z-index: 2;
    border: 0;
    background: rgba(255, 255, 255, .09);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
    transition: .16s
}

.yy-ai-clear {
    font-size: 18px;
    margin-right: -6px
}

.yy-ai-close:hover,
.yy-ai-clear:hover {
    background: rgba(255, 255, 255, .2)
}

.yy-ai-notice {
    font-size: 11px;
    color: #7c879b;
    text-align: center;
    padding: 7px 12px;
    background: #f8faff;
    border-bottom: 1px solid #eef1f7;
    flex: 0 0 auto
}

.yy-ai-messages {
    flex: 1;
    overflow: auto;
    padding: 18px 16px 12px;
    background: linear-gradient(180deg, #f8faff 0, #fff 34%);
    scroll-behavior: smooth
}

.yy-ai-messages::-webkit-scrollbar {
    width: 6px
}

.yy-ai-messages::-webkit-scrollbar-thumb {
    background: #d9e0eb;
    border-radius: 20px
}

.yy-ai-msg {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 0 0 17px
}

.yy-ai-msg.enter {
    animation: yyAiEnter .24s ease both
}

.yy-ai-msg.user {
    flex-direction: row-reverse
}

.yy-ai-msg-avatar {
    width: 31px;
    height: 31px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #fff;
    border: 1px solid #e2e8f1;
    box-shadow: 0 4px 12px rgba(40, 91, 210, .10);
    overflow: hidden
}

.yy-ai-msg-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    padding: 3px
}

.yy-ai-msg.user .yy-ai-msg-avatar {
    background: #e9edf4;
    color: #667085;
    border-color: transparent;
    box-shadow: none
}

.yy-ai-msg-body {
    max-width: calc(100% - 45px)
}

.yy-ai-bubble {
    font-size: 14px;
    line-height: 1.72;
    color: var(--yy-ai-text);
    background: #fff;
    border: 1px solid #e8edf5;
    border-radius: 5px 16px 16px 16px;
    padding: 11px 13px;
    box-shadow: 0 4px 15px rgba(30, 55, 90, .055);
    word-break: break-word
}

.yy-ai-msg.user .yy-ai-bubble {
    color: #fff;
    background: linear-gradient(135deg, #2174e7, #5960dc);
    border: 0;
    border-radius: 16px 5px 16px 16px;
    box-shadow: 0 6px 18px rgba(49, 91, 209, .18)
}

.yy-ai-bubble h3,
.yy-ai-bubble h4 {
    margin: 6px 0 2px;
    font-size: 14px
}

.yy-ai-list {
    margin: 2px 0
}

.yy-ai-sources {
    margin-top: 7px;
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap
}

.yy-ai-sources>span {
    font-size: 10px;
    color: #98a2b3
}

.yy-ai-sources button {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid #dce6f7;
    background: #f4f8ff;
    color: #45678f;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 10px;
    cursor: pointer
}

.yy-ai-sources button.expanded {
    max-width: 100%;
    white-space: normal
}

.yy-ai-tools {
    display: flex;
    gap: 5px;
    margin-top: 5px
}

.yy-ai-tools button {
    border: 0;
    background: transparent;
    color: #a0a9b7;
    font-size: 10px;
    padding: 3px 5px;
    cursor: pointer
}

.yy-ai-tools button:hover,
.yy-ai-tools button.active {
    color: #246cdd
}

.yy-ai-human {
    margin-top: 8px;
    border: 1px solid #d3e0f7;
    background: #fff;
    color: #246cdd;
    border-radius: 9px;
    padding: 7px 11px;
    font-size: 12px;
    cursor: pointer
}

.yy-ai-human:hover {
    background: #f2f7ff
}

.yy-ai-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #8b95a6
}

.yy-ai-typing i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #7086a6;
    animation: yyAiDot 1.1s infinite
}

.yy-ai-typing i:nth-child(2) {
    animation-delay: .15s
}

.yy-ai-typing i:nth-child(3) {
    animation-delay: .3s
}

.yy-ai-typing span {
    font-size: 11px;
    margin-left: 5px
}

.yy-ai-quick {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 2px 16px 10px;
    background: #fff;
    flex: 0 0 auto
}

.yy-ai-quick.hidden {
    display: none
}

.yy-ai-quick::-webkit-scrollbar {
    display: none
}

.yy-ai-quick button {
    white-space: nowrap;
    border: 1px solid #dde6f4;
    background: #f8faff;
    color: #56708f;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 11px;
    cursor: pointer
}

.yy-ai-quick button:hover {
    border-color: #9bbdf2;
    color: #1766dc
}

.yy-ai-footer {
    padding: 10px 14px 9px;
    border-top: 1px solid var(--yy-ai-line);
    background: #fff;
    flex: 0 0 auto
}

.yy-ai-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f5f7fb;
    border: 1px solid transparent;
    border-radius: 15px;
    padding: 7px 7px 7px 12px;
    transition: .16s
}

.yy-ai-input-wrap:focus-within {
    background: #fff;
    border-color: #a9c5f5;
    box-shadow: 0 0 0 3px rgba(42, 111, 224, .08)
}

.yy-ai-input-wrap textarea {
    flex: 1;
    resize: none;
    border: 0;
    outline: 0;
    background: transparent;
    min-height: 24px;
    max-height: 108px;
    padding: 3px 0;
    color: #1e293b;
    font: 14px/1.55 "Microsoft YaHei", "PingFang SC", sans-serif
}

.yy-ai-input-wrap textarea::placeholder {
    color: #a0a9b8
}

.yy-ai-send {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(135deg, #176fe9, #6657df);
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(55, 91, 210, .22);
    transition: .16s
}

.yy-ai-send:hover {
    transform: translateY(-1px)
}

.yy-ai-send:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none
}

.yy-ai-send span {
    font-size: 14px;
    transform: rotate(-15deg)
}

.yy-ai-footnote {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 2px 0;
    color: #a2aaba;
    font-size: 9px
}

.yy-ai-human-link {
    border: 0;
    background: transparent;
    color: #657da3;
    font-size: 10px;
    cursor: pointer;
    padding: 2px
}

.yy-ai-human-link:hover {
    color: #1766dc
}

@keyframes yyAiEnter {
    from {
        opacity: 0;
        transform: translateY(7px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

@keyframes yyAiDot {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: .45
    }

    30% {
        transform: translateY(-4px);
        opacity: 1
    }
}

@media(max-width:640px) {
    .yy-ai-overlay {
        background: transparent
    }

    .yy-ai-window {
        inset: 0;
        width: 100%;
        height: 100%;
        max-height: none;
        border: 0;
        border-radius: 0;
        transform: translateY(15px)
    }

    .yy-ai-header {
        height: 68px;
        padding-top: max(0px, env(safe-area-inset-top));
        box-sizing: content-box;
        cursor: default;
        touch-action: auto
    }

    .yy-ai-messages {
        padding-left: 13px;
        padding-right: 13px
    }

    .yy-ai-footer {
        padding-bottom: max(10px, env(safe-area-inset-bottom))
    }

    .yy-ai-notice {
        font-size: 10px
    }
}

@media(prefers-reduced-motion:reduce) {

    .yy-ai-overlay,
    .yy-ai-window,
    .yy-ai-msg.enter,
    .yy-ai-typing i {
        transition: none;
        animation: none
    }
}

.yy-ai-human-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 13px;
    border-bottom: 1px solid #e5eaf1;
    background: #fff8e9;
    color: #8c5d12;
    font-size: 11px;
    line-height: 1.5;
    flex: 0 0 auto
}

.yy-ai-human-status.hidden {
    display: none
}

.yy-ai-human-status.active {
    background: #edf9f3;
    color: #1b754b
}

.yy-ai-human-status.offline {
    background: #f4f6f9;
    color: #657286
}

.yy-ai-human-status.closed {
    background: #f3f5f8;
    color: #667386
}

.yy-ai-human-status button {
    border: 1px solid currentColor;
    background: #fff;
    border-radius: 7px;
    padding: 4px 8px;
    color: inherit;
    font-size: 10px;
    cursor: pointer;
    white-space: nowrap
}

.yy-ai-msg.human .yy-ai-msg-avatar {
    background: #fff;
    color: #fff;
    border-color: #e2e8f1;
    font-size: 11px
}

.yy-ai-msg.human .yy-ai-bubble {
    background: #f4fcf8;
    border-color: #c8ead8
}

.yy-ai-msg.system {
    justify-content: center;
    margin: 6px 0 14px
}

.yy-ai-msg.system .yy-ai-msg-body {
    max-width: 90%
}

.yy-ai-msg.system .yy-ai-bubble {
    padding: 5px 10px;
    border: 0;
    border-radius: 999px;
    background: #e9edf3;
    color: #6d7989;
    font-size: 11px;
    box-shadow: none;
    text-align: center
}

.yy-ai-sender-label {
    margin: 0 0 4px 2px;
    font-size: 10px;
    color: #8b96a5
}

.yy-ai-msg.human .yy-ai-sender-label {
    color: #27805a
}

.yy-ai-human-link:disabled {
    opacity: .55;
    cursor: default
}

.yy-ai-media-tools {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 2px 0
}

.yy-ai-tool-btn {
    border: 1px solid #dde6f4;
    background: #f8faff;
    color: #56708f;
    border-radius: 10px;
    padding: 6px 11px;
    font-size: 11px;
    cursor: pointer
}

.yy-ai-tool-btn:hover:not(:disabled) {
    border-color: #9bbdf2;
    color: #1766dc
}

.yy-ai-tool-btn:disabled {
    opacity: .5;
    cursor: not-allowed
}

.yy-ai-image-input {
    display: none
}

.yy-ai-sticker-panel {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 0 0
}

.yy-ai-sticker-panel.hidden {
    display: none
}

.yy-ai-sticker-item {
    border: 1px solid #e4e9f1;
    background: #fff;
    border-radius: 10px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer
}

.yy-ai-sticker-item:hover {
    border-color: #9bbdf2;
    background: #f8fbff
}

.yy-ai-sticker-item img {
    width: 100%;
    max-width: 62px;
    height: 62px;
    object-fit: contain
}

.yy-ai-sticker-item span {
    font-size: 10px;
    color: #5c6d83
}

.yy-ai-bubble-media {
    padding: 8px 8px 6px
}

.yy-ai-bubble-media.sticker {
    padding: 8px 8px 4px
}

.yy-ai-media-link {
    display: block;
    text-decoration: none
}

.yy-ai-media-image {
    display: block;
    max-width: 220px;
    max-height: 220px;
    width: auto;
    height: auto;
    border-radius: 12px
}

.yy-ai-media-image.sticker {
    max-width: 140px;
    max-height: 140px
}

.yy-ai-media-caption {
    margin-top: 6px;
    font-size: 11px;
    color: #7b8796
}

.yy-ai-msg.user .yy-ai-media-caption {
    color: rgba(255, 255, 255, .88)
}

@media(max-width:640px) {
    .yy-ai-sticker-panel {
        grid-template-columns: repeat(4, minmax(0, 1fr))
    }

    .yy-ai-media-image {
        max-width: 180px;
        max-height: 180px
    }

    .yy-ai-media-image.sticker {
        max-width: 120px;
        max-height: 120px
    }
}

/* v1.3 图片预览、拖拽粘贴与微信式表情面板 */
.yy-ai-window {
    isolation: isolate
}

.yy-ai-media-tools {
    position: relative;
    padding: 7px 2px 0
}

.yy-ai-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 0;
    background: transparent;
    color: #66768b;
    padding: 5px 8px;
    border-radius: 7px;
    font-size: 11px
}

.yy-ai-tool-btn:before {
    font-size: 16px;
    line-height: 1
}

.yy-ai-image-btn:before {
    content: "▧"
}

.yy-ai-sticker-btn:before {
    content: "☺"
}

.yy-ai-tool-btn:hover:not(:disabled) {
    background: #f0f3f7;
    color: #1c67d6;
    border: 0
}

.yy-ai-sticker-panel {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 66px;
    z-index: 12;
    display: flex;
    flex-direction: column;
    max-height: 360px;
    padding: 0;
    background: #fff;
    border: 1px solid #dfe5ed;
    border-radius: 14px;
    box-shadow: 0 16px 46px rgba(22, 37, 61, .2);
    overflow: hidden
}

.yy-ai-sticker-panel.hidden {
    display: none
}

.yy-ai-sticker-head {
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 13px;
    border-bottom: 1px solid #eef1f5
}

.yy-ai-sticker-head strong {
    font-size: 13px;
    color: #313d4f
}

.yy-ai-sticker-close {
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    border-radius: 8px;
    color: #8c98a8;
    font-size: 20px;
    cursor: pointer
}

.yy-ai-sticker-close:hover {
    background: #f1f3f6
}

.yy-ai-sticker-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    padding: 8px;
    overflow: auto;
    background: #fff
}

.yy-ai-sticker-item {
    border: 0;
    background: transparent;
    border-radius: 9px;
    padding: 4px;
    aspect-ratio: 1/1;
    display: grid;
    place-items: center;
    cursor: pointer
}

.yy-ai-sticker-item:hover {
    background: #f3f5f7;
    border: 0
}

.yy-ai-sticker-item img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain
}

.yy-ai-sticker-item span {
    display: none
}

.yy-ai-sticker-foot {
    height: 31px;
    display: flex;
    align-items: center;
    padding: 0 13px;
    border-top: 1px solid #eef1f5;
    background: #fafbfc;
    color: #9aa4b2;
    font-size: 10px
}

.yy-ai-media-link {
    display: block;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: zoom-in
}

.yy-ai-drop-mask {
    position: absolute;
    inset: 72px 0 0;
    z-index: 30;
    display: grid;
    place-items: center;
    background: rgba(245, 249, 255, .92);
    backdrop-filter: blur(4px);
    border: 3px dashed #6c9ee9
}

.yy-ai-drop-mask.hidden {
    display: none
}

.yy-ai-drop-mask>div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #3566a7
}

.yy-ai-drop-mask strong {
    font-size: 20px
}

.yy-ai-drop-mask span {
    font-size: 12px;
    color: #73849a
}

.yy-ai-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 50px;
    background: rgba(8, 12, 20, .88);
    backdrop-filter: blur(6px)
}

.yy-ai-lightbox.hidden {
    display: none
}

.yy-ai-lightbox img {
    max-width: min(92vw, 1100px);
    max-height: 82vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, .5)
}

.yy-ai-lightbox-close {
    position: fixed;
    right: 24px;
    top: 18px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 31px;
    cursor: pointer
}

.yy-ai-lightbox-close:hover {
    background: rgba(255, 255, 255, .24)
}

.yy-ai-lightbox-caption {
    margin-top: 14px;
    color: #fff;
    font-size: 13px;
    opacity: .82
}

.yy-ai-preview-lock {
    overflow: hidden
}

@media(max-width:640px) {
    .yy-ai-sticker-panel {
        left: 8px;
        right: 8px;
        bottom: max(67px, calc(57px + env(safe-area-inset-bottom)));
        max-height: 46vh
    }

    .yy-ai-sticker-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr))
    }

    .yy-ai-drop-mask {
        inset: 68px 0 0
    }

    .yy-ai-lightbox {
        padding: 20px
    }

    .yy-ai-lightbox-close {
        right: 14px;
        top: 12px
    }

    .yy-ai-lightbox img {
        max-width: 96vw;
        max-height: 84vh
    }
}

/* v1.3.1 图片和表情使用纯图片展示，不套用文字气泡 */
.yy-ai-media-message {
    display: inline-block;
    max-width: 100%;
    padding: 0 !important;
    margin: 0;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: inherit !important;
    line-height: 0
}

.yy-ai-msg.user .yy-ai-media-message,
.yy-ai-msg.human .yy-ai-media-message,
.yy-ai-msg.assistant .yy-ai-media-message {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important
}

.yy-ai-media-message .yy-ai-media-link {
    line-height: 0
}

.yy-ai-media-caption {
    display: none !important
}

.yy-ai-lightbox-caption:empty {
    display: none
}

.yy-ai-tools .yy-ai-copy {
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    padding: 3px;
    border-radius: 6px
}

.yy-ai-tools .yy-ai-copy svg {
    width: 15px;
    height: 15px;
    display: block;
    fill: currentColor
}

.yy-ai-tools .yy-ai-copy.copied {
    color: #20a464;
    background: #edf9f3
}