*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.1);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #1e1b4b;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.08);
    --bg-input: #f1f5f9;
    --bg-message-ai: #f0f0ff;
    --bg-message-human: #eef2ff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-sidebar: rgba(255, 255, 255, 0.7);
    --text-sidebar-active: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: 0.2s ease;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

#app {
    height: 100vh;
    display: flex;
}

.hidden {
    display: none !important;
}

.page {
    height: 100%;
    width: 100%;
}

/* Auth */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
}

.auth-container {
    width: 420px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    margin-bottom: 16px;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.auth-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-input);
    transition: var(--transition);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg-card);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
}

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

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

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

.btn-text {
    background: transparent;
    color: var(--primary);
    padding: 6px 12px;
}

.btn-text:hover {
    background: var(--primary-light);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-sidebar);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--bg-sidebar-hover);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.remember-me input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--primary);
}

.btn-send {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Layout */
#auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
}

#main-page {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-sidebar-active);
}

.sidebar-search {
    padding: 12px 16px;
}

.sidebar-search input {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-sidebar-active);
    font-size: 13px;
    font-family: inherit;
}

.sidebar-search input::placeholder {
    color: var(--text-sidebar);
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-rooms {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-sidebar);
    position: relative;
}

.room-item:hover {
    background: var(--bg-sidebar-hover);
}

.room-item.active {
    background: rgba(99, 102, 241, 0.2);
    color: var(--text-sidebar-active);
}

.room-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.room-info {
    flex: 1;
    min-width: 0;
}

.room-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-meta {
    font-size: 12px;
    color: var(--text-sidebar);
    opacity: 0.7;
}

