/* 移动端版本：全屏背景 */
html,
body {
    background-color: var(--bg-color) !important;
}

/* --- 1. 核心配色与布局 --- */
:root {
    --case-color: #dbeafe;
    --case-border: #bfdbfe;
    --bg-color: #eff6ff;
    --bubble-me: #ffadc0;
    --bubble-ai: #ffffff;
    --text-dark: #1e3a8a;
    --text-light: #60a5fa;
    --pink-btn: #a4d3ff;
    /* 安全区域变量 */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    height: 100dvh;
    /* 移动端动态视口高度 */
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-color) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", sans-serif;
    overflow: hidden;
    user-select: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* 移动端触摸优化 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* 移动端版本：全屏容器 */
.phone-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
}

/* 移动端版本：全屏布局 */
.phone-case {
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    border-radius: 0;
    border: none;
    box-shadow: none;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* 安全区域适配 */
    padding-top: var(--safe-area-top);
    padding-bottom: var(--safe-area-bottom);
}

/* 移动端版本：以下桌面端装饰样式已移除 */
/* status-bar, camera-notch, window-btn, resize-handle 不再需要 */

.status-bar,
.camera-notch,
.window-btn,
.resize-handle {
    display: none !important;
}

/* 屏幕切换逻辑 */
.screen {
    flex: 1;
    display: none;
    flex-direction: column;
    background: var(--bg-color);
    overflow: hidden;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.screen.active {
    display: flex;
    animation: screenFadeIn 0.2s ease-out;
}

@keyframes screenFadeIn {
    from {
        opacity: 0;
        transform: translateZ(0) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateZ(0) scale(1);
    }
}

/* 导航头 */
.nav-header {
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-dark);
    font-weight: bold;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
}

.nav-btn {
    background: transparent;
    border: none;
    width: auto;
    height: auto;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 25px;
    font-weight: bold;
}

.nav-btn img {
    width: 25px;
    height: 25px;
}

/* --- 列表页样式 --- */
.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.content-scroll::-webkit-scrollbar {
    display: none;
}

/* 隐藏滚动条 */

.list-item {
    background: #ffffff94;
    padding: 6px;
    border-radius: 10px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.15s ease-out, background 0.2s;
    transform: translateZ(0);
    will-change: transform;
}

.list-item:active {
    transform: translateZ(0) scale(0.98);
}

.list-avatar {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    /* 方形圆角 */
    object-fit: cover;
    background: #eee;
}

.list-info h4 {
    margin: 0;
    color: var(--text-dark);
    font-size: 15px;
}

.list-info p {
    margin: 4px 0 0 0;
    color: #696969;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.list-info p::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
}

.del-btn {
    color: #f87171;
    margin-left: auto;
    font-size: 12px;
    padding: 5px;
}

/* --- 聊天室样式 --- */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: none;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.chat-area::-webkit-scrollbar {
    display: none;
}

.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.msg-row.me {
    flex-direction: row-reverse;
}

.chat-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background-color: white;
    border: none;
    object-fit: cover;
}

.bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.msg-row.ai .bubble {
    background: #d6ecffe0;
    color: #444444;
    border-bottom-left-radius: 4px;
}

.msg-row.me .bubble {
    background: #ffffffe0;
    color: #444444;
    border-bottom-right-radius: 4px;
}

/* --- 底部输入栏 --- */
.input-bar {
    padding: 10px;
    background: white;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid #eef2ff;
}

.input-box {
    flex: 1;
    background: #f1f5f9;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    outline: none;
    color: #333;
    font-size: 14px;
}

/* 粉色爱心按钮 */
.pink-heart-btn {
    background: var(--pink-btn);
    color: white;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: transform 0.15s ease-out;
    will-change: transform;
}

.pink-heart-btn:active {
    transform: scale(0.9);
}

.send-btn {
    background: var(--text-light);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: transform 0.1s ease-out, opacity 0.1s;
}

.send-btn:active {
    transform: scale(0.9);
    opacity: 0.8;
}

/* --- 弹窗样式 (支持滚动) --- */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 10;
    display: none;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    transform: translateZ(0);
}

