/* ==========================================================================
   焚聊 · 仿微信桌面端样式
   配色对齐微信：深灰导航条 #2e2e2e / 列表 #e6e6e6 / 聊天区 #f5f5f5
   自己气泡 #95ec69 / 对方气泡 #fff / 品牌绿 #07c160
   ========================================================================== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
.svg-defs { display: none; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.5 "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: #191919;
  background: #ededed;
  overflow: hidden;
}
button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
[hidden] { display: none !important; }

/* ------------------------------- 脚本异常兜底条 --------------------------- */
.error-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 999;
  background: #d03050; color: #fff; padding: 8px 14px;
  font-size: 12px; max-height: 96px; overflow: auto; white-space: pre-wrap;
}

/* ------------------------------- 登录 / 注册 ------------------------------ */
.login-wrap {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 50% 0%, #f2f3f5 0%, #e3e5e8 60%, #d8dade 100%);
  padding: 20px; overflow: auto;
}
.login-card {
  width: 360px; max-width: 100%; background: #fff; border-radius: 12px;
  padding: 28px 26px 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, .12);
}
.login-brand { text-align: center; margin-bottom: 18px; }
.login-mark {
  width: 54px; height: 54px; margin: 0 auto 10px; border-radius: 14px;
  background: #07c160; color: #fff; display: flex; align-items: center; justify-content: center;
}
.login-title { font-size: 21px; font-weight: 600; letter-spacing: 2px; }
.login-sub { margin-top: 6px; color: #9a9a9a; font-size: 12px; }
.login-sub b { color: #07c160; }
.login-tabs { display: flex; gap: 18px; justify-content: center; margin: 16px 0 14px; border-bottom: 1px solid #f0f0f0; padding-bottom: 10px; }
.login-tab { color: #8a8a8a; font-size: 14px; padding: 4px 2px 8px; position: relative; }
.login-tab.is-on { color: #191919; font-weight: 600; }
.login-tab.is-on::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  bottom: -11px; width: 22px; height: 2px; background: #07c160; border-radius: 2px;
}
.login-form { display: flex; flex-direction: column; gap: 12px; }
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld span { font-size: 12px; color: #9a9a9a; }
.fld input {
  height: 40px; border: 1px solid #e5e5e5; border-radius: 6px; padding: 0 12px;
  background: #fafafa; outline: none; transition: border-color .15s, background .15s;
}
.fld input:focus { border-color: #07c160; background: #fff; }
.btn-primary {
  height: 42px; margin-top: 4px; border-radius: 6px; background: #07c160; color: #fff;
  font-size: 15px; letter-spacing: 4px; transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { background: #b7e8c9; cursor: not-allowed; }
.login-msg { margin-top: 12px; font-size: 12px; color: #d03050; text-align: center; }
.login-msg.ok { color: #07c160; }
.boot-notice {
  margin-bottom: 12px; padding: 9px 11px; border-radius: 6px; font-size: 12px; line-height: 1.6;
  background: #fff7e6; color: #a05a00; border: 1px solid #ffe0ad;
}
.login-foot { margin: 16px 0 0; text-align: center; color: #c4c4c4; font-size: 11px; }

/* --------------------------------- 主框架 -------------------------------- */
.app { position: fixed; inset: 0; display: flex; background: #ededed; }

.rail {
  width: 60px; flex: 0 0 60px; background: #2e2e2e; color: #9a9a9a;
  display: flex; flex-direction: column; align-items: center; padding: 14px 0 12px; gap: 6px;
}
.rail-avatar {
  width: 36px; height: 36px; border-radius: 5px; color: #fff; font-size: 15px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
  background: #4f7ff0; overflow: hidden; user-select: none;
}
.rail-btn { width: 40px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 6px; color: #6d6d6d; }
.rail-btn:hover { color: #b9b9b9; }
.rail-btn.is-on { color: #07c160; }
.rail-space { flex: 1; }
.rail-status { width: 8px; height: 8px; border-radius: 50%; background: #07c160; margin: 6px 0; }
.rail-status.warn { background: #f5a623; }
.rail-status.bad { background: #d03050; }

/* -------------------------------- 列表栏 -------------------------------- */
.side { width: 250px; flex: 0 0 250px; background: #e6e6e6; display: flex; flex-direction: column; border-right: 1px solid #dadada; }
.side-search { margin: 12px 12px 4px; position: relative; }
.side-search input {
  width: 100%; height: 28px; border: 0; border-radius: 4px;
  background: #d9d9d9; padding: 0 8px 0 28px; outline: none; font-size: 13px;
}
.side-search input:focus { background: #d0d0d0; }
.side-search-icon { position: absolute; left: 8px; top: 7px; color: #979797; }
.side-head {
  height: 32px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; color: #7f7f7f; font-size: 12px;
}
.side-count { font-size: 11px; }
.conv-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.conv-item {
  display: flex; gap: 10px; padding: 10px 12px; align-items: center; cursor: pointer; position: relative;
}
.conv-item:hover { background: #dcdcdb; }
.conv-item.is-on { background: #c9c9c9; }
.avatar {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 4px; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 16px; user-select: none;
}
.avatar.dot::after {
  content: ""; position: absolute; right: 12px; bottom: 12px; width: 9px; height: 9px;
  border-radius: 50%; background: #07c160; border: 2px solid #e6e6e6;
}
.conv-item.is-on .avatar.dot::after { border-color: #c9c9c9; }
.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; align-items: baseline; gap: 6px; }
.conv-name { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { color: #b2b2b2; font-size: 11px; flex: 0 0 auto; }
.conv-bottom { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.conv-preview {
  flex: 1; min-width: 0; color: #9a9a9a; font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-preview.burn { color: #d0a24a; }
.badge {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: #fa5151; color: #fff;
  font-size: 11px; line-height: 17px; text-align: center; flex: 0 0 auto;
}
.list-empty { padding: 30px 16px; text-align: center; color: #a3a3a3; font-size: 12px; line-height: 1.8; }

/* -------------------------------- 聊天区 -------------------------------- */
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #f5f5f5; }
.chat-head {
  height: 58px; flex: 0 0 58px; border-bottom: 1px solid #e2e2e2; background: #f5f5f5;
  display: flex; align-items: center; gap: 10px; padding: 0 18px;
}
.chat-back { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; color: #4a4a4a; margin-left: -8px; }
.chat-head-text { flex: 1; min-width: 0; }
.chat-peer { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sub { font-size: 11px; color: #9a9a9a; height: 15px; }
.chat-sub.online { color: #07c160; }
.chat-head-burn {
  display: flex; align-items: center; gap: 4px; color: #b07a2a; font-size: 12px;
  background: #fdf3e2; border: 1px solid #f5e2c0; border-radius: 20px; padding: 3px 10px; flex: 0 0 auto;
}
.msg-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px 18px 6px; }
.msg-list { display: flex; flex-direction: column; }
.empty-state { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #b6b6b6; gap: 6px; }
.empty-mark { color: #dcdcdc; }
.empty-state p { margin: 0; }
.empty-tip { font-size: 12px; }
.empty-tip b { color: #b07a2a; }

.day-sep { text-align: center; color: #b9b9b9; font-size: 11px; margin: 12px 0 6px; }
.sys-line { text-align: center; margin: 10px 0; }
.sys-line span {
  display: inline-block; background: #e4e4e4; color: #8a8a8a; font-size: 11px;
  padding: 3px 10px; border-radius: 10px;
}

.row { display: flex; margin: 7px 0; align-items: flex-start; gap: 8px; }
.row.mine { flex-direction: row-reverse; }
.row-avatar {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 4px; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 15px; user-select: none;
}
.bubble-wrap { max-width: min(62%, 560px); min-width: 0; }
.bubble {
  position: relative; background: #fff; color: #191919; border-radius: 6px;
  padding: 9px 12px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
.row.mine .bubble { background: #95ec69; }
.bubble::before {
  content: ""; position: absolute; top: 12px; left: -5px; width: 10px; height: 10px;
  background: #fff; transform: rotate(45deg); border-radius: 2px;
}
.row.mine .bubble::before { left: auto; right: -5px; background: #95ec69; }
.bubble.pending { opacity: .55; }
.bubble-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11px; color: #b2b2b2; }
.row.mine .bubble-meta { justify-content: flex-end; }
.burn-tag { display: inline-flex; align-items: center; gap: 3px; color: #d0762a; }
.burn-tag.urgent { color: #d03050; }
.burn-tag svg { flex: 0 0 auto; }
.state-tag { color: #b2b2b2; }
.row.gone .bubble { background: #ececec; color: #b0b0b0; box-shadow: none; }
.row.gone .bubble::before { background: #ececec; }
.row.removing { opacity: 0; transform: translateY(-4px); transition: opacity .45s ease, transform .45s ease; }

/* ------------------------------- 输入区 --------------------------------- */
.typing-hint { padding: 0 20px 2px; font-size: 11px; color: #07c160; height: 16px; }
.composer { flex: 0 0 auto; border-top: 1px solid #e2e2e2; background: #f5f5f5; padding: 8px 16px 12px; }
#msgInput {
  width: 100%; min-height: 74px; max-height: 180px; border: 0; outline: none; resize: none;
  background: #f5f5f5; padding: 4px 2px 0; line-height: 1.6; font-size: 14px;
}
.composer-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.composer-hint { font-size: 11px; color: #b6b6b6; }
.composer-hint.warn { color: #d0762a; }
.btn-send {
  height: 32px; padding: 0 16px; border-radius: 5px; background: #e4e4e4; color: #a8a8a8;
  display: flex; align-items: center; gap: 6px; transition: background .15s, color .15s;
}
.btn-send.on { background: #07c160; color: #fff; }

/* --------------------------------- 提示 --------------------------------- */
.toast {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 900;
  background: rgba(0, 0, 0, .78); color: #fff; padding: 9px 16px; border-radius: 6px;
  font-size: 13px; max-width: 80vw; animation: toastIn .18s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 滚动条：贴近微信的细灰条 */
.conv-list::-webkit-scrollbar, .msg-scroll::-webkit-scrollbar, #msgInput::-webkit-scrollbar { width: 6px; }
.conv-list::-webkit-scrollbar-thumb, .msg-scroll::-webkit-scrollbar-thumb, #msgInput::-webkit-scrollbar-thumb { background: #c9c9c9; border-radius: 3px; }
.conv-list::-webkit-scrollbar-track, .msg-scroll::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------- 移动端 --------------------------------- */
@media (max-width: 760px) {
  .app { background: #ededed; }
  .rail { display: none; }
  .side { width: 100%; flex: 1 1 auto; border-right: 0; }
  .chat { display: none; }
  body.show-chat .side { display: none; }
  body.show-chat .chat { display: flex; }
  .msg-scroll { padding: 10px 10px 4px; }
  .bubble-wrap { max-width: 78%; }
  .chat-head-burn { display: none; }
  #msgInput { min-height: 54px; }
  .login-card { width: 100%; }
}
