/* ===============================
   1. 全局重置与基础样式 type = d
   =============================== */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }

body {
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.hidden { display: none !important; }

/* ===============================
   2. 提示框 & 弹窗
   =============================== */
#toast-container {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 10000;
    display: flex; flex-direction: column; gap: 10px;
}
.toast {
    background: white; padding: 12px 24px; border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); font-size: 14px; font-weight: 500;
    display: flex; align-items: center; animation: slideDown 0.3s ease-out forwards;
}
.toast.success { border-left: 4px solid #00c853; color: #00c853; }
.toast.error { border-left: 4px solid #ff3d00; color: #ff3d00; }
.toast.info { border-left: 4px solid #2979ff; color: #2979ff; }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* 模态框 */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(5px);
    z-index: 9999; display: flex; justify-content: center; align-items: center; opacity: 1; transition: opacity 0.3s;
}
.modal-box {
    background: white; width: 320px; padding: 30px; border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3); text-align: center; animation: scaleUp 0.3s ease-out;
}
@keyframes scaleUp { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-box h3 { margin-bottom: 10px; color: #333; }
.modal-desc { color: #888; font-size: 13px; margin-bottom: 10px; }
.modal-buttons { display: flex; gap: 15px; margin-top: 25px; }
.modal-buttons button {
    flex: 1; padding: 10px; border-radius: 10px; border: none; cursor: pointer; font-size: 14px; font-weight: bold; transition: 0.2s;
}
.btn-cancel { background: #f0f2f5; color: #666; }
.btn-cancel:hover { background: #e4e6eb; }
.btn-confirm { background: linear-gradient(to right, #667eea, #764ba2); color: white; }
.btn-confirm:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-confirm-delete { background: linear-gradient(to right, #ff416c, #ff4b2b); color: white; box-shadow: 0 4px 10px rgba(255, 75, 43, 0.3); }
.btn-confirm-delete:hover { opacity: 0.9; transform: translateY(-1px); }

/* ===============================
   3. 登录/注册
   =============================== */
#auth-wrapper { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; }
.auth-card {
    background: rgba(255, 255, 255, 0.9); padding: 40px; border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2); text-align: center; width: 380px;
    backdrop-filter: blur(12px); transition: all 0.4s ease; animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.avatar-container img { width: 80px; height: 80px; border-radius: 50%; box-shadow: 0 5px 15px rgba(0,0,0,0.1); background: white; padding: 5px; margin-bottom: 15px; }
.input-group { position: relative; margin-bottom: 20px; text-align: left;}
.input-group input { width: 100%; padding: 12px 15px; border: 2px solid #eee; border-radius: 12px; background: #f9f9f9; font-size: 15px; transition: 0.3s; }
.input-group input:focus { border-color: #764ba2; background: white; }
.input-group label { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #aaa; pointer-events: none; transition: 0.3s; font-size: 14px; background: transparent; padding: 0 5px; }
.input-group input:focus + label, .input-group input:not(:placeholder-shown) + label { top: 0; font-size: 12px; color: #764ba2; background: white; }
.btn-primary { width: 100%; padding: 12px; background: linear-gradient(to right, #667eea, #764ba2); color: white; border: none; border-radius: 12px; font-size: 16px; cursor: pointer; font-weight: bold; box-shadow: 0 5px 15px rgba(118, 75, 162, 0.3); transition: 0.3s; margin-top: 10px; }
.btn-primary:hover { box-shadow: 0 8px 25px rgba(118, 75, 162, 0.5); transform: translateY(-2px); }
.switch-link { margin-top: 20px; font-size: 14px; color: #666; }
.switch-link span { color: #764ba2; cursor: pointer; font-weight: bold; margin-left: 5px; }

/* 验证码组合框 */
.captcha-group { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.captcha-img-box { width: 100px; height: 46px; background: #eee; border-radius: 12px; cursor: pointer; overflow: hidden; flex-shrink: 0; }
.captcha-img-box img { width: 100%; height: 100%; object-fit: cover; }


/* ===============================
   4. 主界面布局
   =============================== */
#app-container {
    display: none; 
    width: 95vw; 
    max-width: 1366px; 
    height: 90vh; 
    max-height: 768px;
    background: white; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden; flex-direction: row;
}

/* 左侧栏 */
.sidebar {
    width: 280px;
    /* 【关键修复】防止被右边挤压 */
    min-width: 280px;
    flex-shrink: 0;

    background: #f7f8fc; border-right: 1px solid #ebedf0;
    display: flex; flex-direction: column;
}

.my-profile {
    padding: 20px; background: white; border-bottom: 1px solid #ebedf0;
    display: flex; align-items: center; height: 80px; flex-shrink: 0;
}
.my-avatar-wrapper { position: relative; width: 45px; height: 45px; margin-right: 12px; }
.my-avatar-wrapper img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.status-badge {
    position: absolute; top: 0; right: 0; width: 12px; height: 12px;
    border-radius: 50%; border: 2px solid white; transition: background-color 0.3s; z-index: 10;
}
.status-badge.online { background-color: #00c853; box-shadow: 0 0 5px rgba(0, 200, 83, 0.6); }
.status-badge.offline { background-color: #ff4757; box-shadow: 0 0 5px rgba(255, 71, 87, 0.6); }

.profile-info { display: flex; flex-direction: column; justify-content: center; flex: 1; overflow: hidden; }
#my-username { font-weight: bold; font-size: 16px; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-btns { display: flex; gap: 10px; font-size: 12px; }
.logout-btn { color: #ff4757; cursor: pointer; }
.add-friend-btn { color: #667eea; cursor: pointer; font-weight: bold; }
.notice-btn { color: #ff9800; cursor: pointer; font-weight: bold; position: relative; }
#notice-dot { position: absolute; top: -3px; right: -7px; width: 10px; height: 10px; background-color: #ff4757; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 0 1px rgba(0,0,0,0.05); }

/* --- Tab 切换栏 --- */
.sidebar-tabs {
    display: flex; background: #fff; border-bottom: 1px solid #ebedf0; flex-shrink: 0;
}
.sidebar-tabs .tab-item {
    flex: 1; text-align: center; padding: 12px 0; cursor: pointer;
    font-size: 14px; color: #666; border-bottom: 2px solid transparent; transition: all 0.2s;
}
.sidebar-tabs .tab-item:hover { background-color: #f9f9f9; }
.sidebar-tabs .tab-item.active { color: #667eea; border-bottom-color: #667eea; font-weight: bold; }

/* 列表区 */
.user-list { flex: 1; overflow-y: auto; }

/* 列表项样式 */
.user-item {
    padding: 12px 15px; display: flex; align-items: center; cursor: pointer;
    transition: 0.2s; height: 72px; border-bottom: 1px solid #f5f5f5;
}
.user-item:hover { background: #f0f0f0; }
.user-item.active { background: #e6e6e6; }

.avatar-wrapper { position: relative; width: 44px; height: 44px; margin-right: 12px; flex-shrink: 0; }
.avatar-wrapper img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.badge {
    position: absolute; top: -5px; right: -5px; background-color: #ff4757; color: white;
    font-size: 10px; height: 16px; min-width: 16px; padding: 0 4px;
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    border: 2px solid white; z-index: 2;
}

.user-info { flex: 1; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.info-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.user-name { font-size: 14px; color: #333; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.msg-time-list { font-size: 12px; color: #999; }
.info-bottom { display: flex; }
.preview-text { font-size: 12px; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }

/* 右侧聊天区 */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    /* 【关键修复】防止被长文本撑爆 */
    min-width: 0;
    overflow: hidden;
}

.chat-header {
    height: 60px; border-bottom: 1px solid #ebedf0; display: flex; align-items: center;
    justify-content: space-between; padding: 0 25px; background: white; flex-shrink: 0;
}
#chat-title { font-weight: bold; font-size: 17px; }
.btn-danger {
    padding: 6px 16px; background: transparent; color: #ff4757; border: 1px solid #ff4757;
    border-radius: 20px; font-size: 12px; cursor: pointer; transition: all 0.3s; font-weight: 500;
}
.btn-danger:hover { background: #ff4757; color: white; transform: translateY(-1px); }

.chat-window { flex: 1; padding: 20px; overflow-y: auto; background: #fdfdfd; display: flex; flex-direction: column; }
.empty-tip { text-align: center; color: #999; margin-top: 50px; }

/* --- 底部输入区 (高度自适应) --- */
.input-area {
    min-height: 140px;
    max-height: 300px;
    border-top: 1px solid #ebedf0;
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    background: white;
    flex-shrink: 0;
    transition: height 0.2s;
    position: relative; /* 引用条定位需要 */
}

.input-area textarea {
    font-family: inherit;
    font-size: 14px;
    border: none;
    resize: none;
    flex: 1;
    margin-bottom: 5px;
    min-height: 50px; /* 保证输入框最小高度 */
}

.input-area div { text-align: right; } /* 按钮容器 */

.input-area button {
    padding: 6px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
}
.input-area button:hover { background: #5a6fd6; }

/* === 5. 消息气泡样式 (优化版) === */
.message { display: flex; max-width: 80%; margin-bottom: 15px; }

/* 头像对齐：和 Bubble 顶部对齐 */
.message { align-items: flex-start; }

/* 头像对齐 */
.message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.message.received { align-self: flex-start; }

.message img { width: 36px; height: 36px; border-radius: 4px; margin: 0 10px; flex-shrink: 0; cursor: pointer; }

/* --- 气泡容器布局核心修改 --- */
.bubble-container {
    display: flex;
    max-width: 100%;
}

/* 别人发的：纵向排列 (名字在上，气泡在下) */
.message.received .bubble-container {
    flex-direction: column;
    align-items: flex-start;
}
/* 我们需要把圆环放在 bubble 和 status 之间，或者 status 里面 */
.message.sent .status-wrapper {
    display: flex;
    align-items: flex-end;
    margin-right: 5px;
    flex-direction: column; /* 垂直排布：圆环在上，时间在下，或者根据需要 */
}

/* 我发的：横向反转 (状态在左，气泡在右) */
.message.sent .bubble-container {
    flex-direction: row-reverse;
    align-items: flex-end; /* 底部对齐 */
}

/* 发送者名字美化 */
.sender-name {
    font-size: 12px;
    color: #999;
    margin-bottom: 3px;
    margin-left: 2px; /* 稍微缩进对齐气泡 */
    line-height: 1.2;
}

/* 气泡本体 */
.message .bubble {
    padding: 10px 14px; border-radius: 8px; font-size: 14px; line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    display: flex; flex-direction: column; min-width: 40px;
    word-break: break-word; word-wrap: break-word; white-space: pre-wrap;
    position: relative;
}

/* 气泡颜色与圆角优化 */
.message.sent .bubble {
    background: #667eea; color: white;
    border-top-right-radius: 2px; /* 右上角尖角 */
}
.message.received .bubble {
    background: white; border: 1px solid #eee; color: #333;
    border-top-left-radius: 2px; /* 左上角尖角 */
}

/* 图片气泡特殊处理 */
.message .bubble.is-image {
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;

    /* 关键修复：图片气泡需改为 block/inline-block，且不能是 flex column，否则绝对定位可能受影响或有间隙 */
    display: inline-block !important;
    position: relative;
    width: auto;
    height: auto;
    line-height: 0; /* 消除 img 底部的幽灵空白 */
}
.message .bubble.is-image img {
    margin: 0;
    border-radius: 8px;
    max-width: 250px;
    max-height: 300px;
    display: block; /* 消除行内元素间隙 */
}
.msg-time { font-size: 10px; margin-top: 4px; opacity: 0.7; }
.message.sent .msg-time { color: #e0e0e0; text-align: right; align-self: flex-end; }
.message.received .msg-time { color: #999; text-align: left; align-self: flex-start; }

div.message:not(.sent) .msg-status { display: none; } /* Only show status for sent msgs */

/* Image time in bottom-right corner of image */
.message .bubble.is-image {
    position: relative;
    display: inline-block;
}
.message .bubble.is-image .msg-time {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.5);
    color: white !important;
    padding: 2px 6px;
    border-radius: 10px;
    margin: 0;
    text-align: center;
    line-height: normal;
    pointer-events: none;
    z-index: 5;
    opacity: 1; /* Reset opacity from general .msg-time */
}

/* Ensure sent/received specific overrides don't break it */
.message.sent .bubble.is-image .msg-time,
.message.received .bubble.is-image .msg-time {
    align-self: auto;
    text-align: center;
    color: white !important;
}

.msg-status { font-size: 10px; margin-top: 15px; margin-right: 8px; flex-shrink: 0; }
.msg-status.unread { color: #f44336; }
.msg-status.read { color: #bbb; }
.recalled-tip {
    text-align: center; font-size: 12px; color: #999; margin: 10px 0;
    background: rgba(0,0,0,0.03); padding: 4px 10px; border-radius: 10px; align-self: center !important; max-width: 100% !important;
}

/* === 引用条样式 (限制高度) === */
.reply-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
    padding: 8px 15px;
    font-size: 12px;
    color: #666;
    border-bottom: 1px solid #eee;
    border-left: 4px solid #667eea;
    width: 100%;
    animation: slideUp 0.2s;

    /* 【关键修复】防止高度过大 */
    max-height: 60px;
    flex-shrink: 0;
    overflow: hidden;
    box-sizing: border-box;
}
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.reply-text {
    /* 【关键修复】限制行数，防止撑开 */
    white-space: normal;
    word-break: break-all;

    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; /* 最多显示2行 */
    overflow: hidden;

    max-width: calc(100% - 30px);
    font-weight: bold;
    line-height: 1.4;
    color: #555;
}
.reply-close { cursor: pointer; font-size: 18px; color: #999; padding: 0 5px; flex-shrink: 0;}
.reply-close:hover { color: #ff4757; }

/* === 引用块内容限制 (修复版) === */
.quote-box {
    /* 强制容器约束 */
    display: flex !important;
    flex-direction: column !important;
    max-width: 100% !important;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.05);
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    border-left: 2px solid rgba(0,0,0,0.2);
}
.message.received .quote-box { background: rgba(0,0,0,0.05); }
.message.sent .quote-box { background: rgba(0,0,0,0.15); color: #eee; border-left-color: rgba(255,255,255,0.5); }
.quote-name { font-weight: bold; margin-bottom: 2px; font-size: 11px; opacity: 0.9; }

.quote-content {
    /* 【关键修复】强制切断超长内容 */
    display: -webkit-box !important;
    -webkit-line-clamp: 3; /* 最多3行 */
    -webkit-box-orient: vertical;
    overflow: hidden !important;
    max-height: 50px !important; /* 物理限高 */

    white-space: normal !important;
    word-break: break-all !important;

    text-overflow: ellipsis;
    font-size: 12px;
    line-height: 1.4;
    color: inherit;
    text-align: left;
    width: 100%;
}
.message.sent .quote-content { color: rgba(255, 255, 255, 0.8); }


/* 右键菜单 */
.context-menu {
    position: absolute; background: white; box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border-radius: 8px; padding: 5px 0; z-index: 10001; width: 120px; overflow: hidden;
}
.menu-item {
    padding: 10px 15px; font-size: 14px; color: #333; cursor: pointer; transition: 0.2s;
    display: flex; align-items: center; gap: 8px;
}
.menu-item:hover { background: #f5f5f5; }

/* 底部版权 */
.app-footer { position: fixed; bottom: 15px; left: 0; width: 100%; text-align: center; z-index: 0; pointer-events: none; }
.app-footer p { color: rgba(255, 255, 255, 0.5); font-size: 12px; margin: -3px 0; font-weight: 300; }
@media screen and (max-height: 500px) { .app-footer { display: none; } }

/* 加载更多提示 */
.loading-history {
    text-align: center;
    font-size: 12px;
    color: #999;
    padding: 10px 0;
    width: 100%;
}
.loading-history .spinner {
    display: inline-block; animation: rotate 1s linear infinite; margin-right: 5px;
}
@keyframes rotate { 100% { transform: rotate(360deg); } }

/* === 6. 图片优化与查看器 === */
.message .bubble.is-image {
    padding: 0 !important; background: transparent !important; box-shadow: none !important;
    border: none !important; overflow: hidden; position: relative; display: inline-block;
}
.message .bubble.is-image img {
    max-width: 300px; max-height: 300px; width: auto; height: auto;
    border-radius: 8px; cursor: zoom-in; display: block; margin: 0; transition: opacity 0.2s;
}
.message .bubble.is-image img:hover { opacity: 0.9; }

.message .bubble.is-image .msg-time {
    position: absolute; bottom: 6px; right: 8px;
    background-color: rgba(0, 0, 0, 0.5); color: #fff !important;
    font-size: 10px; padding: 2px 6px; border-radius: 10px; line-height: 1;
    pointer-events: none; z-index: 5; text-align: center; align-self: auto; width: auto; margin: 0;
}

/* 查看器 */
.image-viewer {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9); z-index: 99999; display: flex; flex-direction: column;
    justify-content: center; align-items: center; user-select: none; opacity: 1; transition: opacity 0.2s ease;
}
.image-viewer.hidden { display: none !important; opacity: 0; }
.viewer-content { flex: 1; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden; cursor: grab; }
.viewer-content:active { cursor: grabbing; }
.image-viewer img { max-width: 90%; max-height: 85%; object-fit: contain; transition: transform 0.1s linear; will-change: transform; }
.viewer-close { position: absolute; top: 30px; right: 40px; color: white; font-size: 40px; cursor: pointer; opacity: 0.7; z-index: 100000; }
.viewer-close:hover { opacity: 1; transform: scale(1.1); }
.viewer-controls {
    position: absolute; bottom: 30px; background: rgba(255, 255, 255, 0.2); backdrop-filter: blur(10px);
    padding: 10px 25px; border-radius: 50px; display: flex; align-items: center; gap: 15px; color: white;
}
.viewer-controls button {
    background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.3); color: white;
    width: 36px; height: 36px; border-radius: 50%; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s;
}
.viewer-controls button:hover { background: rgba(0,0,0,0.8); border-color: white; }
#zoom-level { font-size: 14px; min-width: 50px; text-align: center; }

/* 建群按钮 */
.group-btn { color: #00bcd4; cursor: pointer; font-weight: bold; }
.group-btn:hover { text-decoration: underline; }

/* === 好友选择列表 (多选) === */
.friend-select-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 5px;
    margin-bottom: 20px;
    text-align: left;
}

.select-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #f9f9f9;
    cursor: pointer;
    transition: 0.2s;
}
.select-item:hover { background: #f0f0f0; }

.select-item input {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.select-item img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
}

.select-item span {
    font-size: 14px;
    color: #333;
}

/* === 群消息已读圆环 === */
.read-ring {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border: 1px solid #999;
    border-radius: 50%;
    font-size: 9px;
    color: #999;
    margin-right: 5px; /* 放在气泡左边 */
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.read-ring:hover {
    border-color: #667eea;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

/* 已读列表项 */
.read-user-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid #f5f5f5;
}
.read-user-item img {
    width: 30px; height: 30px; border-radius: 50%; margin-right: 10px;
}
.read-user-item span {
    font-size: 14px; color: #333;
}
.message.sent .bubble.is-image .msg-time { color: white !important; }

/* === 新增：消息发送中 Loading === */
.msg-loading {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0,0,0,0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 5px;
    margin-bottom: 2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.message.sending { opacity: 0.8; }
.message.sending .msg-status { display: none !important; }

/* 好友请求列表样式修复 */
#request-modal .modal-box {
    width: 400px;
    max-width: 90%;
}
#request-list {
    max-height: 350px;
    overflow-y: auto;
    margin: 10px 0;
    padding: 5px;
}
.req-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.req-item img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
    background: #eee;
}
.req-info {
    flex: 1;
    text-align: left;
    font-weight: bold;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}
.req-actions {
    display: flex;
    gap: 6px;
}
.btn-mini {
    padding: 4px 10px;
    border-radius: 6px;
    border: none;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}
.btn-accept {
    background: linear-gradient(to right, #667eea, #764ba2);
    color: white;
}
.btn-reject {
    background: #eee;
    color: #666;
}
.btn-mini:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 通知红点样式优化 */
#notice-dot {
    position: absolute;
    top: -3px;
    right: -7px;
    width: 10px;
    height: 10px;
    background-color: #ff4757;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.05);
}

/* 容器主体 */
.cf-turnstile-wrapper {
    width: 300px;
    height: 65px;
    background-color: #fff;
    border: 1px solid #d1d1d1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    box-sizing: border-box;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 20px 0; /* 根据需要调整外边距 */
}

.cf-turnstile-wrapper:hover {
    background-color: #f9f9f9;
}

/* 状态：禁止点击 (验证成功后) */
.cf-turnstile-wrapper.disabled {
    cursor: default;
    background-color: #fff;
}

/* 左侧：复选框/加载/成功图标容器 */
.cf-checkbox-wrapper {
    width: 28px;
    height: 28px;
    margin-right: 12px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 1. 初始空复选框 */
.cf-checkbox {
    width: 100%;
    height: 100%;
    border: 2px solid #c1c1c1;
    border-radius: 4px;
    background: #fff;
    transition: border-color 0.2s;
}

.cf-turnstile-wrapper:hover .cf-checkbox {
    border-color: #a0a0a0;
}

/* 2. 加载动画 (默认隐藏) */
.cf-spinner {
    display: none;
    animation: rotate 2s linear infinite;
    width: 100%;
    height: 100%;
    position: absolute;
}
.cf-spinner .path {
    stroke: #0051c3; /* Cloudflare 蓝 */
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

/* 3. 成功打钩 (默认隐藏) */
.cf-success-icon {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
}
.checkmark-circle {
    stroke: #00a96e; /* 成功绿 */
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}
.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke: #00a96e;
    stroke-width: 4;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

/* 中间文字 */
.cf-text {
    flex-grow: 1;
    font-size: 14px;
    color: #404040;
    font-weight: 500;
}

/* 右侧 Logo 区域 */
.cf-logo-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 50px;
}
.cf-logo-img {
    font-size: 24px;
    line-height: 1;
    margin-bottom: 2px;
}
.cf-footer-text {
    font-size: 10px;
    color: #999;
    transform: scale(0.9);
}

/* 动画关键帧 */
@keyframes rotate { 100% { transform: rotate(360deg); } }
@keyframes dash {
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}
@keyframes stroke { 100% { stroke-dashoffset: 0; } }

/* ===============================
   新增：表情选择器样式
   =============================== */
.emoji-picker {
    position: absolute;
    bottom: 40px; /* 位于工具栏上方 */
    right: 0;
    width: 320px;
    height: 200px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 5px;
    z-index: 1000;
}

.emoji-item {
    font-size: 24px;
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}

.emoji-item:hover {
    background-color: #f0f2f5;
}

/* 滚动条美化 */
.emoji-picker::-webkit-scrollbar {
    width: 6px;
}
.emoji-picker::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}
.emoji-picker::-webkit-scrollbar-track {
    background-color: transparent;
}