.modal.show {
    display: flex;
    animation: fadeUp 0.25s ease-out;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(15px) translateZ(0);
    }

    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

.modal-header {
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-dark);
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 5px;
    font-weight: bold;
}

.setting-input,
.setting-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
}

.setting-textarea {
    height: 80px;
    resize: none;
}

/* 头像上传预览 */
.avatar-upload-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 10px;
}

.avatar-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px dashed #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    font-size: 10px;
    color: #94a3b8;
}

.hidden-input {
    display: none;
}

.primary-btn {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    background: var(--text-light);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.15s ease-out, opacity 0.15s;
}

.primary-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.cancel-btn {
    text-align: center;
    margin-top: 15px;
    color: #999;
    cursor: pointer;
    font-size: 14px;
}

/* --- iOS风格首页样式 --- */
/* 桌面壁纸 */
.desktop-wallpaper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    background-position: center;
    z-index: 0;
}

/* Dock栏容器 */
.dock-container {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 10;
}

/* Dock图标 */
.dock-icon {
    width: 45px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
    transform: translateZ(0);
}

.dock-icon:hover {
    transform: translateY(-6px) scale(1.15) translateZ(0);
}

.dock-icon:active {
    transform: translateY(-6px) scale(1.05) translateZ(0);
}

/* 图标SVG容器 - 超透明磨砂气泡 */
.icon-svg {
    width: 30px;
    height: 30px;
    padding: 8px;
    position: relative;
    /* 渐变背景 - 更透明 */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.1) 100%);
    /* 降低模糊度 - 更通透 */
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    border-radius: 12px;
    /* 明亮边框 - 更透明 */
    border: 1px solid rgba(255, 255, 255, 0.3);
    /* 柔和阴影 + 光泽 */
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.05),
        0 1px 3px rgba(0, 0, 0, 0.08),
        inset 0 1px 1px rgba(255, 255, 255, 0.8),
        inset 0 -1px 1px rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 顶部高光层 */
.icon-svg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 12px 12px 0 0;
    pointer-events: none;
}

/* 图标内的图片 */
.icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
}

.dock-icon:hover .icon-svg {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.15) 100%);
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.08),
        0 2px 6px rgba(0, 0, 0, 0.05),
        inset 0 1px 1px rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
}

/* 图标标签 */
.icon-label {
    font-size: 9px;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    font-weight: 500;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

/* 时钟组件 */
.clock-widget {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    padding: 20px;
    border-radius: 20px;
    text-align: center;
    z-index: 5;
}

/* 日期信息 */
.clock-date {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    margin-bottom: -6px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* 时间显示 */
.clock-time {
    font-size: 70px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.98);
    text-shadow:
        0 2px 8px rgba(0, 0, 0, 0.2);
    font-family: 'Inter', -apple-system, sans-serif;
}

/* 壁纸预览 */
.wallpaper-preview {
    width: 100%;
    height: 200px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    color: #94a3b8;
    font-size: 14px;
    transition: border-color 0.3s;
}

.wallpaper-preview:hover {
    border-color: #93c5fd;
}

/* 底部条 */
.home-indicator {
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
}

.home-bar {
    width: 100px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
}

/* --- 工具栏与表情面板 --- */
.toolbar {
    padding: 1px 15px 0 15px;
    /* 上左右留白 */
    background: white;
    display: flex;
    gap: 15px;
    border-top: 1px solid #eef2ff;
}

.tool-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s, transform 0.15s;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transform: translateZ(0);
}

.tool-btn svg {
    width: 22px;
    height: 22px;
    stroke: #60a5fa;
    fill: none;
    stroke-width: 2;
}

.tool-btn:hover {
    background-color: #f1f5f9;
}

.tool-btn:active {
    transform: translateZ(0) scale(0.95);
}

/* 表情面板容器 */
.sticker-panel {
    height: 0;
    overflow: hidden;
    background: #fff;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid #f1f5f9;
}

.sticker-panel.open {
    height: 150px;
    /* 展开高度 */
}

.sticker-grid {
    padding: 10px 15px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    /* 一行5个 */
    gap: 10px;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
}

/* 单个表情 */
.sticker-item {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    position: relative;
}

