.chat-container { position: fixed; bottom: 50px; left: 0; width: 100%; background: rgba(255, 255, 255, 0); /* 几乎全透明 */ display: flex; flex-direction: column; align-items: center; z-index: 5; } .chat-box { width: 90%; min-height: 20px; max-height: 50vh; overflow-y: auto; background: rgba(200, 200, 200, 0.1); /* 淡灰半透明 */ backdrop-filter: blur(8px); /* 背景模糊 */ -webkit-backdrop-filter: blur(8px); /* Safari 兼容 */ margin-bottom: 10px; padding: 10px; border-radius: 8px; position: relative; z-index: 10; display: none; } .chat-box.show { animation: slideUp 0.3s ease-out forwards; } .chat-box.hide { animation: slideDown 0.3s ease-in forwards; } .message { margin: 5px 0; padding: 10px 15px; max-width: fit-content; border-radius: 12px; word-break: break-word; } .message.user { background-color: #daf1fc; align-self: flex-end; text-align: left; margin-left: auto; } .message.bot { background-color: #eee; align-self: flex-start; text-align: left; margin-right: auto; font-size: 14px; line-height: 1.5; } /* 清除常见 markdown 元素的默认 margin */ .message.bot h1, .message.bot h2, .message.bot h3, .message.bot p, .message.bot ul, .message.bot ol, .message.bot pre, .message.bot code { margin: 0; padding: 0; font-size: inherit; } /* 更友好地渲染列表 */ .message.bot ul, .message.bot ol { padding-left: 1.2em; } /* 美化代码块 */ .message.bot pre { background: #272822; color: #f8f8f2; padding: 8px; overflow-x: auto; border-radius: 4px; } .input-row { display: flex; justify-content: center; width: 90%; gap: 10px; } #userInput { flex: 1; padding: 10px; font-size: 16px; border: 1px solid #ccc; border-radius: 6px; } button { padding: 10px 16px; font-size: 16px; border: none; background-color: #007BFF; color: white; border-radius: 6px; cursor: pointer; } button:hover { background-color: #0056b3; } .typing { color: #aaa; font-style: italic; animation: blink 1.8s infinite; } @keyframes blink { 50% { opacity: 0.3; } } @keyframes slideUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } } @keyframes slideDown { from { transform: translateY(0); opacity: 1; } to { transform: translateY(100%); opacity: 0; } }