:root {
  --green: #07C160;
  --green-dark: #06AD56;
  --bg: #EDEDED;
  --cell: #FFFFFF;
  --text: #191919;
  --sub: #888888;
  --hint: #B2B2B2;
  --line: #E6E6E6;
  --bubble-self: #95EC69;
  --bubble-other: #FFFFFF;
  --nav-h: 44px;
  --tab-h: 50px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { overflow: hidden; }
.hidden { display: none !important; }

button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }

#app, .screen {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------------------------------------------------------------- navbar */
.navbar {
  flex: 0 0 auto;
  padding-top: var(--sat);
  height: calc(var(--nav-h) + var(--sat));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #EDEDED;
  border-bottom: 0.5px solid #D8D8D8;
  z-index: 20;
}
.navbar .title {
  font-size: 17px;
  font-weight: 500;
  max-width: 62%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.navbar .subtitle {
  position: absolute;
  bottom: 2px;
  font-size: 10px;
  color: var(--green);
  font-weight: 400;
}
.navbar .left, .navbar .right {
  position: absolute;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
}
.navbar .left { left: 6px; }
.navbar .right { right: 10px; }
.navbar .icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.navbar .text-btn { font-size: 16px; padding: 0 6px; }
.navbar .icon-btn svg { width: 24px; height: 24px; display: block; }
.navbar .text-btn svg { width: 22px; height: 22px; display: block; }
.navbar.has-sub .title { transform: translateY(-7px); }

/* ---------------------------------------------------------------- layout */
.body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}
.body.no-pad { padding: 0; }