.sticker-item:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.sticker-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* 添加按钮样式 */
.add-sticker-btn {
    font-size: 24px;
    color: #94a3b8;
    background: #f1f5f9;
}

/* --- 转账卡片样式 --- */
.bubble-transfer {
    background-color: #f79c4a !important;
    /* 微信转账橙 */
    color: white !important;
    padding: 0 !important;
    /* 去掉默认内边距,我们自己布局 */
    width: 230px;
    border-radius: 12px !important;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(247, 156, 74, 0.3);
}

/* 收款后变色 - 使用浅橙色背景，文字变深 */
.bubble-transfer.received {
    background-color: #fcebc6 !important;
    color: #8b5a2b !important;
}

.bubble-transfer.received .transfer-icon {
    background-color: #ffca65 !important;
    border-color: #e8b85a !important;
    color: white !important;
}

.bubble-transfer.received .transfer-footer {
    background: rgba(139, 90, 43, 0.1) !important;
    color: #8b5a2b !important;
}

/* 已拒收状态 */
.bubble-transfer.rejected {
    background-color: #e8e8e8 !important;
    color: #888 !important;
}

.bubble-transfer.rejected .transfer-icon {
    background-color: #aaa !important;
    border-color: #999 !important;
    color: white !important;
}

.bubble-transfer.rejected .transfer-footer {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #888 !important;
}

