:root{
    --wschats-primary:#1E88E5;
    --wschats-bg:#F0F4FA;
    --wschats-text:#333;
    --wschats-light:#fff;
    --wschats-shadow:rgba(0,0,0,0.2);
    --wschats-border:#EAEAEA;
    --wschats-font-xs: clamp(10px, 2vw, 11px);
    --wschats-font-sm: clamp(12px, 2.2vw, 13px);
    --wschats-font-base: clamp(13px, 2.4vw, 14px);
    --wschats-font-md: clamp(14px, 2.6vw, 15px);
    --wschats-font-lg: clamp(15px, 2.8vw, 16px);
}
#wensha-chat-wrapper{
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    position:fixed;
    bottom:20px;
    right:20px;
    z-index:9999;
    transition:all 0.3s;
}
.wschats-chat-toggle{
    width:56px;
    height:56px;
    background:var(--wschats-primary);
    border-radius:50%;
    box-shadow:0 2px 10px var(--wschats-shadow);
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    position:relative;
    color:white;
    font-size:24px;
}
.wschats-chat-badge{
    position:absolute;
    top:-5px;
    right:-5px;
    background:red;
    color:white;
    border-radius:50%;
    min-width:20px;
    height:20px;
    font-size:var(--wschats-font-xs);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:0 4px;
    box-sizing:border-box;
}
.wschats-chat-panel{
    position:absolute;
    bottom:70px;
    right:0;
    width:360px;
    height:500px;
    background:white;
    border-radius:12px;
    box-shadow:0 5px 30px var(--wschats-shadow);
    display:flex;
    flex-direction:column;
    overflow:hidden;
    border:1px solid #ddd;
}
.wschats-chat-header{
    background:var(--wschats-primary);
    color:white;
    padding:10px 14px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    flex-shrink:0;
    font-size:var(--wschats-font-lg);
    font-weight:500;
}
.wschats-chat-header-actions{
    display:flex;
    gap:6px;
}
.wschats-chat-username{
    font-size:var(--wschats-font-sm);
    background:rgba(255,255,255,0.2);
    padding:3px 8px;
    border-radius:16px;
    max-width:90px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.wschats-chat-header button{
    background:transparent;
    border:none;
    color:white;
    cursor:pointer;
    font-size:var(--wschats-font-md);
}
.wschats-chat-announcement{
    background:linear-gradient(135deg,#f8f9fa 0%,#e9ecef 100%);
    color:#2c3e50;
    border-bottom:1px solid #dee2e6;
    font-size:var(--wschats-font-sm);
    font-weight:500;
    padding:0;
    height:34px;
    line-height:34px;
    position:relative;
    overflow:hidden;
    flex-shrink:0;
}
.wschats-announcement-scroll{
    overflow:hidden;
    white-space:nowrap;
    width:100%;
    height:100%;
}
.wschats-announcement-content{
    display:inline-block;
    white-space:nowrap;
    will-change:transform;
    animation:scrollAnnouncement linear infinite;
}
.wschats-announcement-content a{
    color:#0066cc;
    text-decoration:none;
    transition:color 0.2s;
    display:inline-block;
}
.wschats-announcement-content a:hover{
    color:#003366;
    text-decoration:underline;
}
.wschats-announcement-content span{
    display:inline-block;
    padding:0 12px;
}
.wschats-announcement-scroll.wschats-static .wschats-announcement-content{
    display:flex;
    justify-content:center;
    align-items:center;
    width:100%;
    animation:none;
    white-space:normal;
}
.wschats-announcement-scroll.wschats-static .wschats-announcement-content span{
    white-space:normal;
    text-align:center;
}
@keyframes scrollAnnouncement{
    0%{transform:translateX(0);}
    100%{transform:translateX(-50%);}
}
.wschats-chat-main{
    flex:1;
    display:flex;
    overflow:hidden;
    position:relative;
}
.wschats-chat-messages{
    flex:1;
    overflow-y:auto;
    padding:6px;
    background:var(--wschats-bg);
    display:flex;
    flex-direction:column;
    gap:8px;
    transition:all 0.3s ease;
}
.wschats-chat-online-container{
    width:130px;
    background:#FAFAFA;
    border-left:1px solid var(--wschats-border);
    display:flex;
    flex-direction:column;
    transition:all 0.3s ease;
    flex-shrink:0;
    position:relative;
    right:0;
}
.wschats-chat-online-container.wschats-collapsed{
    display:none;
}
.wschats-chat-online-toggle{
    height:32px;
    display:flex;
    align-items:center;
    justify-content:center;
    color:var(--wschats-primary);
    cursor:pointer;
    font-size:var(--wschats-font-sm);
    border-bottom:1px solid var(--wschats-border);
    width:100%;
}
.wschats-chat-online-container.wschats-collapsed .wschats-chat-online-toggle span:nth-child(2){
    display: none;
}
.wschats-chat-online-list{
    flex:1;
    padding:4px;
    overflow-y:auto;
    font-size:var(--wschats-font-sm);
    transition:all 0.3s ease;
}
.wschats-chat-online-container.wschats-collapsed .wschats-chat-online-list{
    display:none;
}
#online-users-list{
    list-style:none;
    padding:0;
    margin:0;
    display:flex;
    flex-direction:column;
    gap:2px;
}
#online-users-list li{
    padding:4px 5px;
    display:flex;
    align-items:center;
    gap:5px;
    cursor:pointer;
    border-radius:6px;
    transition:all 0.2s ease;
}
#online-users-list li:hover{
    background:#E3F2FD;
}
.wschats-online-avatar{
    width:20px;
    height:20px;
    border-radius:50%;
    background:var(--wschats-primary);
    display:inline-flex;
    align-items:center;
    justify-content:center;
    font-weight:600;
    font-size:var(--wschats-font-sm);
    color:white;
    flex-shrink:0;
}
.wschats-online-name{
    flex:1;
    overflow:visible;
    white-space:normal;
    line-height:1.2;
    font-weight:500;
    color:#333;
}
.wschats-message{
    display:flex;
    align-items:flex-start;
    gap:6px;
    max-width:100%;
    animation:msgFadeIn 0.3s ease forwards;
    opacity:0;
    position:relative;
}
.wschats-message.wschats-mine{
    flex-direction:row-reverse;
}
.wschats-message-avatar{
    width:28px;
    height:28px;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:bold;
    font-size:var(--wschats-font-sm);
    flex-shrink:0;
    cursor:default;
    position:relative;
    top:0;
}
.wschats-message-content-wrapper{
    max-width:78%;
    display:flex;
    flex-direction:column;
    gap:1px;
    align-items:flex-start;
    position:relative;
}
.wschats-message.wschats-mine .wschats-message-content-wrapper{
    align-items:flex-end;
}
.wschats-message-username{
    font-size:var(--wschats-font-sm);
    font-weight:600;
    margin:0;
    opacity:0.9;
    line-height:1;
    position:relative;
    top:0;
}
.wschats-vip-badge{
    display:inline-block;
    margin-left:6px;
    font-size:11px;
    background:#ffd700;
    color:#333;
    padding:2px 5px;
    border-radius:10px;
    line-height:1;
    font-weight:500;
}
.wschats-message-bubble{
    padding:7px 10px;
    border-radius:12px;
    box-shadow:0 1px 2px rgba(0,0,0,0.08);
    word-break:break-word;
    background:#ffffff;
    display:inline-block;
    max-width:100%;
    width:fit-content;
    position:relative;
    font-size:var(--wschats-font-base);
    line-height:1.5;
}
.wschats-message.wschats-other .wschats-message-bubble{
    border-top-left-radius:4px;
}
.wschats-message.wschats-other .wschats-message-bubble::before{
    content:'';
    position:absolute;
    top:8px;
    left:-6px;
    width:0;
    height:0;
    border-top:6px solid transparent;
    border-bottom:6px solid transparent;
    border-right:6px solid inherit;
    background:transparent;
}
.wschats-message.wschats-mine .wschats-message-bubble{
    border-top-right-radius:4px;
}
.wschats-message.wschats-mine .wschats-message-bubble::before{
    content:'';
    position:absolute;
    top:8px;
    right:-6px;
    width:0;
    height:0;
    border-top:6px solid transparent;
    border-bottom:6px solid transparent;
    border-left:6px solid inherit;
    background:transparent;
}
.wschats-message-time{
    font-size:var(--wschats-font-xs);
    color:#999;
    margin:2px 0 0;
    line-height:1;
}
.wschats-message-content{
    width:100%;
}
.wschats-chat-image{
    max-width:160px;
    max-height:160px;
    border-radius:8px;
    cursor:pointer;
    display:block;
    margin:0;
}
.wschats-message-bubble.wschats-system-message{
    background:#f0f0f0;
    color:#666;
    font-style:italic;
    font-size: 12px;
}
.wschats-message-bubble.wschats-system-message::before{
    display:none;
}
.wschats-at-highlight{
    background:#ffd700;
    color:#333;
    padding:0 2px;
    border-radius:2px;
    font-weight:500;
    font-size:inherit;
}
.wschats-chat-input-area{
    border-top:1px solid #eee;
    padding:6px;
    background:white;
    position:relative;
    flex-shrink:0;
}
.wschats-chat-input-row{
    display:flex;
    gap:6px;
    align-items:flex-end;
}
#chat-input{
    flex:1;
    border:1px solid #ddd;
    border-radius:16px;
    padding:7px 12px;
    resize:none;
    max-height:80px;
    font-family:inherit;
    font-size:var(--wschats-font-base);
    outline:none;
    transition:border-color 0.2s ease;
    line-height:1.4;
}
#chat-input:focus{
    border-color:var(--wschats-primary);
}
.wschats-chat-buttons{
    display:flex;
    gap:4px;
}
.wschats-chat-buttons button{
    background:var(--wschats-primary);
    border:none;
    color:white;
    width:30px;
    height:30px;
    border-radius:50%;
    cursor:pointer;
    font-size:var(--wschats-font-md);
    display:flex;
    align-items:center;
    justify-content:center;
    transition:background-color 0.2s ease,transform 0.1s ease;
}
.wschats-chat-buttons button:hover{
    background:#1565C0;
}
.wschats-chat-buttons button:active{
    transform:scale(0.95);
}
#chat-send-btn{
    width:auto;
    padding:0 12px;
    border-radius:16px;
    font-size:var(--wschats-font-sm);
}
.wschats-chat-emoji-panel{
    position:absolute;
    bottom:100%;
    left:0;
    background:white;
    border:1px solid #ddd;
    border-radius:10px;
    padding:8px 6px 6px 6px;
    width:240px;
    display:flex;
    flex-wrap:wrap;
    gap:5px;
    margin-bottom:6px;
    box-shadow:0 2px 8px rgba(0,0,0,0.1);
    z-index:100;
}
.wschats-chat-emoji-item{
    font-size:clamp(16px, 3vw, 20px);
    cursor:pointer;
    padding:3px;
    transition:transform 0.1s;
    text-align:center;
    width:28px;
}
.wschats-chat-emoji-item:hover{
    transform:scale(1.2);
}
.wschats-chat-at-panel{
    position:absolute;
    bottom:100%;
    left:0;
    background:white;
    border:1px solid #ddd;
    border-radius:10px;
    padding:6px;
    width:160px;
    max-height:180px;
    overflow-y:auto;
    margin-bottom:6px;
    box-shadow:0 2px 8px rgba(0,0,0,0.1);
    z-index:100;
    font-size:var(--wschats-font-sm);
}
.wschats-at-user-item{
    padding:4px 6px;
    cursor:pointer;
    border-radius:6px;
    display:flex;
    align-items:center;
    gap:6px;
}
.wschats-at-user-item:hover{
    background:#f0f0f0;
}
.wschats-at-user-avatar{
    width:24px;
    height:24px;
    border-radius:50%;
    background:#ccc;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    font-weight:bold;
    font-size:var(--wschats-font-sm);
    color:white;
}
.wschats-at-user-name{
    flex:1;
}
.wschats-chat-color-panel{
    position:absolute;
    bottom:100%;
    right:0;
    background:white;
    border:1px solid #e0e0e0;
    border-radius:14px;
    padding:0;
    width:auto;
    min-width:120px;
    max-width:260px;
    max-height:360px;
    overflow:hidden;
    margin-bottom:6px;
    box-shadow:0 6px 20px rgba(0,0,0,0.12);
    z-index:100;
    backdrop-filter:blur(2px);
    display:flex;
    flex-direction:column;
    gap:0;
    font-size:var(--wschats-font-sm);
}
.wschats-color-panel-title{
    font-weight:600;
    text-align:center;
    margin:0;
    font-size:var(--wschats-font-base);
    background:linear-gradient(135deg,var(--wschats-primary),#1565C0);
    color:white;
    padding:4px 0;
    border-radius:0;
    letter-spacing:0.5px;
    flex-shrink:0;
}
#color-schemes-list{
    display:flex;
    flex-direction:column;
    gap:4px;
    flex:1;
    width:100%;
    padding:6px;
    overflow-y:auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    box-sizing:border-box;
}
#color-schemes-list::-webkit-scrollbar{
    display:none;
}
.wschats-color-scheme-option{
    cursor:pointer;
    padding:4px;
    border-radius:12px;
    transition:all 0.2s ease;
    border:2px solid transparent;
    text-align:center;
    background:#fafafa;
    white-space:nowrap;
    width:100%;
    box-sizing:border-box;
}
.wschats-color-scheme-option:hover{
    background:#f0f0f0;
}
.wschats-color-scheme-option.selected{
    border-color:var(--wschats-primary);
    background:#e3f2fd;
}
.wschats-message-bubble-preview{
    padding:4px 8px;
    border-radius:12px;
    background:#E3F2FD;
    color:#0D47A1;
    font-size:var(--wschats-font-sm);
    display:inline-block;
    max-width:100%;
    width:auto;
    margin:0 auto;
    font-weight:500;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
#chat-img-preview{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:rgba(0,0,0,0.85);
    z-index:999999;
    display:none;
    justify-content:center;
    align-items:center;
    cursor:zoom-out;
}
#chat-img-preview img{
    max-width:90%;
    max-height:90vh;
    object-fit:contain;
    border-radius:8px;
    box-shadow:0 0 20px rgba(0,0,0,0.5);
    animation:imgPreviewIn 0.3s ease forwards;
}
#chat-img-preview div{
    position:absolute;
    top:20px;
    right:20px;
    color:#fff;
    font-size:var(--wschats-font-md);
    background:rgba(0,0,0,0.5);
    padding:6px 12px;
    border-radius:6px;
    cursor:pointer;
}
@keyframes msgFadeIn{
    to{opacity:1;}
}
@keyframes imgPreviewIn{
    from{opacity:0;transform:scale(0.9);}
    to{opacity:1;transform:scale(1);}
}
@media (max-width:480px){
    #wensha-chat-wrapper{
        bottom:10px;
        right:10px;
    }
    .wschats-chat-panel{
        position:fixed;
        top:0;
        left:0;
        width:100%;
        height:100%;
        bottom:auto;
        right:auto;
        border-radius:0;
        border:none;
        box-shadow:none;
    }
    .wschats-chat-header{
        position:sticky;
        top:0;
        z-index:10;
        padding:8px 12px;
        font-size:var(--wschats-font-md);
    }
    .wschats-chat-announcement{
        height:32px;
        line-height:32px;
        font-size:var(--wschats-font-sm);
    }
    .wschats-chat-main{
        flex:1;
        display:flex;
        overflow:hidden;
    }
    .wschats-chat-messages{
        flex:1;
        overflow-y:auto;
        padding:4px;
        gap:6px;
    }
    .wschats-chat-input-area{
        position:sticky;
        bottom:0;
        z-index:10;
        background:#fff;
        padding:5px;
    }
    .wschats-chat-toggle{
        width:46px;
        height:46px;
        font-size:20px;
    }
    .wschats-chat-online-container{
        width:90px;
    }
    .wschats-chat-online-container.wschats-collapsed{
        display:none;
    }
    .wschats-chat-online-list{
        padding:2px;
    }
    #online-users-list li{
        padding:3px 4px;
        gap:4px;
    }
    .wschats-online-avatar{
        width:18px;
        height:18px;
    }
    .wschats-message-content-wrapper{
        max-width:88%;
    }
    .wschats-message-bubble{
        padding:6px 9px !important;
        border-radius:10px !important;
        font-size:var(--wschats-font-base) !important;
    }
    .wschats-message.wschats-other .wschats-message-bubble::before,
    .wschats-message.wschats-mine .wschats-message-bubble::before{
        top:7px;
        border-top-width:5px;
        border-bottom-width:5px;
        border-right-width:5px;
        border-left-width:5px;
    }
    .wschats-message.wschats-other .wschats-message-bubble{
        border-top-left-radius:3px !important;
    }
    .wschats-message.wschats-mine .wschats-message-bubble{
        border-top-right-radius:3px !important;
    }
    .wschats-chat-image{
        max-width:100% !important;
        border-radius:6px;
    }
    #chat-input{
        padding:6px 10px;
        font-size:var(--wschats-font-base);
    }
    .wschats-message-avatar{
        width:24px;
        height:24px;
    }
    .wschats-chat-buttons button{
        width:28px;
        height:28px;
    }
    #chat-send-btn{
        padding:0 8px;
    }
    .wschats-chat-color-panel{
        width:auto;
        min-width:100px;
        max-width:200px;
        max-height:280px;
    }
}
@media (min-width:720px){
    .wschats-chat-panel{
        width:720px;
        height:600px;
    }
    .wschats-chat-online-container{
        width:150px;
    }
    .wschats-chat-online-container.wschats-collapsed{
        display:none;
    }
    .wschats-chat-color-panel{
        width:auto;
        min-width:160px;
        max-width:280px;
    }
    .wschats-message-content-wrapper{
        max-width:68%;
    }
    .wschats-message-bubble{
        padding:8px 12px;
    }
    .wschats-message.wschats-other .wschats-message-bubble::before,
    .wschats-message.wschats-mine .wschats-message-bubble::before{
        top:9px;
        border-top-width:7px;
        border-bottom-width:7px;
        border-right-width:7px;
        border-left-width:7px;
    }
    .wschats-chat-image{
        max-width:200px;
        max-height:200px;
    }
    #color-schemes-list{
        padding:8px;
        gap:6px;
    }
    .wschats-color-scheme-option{
        padding:6px;
    }
}
.wschats-chat-header-actions button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
#online-count-badge {
    background: rgba(255,255,255,0.3);
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 12px;
    margin-left: 2px;
}
.wschats-online-header {
    padding: 8px;
    font-weight: bold;
    border-bottom: 1px solid var(--wschats-border);
    background: #f5f5f5;
}