/* =========================================
   【回复美化专用 CSS】 - 暗黑赛博聊天叙事主题
   ========================================= */

/* 1. 全局变量与容器 */
:root {
    --bg-chat: #0d0917;
    --box-bg: #161023;
    --border-color: #352a4d;
    --text-main: #f0f0f0;
    --text-sub: #a6a0bd;
    --accent-pink: #e040a0;
    --accent-purple: #8a4bf7;
    --btn-grad: linear-gradient(90deg, #f565b3, #b35bf5);
}

.chat-wrap {
    background-color: var(--bg-chat);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    max-width: 680px;
    margin: 20px auto;
    padding: 10px 20px 40px;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(181, 91, 245, 0.05);
}

/* 2. 通用折叠面板 (推理区 & 记忆区) */
details.chat-reason, details.chat-mem {
    background-color: var(--box-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin: 16px 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

details.chat-reason[open], details.chat-mem[open] {
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px rgba(138, 75, 247, 0.15);
}

details summary {
    padding: 14px 18px;
    cursor: pointer;
    font-weight: bold;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    background: rgba(255, 255, 255, 0.02);
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::after {
    content: "▶";
    font-size: 12px;
    color: var(--text-sub);
    transition: transform 0.2s;
}

details[open] summary::after {
    transform: rotate(90deg);
}

details summary:hover {
    background: rgba(224, 64, 160, 0.05);
}

/* 推理区内部 */
.chat-reason-in, .chat-mem-in {
    padding: 14px 18px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    line-height: 1.7;
    color: #d6d1e6;
    background: rgba(13, 9, 23, 0.3);
}

/* 3. 时间戳 */
.chat-time {
    text-align: center;
    font-size: 12px;
    color: var(--text-sub);
    padding: 20px 0 12px;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.chat-time::before, .chat-time::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-color);
    max-width: 60px;
}

/* 4. 基础消息结构 (群聊) */
.chat-msg {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border-left: 2px solid transparent;
}

.chat-msg:hover {
    background: rgba(255, 255, 255, 0.04);
}

.chat-msg .chat-name {
    font-weight: bold;
    color: var(--accent-pink);
    font-size: 14px;
    margin-bottom: 4px;
    display: block;
}

.chat-msg .chat-text {
    font-size: 15px;
    line-height: 1.6;
    color: #e6e0f0;
    word-break: break-word;
}

/* 图片与语音特殊样式 */
.chat-msg .chat-img {
    display: block;
    background: #1f1833;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 14px;
    margin: 6px 0;
    font-size: 14px;
    color: #c9c1d4;
    font-family: monospace;
    white-space: pre-wrap;
    overflow-x: auto;
}

.chat-msg .chat-voice {
    display: inline-block;
    background: #201735;
    color: var(--accent-pink);
    border: 1px solid rgba(224, 64, 160, 0.2);
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 14px;
    margin: 4px 0;
}

/* 5. 私聊特殊样式 */
.chat-private {
    margin: 18px 0;
    border: 1px solid var(--accent-purple);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(138, 75, 247, 0.05);
}

.chat-private-h {
    background: rgba(138, 75, 247, 0.15);
    padding: 6px 14px;
    font-size: 13px;
    color: #b39eff;
    border-bottom: 1px solid var(--accent-purple);
    font-weight: bold;
}

.chat-private .chat-msg {
    margin: 0;
    border-left: none;
    border-radius: 0;
    background: transparent;
}
.chat-private .chat-msg:hover {
    background: rgba(255, 255, 255, 0.03);
}
.chat-private .chat-msg .chat-name {
    color: #e57dff;
}

/* 6. 行动/选项列表 */
.chat-acts {
    background: var(--box-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    margin: 20px 0;
}

.chat-acts-h {
    font-size: 13px;
    color: var(--text-sub);
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 12px;
    font-weight: bold;
}

.chat-acts-i {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 14px;
    margin: 6px 0;
    border-radius: 6px;
    border: 1px solid transparent;
    color: #d6d1e6;
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-acts-i:hover {
    border-color: var(--accent-purple);
    background: rgba(138, 75, 247, 0.05);
    color: #fff;
}

/* 7. 状态面板 */
.chat-panel {
    background: var(--box-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-panel-h {
    font-size: 13px;
    color: var(--text-sub);
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 4px;
    font-weight: bold;
}

.chat-panel-r {
    display: flex;
    font-size: 14px;
    align-items: baseline;
    gap: 8px;
}

.chat-panel-k {
    color: var(--text-sub);
    min-width: 68px;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.chat-panel-v {
    color: var(--text-main);
    word-break: break-all;
}

/* 8. 记忆区深度格式化 */
.chat-mem-in { display: flex; flex-direction: column; gap: 12px; background: transparent; }

.chat-mem-s {
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.chat-mem-t {
    color: var(--accent-pink);
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 6px;
}

.chat-mem-l, .chat-mem-p {
    color: #d6d1e6;
    font-size: 14px;
    line-height: 1.6;
}

.chat-mem-w {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    color: #ff6b6b;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    opacity: 0.8;
}