.transfer-content {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.transfer-icon {
    width: 40px;
    height: 40px;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

.transfer-info {
    display: flex;
    flex-direction: column;
}

.transfer-amount {
    font-size: 16px;
    font-weight: bold;
}

.transfer-desc {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.transfer-footer {
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 15px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.9);
}

/* --- 引用预览样式 --- */
.quote-preview {
    background: #f8f9fa;
    border-top: 1px solid #e2e8f0;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.quote-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 3px solid #60a5fa;
}

.quote-text {
    flex: 1;
    font-size: 13px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quote-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quote-close:hover {
    color: #64748b;
}

/* --- 气泡内引用样式 --- */
.bubble-quote {
    background: rgba(0, 0, 0, 0.05);
    padding: 6px 10px;
    border-radius: 6px;
    border-left: 3px solid rgba(96, 165, 250, 0.5);
    margin-bottom: 6px;
    font-size: 12px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg-row.me .bubble-quote {
    border-left-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.3);
    color: rgba(115, 115, 115, 0.8);
}

/* --- 消息时间样式 --- */
.msg-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
}

.msg-row.me .msg-time {
    text-align: right;
}

.msg-row.ai .msg-time {
    text-align: left;
    margin-left: 44px;
}

.time-divider {
    text-align: center;
    padding: 10px 0;
}

.time-divider span {
    font-size: 12px;
    color: #9ca3af;
    background: rgba(229, 231, 235, 0.6);
    padding: 4px 12px;
    border-radius: 12px;
}

/* --- 右键菜单样式 --- */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
    z-index: 9999;
    min-width: 120px;
    display: none;
}

.context-menu.show {
    display: block;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #334155;
    transition: background 0.2s;
}

.context-menu-item:hover {
    background: #f1f5f9;
}

.context-menu-item.delete {
    color: #ef4444;
}

/* --- 手机挂饰样式 --- */
.phone-charm {
    position: absolute;
    /* 位置和大小现在直接在HTML标签里调节 */
    z-index: 200;
    pointer-events: auto;
    /* filter: drop-shadow(...); 移到HTML里方便调节 */
    transform-origin: top center;
}



.phone-charm img {
    width: 100%;
    height: auto;
    display: block;
    /* 初始状态稍微有点自然下垂的感觉 */
    transform-origin: 50% 0;
    /* 图片的顶部中心作为旋转点 */
    transition: transform 0.3s ease-out;
}

/* 鼠标悬停时的摆动动画 (改用JS控制，兼容PyQt6) */
.phone-charm.swinging img {
    animation: charmSwing 1.5s ease-in-out infinite;
}

@keyframes charmSwing {
    0% {
        transform: rotate(0deg);
    }

    20% {
        transform: rotate(15deg);
    }

    40% {
        transform: rotate(-12deg);
    }

    60% {
        transform: rotate(8deg);
    }

    80% {
        transform: rotate(-4deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

/* --- AI通知弹框样式 --- */
.ai-notification {
    position: absolute;
    top: 180px;
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 100;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.ai-notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.ai-notification-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.ai-notification-time {
    font-size: 12px;
    color: #9ca3af;
}

.ai-notification-content {
    font-size: 14px;
    color: #64748b;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- 表情面板 Tabs 样式 --- */
.sticker-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sticker-tab {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    cursor: pointer;
    font-size: 18px;
    color: #94a3b8;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.sticker-tab:hover {
    background: #f1f5f9;
}

.sticker-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: white;
}

/* Emoji 特殊样式 */
.emoji-item {
    font-size: 20px;
    /* 缩小一点 */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
    user-select: none;
}

.emoji-item:active {
    background: #e2e8f0;
    transform: scale(0.9);
}

/* 调整表情面板高度，留出 tab 的空间 */
.sticker-panel.open {
    height: 220px;
    /* 稍微增高一点 */
    display: flex;
    flex-direction: column;
}

/* 复用 sticker-grid 但去掉高度限制，让父容器控制 */
.sticker-grid {
    flex: 1;
    /* 正确填满剩余空间 */
    overflow-y: auto;
    padding: 10px;
    height: auto;
}

/* 专门针对 Emoji 列表的 8 列布局 */
#emoji-list {
    grid-template-columns: repeat(8, 1fr) !important;
    gap: 5px !important;
    /* 缩小间距 */
}

/* =========================================
   气泡样式系统
   使用方式：在 .chat-area 上添加 .bubble-style-xxx 类
   注意：所有样式排除 .bubble-transfer 以保护转账气泡
========================================= */

/* --- 1. 水光果冻 (Jelly) --- */
.bubble-style-jelly .bubble:not(.bubble-transfer) {
    border-radius: 50px !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    backdrop-filter: blur(5px);
    box-shadow:
        inset 0 3px 6px rgba(255, 255, 255, 0.9),
        inset 0 -3px 6px rgba(0, 0, 0, 0.05),
        0 5px 15px rgba(100, 149, 237, 0.15) !important;
}

.bubble-style-jelly .msg-row.ai .bubble:not(.bubble-transfer) {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(240, 248, 255, 0.8) 100%) !important;
    color: #333 !important;
}

.bubble-style-jelly .msg-row.me .bubble:not(.bubble-transfer) {
    background: linear-gradient(180deg, rgba(220, 240, 255, 0.95) 0%, rgba(190, 225, 255, 0.85) 100%) !important;
    color: #0056b3 !important;
}

/* --- 2. 极简冬日 (Winter) --- */
.bubble-style-winter .bubble:not(.bubble-transfer) {
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
}

.bubble-style-winter .msg-row.ai .bubble:not(.bubble-transfer) {
    background: #ffffff !important;
    color: #000 !important;
    border-top-left-radius: 2px !important;
}

.bubble-style-winter .msg-row.me .bubble:not(.bubble-transfer) {
    background: #deeeff !important;
    color: #3a4d65 !important;
    border-top-right-radius: 2px !important;
}

/* --- 3. 软萌气垫 (Soft) --- */
.bubble-style-soft .bubble:not(.bubble-transfer) {
    border-radius: 20px !important;
    border: 2px solid #fff !important;
    box-shadow: 0 0 0 1px #898989 !important;
}

.bubble-style-soft .msg-row.ai .bubble:not(.bubble-transfer) {
    background: rgba(255, 255, 255, 0.8) !important;
    color: #555 !important;
}

.bubble-style-soft .msg-row.me .bubble:not(.bubble-transfer) {
    background: rgba(255, 240, 245, 0.9) !important;
    color: #d63384 !important;
}

/* --- 4. 经典气泡 (Classic) --- */
.bubble-style-classic .bubble:not(.bubble-transfer) {
    border-radius: 6px !important;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05) !important;
    position: relative;
}

.bubble-style-classic .msg-row.ai .bubble:not(.bubble-transfer) {
    background: #fff !important;
    color: #000 !important;
}

.bubble-style-classic .msg-row.ai .bubble:not(.bubble-transfer)::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 14px;
    border-right: 5px solid #fff;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.bubble-style-classic .msg-row.me .bubble:not(.bubble-transfer) {
    background: #95ec69 !important;
    color: #000 !important;
}

.bubble-style-classic .msg-row.me .bubble:not(.bubble-transfer)::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 14px;
    border-left: 5px solid #95ec69;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

/* --- 5. 蜜桃粉 (Sakura) --- */
.bubble-style-sakura .bubble:not(.bubble-transfer) {
    border-radius: 50px !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(5px);
}

.bubble-style-sakura .msg-row.ai .bubble:not(.bubble-transfer) {
    background: linear-gradient(180deg, #fff0f3 0%, #ffe4e9 100%) !important;
    color: #555 !important;
}

.bubble-style-sakura .msg-row.me .bubble:not(.bubble-transfer) {
    background: linear-gradient(180deg, #ffdee7 0%, #ffb7c5 100%) !important;
    color: #9d174d !important;
    box-shadow:
        inset 0 3px 6px rgba(255, 255, 255, 0.8),
        inset 0 -3px 6px rgba(157, 23, 77, 0.1),
        0 5px 15px rgba(255, 183, 197, 0.4) !important;
}

/* --- 6. 薄荷绿 (Mint) --- */
.bubble-style-mint .bubble:not(.bubble-transfer) {
    border-radius: 50px !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(5px);
}

.bubble-style-mint .msg-row.ai .bubble:not(.bubble-transfer) {
    background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%) !important;
    color: #555 !important;
}

.bubble-style-mint .msg-row.me .bubble:not(.bubble-transfer) {
    background: linear-gradient(180deg, #ccfbf1 0%, #99f6e4 100%) !important;
    color: #0f766e !important;
    box-shadow:
        inset 0 3px 6px rgba(255, 255, 255, 0.8),
        inset 0 -3px 6px rgba(15, 118, 110, 0.1),
        0 5px 15px rgba(153, 246, 228, 0.4) !important;
}

/* --- 7. 香芋紫 (Lavender) --- */
.bubble-style-lavender .bubble:not(.bubble-transfer) {
    border-radius: 50px !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(5px);
}

.bubble-style-lavender .msg-row.ai .bubble:not(.bubble-transfer) {
    background: linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%) !important;
    color: #555 !important;
}

.bubble-style-lavender .msg-row.me .bubble:not(.bubble-transfer) {
    background: linear-gradient(180deg, #e9d5ff 0%, #d8b4fe 100%) !important;
    color: #6b21a8 !important;
    box-shadow:
        inset 0 3px 6px rgba(255, 255, 255, 0.8),
        inset 0 -3px 6px rgba(107, 33, 168, 0.1),
        0 5px 15px rgba(216, 180, 254, 0.4) !important;
}

/* --- 8. 柠檬黄 (Lemon) --- */
.bubble-style-lemon .bubble:not(.bubble-transfer) {
    border-radius: 50px !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(5px);
}

.bubble-style-lemon .msg-row.ai .bubble:not(.bubble-transfer) {
    background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%) !important;
    color: #555 !important;
}

.bubble-style-lemon .msg-row.me .bubble:not(.bubble-transfer) {
    background: linear-gradient(180deg, #fef08a 0%, #fde047 100%) !important;
    color: #854d0e !important;
    box-shadow:
        inset 0 3px 6px rgba(255, 255, 255, 0.9),
        inset 0 -3px 6px rgba(133, 77, 14, 0.1),
        0 5px 15px rgba(253, 224, 71, 0.4) !important;
}

/* =========================================
   转账气泡样式保护 - 确保不受气泡主题影响
   使用高优先级选择器覆盖所有气泡样式！
========================================= */

/* 基础保护：针对所有气泡样式 */
[class*="bubble-style-"] .msg-row .bubble.bubble-transfer,
[class*="bubble-style-"] .msg-row.ai .bubble.bubble-transfer,
[class*="bubble-style-"] .msg-row.me .bubble.bubble-transfer {
    /* 强制使用默认外形 */
    background: #f79c4a !important;
    background-color: #f79c4a !important;
    color: white !important;
    border-radius: 12px !important;
    border: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: 0 2px 5px rgba(247, 156, 74, 0.3) !important;
}

/* 已收款状态 */
[class*="bubble-style-"] .msg-row .bubble.bubble-transfer.received,
[class*="bubble-style-"] .msg-row.ai .bubble.bubble-transfer.received,
[class*="bubble-style-"] .msg-row.me .bubble.bubble-transfer.received {
    background: #fcebc6 !important;
    background-color: #fcebc6 !important;
    color: #8b5a2b !important;
    box-shadow: 0 2px 5px rgba(247, 156, 74, 0.15) !important;
}

/* 已拒收状态 */
[class*="bubble-style-"] .msg-row .bubble.bubble-transfer.rejected,
[class*="bubble-style-"] .msg-row.ai .bubble.bubble-transfer.rejected,
[class*="bubble-style-"] .msg-row.me .bubble.bubble-transfer.rejected {
    background: #e8e8e8 !important;
    background-color: #e8e8e8 !important;
    color: #888 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
}

/* --- 气泡样式选择器 --- */
.bubble-style-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
    font-size: 12px;
    text-align: center;
}

.bubble-style-option:hover {
    border-color: #e9d5ff;
    color: #7c3aed;
}

/* --- AI主动联系通知弹窗 --- */
.ai-notification {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 280px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 12px;
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    cursor: pointer;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: notificationSlideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: transform 0.2s ease;
}

.ai-notification:active {
    transform: translateX(-50%) scale(0.98);
}

@keyframes notificationSlideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.ai-notification-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #f0f4f8;
    flex-shrink: 0;
}

.ai-notification-body {
    flex: 1;
    min-width: 0;
}

.ai-notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.ai-notification-name {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
}

.ai-notification-time {
    font-size: 11px;
    color: #94a3b8;
}

.ai-notification-content {
    font-size: 13px;
    color: #475569;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.bubble-style-option:has(input:checked) {
    border-color: #3b82f6;
    background: #dbeafe;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.bubble-style-option input {
    display: none;
}

.bubble-style-option span {
    pointer-events: none;
}

/* --- 加载更多提示（分页加载优化）--- */
.load-more-hint {
    text-align: center;
    padding: 12px 0;
    color: #9ca3af;
    font-size: 12px;
    letter-spacing: 1px;
}

/* --- 引用预览优化 --- */
.quote-preview {
    padding: 8px 12px;
    background: #fff;
    /* 保持背景一致 */
    border-top: 1px solid #f1f5f9;
    display: none;
    /* JS控制 */
    animation: fadeIn 0.2s ease-out;
}

.quote-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: #eff6ff;
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
    /* 蓝色竖条 */
    gap: 10px;
    box-sizing: border-box;
}