/* 群列表 @ 提醒角标（微信风格红色文字） */
.room-badge {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.room-badge-mention {
    color: var(--danger);
    animation: badgePopIn 0.3s ease;
}

@keyframes badgePopIn {
    from { transform: translateY(-50%) scale(0.8); opacity: 0; }
    to { transform: translateY(-50%) scale(1); opacity: 1; }
}

/* 桌面通知请求提示条 */
.notification-prompt {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 20px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

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

.notification-prompt .btn {
    white-space: nowrap;
    font-size: 12px;
    padding: 6px 14px;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.admin-entry {
    color: var(--text-sidebar);
    font-size: 12px;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.admin-entry:hover {
    background: rgba(99, 102, 241, 0.15);
    color: #c7d2fe;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    flex: 1;
    min-width: 0;
}

.user-info:hover {
    background: var(--bg-sidebar-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

#user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-sidebar-active);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-signature {
    font-size: 11px;
    color: var(--text-sidebar);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.7;
}

.user-signature:empty {
    display: none;
}

#logout-btn {
    color: var(--text-sidebar);
    font-size: 13px;
}

#logout-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Empty State */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-secondary);
}

.empty-state h2 {
    font-size: 20px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 8px;
}

.empty-state-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-show-sidebar {
    display: none;
    gap: 6px;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.chat-header-info h2 {
    font-size: 16px;
    font-weight: 600;
}

.chat-room-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-room-invite {
    font-size: 12px;
    color: var(--primary);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-room-invite code {
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    background: rgba(99, 102, 241, 0.1);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--primary);
}

.chat-header-actions {
    display: flex;
    gap: 4px;
}

.chat-header-actions .btn-icon {
    color: var(--text-secondary);
}

.chat-header-actions .btn-icon:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #ededed;
}

.message {
    display: flex;
    gap: 10px;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

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

.message.human {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.ai {
    align-self: flex-start;
}

.message.system {
    align-self: center;
    max-width: 60%;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: opacity 0.15s;
}

.message-avatar:hover {
    opacity: 0.85;
}

.message-avatar-clickable {
    cursor: pointer;
}

.message-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.message-header {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    padding: 0 4px;
}

.message.human .message-header {
    display: none;
}

.message.ai .message-header {
    display: block;
}

.message-content {
    padding: 9px 12px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    position: relative;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.05);
    max-width: 100%;
}

.message.human .message-content {
    background: #95EC69;
    color: #000;
}

.message.ai .message-content {
    background: #ffffff;
    color: #000;
}

/* 微信样式小尾巴 */
.message.ai .message-content::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 6px solid #ffffff;
}

.message.human .message-content::before {
    content: '';
    position: absolute;
    right: -5px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 6px solid #95EC69;
}

.message.system .message-content {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    box-shadow: none;
    border-radius: 4px;
}

.message.system .message-content::before {
    display: none;
}

.message-time {
    display: none;
}

/* 待服务端确认的消息（已本地回显，未收到回执） */
.message.message-pending .message-content {
    opacity: 0.6;
}

.mentioned-highlight {
    color: var(--primary);
    font-weight: 600;
    transition: background 0.15s;
    border-radius: 2px;
    padding: 0 2px;
}

.mentioned-highlight:hover {
    background: var(--primary-light);
}

.mentioned-highlight.all {
    color: var(--danger);
}

.mentioned-highlight.all:hover {
    background: rgba(239, 68, 68, 0.08);
}

/* 被 @ 时消息气泡的永久提醒标记（微信风格：左侧红条 + 淡黄背景） */
.message.mentioned-me .message-content {
    border-left: 3px solid var(--danger);
    background: rgba(254, 240, 240, 0.6);
    padding-left: 9px;
}

/* 暗色模式下 */
@media (prefers-color-scheme: dark) {
    .message.mentioned-me .message-content {
        background: rgba(239, 68, 68, 0.08);
    }
}

/* 时间分隔（按 5 分钟分组） */
.time-divider {
    text-align: center;
    padding: 6px 0;
    width: 100%;
}

.time-divider span {
    font-size: 12px;
    color: #b2b2b2;
    background: transparent;
    padding: 2px 8px;
}

/* 日期分隔线 */
.date-divider {
    text-align: center;
    padding: 8px 0;
    grid-column: 1 / -1;
    width: 100%;
    display: flex;
    justify-content: center;
}

.date-divider span {
    font-size: 12px;
    color: #b2b2b2;
    background: transparent;
    padding: 2px 8px;
    border: none;
    border-radius: 0;
}

/* 打字指示器 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
    animation: fadeIn 0.3s ease;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-light);
    animation: typingBounce 1.4s infinite both;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.typing-text {
    font-size: 12px;
    color: var(--text-light);
    margin-left: 4px;
}

/* Chat Input */
.chat-input-area {
    padding: 16px 24px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    position: relative;
}

/* @提及下拉面板 - 参考微信/钉钉交互 */
.mention-panel {
    position: absolute;
    bottom: 100%;
    left: 24px;
    right: 24px;
    margin-bottom: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
    display: block;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.mention-panel.hidden {
    display: block !important;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
}

.mention-panel-header {
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.mention-list {
    padding: 6px;
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.mention-item:hover,
.mention-item.mention-active {
    background: var(--primary-light);
}

.mention-item.mention-item-all {
    background: rgba(239, 68, 68, 0.05);
}

.mention-item.mention-item-all:hover,
.mention-item.mention-item-all.mention-active {
    background: rgba(239, 68, 68, 0.12);
}

.mention-item.mention-item-all .mention-name {
    color: var(--danger);
}

.mention-item.mention-active .mention-name {
    color: var(--primary);
}

.mention-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

.mention-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.mention-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.mention-type {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
    display: inline-block;
    margin-top: 2px;
    width: fit-content;
}

/* 输入框区域 */
.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-input);
    border-radius: var(--radius);
    padding: 8px 12px;
    border: 1.5px solid transparent;
    transition: var(--transition);
    position: relative;
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary);
    background: var(--bg-card);
}

/* @成员标签 - 真正流在文字中（参考微信/钉钉 contenteditable 方案） */
.mention-tag {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    user-select: all;       /* 整体选中 */
    cursor: default;
    margin: 0 1px;
    vertical-align: baseline;
}

.mention-tag.mention-tag-all {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* contenteditable 输入框 */
.chat-input {
    flex: 1;
    min-width: 120px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    max-height: 120px;
    min-height: 24px;
    line-height: 1.5;
    color: var(--text-primary);
    padding: 0;
    overflow-y: auto;
    word-break: break-word;
    white-space: pre-wrap;
}

.chat-input:empty::before {
    content: attr(data-placeholder);
    color: var(--text-light);
    pointer-events: none;
}

.chat-input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.chat-input-actions .btn-icon {
    color: var(--text-light);
}

.chat-input-actions .btn-icon:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.chat-input-actions .btn-icon.active {
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

/* Members Panel */
.members-panel {
    width: 280px;
    min-width: 280px;
    border-left: 1px solid var(--border);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.members-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.members-panel-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.members-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.member-item:hover {
    background: var(--bg-input);
}

/* 点击消息 @ 标签时成员的高亮闪烁 */
.member-highlight-flash {
    animation: memberFlash 0.8s ease;
}

@keyframes memberFlash {
    0%   { background: var(--primary-light); transform: scale(1.03); }
    100% { background: transparent; transform: scale(1); }
}

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: opacity 0.15s;
}

.member-avatar:hover {
    opacity: 0.85;
}

.member-info {
    flex: 1;
    min-width: 0;
}

.member-name {
    font-size: 14px;
    font-weight: 600;
}

.member-tag {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.member-tag.human-tag {
    background: #dbeafe;
    color: #2563eb;
}

.member-tag.ai-tag {
    background: #ede9fe;
    color: #7c3aed;
}

.member-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.member-item:hover .member-actions {
    opacity: 1;
}

.member-actions .btn-icon {
    width: 28px;
    height: 28px;
    color: var(--text-light);
}

.member-actions .btn-icon:hover {
    background: var(--bg-input);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.2s ease;
}

/* AI 成员弹窗：加宽并增大提示词输入框 */
#create-room-modal,
#add-ai-modal,
#edit-ai-modal {
    width: 620px;
}

#new-ai-prompt,
#edit-ai-prompt {
    min-height: 160px;
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-input);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* AI Member Form */
.ai-member-form {
    display: grid;
    grid-template-columns: 1fr 40px;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.ai-member-form .ai-prompt-input {
    grid-column: 1 / -1;
    min-height: 120px;
    resize: vertical;
}

.ai-member-form input,
.ai-member-form textarea {
    margin-bottom: 0;
}

.ai-member-form .btn-remove-ai {
    margin-top: 4px;
}

.ai-member-form .btn-remove-ai {
    color: var(--text-light);
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    margin-top: 0;
}

.ai-member-form .btn-remove-ai:hover {
    color: var(--danger);
    background: rgba(238, 34, 51, 0.1);
}

/* Auto Chat Status */
.auto-chat-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

.auto-chat-quota {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-secondary, #888);
}

.auto-chat-quota.empty {
    color: var(--danger, #e23);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-light);
}

.status-dot.active {
    background: var(--success);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ===== 表情回应 (Reaction Bar) ===== */
.reaction-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    color: var(--text-secondary);
    user-select: none;
}

.reaction-badge:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.reaction-badge.reacted {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

/* 行内 [+] 按钮（放在消息内容末尾） */
.reaction-add-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--text-light);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
    margin-left: 4px;
    vertical-align: middle;
    opacity: 0;
    font-family: inherit;
    line-height: 1;
    flex-shrink: 0;
}

.message:hover .reaction-add-inline {
    opacity: 1;
}

.reaction-add-inline:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    border-style: solid;
}

/* 表情选择器弹出框 */
.reaction-picker {
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 200;
}

.reaction-picker-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
    font-family: inherit;
}

.reaction-picker-item:hover {
    background: var(--bg-input);
    transform: scale(1.2);
}

/* ===== 表情选择器 ===== */
.emoji-panel {
    position: absolute;
    bottom: 100%;
    right: 12px;
    margin-bottom: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.12);
    z-index: 100;
    width: 320px;
    max-height: 260px;
    overflow-y: auto;
    padding: 8px;
}

.emoji-list {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.emoji-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: transparent;
    padding: 0;
    user-select: none;
}

.emoji-item:hover {
    background: var(--bg-input);
}

.emoji-item:active {
    background: var(--primary-light);
    transform: scale(1.15);
}

/* 返回按钮（移动端可见） */
.btn-back {
    color: var(--text-secondary);
    display: none;
}

.btn-back:hover {
    color: var(--primary);
    background: var(--primary-light);
}

/* 关闭侧边栏按钮（移动端可见） */
.btn-close-sidebar {
    display: none;
}

/* 关闭成员面板按钮（移动端可见） */
.btn-close-members {
    display: none;
    color: var(--text-secondary);
}

.btn-close-members:hover {
    color: var(--text-primary);
    background: var(--bg-input);
}

/* 侧边栏遮罩 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

/* 聊天头部左侧区域 */
.chat-header-left {
    display: none;
    align-items: center;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    /* 侧边栏 - 移动端抽屉式 */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 110;
        width: 85vw;
        max-width: 320px;
        min-width: 260px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.visible {
        opacity: 1;
        pointer-events: auto;
    }

    .btn-close-sidebar {
        display: flex;
    }

    .sidebar-header-actions {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    /* 聊天头部 - 移动端显示返回按钮 */
    .chat-header-left {
        display: flex;
        align-items: center;
    }

    .btn-back {
        display: flex;
    }

    /* 成员面板 - 移动端全屏覆盖 */
    .members-panel {
        position: fixed;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        min-width: 100%;
        z-index: 100;
        box-shadow: none;
    }

    .members-panel-header {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .members-panel-header h3 {
        flex: 1;
        text-align: center;
    }

    .btn-close-members {
        display: flex;
        flex-shrink: 0;
    }

    .members-panel-header-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
    }

    /* 消息气泡 - 移动端放宽 */
    .message {
        max-width: 90%;
    }

    .message.system {
        max-width: 85%;
    }

    /* 消息区域 - 减少内边距 */
    .chat-messages {
        padding: 12px 12px;
    }

    /* 输入区域 - 移动端适配 */
    .chat-input-area {
        padding: 10px 12px;
    }

    .chat-input-wrapper {
        padding: 6px 10px;
        gap: 8px;
    }

    .chat-input {
        font-size: 15px;
        min-height: 22px;
        max-height: 100px;
    }

    .chat-input-actions {
        gap: 4px;
    }

    .chat-input-actions .btn-icon {
        width: 32px;
        height: 32px;
    }

    .btn-send {
        width: 36px;
        height: 36px;
    }

    /* 表情面板 - 移动端适配 */
    .emoji-panel {
        width: 100%;
        left: 0;
        right: 0;
        border-radius: var(--radius) var(--radius) 0 0;
        max-height: 220px;
        padding: 6px;
    }

    .emoji-list {
        grid-template-columns: repeat(7, 1fr);
        gap: 2px;
    }

    .emoji-item {
        width: 100%;
        height: 34px;
        font-size: 18px;
    }

    /* 聊天头部 */
    .chat-header {
        padding: 10px 12px;
    }

    .chat-header-info h2 {
        font-size: 15px;
    }

    .chat-room-meta {
        font-size: 11px;
    }

    /* @ 面板 */
    .mention-panel {
        left: 0;
        right: 0;
        max-height: 200px;
    }

    /* 模态框 - 移动端全屏/接近全屏 */
    .modal {
        width: 95vw;
        max-width: 95vw;
        max-height: 90vh;
        border-radius: var(--radius-lg);
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-header h3 {
        font-size: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
        gap: 8px;
    }

    .modal-footer .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    /* 认证容器 - 移动端适配 */
    .auth-container {
        width: 90vw;
        max-width: 400px;
        padding: 28px 24px;
    }

    .auth-header h1 {
        font-size: 22px;
    }

    /* 表单 */
    .form-group input,
    .form-group textarea {
        font-size: 16px; /* 防止 iOS 缩放 */
        padding: 10px 12px;
    }

    .form-group textarea {
        min-height: 60px;
    }

    /* AI 成员表单 - 移动端垂直排列 */
    .ai-member-form {
        flex-direction: column;
        gap: 6px;
    }

    .ai-member-form input,
    .ai-member-form textarea {
        flex: none;
        width: 100%;
    }

    /* 空状态 */
    .empty-state {
        padding: 24px;
        text-align: center;
    }

    .empty-state h2 {
        font-size: 17px;
    }

    .empty-state p {
        font-size: 13px;
    }

    .btn-show-sidebar {
        display: inline-flex;
    }

    .empty-state-actions {
        flex-direction: column;
        width: 100%;
        max-width: 240px;
    }

    .empty-state-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* 通知提示条 */
    .notification-prompt {
        left: 16px;
        right: 16px;
        transform: none;
        font-size: 13px;
        padding: 10px 14px;
    }

    /* 隐藏桌面端某些元素 */
    #auto-chat-btn {
        /* 移动端保留但缩小 */
    }

    /* 确保 input 输入不被遮挡 */
    input, textarea, [contenteditable] {
        -webkit-appearance: none;
        border-radius: var(--radius-sm);
    }
}

/* 小屏手机优化 (iPhone SE 等) */
@media (max-width: 375px) {
    .chat-messages {
        padding: 8px 8px;
    }

    .chat-input-area {
        padding: 8px 10px;
    }

    .chat-input-wrapper {
        padding: 6px 8px;
        gap: 6px;
    }

    .chat-input {
        font-size: 14px;
    }

    .emoji-panel {
        max-height: 200px;
    }

    .emoji-list {
        grid-template-columns: repeat(6, 1fr);
    }

    .emoji-item {
        height: 32px;
        font-size: 17px;
    }

    .message {
        max-width: 95%;
    }

    .message-content {
        font-size: 13px;
        padding: 8px 10px;
    }

    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .chat-header {
        padding: 8px 10px;
    }

    .chat-header-info h2 {
        font-size: 14px;
    }
}

/* 横屏手机适配 */
@media (max-width: 900px) and (orientation: landscape) {
    .chat-messages {
        padding: 8px 12px;
    }

    .chat-input-area {
        padding: 8px 12px;
    }

    .message {
        max-width: 75%;
    }

    .emoji-panel {
        max-height: 160px;
    }
}

/* ===== 多人类群聊：角色徽章 / 成员栏 / 邀请-退群 / @ 分组 ===== */

.room-role-badge {
    display: inline-block;
    font-size: 10px;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: 1px;
    font-weight: 600;
}

.room-role-badge.owner {
    background: rgba(99, 102, 241, 0.18);
    color: #c7d2fe;
}

.room-role-badge.member {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.75);
}

.members-header-bar {
    display: none;
}

#leave-room-btn {
    color: #ef4444;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
}

#leave-room-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

#add-member-btn {
    font-size: 13px;
}

