/* ===== 基础 ===== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: #eef1f6;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: #333;
  -webkit-font-smoothing: antialiased;
}

:root {
  --primary: #a8d0f0;
  --primary-deep: #1a4a72;
  --accent: #5b9bd5;
  --bg: #f7f9fc;
  --card: #ffffff;
  --text: #333;
  --muted: #999;
  --muted-2: #aaa;
  --danger: #c0392b;
  --like: #e74c3c;
  --w: 420px;
}

.phone {
  position: relative;
  width: 100%;
  max-width: var(--w);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(30, 60, 90, .08);
}

/* ===== 顶栏 ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 46px;
  line-height: 46px;
  text-align: center;
  background: #fff;
  border-bottom: 1px solid #eef1f5;
  font-size: 16px;
  font-weight: 600;
  color: #222;
  flex: 0 0 auto;
}

.app-main { flex: 1 1 auto; }

.hidden { display: none !important; }

/* ===== 底部 tab ===== */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--w);
  display: flex;
  background: #fff;
  border-top: 1px solid #eef1f5;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  z-index: 30;
}
.tabbar-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #999;
  text-decoration: none;
  padding: 10px 0;
}
.tabbar-item.active { color: var(--accent); font-weight: 600; }

/* ===== 通用 ===== */
.wrap { padding: 10px; }
.page { padding-bottom: 30px; }

.card {
  background: var(--card);
  border-radius: 8px;
  padding: 12px;
  margin: 10px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .04);
}