.quote-text {
    flex: 1;
    font-size: 13px;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* 确保文字单行显示并截断 */
    max-width: 240px;
    /* 限制最大宽度，防止撑开 */
}

.quote-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
    /* 防止按钮被挤压 */
    display: flex;
    align-items: center;
    justify-content: center;
}


/* --- 转账气泡样式 (移动端固定样式) --- */
.bubble-transfer {
    /* 固定橙色背景，不跟随主题 */
    background-color: #f79c4a !important;
    color: white !important;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    border-radius: 12px !important;
    border: none !important;
    backdrop-filter: none !important;
    box-shadow: 0 2px 5px rgba(247, 156, 74, 0.3) !important;
}

/* 已收款状态 - 浅色背景，深色文字 */
.bubble-transfer.received {
    background-color: #fcebc6 !important;
    color: #8b5a2b !important;
}

/* 已拒收状态 */
.bubble-transfer.rejected {
    background-color: #e8e8e8 !important;
    color: #888 !important;
}

.transfer-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* 默认左对齐 */
    gap: 15px;
    /* 用户指定 */
    padding: 15px;
    /* 用户指定 */
}

.transfer-icon {
    width: 40px;
    /* 用户指定 */
    height: 40px;
    /* 用户指定 */
    background: #f79c4a;
    color: white;
    border: 2px solid white;
    /* 用户指定 */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    /* 用户指定 */
    font-weight: bold;
    flex-shrink: 0;
}