.add-member-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.member-tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.member-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.add-member-pane {
    display: none;
}

.add-member-pane.active {
    display: block;
}

.me-tag {
    font-size: 10px;
    color: var(--primary);
    background: var(--primary-light);
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    font-weight: 500;
}

.kick-btn {
    margin-left: auto;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #999);
    cursor: pointer;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.member-item:hover .kick-btn {
    opacity: 1;
}

.kick-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.mention-group-title {
    font-size: 11px;
    color: var(--text-secondary, #999);
    padding: 6px 12px 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}

/* 背景音乐控件 */
.music-btn.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.12);
}

.music-panel {
    position: fixed;
    top: 68px;
    right: 24px;
    width: 300px;
    max-height: calc(100vh - 100px);
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.music-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.music-panel-header h4 {
    margin: 0 0 2px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.music-panel-header p {
    margin: 0;
    font-size: 11px;
    color: var(--text-secondary);
}

.music-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

#music-mode-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 16px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    color: var(--text-secondary);
}

#music-mode-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

/* 播放控件行（上一首 / 播放暂停 / 下一首） */
.music-controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-shrink: 0;
    margin-bottom: 10px;
}

.music-ctrl-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.music-ctrl-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.music-ctrl-btn:active {
    transform: scale(0.92);
}

