221 lines
4.5 KiB
CSS
Raw Normal View History

.chat-container {
position: fixed;
2026-03-25 21:15:55 +08:00
bottom: calc(var(--footer-height, 32px) + 18px);
left: 0;
width: 100%;
2026-03-25 21:15:55 +08:00
background: transparent;
display: flex;
flex-direction: column;
align-items: center;
2026-03-25 21:15:55 +08:00
z-index: 1000;
}
.chat-box {
width: 90%;
2025-04-06 22:15:36 +08:00
min-height: 20px;
max-height: 50vh;
overflow-y: auto;
2026-03-25 21:15:55 +08:00
backdrop-filter: blur(var(--card_filter));
-webkit-backdrop-filter: blur(var(--card_filter));
background: var(--item_bg_color);
border: 1px solid rgba(255, 255, 255, 0.12);
background-clip: padding-box;
margin-bottom: 15px;
padding: 20px;
border-radius: 13px;
position: relative;
z-index: 10;
2025-04-06 22:15:36 +08:00
display: none;
2026-03-25 21:15:55 +08:00
box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.1);
2025-03-31 22:34:17 +08:00
}
.chat-box.show {
animation: slideUp 0.3s ease-out forwards;
2025-03-31 22:34:17 +08:00
}
.chat-box.hide {
animation: slideDown 0.3s ease-in forwards;
2025-03-31 22:34:17 +08:00
}
2025-04-08 18:42:46 +08:00
.message {
2026-03-25 21:15:55 +08:00
margin: 8px 0;
padding: 12px 18px;
max-width: 80%;
width: fit-content; /* 让气泡宽度随文字内容自适应 */
min-width: 10px;
display: block;
border-radius: 16px;
2025-04-08 18:42:46 +08:00
word-break: break-word;
2026-03-25 21:15:55 +08:00
transition: all 0.3s ease;
backdrop-filter: blur(var(--card_filter));
-webkit-backdrop-filter: blur(var(--card_filter));
user-select: text;
position: relative;
}
.copy-button {
position: absolute;
top: 8px;
right: 8px;
background: rgba(0, 0, 0, 0.3);
color: white;
border: none;
border-radius: 4px;
padding: 4px 8px;
font-size: 12px;
cursor: pointer;
opacity: 0;
transition: opacity 0.3s ease;
}
.message:hover .copy-button {
opacity: 1;
2025-04-08 18:42:46 +08:00
}
.message.user {
2026-03-25 21:15:55 +08:00
background: rgba(255, 255, 255, 0.25);
border: 1px solid rgba(255, 255, 255, 0.15);
2025-04-08 18:42:46 +08:00
align-self: flex-end;
text-align: left;
margin-left: auto;
2026-03-25 21:15:55 +08:00
color: var(--main_text_color);
2025-04-08 18:42:46 +08:00
}
.message.bot {
2026-03-25 21:15:55 +08:00
background: rgba(255, 255, 255, 0.15);
border: 1px solid rgba(255, 255, 255, 0.10);
2025-04-08 18:42:46 +08:00
align-self: flex-start;
text-align: left;
margin-right: auto;
font-size: 14px;
2026-03-25 21:15:55 +08:00
line-height: 1.6;
color: var(--main_text_color);
}
/* 清除常见 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;
2025-04-08 18:42:46 +08:00
}
.input-row {
display: flex;
justify-content: center;
width: 90%;
2026-03-25 21:15:55 +08:00
gap: 12px;
2025-03-31 22:34:17 +08:00
}
#userInput {
flex: 1;
2026-03-25 21:15:55 +08:00
padding: 12px 16px;
font-size: 16px;
2026-03-25 21:15:55 +08:00
border: none;
border-radius: 13px;
backdrop-filter: blur(var(--card_filter));
-webkit-backdrop-filter: blur(var(--card_filter));
background: var(--item_bg_color);
border: 1px solid rgba(255, 255, 255, 0.12);
background-clip: padding-box;
color: var(--main_text_color);
transition: all 0.3s ease;
}
#userInput:focus {
outline: none;
background: var(--item_hover_color);
transform: translateY(-2px);
}
html[data-theme="Dark"] .chat-box {
border: 1px solid rgba(255, 255, 255, 0.08);
}
html[data-theme="Dark"] .message.user {
background: rgba(255, 255, 255, 0.20);
border: 1px solid rgba(255, 255, 255, 0.10);
}
html[data-theme="Dark"] .message.bot {
background: rgba(255, 255, 255, 0.10);
border: 1px solid rgba(255, 255, 255, 0.05);
}
html[data-theme="Dark"] #userInput {
border: 1px solid rgba(255, 255, 255, 0.08);
2025-03-31 22:34:17 +08:00
}
button {
2026-03-25 21:15:55 +08:00
padding: 12px 20px;
font-size: 16px;
border: none;
2026-03-25 21:15:55 +08:00
border-radius: 13px;
backdrop-filter: blur(var(--card_filter));
-webkit-backdrop-filter: blur(var(--card_filter));
background: var(--item_bg_color);
color: var(--main_text_color);
cursor: pointer;
2026-03-25 21:15:55 +08:00
transition: all 0.3s ease;
}
button:hover {
2026-03-25 21:15:55 +08:00
background: var(--item_hover_color);
transform: translateY(-2px);
box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.1);
}
2025-04-09 11:37:16 +08:00
.typing {
2026-03-25 21:15:55 +08:00
color: var(--purple_text_color);
2025-04-09 11:37:16 +08:00
font-style: italic;
animation: blink 1.8s infinite;
2025-04-09 11:37:16 +08:00
}
@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;
}
}