/* 重置所有元素的盒模型，确保宽度和高度包含内边距和边框 */
*, ::before, ::after {
    box-sizing: border-box;
}

/* 设置HTML和body为全高，确保全屏布局 */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* 为body设置深色渐变背景和裂纹纹理，营造情绪破碎风格 */
body {
    font-family: 'Indie Flower', cursive; /* 手写字体，增加破碎感 */
    background: linear-gradient(135deg, #000000, #2a1235); /* 黑色到深紫渐变 */
    color: #e2e8f0; /* 浅灰色文本，确保对比度 */
    display: flex; /* 使用Flexbox布局 */
    flex-direction: column; /* 垂直排列 */
    height: 100vh; /* 占满视口高度 */
    position: relative; /* 允许伪元素绝对定位 */
}

/* 添加裂纹纹理覆盖层，增强破碎感 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://www.transparenttextures.com/patterns/cracked.png') repeat; /* 裂纹纹理 */
    opacity: 0.2; /* 微透明效果 */
    z-index: -1; /* 置于内容后方 */
}

/* 顶部栏样式，使用深紫背景 */
.top {
    display: flex;
    justify-content: center; /* 居中 "多人聊天室" */
    align-items: center; /* 垂直居中 */
    padding-left: 10px;
    padding-right: 10px; /* 确保右边也有内边距 */
    background-color: #3e2455; /* 深紫背景 */
    height: 40px;
    line-height: 40px;
    color: #e2e8f0; /* 浅灰色文本 */
    position: relative; /* 用于绝对定位 "他们的痕迹" */
}

/* "多人聊天室" 样式 */
.name {
    flex: 0 1 auto; /* 保持居中 */
}

/* "他们的痕迹" 样式 */
/* 聊天框样式，设置半透明深灰蓝色背景并占满可用高度 */
.mk-chat-box {
    font-family: "Helvetica Neue", Helvetica, Microsoft Yahei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif;
    font-size: 16px;
    width: 100%;
    padding: 10px; /* 增加内边距，改善消息间距 */
    position: relative;
    overflow-y: auto; /* 启用垂直滚动 */
    flex: 1; /* 占据剩余高度 */
    background-color: #3d3f49db; /* 半透明深灰蓝色背景 */
}

/* 输入区域样式，使用深紫背景 */
.write {
    height: 40px;
    width: 100%;
    background-color: #3e2455; /* 与聊天框一致 */
    display: flex; /* 水平排列输入框和按钮 */
}

/* 输入框样式，采用半透明背景 */
.write input {
    font-size: 16px;
    flex: 1; /* 占据剩余空间 */
    height: 40px;
    padding: 0 10px;
    border-radius: 5px 0 0 5px; /* 左侧圆角 */
    border: 1px solid rgba(255, 255, 255, 0.2); /* 浅色边框 */
    outline: none;
    background: rgba(255, 255, 255, 0.1); /* 半透明白色 */
    color: #e2e8f0; /* 浅灰色文本 */
    font-family: 'Source Sans Pro', sans-serif;
    font-weight: 400;
}

/* 发送按钮样式，使用中紫色背景 */
.send {
    color: #ffffff; /* 白色文本，增强对比度 */
    text-decoration: none;
    width: 60px;
    background-color: #7d5a9b; /* 中紫色背景 */
    display: inline-block;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 0 5px 5px 0; /* 右侧圆角 */
}

/* 禁用状态的发送按钮 */
.send.disabled {
    background-color: #cccccc; /* 灰色背景 */
}

/* 消息容器样式 */
.mk-chat-box .msg {
    margin: 4px 6px;
    position: relative;
    min-height: 40px;
    border: 0;
}

/* 右侧（发送）消息对齐 */
.mk-chat-box .right {
    text-align: right;
    margin-left: 64px;
}

/* 左侧（接收）消息对齐 */
.mk-chat-box .left {
    text-align: left;
    margin-right: 64px;
}

/* 头像样式，带浅色边框 */
.mk-chat-box img.head {
    width: 32px;
    height: 32px;
    top: 8px;
    position: absolute;
    border-radius: 100%;
    border: 1px solid rgba(255, 255, 255, 0.2); /* 浅色边框 */
    user-select: none;
}

/* 右侧消息头像定位 */
.mk-chat-box .right img.head {
    right: 0;
}

/* 左侧消息头像定位 */
.mk-chat-box .left img.head {
    left: 0;
}

/* 昵称样式，使用中灰色 */
.mk-chat-box .name {
    color: #a0aec0; /* 中灰色，适合次要文本 */
    font-size: 12px;
    display: block;
    line-height: 18px;
}

