:root{
  --bg:#ededed;
  --bar:rgba(247,247,247,.96);
  --line:rgba(0,0,0,.055);
  --text:#111;
  --sub:#8a8a8a;
  --bubble:#fff;
  --mine:#95ec69;
  --send:#07c160;
  --shadow:0 .5px 1.2px rgba(0,0,0,.045);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",Arial,sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;background:#d8d8d8;color:var(--text)}
body{overflow:hidden}
button,input,textarea,select{font:inherit}
button{border:0;background:none;color:inherit}
button:active{opacity:.66}

.app{
  width:min(860px,100%);
  height:100dvh;
  margin:0 auto;
  display:grid;
  grid-template-rows:calc(52px + env(safe-area-inset-top)) 1fr auto;
  background:var(--bg);
  box-shadow:0 0 30px rgba(0,0,0,.10);
}
.topbar{
  display:grid;
  grid-template-columns:64px 1fr 64px;
  align-items:end;
  min-height:52px;
  padding-top:env(safe-area-inset-top);
  background:var(--bar);
  border-bottom:1px solid var(--line);
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
  z-index:5;
}
.nav-btn{
  height:52px;
  display:flex;
  align-items:center;
  cursor:pointer;
}
.back{
  justify-content:flex-start;
  padding-left:16px;
  font-size:34px;
  font-weight:200;
  line-height:1;
}
.more{
  justify-content:flex-end;
  padding-right:17px;
  font-size:17px;
  font-weight:700;
  letter-spacing:2px;
}
.title-wrap{
  height:52px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  min-width:0;
}
.title{font-size:17px;font-weight:600;line-height:21px}
.status{font-size:10px;color:#999;line-height:14px;margin-top:1px}

.chat{
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  padding:10px 13px 104px;
  overscroll-behavior:contain;
  scroll-behavior:smooth;
}
.date-pill{
  margin:5px auto 18px;
  width:max-content;
  color:#aaa;
  font-size:12px;
  line-height:18px;
}
.msg{
  display:flex;
  align-items:flex-start;
  gap:10px;
  margin:14px 0;
}
.msg.mine{justify-content:flex-end}
.avatar{
  width:40px;height:40px;flex:0 0 40px;
  border-radius:5px;
  display:grid;place-items:center;
  font-size:16px;
  user-select:none;
  overflow:hidden;
  box-shadow:inset 0 0 0 .5px rgba(0,0,0,.06);
}
.avatar.dragon{
  background:linear-gradient(145deg,#3b5047,#273b33);
  color:#f4e0a6;
}
.avatar.self{
  background:linear-gradient(145deg,#d8d0bd,#c4baa4);
  color:#4b463c;
}
.bubble{
  position:relative;
  max-width:min(69%,570px);
  padding:9px 12px 10px;
  border-radius:5px;
  font-size:16px;
  line-height:1.55;
  white-space:pre-wrap;
  word-break:break-word;
  box-shadow:var(--shadow);
}
.other .bubble{background:var(--bubble)}
.mine .bubble{background:var(--mine)}
.other .bubble::before{
  content:"";
  position:absolute;
  left:-7px;top:13px;
  border-top:6px solid transparent;
  border-bottom:6px solid transparent;
  border-right:8px solid var(--bubble);
}
.mine .bubble::after{
  content:"";
  position:absolute;
  right:-7px;top:13px;
  border-top:6px solid transparent;
  border-bottom:6px solid transparent;
  border-left:8px solid var(--mine);
}
.loading .bubble{color:#7d7d7d;letter-spacing:2px}

.empty{
  text-align:center;
  color:#9b9b9b;
  font-size:13px;
  margin-top:25vh;
  line-height:1.8;
}
.empty-mark{
  width:44px;height:44px;border-radius:8px;margin:0 auto 12px;
  display:grid;place-items:center;
  background:#344a40;color:#f2dfaa;font-size:18px;
}
.empty .sub{font-size:12px;color:#aaa;margin-top:2px}

.composer{
  display:grid;
  grid-template-columns:35px 1fr 35px 35px auto;
  gap:7px;
  align-items:end;
  padding:7px 9px calc(7px + env(safe-area-inset-bottom));
  background:#f7f7f7;
  border-top:1px solid var(--line);
}
.composer textarea{
  min-height:36px;
  max-height:118px;
  resize:none;
  border:0;
  outline:none;
  border-radius:5px;
  padding:8px 10px;
  background:#fff;
  color:#111;
  font-size:16px;
  line-height:20px;
}
.circle-btn{
  width:33px;height:33px;
  border:1.65px solid #222;
  border-radius:50%;
  display:grid;place-items:center;
  font-size:20px;
  margin-bottom:1px;
  cursor:pointer;
}
.circle-btn.plus{font-size:24px;font-weight:300}
.send-btn{
  height:36px;
  padding:0 14px;
  border-radius:4px;
  background:var(--send);
  color:#fff;
  font-size:14px;
  cursor:pointer;
}
.send-btn:disabled{opacity:.55}
.hidden{display:none!important}

.context-menu{
  position:fixed;
  z-index:30;
  display:flex;
  overflow:hidden;
  border-radius:5px;
  background:#2b2b2b;
  box-shadow:0 5px 22px rgba(0,0,0,.28);
}
.context-menu button{
  color:#fff;
  padding:10px 16px;
  font-size:14px;
}
.context-menu button+button{border-left:1px solid rgba(255,255,255,.13)}

.toast{
  position:fixed;
  left:50%;top:76px;
  transform:translateX(-50%);
  z-index:50;
  max-width:min(80vw,420px);
  padding:8px 13px;
  border-radius:7px;
  background:rgba(0,0,0,.74);
  color:#fff;
  font-size:13px;
  text-align:center;
}
.settings-dialog{
  width:min(430px,calc(100% - 26px));
  border:0;border-radius:10px;padding:0;
  background:#fff;color:#111;
  box-shadow:0 16px 55px rgba(0,0,0,.25);
}
.settings-dialog::backdrop{
  background:rgba(0,0,0,.42);
  backdrop-filter:blur(3px);
}
.settings-card{padding:20px;display:grid;gap:15px}
.settings-title{text-align:center;font-size:18px;font-weight:600}
.settings-card label{
  display:grid;gap:7px;
  color:#666;font-size:14px;
}
.settings-card input,.settings-card select{
  width:100%;
  padding:10px;
  border:1px solid #ddd;
  border-radius:5px;
  outline:none;
  background:#fff;color:#111;
}
.switch-row{grid-template-columns:1fr auto;align-items:center}
.switch-row input{width:auto}
.hint{font-size:12px;color:#999;line-height:1.55}
.settings-actions{display:flex;justify-content:flex-end;gap:10px}
.secondary,.primary{padding:9px 18px;border-radius:5px}
.secondary{background:#f2f2f2}
.primary{background:var(--send);color:#fff}

@media(max-width:600px){
  html,body{background:var(--bg)}
  .app{box-shadow:none}
  .bubble{max-width:74%}
}
