:root{
  --bg:#111;
  --bg2:#1a1a1a;
  --bg3:#232323;
  --line:#262626;
  --text:#ededed;
  --sub:#8a8a8a;
  --blue:#1e7be0;
  --bubble-me:#2b6cd4;
  --bubble-other:#262626;
  --name:#f0a13c;
  --radius:10px;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
  margin:0;background:var(--bg);color:var(--text);
  font:15px/1.5 -apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
  height:100dvh;overflow:hidden;
}
.screen{position:fixed;inset:0;display:flex;flex-direction:column;background:var(--bg)}
.hide{display:none!important}

/* 登录 */
#login{justify-content:center;padding:28px;gap:12px;background:radial-gradient(800px 400px at 50% 0%,#1d2736,#111 60%)}
#login .logo{width:64px;height:64px;border-radius:18px;margin:0 auto 8px;display:grid;place-items:center;font-size:28px;background:linear-gradient(135deg,#1e7be0,#3f9bff)}
#login h1{margin:0;text-align:center;font-size:21px;font-weight:600}
#login p{margin:0 0 14px;text-align:center;color:var(--sub);font-size:13px}
#login input{padding:13px 15px;border-radius:12px;border:1px solid var(--line);background:#1c1c1c;color:var(--text);font:inherit;outline:none}
#login input:focus{border-color:#2a5f9e}
.primary{padding:13px;border-radius:12px;border:0;font:inherit;font-weight:600;color:#fff;background:var(--blue)}

/* 首页 */
.home-head{padding:14px 16px 8px;background:var(--bg2);flex-shrink:0}
.me-row{display:flex;align-items:center;gap:10px;margin-bottom:12px}
.me-info{display:flex;flex-direction:column;line-height:1.25}
.me-info b{font-size:16px}
.me-info span{font-size:11px;color:#3fd07a}
.plus{margin-left:auto;font-size:22px;color:#cfcfcf;width:32px;height:32px;display:grid;place-items:center;border-radius:50%;border:1px solid #333}
.search{display:flex;align-items:center;gap:6px;background:#2a2a2a;border-radius:9px;padding:9px 12px;color:var(--sub);font-size:14px}
.search i{font-style:normal}
.conv-list{flex:1;overflow-y:auto}
.conv{display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid #1e1e1e}
.conv:active{background:#1d1d1d}
.conv .txt{flex:1;min-width:0}
.conv .top{display:flex;align-items:baseline;gap:8px}
.conv .top b{font-size:16px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.conv .top span{margin-left:auto;font-size:11px;color:#6f6f6f;flex-shrink:0}
.conv .prev{font-size:13px;color:var(--sub);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-top:3px}
.badge{min-width:18px;height:18px;padding:0 5px;border-radius:99px;background:#e5484d;color:#fff;font-size:11px;display:grid;place-items:center;margin-left:6px}
.tabbar{display:flex;border-top:1px solid var(--line);background:#161616;padding-bottom:env(safe-area-inset-bottom);flex-shrink:0}
.tab{flex:1;text-align:center;padding:10px 0 12px;color:#6f6f6f;font-size:12px}
.tab.active{color:#3f9bff}

.avatar{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;font-weight:600;font-size:15px;color:#fff;flex-shrink:0;background:#3a4a6a}
.avatar.lg{width:46px;height:46px;font-size:17px}
.avatar.sm{width:34px;height:34px;font-size:13px}

/* 聊天页 */
.chat-head{display:flex;align-items:center;gap:8px;padding:10px 14px;background:var(--bg2);border-bottom:1px solid var(--line);flex-shrink:0}
.back{font-size:26px;line-height:1;color:#cfcfcf;width:28px;text-align:left}
.chat-title{display:flex;flex-direction:column;line-height:1.2;flex:1;min-width:0}
.chat-title b{font-size:16px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-title span{font-size:11px;color:var(--sub)}
.menu{font-size:20px;color:#cfcfcf}

.msg-list{flex:1;overflow-y:auto;padding:14px 12px 8px;display:flex;flex-direction:column;gap:14px}
.msg{display:flex;gap:9px;max-width:86%}
.msg.me{align-self:flex-end;flex-direction:row-reverse}
.msg .body{display:flex;flex-direction:column;min-width:0}
.msg .who{font-size:12px;color:var(--sub);margin:0 2px 4px;display:flex;align-items:center;gap:5px}
.msg .who b{font-weight:500;color:var(--name)}
.lv{font-size:10px;padding:0 4px;border-radius:3px;background:#2b2b2b;color:#9a9a9a;line-height:15px}
.bubble{padding:10px 13px;border-radius:var(--radius);word-break:break-word;white-space:pre-wrap;font-size:15px;line-height:1.55;width:fit-content}
.msg.other .bubble{background:var(--bubble-other);border-top-left-radius:4px}
.msg.me .bubble{background:var(--bubble-me);border-top-right-radius:4px;color:#fff}
.day{align-self:center;font-size:11px;color:#6f6f6f;background:#1c1c1c;padding:3px 10px;border-radius:99px}

/* 输入区 */
.composer{background:var(--bg2);border-top:1px solid var(--line);padding:8px 12px calc(8px + env(safe-area-inset-bottom));flex-shrink:0}
.tools{display:flex;gap:20px;padding:2px 6px 10px;color:#9a9a9a;font-size:19px}
.tools .tool{line-height:1}
.input-row{display:flex;gap:10px;align-items:flex-end}
#txt{flex:1;resize:none;max-height:110px;padding:10px 12px;border-radius:8px;border:0;background:#2a2a2a;color:var(--text);font:inherit;outline:none}
.send{padding:9px 18px;border-radius:8px;border:0;background:var(--blue);color:#fff;font:inherit;height:40px;flex-shrink:0}
.send:disabled{background:#2a3a52;color:#7b8ea8}
::-webkit-scrollbar{width:0}

/* v3 新增 */
.img{max-width:220px;max-height:260px;border-radius:10px;display:block}
.sticker{width:120px;height:120px;object-fit:contain;display:block}
.voice{display:flex;align-items:center;gap:8px;background:#2a2a2a;padding:10px 14px;border-radius:10px;width:140px;cursor:pointer;user-select:none}
.voice .wave{font-size:9px;letter-spacing:2px;color:#7fb2ff}
.voice.playing .wave{color:#3fd07a}
.mic-tip{position:absolute;left:50%;top:66px;transform:translateX(-50%);background:rgba(229,72,77,.92);color:#fff;padding:6px 14px;border-radius:99px;font-size:12px}
.tool.rec{color:#e5484d}
.sticker-grid{flex:1;overflow-y:auto;display:grid;grid-template-columns:repeat(4,1fr);gap:10px;padding:14px;align-content:start}
.sticker-grid img{width:100%;aspect-ratio:1;object-fit:contain;background:#1c1c1c;border-radius:10px;padding:6px}
.sticker-add{display:grid;place-items:center;aspect-ratio:1;border:1px dashed #3a3a3a;border-radius:10px;color:#666;font-size:26px;cursor:pointer}
.profile-body{flex:1;padding:24px;display:flex;flex-direction:column;align-items:center;gap:10px}
.p-avatar{width:88px;height:88px;border-radius:50%;display:grid;place-items:center;font-size:32px;color:#fff;background:#3a4a6a;background-size:cover;background-position:center;cursor:pointer}
.p-hint{font-size:12px;color:#6f6f6f;margin-bottom:14px}
.p-label{align-self:flex-start;font-size:13px;color:#8a8a8a;margin-top:8px}
.p-input{align-self:stretch;padding:12px;border-radius:10px;border:0;background:#242424;color:#ededed;font:inherit;outline:none}
.p-save{align-self:stretch;margin-top:18px}

.toast{position:fixed;left:50%;bottom:90px;transform:translateX(-50%) translateY(10px);background:rgba(40,40,40,.95);color:#eee;padding:9px 16px;border-radius:99px;font-size:13px;opacity:0;transition:.2s;pointer-events:none;z-index:99}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