/* 右侧消息昵称定位 */
.mk-chat-box .right .name {
    margin: 0 48px 2px 0;
}

/* 左侧消息昵称定位 */
.mk-chat-box .left .name {
    margin: 0 0 2px 48px;
}

/* 消息内容样式 */
.mk-chat-box .content {
    word-break: break-all;
    word-wrap: break-word;
    text-align: left;
    position: relative;
    display: inline-block;
    font-size: 14px;
    padding: 6px;
    line-height: 18px;
    border-radius: 6px;
    min-width: 9px;
    min-height: 18px;
    color: #e2e8f0; /* 浅灰色文本 */
}

/* 消息内容中的图片样式 */
.mk-chat-box .content img {
    width: 100%;
    height: auto;
}

/* 消息内容中的链接样式 */
.mk-chat-box .content a {
    color: #0072C1; /* 蓝色链接 */
    margin: 0 5px;
    cursor: pointer;
}

/* 接收消息气泡样式 */
.mk-chat-box .left .content {
    margin: 0 0 0 48px;
    background-color: rgba(255, 255, 255, 0.05); /* 半透明白色 */
    border: 1px solid rgba(255, 255, 255, 0.1); /* 浅色边框 */
}

/* 发送消息气泡样式 */
.mk-chat-box .right .content {
    margin: 0 48px 0 0;
    background-color: rgba(255, 183, 197, 0.1); /* 半透明粉红 */
    border: 1px solid rgba(255, 183, 197, 0.2); /* 粉红边框 */
}

/* 消息气泡箭头样式 */
.mk-chat-box .content:after {
    content: "";
    position: absolute;
    width: 0;
    height: 0;
}

/* 接收消息气泡箭头 */
.mk-chat-box .left .content:after {
    left: -12px;
    top: 8px;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 12px solid rgba(255, 255, 255, 0.05); /* 匹配接收气泡 */
}

/* 发送消息气泡箭头 */
.mk-chat-box .right .content:after {
    right: -12px;
    top: 8px;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 12px solid rgba(255, 183, 197, 0.1); /* 匹配发送气泡 */
}

/* 系统提示样式 */
.mk-chat-box .tips {
    margin: 12px;
    text-align: center;
    font-size: 12px;
}

/* 系统提示背景和文本样式 */
.mk-chat-box .tips span {
    display: inline-block;
    padding: 4px;
    background-color: rgba(255, 183, 197, 0.2); /* 半透明粉红 */
    color: #e2e8f0; /* 浅灰色文本 */
    border-radius: 6px;
}

/* 不同类型的系统提示 */
.mk-chat-box .tips .tips-primary {
    background-color: #428bca; /* 蓝色 */
}
.mk-chat-box .tips .tips-success {
    background-color: #5cb85c; /* 绿色 */
}
.mk-chat-box .tips .tips-info {
    background-color: #5bc0de; /* 青色 */
}
.mk-chat-box .tips .tips-warning {
    background-color: #f0ad4e; /* 橙色 */
}
.mk-chat-box .tips .tips-danger {
    background-color: #d9534f; /* 红色 */
}

/* 滚动条样式 */
.mk-chat-box::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.mk-chat-box::-webkit-scrollbar-button:vertical {
    display: none;
}
.mk-chat-box::-webkit-scrollbar-track:vertical {
    background-color: transparent;
}
.mk-chat-box::-webkit-scrollbar-track-piece {
    background-color: transparent;
}
.mk-chat-box::-webkit-scrollbar-thumb:vertical {
    background-color: rgba(255, 255, 255, 0.1); /* 半透明白色 */
    border-radius: 8px;
}
.mk-chat-box::-webkit-scrollbar-thumb:vertical:hover,
.mk-chat-box::-webkit-scrollbar-thumb:vertical:active {
    background-color: #8C8C8C; /* 悬停时变灰 */
}

/* 登录区域样式 */
.login {
    margin-top: 10px;
    background-color: #3e2455; /* 匹配聊天框背景 */
    padding: 10px;
}
.login input {
    background-color: rgba(255, 255, 255, 0.1); /* 半透明白色 */
    color: #e2e8f0; /* 浅灰色文本 */
    border: 1px solid rgba(255, 255, 255, 0.2); /* 浅色边框 */
    border-radius: 5px; /* 圆角设计 */
}
.login .write-link.send {
    background-color: #7d5a9b; /* 中紫色背景 */
    color: #ffffff; /* 白色文本 */
    border-radius: 5px; /* 圆角设计 */
}