.music-play-btn {
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 13px;
    min-width: 72px;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* 歌单列表 - 可滚动 */
.music-track-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    min-height: 0;
}

/* 分组标签 */
.music-group-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    padding: 8px 4px 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* 歌单项 */
.music-track-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    gap: 8px;
}

.music-track-item:hover {
    background: var(--bg-input);
}

.music-track-item.active {
    background: rgba(99, 102, 241, 0.08);
    border-left: 3px solid var(--primary);
    padding-left: 7px;
}

.music-track-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.music-track-icon {
    font-size: 14px;
    flex-shrink: 0;
    opacity: 0.7;
}

.music-track-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-track-item.active .music-track-name {
    color: var(--primary);
}

.music-track-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.music-track-item:hover .music-track-actions {
    opacity: 1;
}

.music-track-delete {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 4px;
    padding: 0;
}

.music-track-delete:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* 空状态提示 */
.music-empty-hint {
    font-size: 12px;
    color: var(--text-light);
    padding: 12px 10px;
    text-align: center;
}

/* 进度条行 */
.music-progress-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-bottom: 10px;
    padding: 0 2px;
}

.music-time {
    font-size: 11px;
    color: var(--text-light);
    min-width: 36px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.music-progress-bar {
    flex: 1;
    height: 24px;
    padding: 9px 0;   /* 视觉上 6px 高度条，上下各 9px 点击热区 */
    background: transparent;
    cursor: pointer;
    position: relative;
    box-sizing: border-box;
}

/* 实际的轨道背景 */
.music-progress-bar::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    pointer-events: none;
    z-index: 0;
}

