:root {
    --primary: #4a6fa5;
    --secondary: #6b8cbc;
    --light: #f0f4f8;
    --dark: #2c3e50;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #1a2a6c);
    color: var(--light);
    min-height: 100vh;
    min-height: 100dvh; /* 动态视口高度,适应移动浏览器栏 */
    padding: 0;
    margin: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    height: 100vh;
    height: 100dvh; /* 动态视口高度,适应移动浏览器栏 */
    padding: 15px;
}

.panel {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* Safari 兼容性 */
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* backdrop-filter 降级方案 */
@supports not (backdrop-filter: blur(10px)) {
    .panel {
        background: rgba(255, 255, 255, 0.25); /* 提高不透明度作为降级 */
    }
}

.header {
    padding: 15px;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    position: relative; /* 确保内部元素定位正确 */
}

h1, h2, h3 {
    color: white;
    margin-bottom: 10px;
}

.connection-status {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    margin-bottom: 15px;
    text-align: center;
    cursor: pointer;
    transition: opacity 0.2s;
}

.connection-status:hover {
    opacity: 0.8;
}

.status-connected {
    background: var(--success);
}

.status-no-key {
    background: var(--warning);
}

.status-connecting {
    background: var(--warning);
}

.status-disconnected {
    background: var(--danger);
}

.user-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px;
}

