/* ===== Badeline 聊天面板 / 游戏对话框（书架页与日记页共用） =====
   从 shelf.css 原样抽出：面板壳、消息列表、逐条头像、输入区、游戏对话框。
   两个页面各挂一次；颜色/尺寸/层级与书架页完全一致，页面差异只在各自 CSS 里覆写位置。 */

#badelineDialogText, .bl-msg.assistant { --c:#D678DB; }

#badelineDialog, #blChat {
    font-family:'Renogare','CelesteZH','Microsoft YaHei',sans-serif;
}

#blChat {
    position: fixed;
    left: 50%;
    bottom: 84px;
    width: min(92vw, 520px);
    z-index: 1600;
    background: rgba(16, 10, 28, .93);
    border: 2px solid rgba(205, 182, 255, .5);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .6), 0 0 18px rgba(205, 182, 255, .18);
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
    transition: opacity .25s ease, transform .25s ease;
}
#blChat.show { display: flex; }
#blChat.vis { opacity: 1; transform: translateX(-50%) translateY(0); }
#blChat .bl-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(205, 182, 255, .25);
}
#blChat .bl-head img { width: 40px; height: 40px; image-rendering: pixelated; border-radius: 6px; background: rgba(0,0,0,.4); object-fit: cover; }
#blChat .bl-name { flex: 1; color: #cdb6ff; font-family: 'Renogare','CelesteZH','Microsoft YaHei',sans-serif; font-size: 16px; letter-spacing: 1px; text-shadow: 0 0 10px rgba(205,182,255,.4); }
#blChat .bl-close { background: none; border: none; color: rgba(205,182,255,.6); font-size: 16px; cursor: pointer; }
#blChat .bl-close:hover { color: #cdb6ff; }
#blMsgs { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; max-height: 40vh; min-height: 110px; overflow-y: auto; }
.bl-msg { max-width: 86%; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.7; word-break: break-word; font-family: 'Renogare','CelesteZH','Microsoft YaHei',sans-serif; white-space: pre-wrap; }
.bl-msg.assistant { position: relative; padding-left: 38px; align-self: flex-start; color: #e8ddff; background: rgba(205,182,255,.12); border: 1px solid rgba(205,182,255,.28); }
.bl-msg.user { align-self: flex-end; color: #ffe36d; background: rgba(255,230,109,.1); border: 1px solid rgba(255,230,109,.3); }
.bl-msg.loading { color: rgba(232,221,255,.5); font-style: italic; }
/* 她的历史消息小头像：现有情绪立绘首帧，左上角贴边；用户消息无头像 */
.bl-msg.assistant .bl-avatar {
    position: absolute; left: 6px; top: 6px;
    width: 24px; height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(205,182,255,.35);
    background: rgba(0,0,0,.35);
    object-fit: cover;
    image-rendering: pixelated;
}
#blChat .bl-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(205,182,255,.25); }
#blInput { flex: 1; padding: 9px 10px; border: 1px solid rgba(205,182,255,.4); border-radius: 6px; background: rgba(205,182,255,.1); color: #efe7ff; font-size: 13px; outline: none; font-family: 'Renogare','CelesteZH','Microsoft YaHei',sans-serif; }
#blInput:focus { border-color: #cdb6ff; background: rgba(205,182,255,.18); }
#blInput::placeholder { color: rgba(232,221,255,.35); }
#blSend { padding: 9px 16px; border: none; border-radius: 6px; background: #8a5cff; color: #fff; cursor: pointer; font-size: 14px; letter-spacing: 1px; font-family: 'Renogare','CelesteZH',sans-serif; box-shadow: inset 0 -2px rgba(0,0,0,.35); }
#blSend:hover:not(:disabled) { background: #9d7bff; }
#blSend:disabled { opacity: .5; cursor: not-allowed; }
.bl-emo { display: inline-block; font-size: 10px; color: #b79aff; border: 1px solid rgba(183,154,255,.45); border-radius: 8px; padding: 0 6px; margin-right: 6px; vertical-align: 1px; opacity: .9; }
/* 流式中断时才出现的提示：保留已显示内容之后再补一句，暖色区分，不沿用等待占位的半透明样式 */
.bl-msg.bl-fail { color: rgba(255,190,150,.92); font-style: italic; align-self: flex-start; }

/* ===== Badeline 游戏对话框：官方文本框 + 情绪立绘（演出层；聊天面板让位上移） ===== */
#badelineDialog {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%) translateY(24px);
    width: min(94vw, 900px);
    min-height: 128px;
    z-index: 1600;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 30px;
    background: url('../celeste-portraits/textbox/badeline.png') center / 100% 100% no-repeat;
    opacity: 0;
    pointer-events: none;
    cursor: pointer;
    transition: opacity .25s ease, transform .25s ease;
}
#badelineDialog.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
#badelineDialogPortrait { width: 92px; height: 92px; flex-shrink: 0; border-radius: 6px; overflow: hidden; }
#badelineDialogPortrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
#badelineDialogName { color: #cdb6ff; font-family: 'Press Start 2P', monospace; font-size: 13px; margin-bottom: 5px; }
#badelineDialogText { color: #f2ecff; font-family: 'Renogare','CelesteZH','Microsoft YaHei',sans-serif; font-size: 14px; line-height: 1.7; word-break: break-word; }
#blChat.dialog-live { bottom: 178px; }
@media (max-width: 640px) {
    #badelineDialog { padding: 14px 18px; min-height: 104px; gap: 12px; }
    #badelineDialogPortrait { width: 72px; height: 72px; }
    #blChat.dialog-live { bottom: 150px; }
}
