/*全屏自适应玻璃霓虹版*/
*,::before,::after{box-sizing:border-box}
html,body{height:100%;margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif}
body{
    /* 继承主站背景图/渐变，全屏铺满 */
    background: var(--main_bg_color, #121212) no-repeat center/cover fixed;
    color: var(--main_text_color, #e0e0e0);
    position: relative;
}
/* 全局毛玻璃蒙版 */
body::before{
    content:"";
    position: fixed;
    inset: 0;
    z-index: -1;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(0,0,0,.45);
}

/* 顶部玻璃标题 */
.top{
    background: rgba(255,255,255,.08);
    border-bottom: 1px solid rgba(255,255,255,.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    height: 50px;
    line-height: 50px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #00f5d4;
    text-shadow: 0 0 8px #00f5d4;
}

/* 聊天框全屏 */
.mk-chat-box{
    font-family: "Helvetica Neue", Helvetica, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif;
    font-size: 16px;
    width: 100%;
    height: calc(100vh - 130px);
    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    background: transparent;
    border: 1px solid rgba(255,255,255,.15);
    border-bottom: 0;
}

/* 底部输入玻璃 */
.write{
    background: rgba(255,255,255,.08);
    border-top: 1px solid rgba(255,255,255,.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
}
.write input{
    flex: 1;
    height: 38px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 19px;
    background: rgba(255,255,255,.05);
    color: inherit;
    padding: 0 14px;
    font-size: 15px;
    outline: none;
    transition: all .3s;
}
.write input:focus{
    border-color: #00f5d4;
    box-shadow: 0 0 10px #00f5d4;
}

/* 霓虹发送按钮 */
.send{
    position: relative;
    width: 70px;
    height: 38px;
    border: 1px solid #00f5d4;
    border-radius: 19px;
    background: transparent;
    color: #00f5d4;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    cursor: pointer;
    transition: all .3s;
}
.send::before{
    content: "";
    position: absolute;
    left: -100%;
    top: 0;
    width: 100%;
    height: 100%;
    background: #00f5d4;
    transition: left .4s;
    z-index: -1;
}
.send:hover{
    color: #000;
}
.send:hover::before{
    left: 0;
}
.send.disabled{
    pointer-events: none;
    border-color: #666;
    color: #666;
}

/* 消息容器 */
.mk-chat-box .msg{
    margin: 28px 0 20px 0;
    position: relative;
    min-height: 50px;
}

.mk-chat-box .right{
    text-align: right;
}

.mk-chat-box .left{
    text-align: left;
}

/* 大头像 - 40px */
.mk-chat-box img.head{
    width: 40px;
    height: 40px;
    border-radius: 50%;
    position: absolute;
    top: 0;
    border: 1px solid rgba(255,255,255,.2);
    object-fit: cover;
}

.mk-chat-box .right img.head{
    right: 0;
}

.mk-chat-box .left img.head{
    left: 0;
}

/* 昵称显示在消息框上方 */
.mk-chat-box .name{
    position: absolute;
    top: -22px;
    color: rgba(255,255,255,.7);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    word-break: break-all;
    overflow-wrap: anywhere;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 2px 8px;
    background: rgba(0,0,0,.4);
    border-radius: 6px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2;
}

/* 左侧消息昵称在左上角 */
.mk-chat-box .left .name{
    left: 48px; /* 头像宽度40px + 间距8px */
    text-align: left;
}

/* 右侧消息昵称在右上角 */
.mk-chat-box .right .name{
    right: 48px; /* 头像宽度40px + 间距8px */
    text-align: right;
}

/* 消息内容 - 适配大头像 */
.mk-chat-box .content{
    display: inline-block;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    max-width: calc(65% - 50px); /* 减去头像占用的空间 */
    margin-top: 2px;
    position: relative;
    z-index: 1;
}

/* 左侧消息框向右偏移，避开头像 */
.mk-chat-box .left .content{
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.15);
    margin-left: 48px; /* 头像宽度40px + 间距8px */
    text-align: left;
}

/* 右侧消息框向左偏移，避开头像 */
.mk-chat-box .right .content{
    background: rgba(0,245,212,.15);
    border: 1px solid #00f5d4;
    margin-right: 48px; /* 头像宽度40px + 间距8px */
    text-align: left; /* 保持文字左对齐 */
}

/* 系统提示玻璃 */
.mk-chat-box .tips{
    margin: 16px 12px;
    text-align: center;
    font-size: 12px;
}

.mk-chat-box .tips span{
    display: inline-block;
    padding: 6px 12px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.15);
    color: #fff;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* 滚动条美化 */
.mk-chat-box::-webkit-scrollbar{
    width: 6px;
}

.mk-chat-box::-webkit-scrollbar-thumb{
    background: rgba(255,255,255,.25);
    border-radius: 3px;
}

.mk-chat-box::-webkit-scrollbar-track{
    background: rgba(255,255,255,.05);
}

/* Firefox 滚动条 */
.mk-chat-box{
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.25) rgba(255,255,255,.05);
}

/* 手机微调 */
@media(max-width: 768px){
    .top{
        font-size: 16px;
        height: 44px;
        line-height: 44px;
    }
    
    .mk-chat-box{
        height: calc(100vh - 114px);
        padding: 8px;
    }
    
    .write{
        height: 50px;
        padding: 0 10px;
    }
    
    .send{
        width: 60px;
        font-size: 13px;
    }
    
    /* 移动端头像 */
    .mk-chat-box img.head{
        width: 36px;
        height: 36px;
    }
    
    .mk-chat-box .left .name{
        left: 44px; /* 头像宽度36px + 间距8px */
    }
    
    .mk-chat-box .right .name{
        right: 44px; /* 头像宽度36px + 间距8px */
    }
    
    .mk-chat-box .left .content{
        margin-left: 44px;
    }
    
    .mk-chat-box .right .content{
        margin-right: 44px;
    }
    
    .mk-chat-box .name{
        font-size: 10px;
        top: -20px;
        max-width: 120px;
    }
    
    .mk-chat-box .content{
        max-width: calc(70% - 46px);
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* iOS 键盘适配 */
@supports (-webkit-touch-callout: none) {
    .write{
        position: sticky;
        bottom: 0;
        z-index: 100;
    }
}

/* 防止文本选择 */
.send, .write input, .top{
    user-select: none;
    -webkit-user-select: none;
}

/* 加载状态 */
.send.loading{
    pointer-events: none;
    opacity: 0.7;
}

.send.loading::after{
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin{
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}