.user-item {
    padding: 9px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.user-item.self {
    background: rgba(74, 111, 165, 0.3);
}

.user-name {
    font-weight: bold;
    margin-bottom: 2px;
}

.user-id {
    font-size: 0.75em;
    color: #bbb;
    word-break: break-all;
    font-family: monospace;
}

.user-email {
    font-size: 0.8em;
    color: #aaa;
}

.chat-area {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
}

.message {
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 12px;
    max-width: 90%;
    word-wrap: break-word;
}

.message.sent {
    background: var(--primary);
    align-self: flex-end;
    margin-left: 10%;
}

.message.received {
    background: var(--dark);
    align-self: flex-start;
    margin-right: 10%;
}

.message.encrypted {
    background: rgba(231, 76, 60, 0.3);
    border: 1px solid var(--danger);
}

.sender-info {
    font-weight: bold;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
}

.sender-name {
    color: #4ec9b0;
    font-size: large;
}

.sender-id {
    font-weight: normal;
    font-size: 0.65em;
    color: #bbb;
}

.message-time {
    font-size: 0.75em;
    opacity: 0.7;
}

.message-number {
    font-size: 0.7em;
    opacity: 0.6;
    color: #ffffff;
    font-weight: normal;
    margin-left: 8px;
}

/* 系统消息样式 */
.system-message {
    padding: 8px 15px;
    margin: 8px auto;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    font-size: 0.85em;
    text-align: center;
    font-style: italic;
    max-width: 80%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.system-message.user-joined {
    background: rgba(39, 174, 96, 0.2);
    border-color: rgba(39, 174, 96, 0.3);
    color: #2ecc71;
}

.system-message.user-reconnected {
    background: rgba(52, 152, 219, 0.2);
    border-color: rgba(52, 152, 219, 0.3);
    color: #3498db;
}

/* 新手指导气泡 */
.newbie-guide {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #667eea;
    color: white;
    padding: 15px 20px;
    border-radius: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    width: auto;
    text-align: center;
    animation: slideDown 0.5s ease-out, fadeOut 0.5s ease-in 4.5s forwards;
    font-size: 0.9em;
    line-height: 1.4;
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
}

.newbie-guide::before {
    content: '💡';
    margin-right: 8px;
}

.message-text {
    line-height: 1.4;
}

.input-area {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

textarea {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    resize: none;
    min-height: 60px;
}

button {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: var(--secondary);
}

button:disabled {
    background: #666;
    cursor: not-allowed;
}

/* Tab切换样式 */
.tab-container {
    display: flex;
    flex-direction: column;
    margin-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 0;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.tab-header {
    display: flex;
    gap: 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px 10px 0 0;
    padding: 5px;
    margin: 0;
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    padding: 10px 15px;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.tab-content {
    display: none;
    padding: 15px 10px 10px;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

.tab-content.active {
    display: flex;
}

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

.key-management {
    padding: 0;
}

.key-info {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9em;
}

.key-id {
    word-break: break-all;
    font-family: monospace;
    font-size: 0.65em;
    color: #4ec9b0;
}

.key-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.key-buttons button {
    padding: 8px 12px;
    font-size: 0.85em;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    background: var(--success);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 300px;
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background: var(--danger);
}

.notification.warning {
    background: var(--warning);
}

.debug-info {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.8em;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.room-url {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.8em;
    margin-bottom: 10px;
    word-break: break-all;
}

#roomName {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 60px); /* 右侧预留40px空间 */
    display: inline-block; /* 确保宽度自适应 */
    vertical-align: bottom; /* 保持垂直对齐 */
    padding-right: 10px; /* 右侧内边距 */
}

/* 移动端优化样式 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        gap: 0;
        padding: 0;
    }

    .panel {
        border-radius: 0;
        height: 100vh;
        height: 100dvh; /* 动态视口高度,适应移动浏览器栏 */
        box-shadow: none;
        border: none;
    }

    .chat-area {
        height: 100%;
    }

    .messages {
        border-radius: 0;
        padding-bottom: 90px; /* 防止输入框遮挡消息 */
    }
    
    /* 管理面板样式 */
    .manage-area {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        height: 100vh !important;
        height: 100dvh !important; /* 动态视口高度,适应移动浏览器栏 */
        z-index: 101;
        transition: left 0.3s ease-out;
    }   

    .manage-area.expanded {
        left: 0; 
    }
    
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 100;
    }
    
    .slide-toggle {
        position: fixed;
        top: 18px;
        left: 16px;
        z-index: 102;
        background: rgba(255, 255, 255, 0.16);
        border-radius: 50%;
        width: 48px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        backdrop-filter: blur(10px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.16);
        transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
    }
    
    .material-symbols-outlined {
        font-size: 28px;
        color: white;
        font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
        transition: transform 0.3s ease;
    }
    
    .slide-toggle.expanded .material-symbols-outlined {
        font-variation-settings: 'FILL' 0, 'wght' 600, 'GRAD' 0, 'opsz' 28;
        transform: rotate(180deg);
    }
    
    /* 移动端输入区域优化 */
    .input-area {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 15px;
        border-radius: 0;
        z-index: 99;
        transition: transform 0.2s ease;
    }
    
    textarea {
        min-height: 50px;
        font-size: 16px; /* 提高移动端可读性 */
    }
    
    button#sendButton {
        min-width: 70px;
        align-self: flex-end;
    }
    
    .room-url {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.75em;
    }

    #roomName {
        max-width: calc(100% - 80px); /* 移动端预留更多空间 */
        padding-right: 5px;
    }
}

/* ========================
 * 自定义滚动条样式 (仅桌面端)
 * ======================== */
@media (min-width: 769px) {
    /* WebKit 浏览器 (Chrome, Safari, Edge) */
    ::-webkit-scrollbar {
        width: 6px;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: rgba(128, 128, 128, 0.5);
        border-radius: 3px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: rgba(128, 128, 128, 0.7);
    }

    /* Firefox 标准滚动条样式 */
    * {
        scrollbar-width: thin;
        scrollbar-color: rgba(128, 128, 128, 0.5) transparent;
    }
}

/* ========================
 * 群管理功能样式
 * ======================== */

/* 角色徽章 */
.role-badge {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 8px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: bold;
    vertical-align: middle;
}

.role-creator {
    background: rgba(102, 126, 234, 0.3);
    color: #a5b4fc;
}

.role-admin {
    background: rgba(231, 76, 60, 0.3);
    color: #fca5a5;
}

.role-user {
    background: rgba(52, 152, 219, 0.3);
    color: #93c5fd;
}

.role-guest {
    background: rgba(149, 165, 166, 0.3);
    color: #d1d5db;
}

/* 用户信息容器 */
.user-info-container {
    flex: 1;
}

/* 用户操作按钮 */
.user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.action-btn {
    padding: 4px 10px;
    font-size: 0.75em;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    color: white;
}

.kick-btn {
    background: var(--warning);
}

.kick-btn:hover {
    background: #e67e22;
}

.ban-btn {
    background: var(--danger);
}

.ban-btn:hover {
    background: #c0392b;
}

.transfer-btn {
    background: #9b59b6;
}

.transfer-btn:hover {
    background: #8e44ad;
}

.role-select {
    padding: 4px 8px;
    font-size: 0.75em;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

.role-select option {
    background: var(--dark);
    color: white;
}

/* 管理面板 */
.admin-management {
    margin-top: 0;
    padding-top: 0;
}

.admin-section {
    margin-bottom: 20px;
    padding: 15px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.admin-section h3 {
    font-size: 1em;
    margin-bottom: 12px;
    color: #4ec9b0;
}

.admin-btn {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

.admin-btn:hover {
    background: var(--secondary);
}

/* 邀请表单 */
.invite-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.admin-select,
.admin-input {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 0.85em;
}

.admin-select option {
    background: var(--dark);
    color: white;
}

.admin-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* 邀请链接列表 */
.invite-list,
.ban-list {
    max-height: 300px;
    overflow-y: auto;
}

.invite-item,
.ban-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.invite-info,
.ban-info {
    margin-bottom: 8px;
}

.invite-url {
    font-size: 0.75em;
    color: #4ec9b0;
    word-break: break-all;
    margin-bottom: 5px;
    font-family: monospace;
}

.invite-meta,
.ban-meta {
    font-size: 0.7em;
    color: #aaa;
}

.invite-actions {
    display: flex;
    gap: 5px;
}

.invite-actions button,
.ban-item button {
    flex: 1;
    padding: 5px 10px;
    font-size: 0.75em;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.invite-actions button:hover,
.ban-item button:hover {
    background: var(--secondary);
}

/* 隐私表单 */
.privacy-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.privacy-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
    cursor: pointer;
}

.privacy-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.privacy-label span {
    user-select: none;
}

/* ========================
 * Markdown 样式
 * ======================== */

/* 消息文本中的 Markdown 元素 */
.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4,
.message-text h5,
.message-text h6 {
    margin: 0.5em 0;
    font-weight: bold;
    line-height: 1.3;
}

.message-text h1 { font-size: 1.5em; }
.message-text h2 { font-size: 1.3em; }
.message-text h3 { font-size: 1.1em; }
.message-text h4 { font-size: 1em; }
.message-text h5 { font-size: 0.9em; }
.message-text h6 { font-size: 0.85em; }

/* 行内代码 */
.message-text code {
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

/* 代码块 */
.message-text pre {
    background: #282c34;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-text pre code {
    background: none;
    padding: 0;
    color: #abb2bf;
    font-size: 0.85em;
    line-height: 1.5;
}

/* 引用块 */
.message-text blockquote {
    border-left: 4px solid rgba(255, 255, 255, 0.3);
    margin: 8px 0;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    font-style: italic;
}

.message-text blockquote p {
    margin: 0;
}

/* 列表 */
.message-text ul,
.message-text ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-text li {
    margin: 4px 0;
}

/* 链接 */
.message-text a {
    color: #60a5fa;
    text-decoration: none;
    border-bottom: 1px solid rgba(96, 165, 250, 0.3);
    transition: border-bottom-color 0.2s;
}

.message-text a:hover {
    border-bottom-color: #60a5fa;
}

/* 表格 */
.message-text table {
    border-collapse: collapse;
    margin: 8px 0;
    width: 100%;
    font-size: 0.9em;
}

.message-text table th,
.message-text table td {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 10px;
    text-align: left;
}

.message-text table th {
    background: rgba(0, 0, 0, 0.3);
    font-weight: bold;
}

.message-text table tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.1);
}

/* 水平线 */
.message-text hr {
    border: none;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    margin: 12px 0;
}

/* 粗体和斜体 */
.message-text strong {
    font-weight: bold;
}

.message-text em {
    font-style: italic;
}

/* 删除线 */
.message-text del {
    text-decoration: line-through;
    opacity: 0.7;
}

/* 图片 */
.message-text img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 8px 0;
}

/* 段落间距 */
.message-text p {
    margin: 8px 0;
}

.message-text p:first-child {
    margin-top: 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

/* ========================
 * 回复功能样式
 * ======================== */

/* 回复按钮 */
.reply-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 1em;
    background: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
}

.message:hover .reply-btn {
    opacity: 1;
}

.reply-btn:hover {
    background: rgba(74, 111, 165, 0.6);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.message {
    position: relative;
}

/* 消息中的回复引用 */
.reply-reference {
    display: flex;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    font-size: 0.85em;
}

.reply-icon {
    font-size: 1.2em;
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
}

.reply-content {
    flex: 1;
    overflow: hidden;
}

.reply-sender {
    font-weight: bold;
    color: #4ec9b0;
    margin-bottom: 3px;
    font-size: 0.9em;
}

.reply-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 输入区域上方的回复预览 */
.reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(74, 111, 165, 0.3);
    border-left: 3px solid var(--primary);
    margin-bottom: 10px;
    border-radius: 6px;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reply-preview-content {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    overflow: hidden;
}

.reply-preview-icon {
    font-size: 1.3em;
    color: var(--primary);
    flex-shrink: 0;
}

.reply-preview-info {
    flex: 1;
    overflow: hidden;
}

.reply-preview-sender {
    font-weight: bold;
    color: #4ec9b0;
    margin-bottom: 3px;
    font-size: 0.85em;
}

.reply-preview-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-preview-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 4px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.reply-preview-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* 移动端回复功能优化 */
@media (max-width: 768px) {
    .reply-btn {
        opacity: 0;
        width: 32px;
        height: 32px;
        font-size: 1.1em;
        pointer-events: none;
        z-index: 100;
    }

    /* 消息被点击激活时显示按钮 */
    .message.message-active .reply-btn {
        opacity: 1;
        pointer-events: auto;
        z-index: 100;
    }

    .reply-preview {
        margin-left: 15px;
        margin-right: 15px;
        margin-bottom: 5px;
    }

    .reply-reference {
        font-size: 0.8em;
    }
}
/* ========================
 * 同步功能样式
 * ======================== */

/* 同步按钮 */
.sync-btn {
    position: absolute;
    top: 8px;
    right: 44px;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 1em;
    background: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
}

.message:hover .sync-btn {
    opacity: 1;
}

.sync-btn:hover {
    background: rgba(155, 89, 182, 0.6);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* 同步对话框遮罩层 */
.sync-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s;
}

/* 同步对话框 */
.sync-dialog {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border-radius: 15px;
    padding: 25px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideUp 0.3s ease-out;
}

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

/* 用户列表容器 */
.sync-user-list {
    flex: 1;
    overflow-y: auto;
    margin: 15px 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    max-height: 300px;
}

/* 用户项 */
.sync-user-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.sync-user-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sync-user-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    cursor: pointer;
}

.sync-user-name {
    font-weight: bold;
    color: white;
}

/* 按钮容器 */
.sync-dialog-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.sync-cancel-btn,
.sync-confirm-btn {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.sync-cancel-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sync-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sync-confirm-btn {
    background: var(--primary);
    color: white;
}

.sync-confirm-btn:hover {
    background: var(--secondary);
}

/* 移动端同步功能优化 */
@media (max-width: 768px) {
    .sync-btn {
        opacity: 0;
        width: 32px;
        height: 32px;
        font-size: 1.1em;
        right: 50px;
        pointer-events: none;
    }

    /* 消息被点击激活时显示按钮 */
    .message.message-active .sync-btn {
        opacity: 1;
        pointer-events: auto;
    }

    .sync-dialog {
        width: 95%;
        max-height: 70vh;
        padding: 20px;
    }

    .sync-user-list {
        max-height: 250px;
    }
}

/* ========================
 * 自定义输入对话框样式 (替代 prompt)
 * ======================== */

.custom-prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.2s;
}

.custom-prompt-dialog {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 15px;
    padding: 25px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideUp 0.3s ease-out;
}

/* 不支持 backdrop-filter 的降级 */
@supports not (backdrop-filter: blur(20px)) {
    .custom-prompt-dialog {
        background: rgba(40, 44, 52, 0.95);
    }
}

.custom-prompt-title {
    color: white;
    font-size: 1.1em;
    margin-bottom: 15px;
    font-weight: 500;
}

.custom-prompt-input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 0.95em;
    margin-bottom: 20px;
}

.custom-prompt-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.15);
}

.custom-prompt-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.custom-prompt-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.custom-prompt-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.custom-prompt-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.custom-prompt-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}

.custom-prompt-confirm {
    background: var(--primary);
    color: white;
}

.custom-prompt-confirm:hover {
    background: var(--secondary);
}