.transfer-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.transfer-amount {
    font-size: 16px;
    font-weight: bold;
}

.transfer-desc {
    font-size: 12px;
    opacity: 0.8;
}

.transfer-footer {
    border-top: 1px solid rgba(128, 128, 128, 0.15);
    padding: 4px 15px 8px 15px;
    /* 上边距和左右对齐 content */
    font-size: 11px;
    opacity: 0.7;
}

/* --- AI 记忆管理样式 --- */
.memory-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    position: relative;
}

.memory-item:hover {
    border-color: #94a3b8;
}

.memory-time {
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.memory-content {
    font-size: 13px;
    color: #334155;
    line-height: 1.5;
    word-break: break-word;
}

.memory-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
}

.memory-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.memory-btn:hover {
    background: #e2e8f0;
}

.memory-btn.delete:hover {
    background: #fee2e2;
}

.memory-empty {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
    font-size: 13px;
}

.memory-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

/* 记忆保存成功提示 */
.memory-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(16, 185, 129, 0.95);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 9999;
    animation: toastFadeInOut 2s ease-out forwards;
}

@keyframes toastFadeInOut {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }

    15% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    85% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

/* --- 群聊成员选择列表样式 --- */
.member-select-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 12px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.15s;
}

.member-select-item:last-child {
    border-bottom: none;
}

