/* 我的聊天 · 独立版 —— 按原软件视觉还原（深色 / 气泡 / 总群） */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: #12131a;
  color: #e8eaf2;
  font: 15px/1.55 system-ui, -apple-system, "WenQuanYi Micro Hei", "Microsoft YaHei", sans-serif;
  overscroll-behavior: none;
}
.hidden { display: none !important; }

/* ---------- 启动 / 错误层 ---------- */
#boot, #fatal {
  position: fixed; inset: 0; z-index: 99;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; text-align: center; background: #12131a;
}
.boot-spin {
  width: 34px; height: 34px; border: 3px solid rgba(255,255,255,.14);
  border-top-color: #5b8cff; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#boot-title { font-size: 23px; font-weight: 700; letter-spacing: 3px; }
#boot-text { color: #8b93ab; font-size: 13px; max-width: 320px; word-break: break-all; }
#fatal { background: rgba(10,11,16,.96); }
.fatal-card {
  width: min(360px, 88vw); padding: 26px 22px;
  background: #1b1d29; border: 1px solid #2c3040; border-radius: 18px;
}
.fatal-icon {
  width: 42px; height: 42px; margin: 0 auto 14px; border-radius: 50%;
  background: rgba(255,122,122,.14); color: #ff7a7a;
  font-size: 24px; font-weight: 700; line-height: 42px;
}
#fatal-msg { color: #c9cede; font-size: 14px; word-break: break-all; }
#btn-retry {
  margin-top: 18px; width: 100%; padding: 11px; border: 0; border-radius: 11px;
  background: #5b8cff; color: #fff; font-size: 15px; font-weight: 600;
}

/* ---------- 主容器 ---------- */
#app { display: flex; flex-direction: column; height: 100%; height: 100dvh; }

/* ---------- 顶栏 ---------- */
#hdr {
  flex: none; display: flex; align-items: center; gap: 11px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 12px;
  background: #1a1c26; border-bottom: 1px solid #232634;
}
.hdr-avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(150deg, #4aa8ff, #2f7de0);
  display: flex; align-items: center; justify-content: center;
}
.bubble-icon {
  width: 20px; height: 17px; border-radius: 9px 9px 9px 3px;
  background: #fff; display: block; position: relative;
}
.bubble-icon:after {
  content: ""; position: absolute; left: 4px; bottom: -4px;
  border: 4px solid transparent; border-top-color: #fff; border-right: 0;
}
.hdr-main { flex: 1; min-width: 0; }
.hdr-line { display: flex; align-items: center; gap: 7px; }
#hdr-name { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-official {
  flex: none; font-size: 10px; line-height: 1.5; padding: 1px 6px;
  border-radius: 5px; background: rgba(91,140,255,.16);
  color: #7fa6ff; border: 1px solid rgba(91,140,255,.3);
}
#hdr-sub { color: #8b93ab; font-size: 12px; margin-top: 2px; }
.hdr-online { flex: none; color: #8b93ab; font-size: 11px; display: flex; align-items: center; gap: 5px; }
.hdr-online i { width: 7px; height: 7px; border-radius: 50%; background: #4bd6a0; display: block; }

/* ---------- 消息 ---------- */
#messages {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 13px 20px;
}
.msg { display: flex; gap: 9px; margin-bottom: 16px; align-items: flex-start; }
.msg.me { flex-direction: row-reverse; }
.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  color: #fff; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  user-select: none;
}
.msg-body { max-width: min(74vw, 520px); min-width: 0; }
.meta { color: #8b93ab; font-size: 11px; margin: 0 3px 5px; }
.msg.me .meta { text-align: right; }
.bubble {
  padding: 10px 13px; border-radius: 16px;
  background: #262a36; color: #e8eaf2;
  font-size: 15px; line-height: 1.55; word-break: break-word;
  white-space: pre-wrap;
}
.msg.me .bubble { background: #2f8fe8; color: #fff; border-bottom-right-radius: 5px; }
.msg:not(.me) .bubble { border-bottom-left-radius: 5px; }
.bubble img { max-width: 100%; border-radius: 10px; display: block; }
.bubble a.file {
  display: flex; align-items: center; gap: 9px; text-decoration: none;
  color: inherit; padding: 2px 0;
}
.bubble a.file .fico {
  flex: none; width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255,255,255,.16); display: flex;
  align-items: center; justify-content: center; font-size: 17px;
}
.bubble a.file .fname { font-size: 13px; word-break: break-all; }
#new-tip {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 82px;
  z-index: 8; padding: 7px 14px; border-radius: 20px;
  background: #5b8cff; color: #fff; font-size: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4); cursor: pointer;
}

/* ---------- 输入栏 ---------- */
#composer {
  flex: none; display: flex; align-items: center; gap: 9px;
  padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 10px);
  background: #1a1c26; border-top: 1px solid #232634;
}
#btn-file, #btn-send {
  flex: none; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
#btn-file {
  width: 38px; height: 38px; border-radius: 50%;
  background: #262a36; color: #c9cede; font-size: 24px; line-height: 1;
}
#msg-input {
  flex: 1; min-width: 0; height: 40px; padding: 0 15px;
  border: 0; outline: 0; border-radius: 20px;
  background: #262a36; color: #e8eaf2; font-size: 15px;
}
#msg-input::placeholder { color: #6b7390; }
#btn-send {
  width: 42px; height: 42px; border-radius: 50%;
  background: #2f8fe8; box-shadow: 0 3px 12px rgba(47,143,232,.35);
}
#btn-send:disabled { opacity: .5; }
.paper-plane {
  width: 0; height: 0; display: block; margin-left: 3px;
  border-left: 15px solid #fff;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  transform: rotate(-8deg);
}

@media (min-width: 720px) {
  #app { max-width: 720px; margin: 0 auto; border-left: 1px solid #232634; border-right: 1px solid #232634; }
  body { background: #0d0e14; }
}