/* ---------------------------------------------------------------- tabbar */
.tabbar {
  flex: 0 0 auto;
  height: calc(var(--tab-h) + var(--sab));
  padding-bottom: var(--sab);
  display: flex;
  background: #F7F7F7;
  border-top: 0.5px solid #DADADA;
  z-index: 30;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #7A7E83;
  font-size: 10px;
  position: relative;
}
.tab.active { color: var(--green); }
.tab svg { width: 24px; height: 24px; }
.tab .dot {
  position: absolute;
  top: 3px;
  left: calc(50% + 6px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: #FA5151;
  color: #fff;
  font-size: 11px;
  line-height: 17px;
  text-align: center;
  font-weight: 500;
}

/* ---------------------------------------------------------------- cells */
.cell-group { background: var(--cell); margin-top: 8px; }
.cell-group:first-child { margin-top: 0; }
.cell {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  min-height: 60px;
  background: var(--cell);
  position: relative;
  text-align: left;
  width: 100%;
}
.cell:active { background: #F2F2F2; }
.cell + .cell::before {
  content: "";
  position: absolute;
  left: 60px; right: 0; top: 0;
  height: 0.5px;
  background: var(--line);
}
.cell.no-line::before { display: none; }
.cell .grow { flex: 1; min-width: 0; }
.cell .name {
  font-size: 16px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell .desc {
  font-size: 13px;
  color: var(--sub);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell .time {
  font-size: 12px;
  color: var(--hint);
  align-self: flex-start;
  padding-top: 2px;
  flex: 0 0 auto;
}
.cell svg { width: 20px; height: 20px; flex: 0 0 auto; }
.cell .chev::after {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-right: 1.5px solid #C5C5C5;
  border-bottom: 1.5px solid #C5C5C5;
  transform: rotate(-45deg);
  margin-left: 6px;
  flex: 0 0 auto;
}
.cell .label { font-size: 15px; color: var(--text); }
.cell .value { font-size: 15px; color: var(--sub); max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- avatar */
.avatar {
  width: 44px; height: 44px;
  border-radius: 6px;
  flex: 0 0 auto;
  object-fit: cover;
  background: #C9C9C9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  font-weight: 500;
  overflow: hidden;
  user-select: none;
}
.avatar.sm { width: 36px; height: 36px; font-size: 14px; border-radius: 5px; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; border-radius: 8px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* 会话列表头像右下角的在线小绿点（对方在线时才有） */
.avatar-wrap { position: relative; flex: 0 0 auto; line-height: 0; }
.avatar-wrap .on-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); border: 2px solid #fff;
  box-sizing: content-box;
}

/* 在线 / 最后上线 小字（通讯录、资料页、聊天标题副行） */
.online-tag { color: var(--green); font-size: 11px; margin-left: 6px; font-weight: 400; }
.seen-tag { color: var(--hint); font-size: 11px; margin-left: 6px; font-weight: 400; }

/* 公司内部号：ID 金色 + 官方角标 */
.off-id { color: #B8860B; font-weight: 500; }
.off-badge {
  display: inline-flex; align-items: center; gap: 2px;
  margin-left: 5px; padding: 0 5px; height: 15px; line-height: 15px;
  border-radius: 3px;
  background: linear-gradient(180deg, #FFE9A8, #F3CF62);
  color: #7A5B00; font-size: 9px; font-weight: 700;
  vertical-align: 1px; white-space: nowrap;
}
.off-badge::before { content: "✓"; font-size: 9px; }
.navbar .subtitle.away { color: var(--hint); }

/* ---------------------------------------------------------------- badge */
.badge {
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #FA5151;
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  font-weight: 500;
  flex: 0 0 auto;
}
.badge.dot {
  min-width: 9px; height: 9px; width: 9px; padding: 0;
  border-radius: 50%;
}

/* ---------------------------------------------------------------- messages */
.chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.day-sep {
  align-self: center;
  margin: 12px 0 8px;
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
}
.sys-msg {
  align-self: center;
  margin: 6px 0;
  font-size: 12px;
  color: var(--sub);
  background: rgba(0, 0, 0, 0.05);
  padding: 3px 8px;
  border-radius: 4px;
  max-width: 80%;
  text-align: center;
}
.msg {
  display: flex;
  gap: 9px;
  margin: 7px 0;
  align-items: flex-start;
}
.msg.self { flex-direction: row-reverse; }
.msg .col { display: flex; flex-direction: column; max-width: 70%; min-width: 0; gap: 3px; }
.msg.self .col { align-items: flex-end; }
.msg .sender {
  font-size: 11px;
  color: var(--sub);
  padding: 0 2px;
}
.bubble {
  position: relative;
  background: var(--bubble-other);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 23px;            /* 3.9.2：整体字号 -20% */
  line-height: 1.38;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  max-width: 100%;
  box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.04);
}
.msg.self .bubble { background: var(--bubble-self); }
.bubble.plain { padding: 0; background: transparent !important; box-shadow: none; }
.bubble img.photo {
  display: block;
  max-width: 180px;
  max-height: 220px;
  border-radius: 6px;
  object-fit: cover;
}
.bubble.voice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 84px;
  cursor: pointer;
}
.bubble.voice .wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 18px;
}
.bubble.voice .wave i {
  display: block;
  width: 2px;
  background: #4A4A4A;
  border-radius: 1px;
  opacity: 0.55;
}
.bubble.voice.playing .wave i { opacity: 1; background: var(--green-dark); }
.bubble.voice .dur { font-size: 15px; color: #4A4A4A; }
.msg .meta {
  font-size: 10px;
  color: var(--hint);
  padding: 0 2px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.msg .meta .read { color: #A9A9A9; }
.msg .meta .queued { color: #FA9D3B; }
.msg.pending .bubble { opacity: 0.55; }
.msg.failed .bubble { background: #FDE2E2 !important; }
.msg.revoked .bubble { background: #E9E9E9 !important; color: var(--sub); font-size: 14px; }

.typing { font-size: 11px; color: var(--green); }

/* ---------------------------------------------------------------- composer */
.composer {
  flex: 0 0 auto;
  background: #F7F7F7;
  border-top: 0.5px solid #DADADA;
  padding: 8px 8px calc(8px + var(--sab));
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.composer .tool svg { width: 25px; height: 25px; display: block; }
.composer .tool {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex: 0 0 auto;
  margin-bottom: 2px;
  color: #333;
}
.composer .field {
  flex: 1;
  background: #fff;
  border-radius: 5px;
  padding: 7px 10px;
  min-height: 40px;
  max-height: 150px;
  font-size: 19px;            /* 3.9.2：整体字号 -20% */
  line-height: 1.35;
  border: none;
  outline: none;
  resize: none;
  overflow-y: auto;
  width: 100%;
  display: block;
}
.composer .send {
  background: var(--green);
  color: #fff;
  border-radius: 5px;
  padding: 0 14px;
  height: 34px;
  font-size: 15px;
  margin-bottom: 2px;
  flex: 0 0 auto;
}
.composer .send[disabled] { opacity: 0.45; }
.hold-btn {
  flex: 1;
  height: 36px;
  border-radius: 5px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #333;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.hold-btn.recording { background: #E4E4E4; }

/* emoji panel */
.emoji-panel {
  flex: 0 0 auto;
  background: #F7F7F7;
  border-top: 0.5px solid #DADADA;
  padding: 8px 10px calc(8px + var(--sab));
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 38vh;
  overflow-y: auto;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 6px;
}
.emoji-recent {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding-bottom: 6px;
  border-bottom: 0.5px solid #E3E3E3;
}
.emoji-cap { font-size: 11px; color: #8A8F99; margin-right: 2px; }
.emoji-panel button { font-size: 45px; line-height: 1.1; padding: 2px; }
.emoji-recent button { font-size: 42px; }

/* ---------------------------------------------------------------- misc */
.page-title {
  padding: 8px 16px 6px;
  font-size: 13px;
  color: var(--sub);
}
.empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--hint);
  font-size: 14px;
  line-height: 1.7;
}
.search-wrap {
  padding: 8px 12px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--hint);
  font-size: 15px;
}
.search-box input {
  border: none; outline: none; flex: 1; font-size: 15px; background: transparent;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: #fff;
  border-radius: 6px;
  height: 44px;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 500;
  width: 100%;
}
.btn:active { background: var(--green-dark); }
.btn.ghost { background: #fff; color: var(--text); }
.btn.danger { background: #FA5151; }
.btn.sm { height: 32px; font-size: 14px; padding: 0 12px; width: auto; }
.btn[disabled] { opacity: 0.5; }

/* login */
.login {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 32px;
  background: #fff;
  overflow-y: auto;
}
.login .logo {
  width: 72px; height: 72px;
  border-radius: 16px;
  background: var(--green);
  margin: 14vh auto 14px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 34px;
}
.login h1 { text-align: center; font-size: 20px; font-weight: 500; margin: 0 0 4px; }
.login .tip { text-align: center; color: var(--hint); font-size: 13px; margin-bottom: 26px; }
.field-row {
  display: flex; align-items: center;
  border-bottom: 0.5px solid var(--line);
  padding: 6px 0;
  margin-bottom: 6px;
}
.field-row label { width: 62px; font-size: 15px; color: #555; flex: 0 0 auto; }
.field-row input {
  flex: 1; border: none; outline: none; font-size: 16px; padding: 10px 0; background: transparent;
}
.login .btn { margin-top: 22px; }
.login .switch { text-align: center; margin-top: 18px; font-size: 14px; color: #576B95; }
.login .switch b { font-weight: 400; color: #576B95; }

/* toast */
#toast {
  position: fixed;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 8px;
  max-width: 76vw;
  text-align: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
  line-height: 1.5;
}
#toast.show { opacity: 1; }

/* 离线提示：没网时浮在标题栏下方，不挡操作 */
.net-pill {
  position: fixed;
  left: 50%;
  top: calc(var(--nav-h) + var(--sat) + 6px);
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 6px 12px;
  border-radius: 13px;
  white-space: nowrap;
  z-index: 998;
  pointer-events: none;
  display: none;
}
/* 离线胶囊占了标题栏下面一条，内容整体下移，避免盖住第一条消息的时间 */
body.is-offline .body { padding-top: 30px; }
body.is-offline .chat-body { padding-top: 42px; }

/* modal */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
}
#overlay.show { display: flex; }
.sheet {
  width: 100%;
  max-width: 560px;
  background: #F7F7F7;
  border-radius: 12px 12px 0 0;
  padding: 18px 16px calc(18px + var(--sab));
  animation: up 0.2s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 0 0 14px; font-size: 16px; font-weight: 500; text-align: center; }
.sheet .actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet input[type="text"], .sheet textarea {
  width: 100%;
  border: none; outline: none;
  background: #fff;
  border-radius: 6px;
  padding: 12px;
  font-size: 16px;
  margin-bottom: 8px;
  font-family: inherit;
}
.sheet textarea { resize: none; min-height: 90px; }

/* media viewer */
#viewer {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
#viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* moments */
.moment {
  display: flex;
  gap: 10px;
  padding: 14px 14px;
  background: #fff;
  border-bottom: 0.5px solid var(--line);
}
.moment .content { flex: 1; min-width: 0; }
.moment .nick { font-size: 15px; color: #576B95; font-weight: 500; margin-bottom: 4px; }
.moment .text { font-size: 15px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.moment .imgs {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  grid-template-columns: repeat(3, 1fr);
  max-width: 250px;
}
.moment .imgs.one { grid-template-columns: 1fr; max-width: 190px; }
.moment .imgs img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 3px;
  background: #eee;
}
.moment .imgs.one img { aspect-ratio: auto; max-height: 240px; }
.moment .foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--hint);
}
.moment .acts { display: flex; gap: 12px; }
.moment .act {
  display: flex; align-items: center; gap: 3px;
  color: #576B95; font-size: 13px;
}
.moment .act.liked { color: #FA5151; }
.moment .social {
  background: #F7F7F7;
  border-radius: 4px;
  margin-top: 8px;
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.6;
}
.moment .social .like-line { color: #576B95; }
.moment .social .cmt b { color: #576B95; font-weight: 400; }

/* call overlay */
.call-screen {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: #2A2A2A;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: calc(60px + var(--sat));
  padding-bottom: calc(50px + var(--sab));
}
.call-screen video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111;
}
.call-screen .local {
  position: absolute;
  right: 12px;
  top: calc(12px + var(--sat));
  width: 100px;
  height: 140px;
  border-radius: 8px;
  object-fit: cover;
  background: #000;
  z-index: 3;
  transform: scaleX(-1);
}
.call-info {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-bottom: auto;
}
.call-info .name { font-size: 22px; font-weight: 500; }
.call-info .state { font-size: 14px; opacity: 0.7; margin-top: 8px; }
.call-actions {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 40px;
}
.call-btn {
  width: 66px; height: 66px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  color: #fff;
}
.call-btn.hang { background: #FA5151; }
.call-btn.answer { background: var(--green); }
.call-btn.mute { background: rgba(255, 255, 255, 0.18); }

/* profile */
.profile-head {
  display: flex; align-items: center; gap: 14px;
  background: #fff; padding: 18px 16px;
}
.profile-head .meta { flex: 1; min-width: 0; }
.profile-head .n { font-size: 20px; font-weight: 500; }
.profile-head .u { font-size: 13px; color: var(--hint); margin-top: 3px; }
.profile-head .b { font-size: 13px; color: var(--sub); margin-top: 4px; }

.loading {
  padding: 40px;
  text-align: center;
  color: var(--hint);
  font-size: 14px;
}

@media (min-width: 720px) {
  #app, .screen { max-width: 560px; margin: 0 auto; box-shadow: 0 0 24px rgba(0,0,0,0.12); }
  body { background: #D9D9D9; }
}

/* 录音浮层（微信风格） */
.rec-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 700;
  pointer-events: none;
}
.rec-overlay.hidden { display: none; }
.rec-box {
  min-width: 160px;
  padding: 18px 20px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  text-align: center;
}
.rec-box .rec-dot {
  width: 54px; height: 54px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}
.rec-box.cancel .rec-dot { background: #FA5151; }
.rec-box .rec-txt { font-size: 15px; }
.rec-box .rec-sub { font-size: 12px; opacity: 0.7; margin-top: 4px; }
.rec-box .rec-time { font-size: 20px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.rec-box .rec-bar {
  height: 4px; margin-top: 10px; border-radius: 2px;
  background: rgba(255,255,255,0.2); overflow: hidden;
}
.rec-box .rec-bar i { display: block; height: 100%; width: 0; background: var(--green); transition: width 0.15s; }

/* 图片查看器工具条 + 编辑器 */
#viewer .viewer-bar {
  position: absolute;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  left: 0; right: 0;
  display: flex; justify-content: center; gap: 14px;
}
.vbtn {
  background: rgba(255,255,255,0.16);
  color: #fff;
  border-radius: 18px;
  padding: 8px 18px;
  font-size: 15px;
}
.vbtn.primary { background: var(--green); }
.editor {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: #000;
}
.editor canvas {
  flex: 1 1 auto;
  margin: 10px auto;
  max-width: 100%;
  object-fit: contain;
  touch-action: none;
}
.ed-bar {
  flex: 0 0 auto;
  display: flex; justify-content: center; flex-wrap: wrap; gap: 10px;
  padding: 10px 8px calc(14px + env(safe-area-inset-bottom, 0px));
  background: #1C1C1C;
}

/* 视频消息 */
.video-bubble { position: relative; padding: 0; overflow: hidden; }
.video-bubble video { display: block; width: 220px; max-width: 62vw; border-radius: 6px; background: #000; }
.video-bubble .vdur {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(0,0,0,0.6); color: #fff;
  font-size: 11px; padding: 1px 6px; border-radius: 8px;
}

/* 广告位：应用内打开 */
.ad-overlay {
  position: fixed; inset: 0; z-index: 800;
  background: #fff; display: flex; flex-direction: column;
}
.ad-overlay .ad-bar {
  height: 48px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; background: #f7f7f7; border-bottom: 0.5px solid #e5e5e5;
}
.ad-overlay .ad-title { font-size: 16px; font-weight: 600; }
.ad-overlay iframe { flex: 1 1 auto; width: 100%; border: 0; }
.ad-overlay .ad-fallback {
  flex: 1 1 auto; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  color: var(--hint); font-size: 14px;
}
.ad-overlay .ad-fallback.hidden { display: none; }

/* 田字格广告位 */
.me-body { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
#adsSection {
  flex: 1 1 0; min-height: 0;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  gap: 6px; padding: 10px 12px; background: #fff;
}
#adsSection .ad-cell {
  width: 100%; height: 100%; border-radius: 10px; overflow: hidden;
  background: #FFFDF6; display: flex; align-items: center; justify-content: center;
  border: 2px solid #C9A86A; padding: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
#adsSection .ad-cell img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 6px; }
#adsSection .ad-cell.empty { background: #FFFDF6; }
.ad-cell-text { font-size: 14px; color: var(--text); text-align: center; padding: 6px; }

/* 顶部文字横幅 */
.ad-banner { flex: 0 0 auto; padding: 10px 12px 0; background: #fff; }
.ad-banner.hidden { display: none; }
.ad-banner-btn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: #FFFDF6; border: 2px solid #C9A86A;
  border-radius: 10px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  text-align: left;
}
.ad-banner-title {
  flex: 1; min-width: 0; font-size: 17px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ad-banner-more { flex: 0 0 auto; font-size: 13px; color: var(--green); }
.ad-banner-btn.has-img {
  display: block; padding: 0; overflow: hidden; position: relative;
  border-width: 1px; line-height: 0;
}
.ad-banner-poster { width: 100%; height: 104px; object-fit: cover; display: block; }
.ad-banner-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 7px 12px; text-align: left;
  font-size: 15px; font-weight: 600; color: #fff; line-height: 1.3;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.62));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ad-image-view {
  position: fixed; inset: 0; z-index: 600; background: #000;
  display: flex; flex-direction: column;
}
.ad-image-bar {
  flex: 0 0 auto; height: 48px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 8px;
  background: rgba(0, 0, 0, 0.72); color: #fff; font-size: 16px;
}
.ad-image-bar .icon-btn { color: #fff; font-size: 18px; width: 34px; }
.ad-image-view img { flex: 1 1 auto; width: 100%; min-height: 0; object-fit: contain; display: block; }

/* 广告全文页 */
.ad-detail {
  position: fixed; inset: 0; z-index: 500; background: #fff;
  display: flex; flex-direction: column;
}
.ad-detail-bar {
  flex: 0 0 auto; height: 48px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 8px;
  background: var(--bg); border-bottom: 0.5px solid var(--line);
  font-size: 17px; font-weight: 500;
}
.ad-detail-bar .icon-btn { font-size: 26px; color: var(--text); width: 34px; }
.ad-detail-scroll {
  flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 18px 18px 40px;
}
.ad-detail-scroll h2 { margin: 0 0 14px; font-size: 22px; line-height: 1.35; }
.ad-detail-content { font-size: 16px; line-height: 1.75; color: #333; word-break: break-word; }

/* 「发现」页底部的设置格 */
.discover-grid {
  flex: 0 0 auto; display: grid; grid-template-columns: 1fr 1fr;
  gap: 5px; padding: 6px 10px 8px;
}
.discover-cell {
  height: 40px; display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 8px; font-size: 13px; color: var(--text);
}

/* 「个性」页里的广告开关 */
.switch {
  position: relative; flex: 0 0 auto; width: 52px; height: 32px;
  border-radius: 16px; background: #E5E5E5; border: none; cursor: pointer;
  transition: background .2s; padding: 0;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 28px; height: 28px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: left .2s;
}
.switch.on { background: var(--green); }
.switch.on::after { left: 22px; }
.discover-dl { flex: 0 0 auto; padding: 0 10px 8px; }
.discover-dl .btn { height: 42px; font-size: 15px; }

/* 「我」页底部的两条长条按钮（设置App / 个性设置），和 4 格一行同高 */
.setting-bar { flex: 0 0 auto; display: flex; gap: 5px; padding: 6px 10px 8px; }
.setting-btn {
  flex: 1 1 0; height: 40px; background: #fff; border: none; border-radius: 8px;
  font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap;
}
.setting-btn:active { background: #F2F2F2; }

/* iPhone 添加到桌面引导 */
.install-sheet .install-steps { padding: 4px 20px 14px; }
.install-steps p { margin: 9px 0; font-size: 15px; line-height: 1.5; color: var(--text); }
.install-steps b { color: var(--green); }

.gi-body { flex: 1 1 auto; overflow-y: auto; background: #f7f7f7; }
.gi-head { padding: 12px 16px 6px; font-size: 13px; color: var(--hint); }
.gi-body .cell { background: #fff; border-bottom: 0.5px solid #eee; }

/* 聊天页：点顶部昵称 / 对方头像 → 好友信息（完整备注 + 编辑） */
.navbar .title.tappable { cursor: pointer; }
.msg-avatar { flex: 0 0 auto; }
.pc-head {
  display: flex; flex-direction: column; align-items: center;
  padding: 22px 16px 18px; background: #fff; border-bottom: 0.5px solid #eee;
}
.pc-head .avatar { margin-bottom: 10px; }
.pc-nick { font-size: 19px; font-weight: 600; }
.pc-user { margin-top: 4px; font-size: 12px; color: var(--hint); }
.pc-user .pc-online { color: var(--green); margin-left: 8px; }
.pc-remark {
  background: #fff; padding: 12px 16px; font-size: 15px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  max-height: 40vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.pc-remark.empty { color: var(--hint); }
.pc-overlay .cell { background: #fff; border-top: 0.5px solid #eee; }
.rm-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; font-size: 12px; color: var(--hint);
}

/* 聊天页标题：在返回键和右侧按钮之间的空间内居中，避免长标题压按钮 */
.navbar.chat-nav .title {
  max-width: none;
  position: absolute;
  left: 48px;
  right: var(--nav-right, 128px);
  text-align: center;
}
.ad-bar .vbtn {
  background: none;
  color: var(--green);
  padding: 6px 8px;
  font-size: 15px;
}

/* 详细资料页功能按钮 */
.friend-actions {
  display: flex; gap: 8px; padding: 10px 12px;
  background: var(--cell); margin-top: 8px;
}
.friend-actions button {
  flex: 1; height: 42px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
}
.friend-actions button.primary { background: var(--green); color: #fff; }
.friend-actions button.ghost { background: #f2f2f2; color: var(--green); }