.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 13px; }
.section-title { font-size: 14px; font-weight: 700; color: #333; margin-bottom: 10px; }

.btn-primary {
  display: block;
  width: 100%;
  background: var(--primary);
  color: var(--primary-deep);
  border: none;
  border-radius: 6px;
  font-size: 15px;
  padding: 9px 0;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
}
.btn-primary:disabled { opacity: .6; cursor: default; }

.input {
  width: 100%;
  background: #f2f6fa;
  border: none;
  border-radius: 5px;
  padding: 9px 10px;
  margin-bottom: 10px;
  font-size: 14px;
  outline: none;
  color: #333;
}
.input::placeholder { color: #b3bcc7; }

.tag { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: #e6f0fa; color: var(--accent); }
.tag-admin { background: #dbeafe; color: #2563eb; }
.tag-dev { background: #ede9fe; color: #7c3aed; }

/* ===== 登录 ===== */
.login-wrap { padding: 40px 20px; }
.login-title { font-size: 24px; font-weight: 700; color: var(--primary-deep); text-align: center; }
.login-sub { font-size: 12px; color: var(--muted); text-align: center; margin: 8px 0 20px; }

.tabs { display: flex; margin-bottom: 15px; }
.tab { flex: 1; text-align: center; padding: 8px 0; color: var(--muted); font-size: 15px; cursor: pointer; }
.tab.active { color: var(--accent); font-weight: 700; border-bottom: 2px solid var(--primary); }

.label { font-size: 13px; color: #666; margin-bottom: 6px; }
.roles { display: flex; gap: 8px; margin-bottom: 10px; }
.role {
  flex: 1; text-align: center; padding: 8px 0; background: #f2f6fa;
  border-radius: 5px; font-size: 13px; color: #666; cursor: pointer;
}
.role-active { background: var(--primary); color: var(--primary-deep); font-weight: 700; }

/* ===== 帖子卡片 ===== */
.post-head { display: flex; align-items: center; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; margin-right: 8px; flex: 0 0 auto;
}
.post-info { flex: 1; min-width: 0; }
.uname { font-size: 14px; font-weight: 700; color: #333; }
.time { font-size: 11px; color: var(--muted-2); margin-top: 2px; }

.post-content { margin: 10px 0; font-size: 15px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }

.media-grid { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.media-img {
  width: 100px; height: 100px; border-radius: 4px; object-fit: cover;
  background: #f2f6fa; cursor: zoom-in; display: block;
}
.media-single .media-img { width: 210px; height: 210px; }
.media-video {
  width: 100%; height: 200px; margin: 8px 0;
  border-radius: 4px; background: #000; display: block;
}

.post-actions { display: flex; gap: 20px; font-size: 13px; color: #888; align-items: center; }
.act { padding: 3px 0; cursor: pointer; user-select: none; }
.act-liked { color: var(--like); }
.act-del { color: var(--danger); margin-left: auto; }

/* ===== 评论 ===== */
.comment { padding: 10px 0; border-bottom: 1px solid #f0f0f0; position: relative; }
.comment:last-child { border-bottom: none; }
.c-head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.c-name { font-size: 13px; font-weight: 700; color: var(--accent); }
.c-time { font-size: 11px; color: #bbb; }
.c-content { font-size: 14px; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.c-del { position: absolute; right: 0; bottom: 6px; font-size: 11px; color: var(--danger); cursor: pointer; }

.input-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: var(--w);
  background: #fff; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; align-items: center;
  box-shadow: 0 -1px 5px rgba(0, 0, 0, .05); z-index: 30;
}
.c-input {
  flex: 1; background: #f2f6fa; border: none; border-radius: 15px;
  padding: 7px 12px; font-size: 14px; outline: none;
}
.send-btn { width: auto; padding: 7px 15px; font-size: 13px; flex: 0 0 auto; }

/* ===== 发布 ===== */
.textarea {
  width: 100%; min-height: 140px; background: #f2f6fa; border: none;
  border-radius: 6px; padding: 10px; font-size: 15px; outline: none;
  resize: vertical; font-family: inherit; color: #333;
}
.counter { text-align: right; font-size: 11px; color: var(--muted-2); margin: 4px 0 6px; }

.toolbar { display: flex; gap: 10px; margin: 12px 0; }
.tool {
  flex: 1; text-align: center; padding: 8px 0; background: #f2f6fa;
  border-radius: 5px; font-size: 13px; color: var(--accent); cursor: pointer;
}
.tool-off { color: #bbb; }

.media-item { position: relative; width: 100px; height: 100px; }
.media-item .media-img { width: 100px; height: 100px; cursor: default; }
.media-del {
  position: absolute; top: -5px; right: -5px;
  width: 20px; height: 20px; line-height: 18px; text-align: center;
  border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff;
  font-size: 14px; cursor: pointer; user-select: none;
}
.video-box { position: relative; margin-top: 8px; }
.video-preview { width: 100%; height: 190px; border-radius: 5px; background: #000; display: block; }

/* ===== 我的 ===== */
.profile { display: flex; align-items: center; }
.profile .avatar { width: 52px; height: 52px; font-size: 22px; margin-right: 12px; }
.info { flex: 1; }
.row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; font-size: 15px; color: #333;
  border-bottom: 1px solid #f2f4f7; cursor: pointer;
}
.row:last-child { border-bottom: none; }
.arrow { color: #c9d1da; font-size: 18px; }

.my-post { padding: 10px 0; border-bottom: 1px solid #f2f4f7; cursor: pointer; }
.my-post:last-child { border-bottom: none; }
.mp-content { font-size: 14px; line-height: 1.5; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mp-time { font-size: 11px; color: var(--muted-2); margin-top: 4px; }

/* ===== 后台 ===== */
.u-row { display: flex; align-items: flex-start; }
.u-info { flex: 1; min-width: 0; }
.u-name { font-size: 14px; font-weight: 700; }
.u-meta { margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.banned { font-size: 11px; color: var(--danger); }
.u-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.btn-mini {
  background: #f2f6fa; color: var(--accent); border: none; border-radius: 4px;
  font-size: 12px; padding: 5px 10px; cursor: pointer;
}
.btn-warn { background: #fff4e0; color: #b7791f; }
.btn-danger2 { background: #ffe6e6; color: #c0392b; }
.p-user { font-size: 12px; color: var(--muted-2); margin-bottom: 4px; }
.p-content { font-size: 14px; line-height: 1.5; margin-bottom: 8px; word-break: break-word; }

/* ===== 提示 / 弹层 ===== */
.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, .78); color: #fff; padding: 10px 16px;
  border-radius: 6px; font-size: 13px; max-width: 280px; text-align: center;
  z-index: 100; line-height: 1.5;
}

.sheet-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .35);
  display: flex; align-items: flex-end; justify-content: center; z-index: 90;
}
.sheet {
  width: 100%; max-width: var(--w); background: #fff;
  border-radius: 12px 12px 0 0; padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
}
.sheet-title { text-align: center; font-size: 13px; color: var(--muted); padding: 8px 0; }
.sheet-item {
  display: block; width: 100%; background: none; border: none;
  padding: 13px 0; font-size: 15px; color: #333; cursor: pointer;
  border-top: 1px solid #f2f4f7; font-family: inherit;
}
.sheet-item:active { background: #f7f9fc; }
.sheet-cancel {
  display: block; width: 100%; background: #f7f9fc; border: none;
  padding: 13px 0; font-size: 15px; color: #666; cursor: pointer;
  margin-top: 6px; font-family: inherit;
}

/* ===== 桌面端：模拟手机尺寸 ===== */
@media (min-width: 480px) {
  body { padding: 20px 0; }
  .phone { min-height: calc(100vh - 40px); border-radius: 12px; overflow: hidden; }
  .tabbar { border-radius: 0 0 12px 12px; }
}

/* ===== 个人首页 / 标签 ===== */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eef4fb; color: #4a7fb5;
  border-radius: 10px; padding: 3px 10px; font-size: 12px;
}
.chip-del { cursor: pointer; color: #a8b6c6; font-size: 13px; line-height: 1; }
.chip-del:hover { color: #c0392b; }
.chips-empty { font-size: 12px; color: #b3bcc7; margin-top: 8px; }

.stats { display: flex; gap: 20px; margin-top: 12px; font-size: 13px; color: #666; }
.stats b { color: #1a4a72; font-size: 16px; margin-right: 3px; }

.profile-head { display: flex; align-items: center; gap: 12px; }
.profile-head .avatar { width: 52px; height: 52px; font-size: 22px; margin-right: 0; }
.profile-actions { margin-top: 12px; }
.btn-line {
  display: inline-block; padding: 6px 14px; border-radius: 5px;
  border: 1px solid var(--primary); color: var(--primary-deep);
  background: #fff; font-size: 13px; cursor: pointer; font-family: inherit;
}
.pub-post { padding: 10px 0; border-bottom: 1px solid #f2f4f7; cursor: pointer; }
.pub-post:last-child { border-bottom: none; }
.pp-content { font-size: 14px; line-height: 1.5; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pp-time { font-size: 11px; color: var(--muted-2); margin-top: 4px; }

/* ===== 聊天 ===== */
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 10px; }
.chat-title { font-size: 17px; font-weight: 700; color: #1a4a72; }
.room-card { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.room-avatar {
  width: 44px; height: 44px; border-radius: 10px; background: #a8d0f0; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; flex: 0 0 auto;
}
.room-info { flex: 1; min-width: 0; }
.room-name { font-size: 15px; font-weight: 600; color: #333; }
.room-count { font-size: 11px; color: #999; margin-left: 6px; font-weight: 400; }
.room-last { font-size: 12px; color: #999; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-time { font-size: 11px; color: #bbb; flex: 0 0 auto; }

.chat-page { display: flex; flex-direction: column; height: calc(100vh - 46px - 60px); }
.chat-members { padding: 8px 12px; display: flex; gap: 6px; flex-wrap: wrap; background: #fff; border-bottom: 1px solid #eef1f5; max-height: 76px; overflow-y: auto; }
.chat-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 78%; }
.msg-mine { align-self: flex-end; text-align: right; }
.msg-meta { font-size: 11px; color: #aaa; margin-bottom: 3px; }
.bubble { display: inline-block; padding: 8px 12px; border-radius: 12px; background: #fff; font-size: 14px; line-height: 1.5; text-align: left; word-break: break-word; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.msg-mine .bubble { background: #a8d0f0; color: #12395c; }
.bubble-text { white-space: pre-wrap; }
.bubble-voice { display: inline-flex; align-items: center; gap: 8px; }
.voice-audio { height: 32px; max-width: 180px; }
.voice-dur { font-size: 12px; color: #666; }
.chat-img { max-width: 180px; border-radius: 8px; display: block; }

.chat-input-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 100%; max-width: var(--w); background: #fff;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  display: flex; gap: 6px; align-items: center;
  box-shadow: 0 -1px 6px rgba(0,0,0,.06); z-index: 30;
}
.chat-input { flex: 1; background: #f2f6fa; border: none; border-radius: 15px; padding: 8px 12px; font-size: 14px; outline: none; }
.chat-btn { background: #f2f6fa; border: none; border-radius: 8px; padding: 8px 10px; font-size: 15px; cursor: pointer; flex: 0 0 auto; }
.chat-send { background: #a8d0f0; color: #12395c; font-size: 13px; font-weight: 600; }
.chat-btn.recording { background: #e74c3c; color: #fff; }

/* ===== 通话室 ===== */
.call-page { padding: 20px 16px; text-align: center; }
.call-title { font-size: 20px; font-weight: 700; color: #1a4a72; }
.call-sub { font-size: 13px; color: #888; margin-top: 6px; }
.call-peers { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin: 24px 0; min-height: 120px; }
.call-peer { width: 92px; }
.peer-avatar {
  width: 62px; height: 62px; border-radius: 50%; background: #c9d8e6; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; margin: 0 auto 8px;
}
.call-peer.peer-on .peer-avatar { background: #7bc47f; box-shadow: 0 0 0 4px rgba(123,196,127,.2); }
.peer-name { font-size: 13px; color: #333; }
.peer-state { font-size: 11px; color: #aaa; margin-top: 2px; }
.call-empty { color: #b3bcc7; font-size: 13px; padding: 30px 0; }
.call-actions { display: flex; gap: 16px; justify-content: center; margin-top: 10px; }
.call-btn { background: #f2f6fa; border: none; border-radius: 24px; padding: 12px 24px; font-size: 14px; cursor: pointer; }
.call-hangup { background: #ffd6d6; color: #c0392b; }
.call-tip { font-size: 11px; color: #b3bcc7; margin-top: 20px; }

/* ===== 未读红点 / @提醒 / 视频 ===== */
.room-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: 0 0 auto; }
.badge {
  min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px;
  border-radius: 9px; background: #e74c3c; color: #fff;
  font-size: 11px; text-align: center; font-weight: 600;
}
.tabbar-item { position: relative; }
.tab-badge {
  position: absolute; top: 2px; right: 50%; transform: translateX(24px);
  min-width: 16px; height: 16px; line-height: 16px; padding: 0 4px;
  border-radius: 8px; background: #e74c3c; color: #fff;
  font-size: 10px; text-align: center; font-weight: 600;
}
.at { color: #1a73e8; font-weight: 600; }
.msg-at .bubble { box-shadow: 0 0 0 2px rgba(231, 76, 60, .5); }
.msg-at .bubble::after { content: ' @你'; font-size: 10px; color: #e74c3c; margin-left: 4px; }

.call-videos { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.video-tile {
  position: relative; width: 140px; height: 100px; border-radius: 8px;
  overflow: hidden; background: #1c2430; color: #fff; font-size: 11px;
}
.video-tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.video-tile span { position: absolute; left: 6px; bottom: 4px; }

/* ===== 应用内弹窗（微信里 window.prompt 被禁用） ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 150; padding: 20px;
}
.modal-box {
  width: 100%; max-width: 300px; background: #fff; border-radius: 12px;
  padding: 20px 18px 14px; box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.modal-title { font-size: 15px; color: #333; text-align: center; margin-bottom: 14px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.modal-ok { width: auto; padding: 8px 18px; font-size: 14px; }

/* ===== 头像 ===== */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.big { width: 76px; height: 76px; font-size: 30px; }
.avatar-edit { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
