*{margin:0;padding:0;box-sizing:border-box;}
html,body{height:100%;height:100dvh;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;background:#f5f5f5;color:#333;}

/* ===== 登录 ===== */
#login-screen{display:flex;align-items:center;justify-content:center;height:100vh;height:100dvh;background:#f0f0f0;}
.wx-login-box{background:#fff;border-radius:12px;padding:40px 36px;width:360px;max-width:92vw;box-shadow:0 2px 20px rgba(0,0,0,0.06);text-align:center;}
.wx-login-logo{font-size:48px;margin-bottom:8px;}
.wx-login-title{font-size:20px;font-weight:600;color:#333;margin-bottom:8px;}
.wx-tab-row{display:flex;gap:0;margin-bottom:22px;border-radius:6px;overflow:hidden;border:1px solid #e0e0e0;}
.wx-tab-btn{flex:1;padding:8px 0;background:#fff;border:none;font-size:14px;color:#888;cursor:pointer;transition:0.15s;}
.wx-tab-btn.active{background:#07C160;color:#fff;}
.wx-tab-btn:hover:not(.active){background:#f5f5f5;}
.wx-login-form{display:flex;flex-direction:column;gap:14px;}
.wx-input{width:100%;padding:12px 16px;background:#f5f5f5;border:1px solid transparent;border-radius:8px;font-size:14px;outline:none;transition:0.2s;}
.wx-input:focus{background:#fff;border-color:#07C160;}
.wx-color-row{display:flex;justify-content:center;gap:12px;margin:4px 0;}
.wx-color-dot{width:28px;height:28px;border-radius:50%;cursor:pointer;border:3px solid transparent;transition:0.15s;}
.wx-color-dot:hover{transform:scale(1.15);}
.wx-color-dot.selected{border-color:#07C160;box-shadow:0 0 0 2px rgba(7,193,96,0.2);}
.wx-btn-green{width:100%;padding:12px;background:#07C160;color:#fff;border:none;border-radius:8px;font-size:16px;font-weight:500;cursor:pointer;transition:0.15s;}
.wx-btn-green:hover{background:#06ad56;}
.wx-btn-green:disabled{background:#ccc;cursor:default;}

/* ===== 主布局 ===== */
.wx-app{display:flex;height:100vh;height:100dvh;background:#f5f5f5;}

/* ===== 左侧会话列表 ===== */
.wx-left{width:260px;min-width:260px;background:#e8e8e8;display:flex;flex-direction:column;border-right:1px solid #ddd;}
.wx-left-search{padding:12px;}
.wx-search-input{width:100%;padding:8px 12px;background:#d9d9d9;border:none;border-radius:4px;font-size:13px;outline:none;}
.wx-search-input:focus{background:#fff;}
.wx-conv-list{flex:1;overflow-y:auto;}
.wx-conv-item{display:flex;align-items:center;padding:14px 16px;cursor:pointer;position:relative;transition:0.1s;}
.wx-conv-item:hover{background:#dedede;}
.wx-conv-item.active{background:#cfcfcf;}
.wx-conv-avatar{width:42px;height:42px;border-radius:4px;display:flex;align-items:center;justify-content:center;color:#fff;font-size:15px;font-weight:bold;margin-right:12px;flex-shrink:0;}
.wx-conv-info{flex:1;min-width:0;overflow:hidden;}
.wx-conv-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px;}
.wx-conv-name{font-size:14px;color:#111;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.wx-conv-time{font-size:11px;color:#999;flex-shrink:0;margin-left:8px;}
.wx-conv-bottom{display:flex;align-items:center;}
.wx-conv-last{font-size:12px;color:#888;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:140px;}

/* ===== 中间聊天区 ===== */
.wx-center{flex:1;display:flex;flex-direction:column;background:#f5f5f5;overflow:hidden;min-width:0;}
.wx-chat-header{display:flex;align-items:center;justify-content:space-between;height:56px;padding:0 20px;background:#f0f0f0;border-bottom:1px solid #e0e0e0;}
.wx-chat-title{font-size:17px;font-weight:600;color:#111;}
.wx-header-actions{display:flex;align-items:center;gap:4px;}
.wx-icon-btn{background:none;border:none;font-size:20px;cursor:pointer;padding:6px 10px;border-radius:4px;color:#555;}
.wx-icon-btn:hover{background:#e0e0e0;}
.wx-chat-body{flex:1;overflow-y:auto;padding:16px 20px;}

/* ===== 聊天消息 ===== */
.message{display:flex;margin-bottom:16px;animation:fadeIn 0.2s;}
.message.self{justify-content:flex-end;}
.message.other{justify-content:flex-start;}
.message.system-message{justify-content:center;}
.msg-avatar{width:38px;height:38px;border-radius:4px;display:flex;align-items:center;justify-content:center;color:#fff;font-size:14px;font-weight:bold;flex-shrink:0;}
.message.self .msg-avatar{order:2;margin-left:10px;}
.message.other .msg-avatar{margin-right:10px;}
.msg-body{max-width:60%;display:flex;flex-direction:column;}
.message.self .msg-body{align-items:flex-end;}
.msg-name{font-size:11px;color:#999;margin-bottom:3px;padding:0 4px;}
.msg-bubble{position:relative;padding:10px 14px;border-radius:4px;font-size:14px;line-height:1.5;word-break:break-word;}
.message.self .msg-bubble{background:#95ec69;color:#000;}
.message.other .msg-bubble{background:#fff;color:#333;box-shadow:0 1px 2px rgba(0,0,0,0.05);}
.msg-time{font-size:10px;color:#b0b0b0;margin-top:3px;padding:0 4px;}
.message.system-message .msg-content{background:rgba(0,0,0,0.04);color:#999;padding:6px 14px;border-radius:4px;font-size:12px;}
.msg-media{max-width:240px;max-height:240px;border-radius:4px;cursor:pointer;}
.msg-media.video{max-width:300px;}

@keyframes fadeIn{from{opacity:0;transform:translateY(6px);}to{opacity:1;transform:translateY(0);}}

/* ===== 输入区 ===== */
.wx-input-bar{padding:12px 20px;background:#f0f0f0;border-top:1px solid #e0e0e0;padding-bottom:max(12px,env(safe-area-inset-bottom));}
.wx-input-row{display:flex;gap:10px;align-items:center;}
.wx-msg-input{flex:1;padding:10px 14px;background:#fff;border:1px solid #e0e0e0;border-radius:4px;font-size:14px;outline:none;transition:0.15s;}
.wx-msg-input:focus{border-color:#07C160;}
.wx-send-btn{background:#07C160;color:#fff;border:none;border-radius:4px;padding:10px 20px;font-size:13px;cursor:pointer;transition:0.15s;}
.wx-send-btn:hover{background:#06ad56;}

/* ===== 右侧通讯录 ===== */
.wx-right{width:220px;min-width:220px;background:#f5f5f5;border-left:1px solid #e0e0e0;display:flex;flex-direction:column;}
.wx-right-header{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;font-size:13px;font-weight:600;color:#555;border-bottom:1px solid #e0e0e0;}
.wx-right-count{font-size:11px;background:#07C160;color:#fff;padding:1px 8px;border-radius:10px;font-weight:500;}
.wx-contact-list{flex:1;overflow-y:auto;padding:4px 0;}
.wx-contact-item{display:flex;align-items:center;padding:10px 16px;cursor:pointer;transition:0.1s;}
.wx-contact-item:hover{background:#eaeaea;}
.wx-contact-avatar{width:34px;height:34px;border-radius:4px;display:flex;align-items:center;justify-content:center;color:#fff;font-size:13px;font-weight:bold;margin-right:12px;flex-shrink:0;}
.wx-contact-info{flex:1;min-width:0;}
.wx-contact-name{font-size:13px;color:#333;}
.wx-contact-btn{font-size:11px;background:none;border:1px solid #07C160;color:#07C160;border-radius:3px;padding:3px 8px;cursor:pointer;white-space:nowrap;}
.wx-contact-btn:hover{background:#07C160;color:#fff;}
.wx-contact-btn.private{border-color:#3498db;color:#3498db;}
.wx-contact-btn.private:hover{background:#3498db;color:#fff;}

/* ===== 未读红点 ===== */
.unread-badge{position:absolute;top:2px;right:8px;background:#f5222d;color:#fff;font-size:10px;font-weight:bold;min-width:18px;height:18px;line-height:18px;text-align:center;border-radius:9px;padding:0 5px;z-index:5;}

/* ===== 表情 ===== */
.emoji-picker{position:absolute;bottom:60px;right:20px;background:#fff;border:1px solid #e0e0e0;border-radius:8px;box-shadow:0 4px 24px rgba(0,0,0,0.12);display:none;z-index:200;width:340px;max-width:94vw;}
.emoji-picker.show{display:block;}
.emoji-tabs{display:flex;border-bottom:1px solid #eee;}
.emoji-tab{flex:1;padding:8px;background:none;border:none;font-size:16px;cursor:pointer;text-align:center;}
.emoji-tab.active,.emoji-tab:hover{background:#f0f0f0;}
.emoji-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:2px;padding:8px;max-height:200px;overflow-y:auto;}
.emoji-grid span{font-size:20px;padding:5px;text-align:center;cursor:pointer;border-radius:4px;}
.emoji-grid span:hover{background:#f0f0f0;}

/* ===== 弹出菜单 ===== */
.wx-popup{position:absolute;top:50px;right:16px;background:#fff;border:1px solid #e0e0e0;border-radius:4px;box-shadow:0 2px 12px rgba(0,0,0,0.1);display:none;z-index:200;min-width:120px;}
.wx-popup.show{display:block;}
.wx-popup-item{display:block;width:100%;padding:10px 16px;background:none;border:none;color:#333;font-size:13px;cursor:pointer;text-align:left;}
.wx-popup-item:hover{background:#f0f0f0;}

/* ===== 私聊弹窗 ===== */
.wx-private-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:300;display:none;background:rgba(0,0,0,0.3);align-items:center;justify-content:center;}
.wx-private-overlay.active{display:flex;}
.wx-private-container{width:520px;max-width:95vw;height:520px;max-height:85vh;background:#f5f5f5;border-radius:8px;box-shadow:0 8px 40px rgba(0,0,0,0.2);display:flex;flex-direction:column;overflow:hidden;}
.wx-private-header{display:flex;align-items:center;padding:12px 16px;background:#f0f0f0;border-bottom:1px solid #e0e0e0;gap:10px;}
.wx-back-btn{background:none;border:none;font-size:18px;cursor:pointer;color:#555;padding:2px 6px;}
.wx-back-btn:hover{color:#07C160;}
.wx-private-avatar{width:32px;height:32px;border-radius:4px;display:flex;align-items:center;justify-content:center;color:#fff;font-size:13px;font-weight:bold;}
.wx-private-name{font-size:15px;font-weight:500;}
.wx-private-body{flex:1;overflow-y:auto;padding:16px;}
.wx-private-input-bar{display:flex;gap:8px;padding:10px 16px;background:#f0f0f0;border-top:1px solid #e0e0e0;align-items:center;padding-bottom:max(10px,env(safe-area-inset-bottom));}

/* ===== 滚动条 ===== */
::-webkit-scrollbar{width:5px;}
::-webkit-scrollbar-track{background:transparent;}
::-webkit-scrollbar-thumb{background:rgba(0,0,0,0.1);border-radius:3px;}

/* ===== 汉堡菜单 ===== */
.wx-hamburger{display:none;background:none;border:none;font-size:22px;cursor:pointer;padding:4px 8px;color:#555;margin-right:4px;flex-shrink:0;}
.wx-hamburger:hover{color:#07C160;}
#contactsBtn{display:none;}

/* ===== 遮罩层 ===== */
.wx-overlay{display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.35);z-index:45;}

/* ===== 移动端 ===== */
@media(max-width:768px){
    html,body{width:100vw;overflow-x:hidden;}
    #chat-screen{display:block;width:100vw;overflow:hidden;}
    .wx-app{position:relative;}
    .wx-hamburger{display:block;}
    #contactsBtn{display:block;}

    .wx-left{position:fixed;left:0;top:0;bottom:0;z-index:55;width:0;min-width:0;border-right:none;overflow:hidden;transition:width 0.25s ease,box-shadow 0.25s ease;}
    .wx-left.show{width:280px;min-width:280px;border-right:1px solid #ddd;box-shadow:2px 0 16px rgba(0,0,0,0.2);overflow-y:auto;}

    .wx-right{position:fixed;right:0;top:0;bottom:0;z-index:55;width:0;min-width:0;border-left:none;overflow:hidden;transition:width 0.25s ease,box-shadow 0.25s ease;}
    .wx-right.show{width:240px;min-width:240px;border-left:1px solid #ddd;box-shadow:-2px 0 16px rgba(0,0,0,0.2);overflow-y:auto;}

    .wx-overlay.show{display:block;}
    .wx-center{min-width:100vw;overflow:hidden;}
    .wx-chat-header{padding:0 10px;height:48px;}
    .wx-chat-title{font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:50vw;}
    .wx-header-actions{gap:2px;flex-shrink:0;}
    .wx-icon-btn{padding:6px 8px;font-size:20px;}
    .wx-chat-body{padding:8px 10px 0 10px;}
    .wx-input-bar{padding:6px 8px;padding-bottom:max(6px,env(safe-area-inset-bottom));margin-bottom:54px;}
    .wx-input-row{gap:4px;}
    .wx-msg-input{flex:1;min-width:0;padding:8px 10px;font-size:14px;}
    .wx-send-btn{padding:8px 12px;font-size:12px;flex-shrink:0;}
    .msg-body{max-width:80%;}
    .msg-bubble{font-size:14px;}
    .msg-avatar{width:32px;height:32px;font-size:12px;}
    .message{margin-bottom:10px;}
    .wx-private-container{width:100vw;height:100vh;height:100dvh;max-width:100vw;max-height:100vh;max-height:100dvh;border-radius:0;}
    .wx-private-body{padding:8px 8px 0 8px;}
    .wx-private-header{padding:8px 12px;}
    .wx-private-input-bar{padding:6px 8px;gap:4px;padding-bottom:max(6px,env(safe-area-inset-bottom));margin-bottom:54px;}
    .wx-private-input-bar .wx-msg-input{padding:8px 10px;}
    .wx-private-input-bar .wx-send-btn{padding:8px 12px;}
    .emoji-picker{left:6px;right:6px;bottom:52px;width:auto;}
    .wx-contact-item{padding:12px 14px;}
    .wx-contact-avatar{width:36px;height:36px;font-size:13px;flex-shrink:0;}
    .wx-contact-btn{padding:6px 10px;font-size:12px;min-height:30px;flex-shrink:0;}
    .wx-conv-item{padding:14px 14px;}
    .wx-conv-avatar{width:42px;height:42px;flex-shrink:0;}
    .wx-left-search{padding:10px;}
    .wx-search-input{padding:10px 12px;font-size:14px;}
}

.liquid-nav{display:none;position:fixed;bottom:0;left:0;right:0;z-index:200;background:rgba(255,255,255,0.78);backdrop-filter:blur(22px);-webkit-backdrop-filter:blur(22px);border-top:1px solid rgba(0,0,0,0.05);padding:6px 0 calc(6px + env(safe-area-inset-bottom,0));justify-content:space-around;align-items:flex-start;}
.ln-item{display:flex;flex-direction:column;align-items:center;gap:2px;background:none;border:none;cursor:pointer;padding:4px 0;position:relative;z-index:2;transition:0.2s;flex:1;}
.ln-icon{font-size:22px;line-height:1.2;transition:0.25s;filter:grayscale(0.3);}
.ln-item.active .ln-icon{filter:grayscale(0);transform:translateY(-2px);}
.ln-label{font-size:10px;color:#999;transition:0.2s;}
.ln-item.active .ln-label{color:#07C160;font-weight:600;}
.ln-indicator{position:absolute;top:2px;height:36px;width:58px;background:rgba(7,193,96,0.1);border-radius:18px;transition:left 0.35s cubic-bezier(0.4,0,0.2,1);z-index:1;display:none;}

.me-page,.discover-page{display:none;position:fixed;top:0;left:0;right:0;bottom:0;z-index:50;background:#f5f5f5;flex-direction:column;overflow-y:auto;padding-bottom:80px;}
.me-page.show,.discover-page.show{display:flex;}
.me-header{background:linear-gradient(135deg,#07C160,#06ad56);padding:44px 20px 24px;text-align:center;color:#fff;}
.me-avatar{width:68px;height:68px;border-radius:50%;background:rgba(255,255,255,0.25);display:flex;align-items:center;justify-content:center;color:#fff;font-size:30px;font-weight:bold;margin:0 auto 10px;border:3px solid rgba(255,255,255,0.4);}
.me-name{font-size:18px;font-weight:600;}
.me-id{font-size:12px;opacity:0.8;margin-top:2px;}
.me-list{margin-top:12px;background:#fff;border-top:1px solid #eee;border-bottom:1px solid #eee;}
.me-item{display:flex;align-items:center;padding:14px 18px;border-bottom:1px solid #f0f0f0;font-size:14px;gap:10px;background:#fff;}
.me-item-icon{font-size:18px;width:24px;text-align:center;}
.me-item-label{flex:1;}
.me-item-arrow{margin-left:auto;color:#ccc;font-size:14px;}
.me-logout{color:#f5222d;justify-content:center;font-weight:500;}

.discover-header{background:#f0f0f0;padding:16px 20px;text-align:center;font-size:17px;font-weight:600;color:#111;border-bottom:1px solid #e0e0e0;}
.discover-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:1px;background:#e0e0e0;margin:16px;border-radius:8px;overflow:hidden;}
.discover-card{background:#fff;padding:26px 10px;text-align:center;transition:0.15s;}
.discover-card:active{background:#f5f5f5;}
.discover-card-icon{font-size:36px;margin-bottom:8px;}
.discover-card-label{font-size:12px;color:#888;}

@media(max-width:768px){
    .liquid-nav{display:flex;}
    .ln-indicator{display:block;}
    .wx-input-bar{margin-bottom:0;}
}
