         :root {
            --primary-color: #4f46e5;
            --primary-light: #818cf8;
            --secondary-color: #f3f4f6;
            --text-color: #374151;
            --text-light: #6b7280;
            --background-color: #f9fafb;
            --own-message-bg: #4f46e5;
            --own-message-text: #ffffff;
            --other-message-bg: #ffffff;
            --border-color: #e5e7eb;
            --shadow-color: rgba(0, 0, 0, 0.1);
        }

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

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: var(--background-color);
            color: var(--text-color);
            line-height: 1.6;
            height: 100vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            -webkit-tap-highlight-color: transparent;
        }

        /* 头部样式 */
        .chat-header {
            background-color: var(--primary-color);
            color: white;
            padding: 1rem 1.5rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
            box-shadow: 0 2px 10px var(--shadow-color);
        }

        .chat-header .user-info {
            display: flex;
            align-items: center;
            gap: 1rem;
        }
        
        .yuan {
    background-color: #3498db;
    border-radius: 25px;
}


 .yuansd {
  
    border-radius: 5px;
}

 .yuansdtdtdt {
  
    border-radius: 1px;
}

        .yuanuppp {
    background-color: #3498db;
    border-radius: 5px;
}



.dot {
  display: inline-block;
  width: 0.8em; /* 圆大小缩小 */
  height: 0.8em;
  border: 0.1em solid black;
  border-radius: 50%;
  border-top-color: transparent;
  margin-left: 0.2em;
  animation: rotate 1s linear infinite; /* 旋转速度加快 */
  font-weight: bold; /* 圆环加粗 */
}
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}






        .chat-header .avatar {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background-color: rgba(255, 255, 255, 0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
            font-weight: bold;
        }

        .chat-header .user-details h3 {
            font-size: 1.1rem;
            margin-bottom: 0.2rem;
        }

        .chat-header .user-details p {
            font-size: 0.85rem;
            opacity: 0.8;
        }

        .chat-header .actions {
            display: flex;
            gap: 1rem;
        }

        .chat-header .actions button {
            background: none;
            border: none;
            color: white;
            font-size: 1.2rem;
            cursor: pointer;
            padding: 0.5rem;
            border-radius: 50%;
            transition: background-color 0.2s;
            min-width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .chat-header .actions button:hover {
            background-color: rgba(255, 255, 255, 0.1);
        }

        /* 聊天内容区域 */
        .chat-container {
            flex: 1;
            display: flex;
            overflow: hidden;
        }

        /* 聊天区域 - 调整为占满整个宽度 */
        .chat-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            background-color: var(--background-color);
            position: relative;
        }

        .messages-container {
            flex: 1;
            overflow-y: auto;
            padding: 1.5rem;
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .message-wrapper {
            display: flex;
            gap: 0.75rem;
            animation: fadeIn 0.3s ease;
        }

        .message-wrapper.own {
            flex-direction: row-reverse;
        }

        .message-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background-color: var(--secondary-color);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.85rem;
            font-weight: bold;
            flex-shrink: 0;
        }

        .message-content {
            max-width: 70%;
        }

        .message-bubble {
            padding: 0.75rem 1rem;
            border-radius: 18px;
            position: relative;
            word-wrap: break-word;
            animation: slideIn 0.3s ease;
            display: inline-block;
            word-break: break-all;     /* 强制长文本换行 */
            max-width: 100%;  
        }

        .message-wrapper.own .message-bubble {
            background-color: #81c784;
            color: var(--own-message-text);
            border-bottom-right-radius: 4px;
        }

        .message-wrapper.other .message-bubble {
            background-color: var(--other-message-bg);
            color: var(--text-color);
            border-bottom-left-radius: 4px;
            box-shadow: 0 1px 2px var(--shadow-color);
        }

        .message-time {
            font-size: 0.7rem;
            color: var(--text-light);
            margin-top: 0.25rem;
            text-align: right;
        }

        .message-wrapper.other .message-time {
            text-align: left;
        }

        /* 表情包消息样式 */
        .message-bubble.emoji-message {
            padding: 0.5rem;
        }

        .message-bubble .emoji {
            width: 36px;
            height: 36px;
            display: inline-block;
            margin: 0 2px;
            vertical-align: middle;
        }

        /* 图片消息样式 */
        .message-bubble.image-message {
            padding: 0;
            overflow: hidden;
            position: relative;
            max-width: 200px;
            cursor: pointer;
        }

        .message-bubble.image-message img {
            width: 100%;
            height: auto;
            display: block;
            border-radius: 18px;
            transition: transform 0.2s ease;
        }

        .message-wrapper.own .message-bubble.image-message img {
            border-bottom-right-radius: 4px;
        }

        .message-wrapper.other .message-bubble.image-message img {
            border-bottom-left-radius: 4px;
        }

        .message-bubble.image-message:hover img {
            transform: scale(1.05);
        }

        /* 输入区域 */
        .input-area {
            background-color: white;
            border-top: 1px solid var(--border-color);
            padding: 1rem;
            position: relative;
        }

        .input-container {
            display: flex;
            align-items: flex-end;
            gap: 0.75rem;
        }

        .input-tools {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 0.5rem;
        }

        .tool-button {
            background: none;
            border: none;
            color: var(--text-light);
            font-size: 1.2rem;
            cursor: pointer;
            padding: 0.5rem;
            border-radius: 50%;
            transition: all 0.2s;
            min-width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .tool-button:hover {
            background-color: var(--secondary-color);
            color: var(--primary-color);
        }

        /* 修改消息输入框样式：调整为2行高度，减小圆角半径 */
        .message-input {
            flex: 1;
            min-height: 60px; /* 调整为2行大小 */
            max-height: 120px;
            padding: 0.75rem 1rem;
            border: 1px solid var(--border-color);
            border-radius: 8px; /* 减小圆角半径 */
            font-size: 0.95rem;
            resize: none;
            outline: none;
            transition: border-color 0.2s;
        }

        .message-input:focus {
            border-color: var(--primary-color);
        }

        .send-button {
            background-color: var(--primary-color);
            color: white;
            border: none;
            padding: 0.75rem 1.25rem;
            border-radius: 22px;
            font-size: 0.95rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
            flex-shrink: 0;
            min-width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .send-button:hover:not(:disabled) {
            background-color: var(--primary-light);
            transform: translateY(-1px);
        }

        .send-button:disabled {
            background-color: var(--text-light);
            cursor: not-allowed;
            transform: none;
        }

        /* 表情包面板 */
        .emoji-panel {
            position: absolute;
            bottom: 100%;
            left: 0;
            right: 0;
            background-color: white;
            border-top: 1px solid var(--border-color);
            border-left: 1px solid var(--border-color);
            border-right: 1px solid var(--border-color);
            border-radius: 13px 13px 0 0;
            padding: 1rem;
            max-height: 250px;
            overflow-y: auto;
            display: none;
            z-index: 10;
            box-shadow: 0 -2px 10px var(--shadow-color);
        }

        .emoji-panel.active {
            display: block;
            animation: slideUp 0.3s ease;
        }

        .emoji-categories {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 1rem;
            border-bottom: 1px solid var(--border-color);
            padding-bottom: 0.5rem;
        }

        .emoji-category {
            background: none;
            border: none;
            color: var(--text-light);
            font-size: 1rem;
            cursor: pointer;
            padding: 0.5rem;
            border-radius: 50%;
            transition: all 0.2s;
            min-width: 40px;
            height: 40px;
            
        }

        .emoji-category:hover, .emoji-category.active {
            background-color: var(--secondary-color);
            color: var(--primary-color);
        }

        .emoji-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
            gap: 0.5rem;
        }

        .emoji-item {
            width: 40px;
            height: 40px;
            background: none;
            border: none;
            cursor: pointer;
            border-radius: 8px;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
        }

        .emoji-item:hover {
            background-color: var(--secondary-color);
            transform: scale(1.1);
        }

        /* 图片查看器模态框 */
        .image-viewer-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.8);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.3s ease, visibility 0.3s ease;
        }

        .image-viewer-modal.active {
            opacity: 1;
            visibility: visible;
        }

        .image-viewer-content {
            position: relative;
            max-width: 90%;
            max-height: 90%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .image-viewer-image {
            max-width: 100%;
            max-height: 100%;
            transition: transform 0.2s ease;
            transform-origin: center;
            cursor: grab;
        }

        .image-viewer-image:active {
            cursor: grabbing;
        }

        .image-viewer-close {
            position: absolute;
            top: -40px;
            right: 0;
            background: none;
            border: none;
            color: white;
            font-size: 2rem;
            cursor: pointer;
            padding: 0.5rem;
            border-radius: 50%;
            transition: background-color 0.2s;
            min-width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .image-viewer-close:hover {
            background-color: rgba(255, 255, 255, 0.2);
        }

        /* 图片上传预览区域 - 新的样式，直接显示在输入框上方 */
        .image-preview-container {
            margin-bottom: 0.75rem;
            display: none;
        }

        .image-preview-container.active {
            display: block;
        }

        .image-preview-grid {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
        }

        .image-preview-item {
            position: relative;
            width: 60px;
            height: 60px;
            border-radius: 8px;
            overflow: hidden;
            border: 2px solid var(--border-color);
        }

        .image-preview-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .image-preview-remove {
            position: absolute;
            top: -8px;
            right: -8px;
            background-color: var(--primary-color);
            color: white;
            border: none;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 0.75rem;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 2px 4px var(--shadow-color);
            transition: all 0.2s;
        }

        .image-preview-remove:hover {
            background-color: var(--primary-light);
            transform: scale(1.1);
        }

        .hidden-file-input {
            display: none;
        }

        /* 滚动条样式 */
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }

        ::-webkit-scrollbar-track {
            background: var(--secondary-color);
            border-radius: 3px;
        }

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

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

        /* 动画效果 */
        @keyframes fadeIn {
            from {
                opacity: 0;
            }
            to {
                opacity: 1;
            }
        }

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

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

        @keyframes bounce {
            0%, 20%, 50%, 80%, 100% {
                transform: translateY(0);
            }
            40% {
                transform: translateY(-10px);
            }
            60% {
                transform: translateY(-5px);
            }
        }

        .emoji-bounce {
            animation: bounce 0.5s ease;
        }

        /* 移动端适配 - 小屏幕优化 */
        @media (max-width: 768px) {
            /* 防止横向滚动 */
            html, body {
                overflow-x: hidden;
                width: 100%;
            }
            
            /* 头部优化 */
            .chat-header {
                padding: 0.75rem 1rem;
            }
            
            .chat-header .avatar {
                width: 42px;
                height: 42px;
                font-size: 1.1rem;
            }
            
            .chat-header .user-details h3 {
                font-size: 1rem;
            }
            
            .chat-header .user-details p {
                font-size: 0.8rem;
            }
            
            .chat-header .actions {
                gap: 0.5rem;
            }
            
            .chat-header .actions button {
                min-width: 40px;
                height: 40px;
                font-size: 1.1rem;
            }
            
            /* 消息区域优化 */
            .messages-container {
                padding: 1rem;
                gap: 0.75rem;
            }
            
            .message-content {
                max-width: 85%;
            }
            
            .message-bubble {
                padding: 0.65rem 0.9rem;
                font-size: 0.95rem;
            }
            
            /* 图片消息优化 */
            .message-bubble.image-message {
                max-width: 160px;
            }
            
            .message-avatar {
                width: 32px;
                height: 32px;
                font-size: 0.8rem;
            }
            
            /* 表情包样式优化 */
            .message-bubble .emoji {
                width: 32px;
                height: 32px;
            }
            
            /* 输入区域优化 */
            .input-area {
                padding: 0.75rem 1rem;
            }
            
            .input-container {
                gap: 0.5rem;
            }
            
            .tool-button {
                min-width: 36px;
                height: 36px;
                font-size: 1.1rem;
            }
            
            /* 移动端输入框样式 - 保持2行高度和较小圆角 */
            .message-input {
                min-height: 56px;
                padding: 0.65rem 0.9rem;
                border-radius: 8px;
                font-size: 0.95rem;
            }
            
            .send-button {
                min-width: 42px;
                height: 42px;
                padding: 0.65rem 1.1rem;
                border-radius: 21px;
                font-size: 0.9rem;
            }
            
            /* 调整文本大小以提高可读性 */
            .message-time {
                font-size: 0.65rem;
            }
            
            /* 表情包面板优化 */
            .emoji-panel {
                max-height: 220px;
            }
            
            .emoji-grid {
                grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
                gap: 0.4rem;
            }
            
            .emoji-item {
                width: 36px;
                height: 36px;
                font-size: 1.3rem;
            }
            
            /* 图片查看器移动端优化 */
            .image-viewer-close {
                top: 20px;
                right: 20px;
                font-size: 1.5rem;
                min-width: 40px;
                height: 40px;
            }
            
            /* 图片上传预览区域优化 */
            .image-preview-item {
                width: 50px;
                height: 50px;
            }
        }

        /* 超小屏幕适配 */
        @media (max-width: 480px) {
            /* 进一步优化头部 */
            .chat-header {
                padding: 0.65rem 0.85rem;
            }
            
            .chat-header .avatar {
                width: 38px;
                height: 38px;
                font-size: 1rem;
            }
            
            .chat-header .user-details h3 {
                font-size: 0.95rem;
            }
            
            .chat-header .actions button {
                min-width: 38px;
                height: 38px;
                font-size: 1rem;
            }
            
            /* 消息区域进一步优化 */
            .messages-container {
                padding: 0.85rem;
            }
            
            .message-content {
                max-width: 88%;
            }
            
            .message-bubble {
                padding: 0.6rem 0.85rem;
                font-size: 0.9rem;
            }
            
            /* 图片消息进一步优化 */
            .message-bubble.image-message {
                max-width: 140px;
            }
            
            /* 表情包样式进一步优化 */
            .message-bubble .emoji {
                width: 28px;
                height: 28px;
            }
            
            /* 输入区域进一步优化 */
            .input-area {
                padding: 0.65rem 0.85rem;
            }
            
            .tool-button {
                min-width: 34px;
                height: 34px;
                font-size: 1rem;
            }
            
            /* 超小屏幕输入框样式 - 保持2行高度和较小圆角 */
            .message-input {
                min-height: 52px;
                padding: 0.6rem 0.85rem;
                font-size: 0.9rem;
            }
            
            .send-button {
                min-width: 40px;
                height: 40px;
                padding: 0.6rem 1rem;
                font-size: 0.85rem;
            }
            
            /* 表情包面板进一步优化 */
            .emoji-panel {
                max-height: 200px;
            }
            
            .emoji-grid {
                grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
                gap: 0.3rem;
            }
            
            .emoji-item {
                width: 32px;
                height: 32px;
                font-size: 1.2rem;
            }
            
            /* 图片上传预览区域进一步优化 */
            .image-preview-item {
                width: 45px;
                height: 45px;
            }
        }