.music-progress-bar:hover::before {
    height: 8px;
    border-radius: 4px;
}

.music-progress-fill {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    background: var(--primary);
    border-radius: 3px;
    width: 0%;
    pointer-events: none;
    z-index: 1;
}

.music-progress-bar:hover .music-progress-fill {
    height: 8px;
    border-radius: 4px;
    background: var(--primary-hover);
}

.music-progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
    z-index: 2;
    margin-top: 0;
}

.music-progress-bar:hover .music-progress-thumb,
.music-progress-bar.dragging .music-progress-thumb {
    opacity: 1;
}

/* 音量行 */
.music-volume-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-bottom: 8px;
}

.music-volume-row input {
    flex: 1;
}

/* 上传行 */
.music-upload-row {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

.music-upload-row .btn {
    width: 100%;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    padding: 6px 12px;
}

/* 移动端音乐面板 */
@media (max-width: 768px) {
    .music-panel {
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 50vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}

/* ─── 反馈面板 ──────────────────────────────────────── */

.feedback-categories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.feedback-cat-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    background: var(--bg-secondary);
    color: var(--text);
    font-family: inherit;
    line-height: 1.4;
}

.feedback-cat-option:hover {
    border-color: var(--primary);
}

.feedback-cat-option.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.feedback-success {
    text-align: center;
    padding: 24px 0;
}

.feedback-success svg {
    margin-bottom: 12px;
}

.feedback-success p {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.feedback-success-sub {
    font-size: 13px !important;
    font-weight: 400 !important;
    color: var(--text-secondary) !important;
}

#feedback-modal .form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
    resize: vertical;
}

#feedback-modal .form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ─── 用户名片弹窗 ──────────────────────────────── */

#profile-card-modal .modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
}