.member-select-item:hover {
    background: #f8fafc;
}

.member-select-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    cursor: pointer;
    flex-shrink: 0;
}

.member-select-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #e2e8f0;
    flex-shrink: 0;
}

.member-select-name {
    flex: 1;
    font-size: 14px;
    color: #1e3a8a;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- 群聊成员昵称样式 --- */
.msg-name {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 2px;
    margin-left: 4px;
    line-height: 1.2;
}

/* 调整消息行的布局，适应昵称显示 */
.msg-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 70%;
    /* 与 .bubble 的 max-width 保持一致 */
}

.msg-col .bubble {
    max-width: 100%;
    /* msg-col 内的 bubble 撑满 msg-col 宽度 */
}

.msg-row.me .msg-col {
    align-items: flex-end;
}

/* ==================== AI自动回复通知弹窗 ==================== */
.ai-notification {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    max-width: 260px;
    padding: 12px;
    /* 毛玻璃效果 */
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-notification:hover {
    transform: translateX(-50%) scale(1.02);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}

.ai-notification-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    /* 方形圆角 */
    object-fit: cover;
    flex-shrink: 0;
}

.ai-notification-body {
    flex: 1;
    min-width: 0;
}

.ai-notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.ai-notification-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e3a8a;
}

.ai-notification-time {
    font-size: 11px;
    color: #94a3b8;
}

.ai-notification-content {
    font-size: 13px;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== 头像方形圆角（全局覆盖） ==================== */
/* 聊天列表头像 */
#chat-list img,
.chat-list-item img {
    border-radius: 10px !important;
}

/* 消息头像 */
.msg-avatar {
    border-radius: 10px !important;
}

/* 群聊成员选择头像 */
.member-select-avatar {
    border-radius: 10px !important;
}

/* ==================== 移动端专用优化 ==================== */

/* 防止过度滚动（橡皮筋效果） */
.chat-area,
.content-scroll,
.modal {
    overscroll-behavior: contain;
}

/* 输入框聚焦时的优化 */
.input-box:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}

/* 按钮触摸区域优化（确保最小 44x44px） */
.nav-btn,
.tool-btn,
.send-btn,
.pink-heart-btn {
    min-width: 44px;
    min-height: 44px;
}

/* 列表项触摸反馈 */
.list-item:active {
    background-color: rgba(0, 0, 0, 0.05);
}

/* 右键/长按菜单移动端优化 */
.context-menu {
    min-width: 120px;
    touch-action: none;
}

.context-menu-item {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0 16px;
}

/* 禁止文本选择（除了输入框） */
* {
    -webkit-user-select: none;
    user-select: none;
}

input,
textarea {
    -webkit-user-select: text;
    user-select: text;
}