.profile-card-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    border: 3px solid var(--primary-light);
    flex-shrink: 0;
}

.profile-card-info {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-card-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-card-username {
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-card-signature {
    font-size: 13px;
    color: var(--text-light);
    font-style: italic;
    padding: 6px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    max-width: 280px;
    word-break: break-word;
}

.profile-card-signature:empty {
    display: none;
}

.profile-card-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.profile-card-dot {
    color: var(--border);
}

#profile-card-modal .modal-header {
    border-bottom: none;
    padding-bottom: 8px;
}

#feedback-modal textarea.form-input {
    min-height: 100px;
}

/* ─── 加入群聊弹窗 ──────────────────────────────────── */

.join-room-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.join-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s;
}

.join-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 500;
}

.join-tab:hover {
    color: var(--text);
}

.join-tab-pane {
    display: none;
}

.join-tab-pane.active {
    display: block;
}

.join-search-row {
    display: flex;
    gap: 8px;
}

.join-search-row .form-input {
    flex: 1;
}

.join-search-results {
    margin-top: 12px;
    max-height: 240px;
    overflow-y: auto;
}

.join-loading,
.join-error {
    text-align: center;
    padding: 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

.join-error {
    color: #ef4444;
}

.join-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.join-result-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.join-result-info {
    flex: 1;
    min-width: 0;
}

.join-result-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 2px;
}

.join-result-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.join-result-code {
    font-family: monospace;
    letter-spacing: 1px;
}

.join-result-join-btn {
    flex-shrink: 0;
    margin-left: 8px;
}

.join-search-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ─── 个人资料编辑弹窗 ──────────────────────────────── */

#profile-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-avatar-section {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.profile-avatar-preview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    border: 3px solid var(--primary-light);
}

.profile-avatar-input {
    flex: 1;
    min-width: 0;
}

.avatar-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.avatar-upload-btn {
    cursor: pointer;
    flex-shrink: 0;
}

.avatar-upload-hint {
    font-size: 11px;
    color: var(--text-light);
}

.avatar-upload-hint.uploaded {
    color: #22c55e;
}

.profile-avatar-input label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 6px;
}

.profile-avatar-input .form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
}

.profile-avatar-input .form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.profile-info-tip {
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
    padding: 4px 0;
}

.profile-info-tip strong {
    color: var(--text-secondary);
}

#profile-modal .form-group {
    margin-bottom: 0;
}

#profile-modal .form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
}

#profile-modal .form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}