:root {
  --bg: #f5f6f9;
  --surface: #ffffff;
  --text: #14161a;
  --muted: #8b91a1;
  --line: #ebedf2;
  --accent: #3b6cff;
  --accent-2: #7c5cff;
  --mine: linear-gradient(135deg, #3b6cff, #6a5cff);
  --shadow: 0 8px 30px rgba(20, 24, 40, 0.08);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #e8eaf0;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

#app {
  position: relative;
  width: 100%;
  max-width: 560px;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

#sheet-layer { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
#toast-layer { position: absolute; inset: 0; pointer-events: none; z-index: 50; }

button { font-family: inherit; border: none; background: none; color: inherit; cursor: pointer; }
input, textarea { font-family: inherit; border: none; outline: none; background: none; color: inherit; }
input, textarea { font-size: 16px; }

.screen { display: flex; flex-direction: column; height: 100%; position: relative; animation: fade 0.22s ease; }
.screen.overlay { position: absolute; inset: 0; z-index: 20; background: var(--bg); animation: slideIn 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }

@keyframes fade { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(18px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }

/* ---------- 顶栏 ---------- */
.topbar {
  padding: calc(18px + env(safe-area-inset-top, 0px)) 20px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.topbar h1 { font-size: 26px; font-weight: 720; letter-spacing: -0.5px; }
.topbar .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--text);
  transition: transform 0.15s, background 0.15s;
}
.icon-btn:active { transform: scale(0.94); background: #f0f2f7; }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- 会话列表 ---------- */
.list { flex: 1; overflow-y: auto; padding: 6px 12px 18px; scrollbar-width: none; }
.list::-webkit-scrollbar { display: none; }

.conv {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 16px;
  transition: background 0.15s;
  cursor: pointer;
}
.conv:active { background: #eceffb; }

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-size: 24px;
  flex: none;
  user-select: none;
}

.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conv-name { font-size: 15.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 11.5px; color: var(--muted); flex: none; }
.conv-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 3px; }
.conv-last { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge {
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex: none;
}

.empty {
  margin: 60px 24px;
  text-align: center;
  color: var(--muted);
}
.empty .emoji { font-size: 40px; display: block; margin-bottom: 14px; opacity: 0.9; }
.empty h3 { font-size: 16px; color: var(--text); font-weight: 600; margin-bottom: 8px; }
.empty p { font-size: 13px; line-height: 1.7; }

.square-card {
  margin: 8px 10px 4px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #202a45, #171b26);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.square-card .sq-ico {
  width: 42px; height: 42px; border-radius: 13px; background: rgba(255,255,255,0.1);
  display: grid; place-items: center; font-size: 21px; flex: none;
}
.square-card .sq-main { flex: 1; min-width: 0; }
.square-card .sq-title { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.square-card .sq-sub { font-size: 12.5px; color: rgba(255,255,255,0.6); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.square-card .badge { background: #ff5a5f; }

/* ---------- 底部导航 ---------- */
.tabbar {
  display: flex;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  padding: 6px 8px calc(6px + var(--safe-b));
  flex: none;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 0 5px;
  color: var(--muted);
  font-size: 10.5px;
  border-radius: 12px;
  position: relative;
  transition: color 0.15s;
}
.tab.active { color: var(--accent); }
.tab svg { width: 22px; height: 22px; }
.tab .dot {
  position: absolute;
  top: 4px;
  left: 50%;
  margin-left: 4px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ff5a5f;
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

/* ---------- 聊天 ---------- */
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 246, 249, 0.92);
  backdrop-filter: blur(14px);
  flex: none;
  z-index: 2;
}
.back { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 26px; line-height: 1; color: var(--text); background: var(--surface); border: 1px solid var(--line); }
.back:active { background: #eef0f6; }
.chat-title { flex: 1; min-width: 0; }
.chat-title h2 { font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title span { font-size: 11.5px; color: var(--muted); }
.chat-head .avatar { width: 38px; height: 38px; border-radius: 12px; font-size: 20px; }

.chat-body { flex: 1; overflow-y: auto; padding: 14px 14px 6px; scrollbar-width: none; }
.chat-body::-webkit-scrollbar { display: none; }

.time-sep { text-align: center; font-size: 11px; color: var(--muted); margin: 10px 0 14px; }

.msg { display: flex; gap: 8px; margin-bottom: 14px; align-items: flex-end; animation: pop 0.18s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.msg .avatar { width: 34px; height: 34px; border-radius: 11px; font-size: 18px; }
.msg.mine { flex-direction: row-reverse; }
.bubble {
  max-width: 74%;
  padding: 10px 14px;
  border-radius: 17px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(20, 24, 40, 0.05);
}
.msg.other .bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.mine .bubble { background: var(--mine); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 6px 18px rgba(59, 108, 255, 0.22); }
.msg.pending .bubble { opacity: 0.68; }
.msg.failed .bubble { background: #ffecec; color: #b3261e; border: 1px solid #ffd1d1; }

.square-tip {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #eef2ff;
  color: #4453a8;
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
}

/* ---------- 输入框 ---------- */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 9px 12px calc(9px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  flex: none;
}
.composer textarea {
  flex: 1;
  resize: none;
  background: #f0f2f7;
  border-radius: 20px;
  padding: 11px 16px;
  font-size: 16px;
  line-height: 1.4;
  max-height: 116px;
  min-height: 44px;
}
.composer textarea::placeholder { color: #a4aab8; }
.send-btn {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--mine);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(59, 108, 255, 0.3);
  transition: transform 0.15s, opacity 0.15s;
}
.send-btn:active { transform: scale(0.92); }
.send-btn:disabled { opacity: 0.4; box-shadow: none; }
.send-btn svg { width: 20px; height: 20px; }

/* ---------- 引导页 ---------- */
.onboard {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 26px calc(32px + var(--safe-b));
  background:
    radial-gradient(560px 320px at 12% -6%, rgba(59, 108, 255, 0.18), transparent 62%),
    radial-gradient(520px 320px at 92% 4%, rgba(124, 92, 255, 0.16), transparent 62%),
    var(--bg);
  overflow-y: auto;
}
.brand-mark {
  width: 62px; height: 62px; border-radius: 20px;
  background: var(--mine);
  display: grid; place-items: center;
  box-shadow: 0 12px 28px rgba(59, 108, 255, 0.32);
  margin-bottom: 22px;
}
.brand-mark svg { width: 32px; height: 32px; }
.onboard h1 { font-size: 34px; letter-spacing: -1px; font-weight: 720; }
.onboard .slogan { color: var(--muted); font-size: 14px; margin-top: 8px; line-height: 1.6; }

.field-label { font-size: 12.5px; color: var(--muted); margin: 26px 0 10px; font-weight: 500; }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatar-cell {
  aspect-ratio: 1;
  border-radius: 13px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  font-size: 21px;
  display: grid;
  place-items: center;
  transition: border-color 0.15s, transform 0.15s;
}
.avatar-cell.sel { border-color: var(--accent); background: #eef2ff; transform: translateY(-2px); }
.avatar-cell:active { transform: scale(0.94); }

.nick-input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16px;
}
.nick-input:focus { border-color: var(--accent); }

.primary-btn {
  width: 100%;
  margin-top: 24px;
  padding: 15px;
  border-radius: 15px;
  background: var(--mine);
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  box-shadow: 0 10px 24px rgba(59, 108, 255, 0.28);
  transition: transform 0.15s, opacity 0.15s;
}
.primary-btn:active { transform: scale(0.985); }
.primary-btn:disabled { opacity: 0.5; box-shadow: none; }
.hint { font-size: 12px; color: var(--muted); margin-top: 14px; text-align: center; line-height: 1.6; }

/* ---------- 我的 ---------- */
.profile-head { padding: 10px 20px 22px; }
.profile-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.profile-card .avatar { width: 60px; height: 60px; border-radius: 19px; font-size: 31px; }
.profile-card h2 { font-size: 19px; font-weight: 680; }
.profile-card .uid { font-size: 12px; color: var(--muted); margin-top: 5px; }

.menu { margin: 18px 12px; background: var(--surface); border-radius: 18px; overflow: hidden; border: 1px solid var(--line); }
.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  font-size: 15px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: #f7f8fb; }
.menu-item .chev { color: #c3c8d4; font-size: 18px; }
.menu-item.danger { color: #e0483f; }

.stat-row { display: flex; gap: 10px; margin: 18px 20px 0; }
.stat {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  text-align: center;
}
.stat b { display: block; font-size: 19px; font-weight: 700; }
.stat span { font-size: 11.5px; color: var(--muted); }

/* ---------- 遮罩与弹层 ---------- */
.mask {
  position: absolute;
  inset: 0;
  background: rgba(12, 15, 24, 0.42);
  display: flex;
  align-items: flex-end;
  z-index: 30;
  animation: fade 0.18s ease;
  pointer-events: auto;
}
.sheet {
  width: 100%;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 18px 20px calc(22px + var(--safe-b));
  max-height: 84%;
  display: flex;
  flex-direction: column;
  animation: up 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h3 { font-size: 17px; font-weight: 650; }
.sheet-close { color: var(--muted); font-size: 14px; padding: 4px 6px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0f2f7;
  border-radius: 13px;
  padding: 11px 14px;
  margin-bottom: 12px;
}
.search-box input { flex: 1; }
.search-box svg { width: 17px; height: 17px; color: var(--muted); flex: none; }

.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 6px;
  border-radius: 13px;
  cursor: pointer;
}
.user-row:active { background: #f4f6fb; }
.user-row .avatar { width: 42px; height: 42px; border-radius: 13px; font-size: 22px; }
.user-row .uname { flex: 1; font-size: 15px; font-weight: 550; }
.user-row .go { font-size: 12px; color: var(--accent); font-weight: 600; }

.sheet-scroll { overflow-y: auto; flex: 1; min-height: 120px; }
.sheet-note { font-size: 12px; color: var(--muted); text-align: center; padding: 18px 8px; line-height: 1.7; }

/* ---------- Toast ---------- */
#toast-layer .toast {
  position: absolute;
  left: 50%;
  bottom: calc(96px + var(--safe-b));
  transform: translateX(-50%);
  background: rgba(18, 21, 30, 0.9);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  max-width: 80%;
  text-align: center;
  animation: toastIn 0.2s ease;
  backdrop-filter: blur(8px);
  pointer-events: none;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 通讯录 ---------- */
.chev { color: #c3c8d4; font-size: 18px; }

.friend-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 16px;
  cursor: pointer;
  margin-bottom: 2px;
}
.friend-entry:active { background: #eceffb; }
.entry-ico {
  width: 46px; height: 46px; border-radius: 15px;
  background: linear-gradient(135deg, #ffe7c2, #ffd39c);
  display: grid; place-items: center; font-size: 22px; flex: none;
}
.entry-main { flex: 1; min-width: 0; }
.entry-title { font-size: 15.5px; font-weight: 600; }
.entry-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.mini-btn {
  padding: 6px 14px;
  border-radius: 999px;
  background: #f0f2f7;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  flex: none;
  transition: transform 0.15s;
}
.mini-btn.primary { background: var(--accent); color: #fff; }
.mini-btn:active { transform: scale(0.95); }
.mini-tag {
  font-size: 12px;
  color: var(--muted);
  padding: 5px 11px;
  border-radius: 999px;
  background: #f2f4f8;
  flex: none;
}

.req-section { font-size: 12px; color: var(--muted); padding: 14px 4px 8px; font-weight: 600; }
.req-empty { font-size: 13px; color: var(--muted); padding: 16px 4px; }
.req-item { display: flex; align-items: center; gap: 10px; padding: 10px 4px; }
.req-item .avatar { width: 42px; height: 42px; border-radius: 13px; font-size: 22px; }
.req-main { flex: 1; min-width: 0; }
.req-name { font-size: 15px; font-weight: 600; }
.req-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.req-actions { display: flex; gap: 8px; flex: none; }

/* ---------- 文件传输助手与二维码 ---------- */
.top-actions { display: flex; gap: 8px; }

.helper-card {
  margin: 8px 10px 6px;
  padding: 13px 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, #eef3ff, #e8ecff);
  border: 1px solid #dde5ff;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.helper-card:active { background: #e4eaff; }
.helper-card .avatar {
  width: 46px; height: 46px; border-radius: 14px; font-size: 24px;
  background: #fff; border: 1px solid #dde5ff;
}
.helper-main { flex: 1; min-width: 0; }
.helper-title { font-size: 15.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.helper-sub { font-size: 12.5px; color: #7b86a5; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-pill {
  font-size: 10px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #3b6cff, #7c5cff);
  padding: 3px 9px; border-radius: 999px; flex: none;
}

.attach-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: #f0f2f7; color: #5b6478;
  display: grid; place-items: center; flex: none; margin-bottom: 2px;
}
.attach-btn svg { width: 20px; height: 20px; }
.attach-btn:active { background: #e6e9f2; }

.file-card {
  display: flex; align-items: center; gap: 10px;
  margin-top: 6px; padding: 8px 10px;
  border-radius: 12px; background: rgba(255, 255, 255, 0.18);
  cursor: pointer; max-width: 230px;
}
.msg.other .file-card { background: #f4f6fb; }
.file-ico { font-size: 21px; flex: none; }
.file-main { display: flex; flex-direction: column; min-width: 0; }
.file-main b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-main small { font-size: 11px; opacity: 0.72; margin-top: 2px; }

.profile-mini { text-align: center; padding: 12px 0 20px; }
.profile-mini .avatar { width: 68px; height: 68px; border-radius: 22px; font-size: 34px; margin: 0 auto 12px; }
.profile-mini h2 { font-size: 19px; font-weight: 680; }
.profile-mini p { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.qr-actions { display: flex; justify-content: center; padding-bottom: 8px; }

.scanner {
  position: absolute; inset: 0; background: #0b0d12; color: #fff;
  pointer-events: auto; display: flex; flex-direction: column;
  animation: fade 0.2s ease;
}
.scanner-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px;
  font-size: 16px; font-weight: 600;
}
.scanner-back {
  width: 36px; height: 36px; border-radius: 11px;
  background: rgba(255, 255, 255, 0.1); color: #fff;
  font-size: 24px; display: grid; place-items: center;
}
.scanner-switch { font-size: 13px; color: #9db4ff; padding: 6px 10px; }
.scanner-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px; }
.scan-view { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 16px; position: relative; }
.scan-view video { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 20px; background: #151a24; }
.scan-frame {
  position: absolute; top: 50%; left: 50%;
  width: 62%; aspect-ratio: 1; transform: translate(-50%, -58%);
  border-radius: 18px; border: 2px solid rgba(124, 156, 255, 0.9);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.scan-frame i {
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #7c9cff, transparent);
  animation: scanline 2.2s linear infinite;
}
@keyframes scanline { 0% { top: 2%; } 50% { top: 98%; } 100% { top: 2%; } }
.scan-hint { font-size: 13px; color: #c7cddd; text-align: center; }
.scan-note { font-size: 11.5px; color: #6f7789; text-align: center; }
.qr-panel {
  background: #fff; color: var(--text); border-radius: 24px;
  padding: 26px 22px; display: flex; flex-direction: column;
  align-items: center; gap: 14px; max-width: 340px; width: 100%;
}
.qr-panel canvas { border-radius: 12px; }
.qr-name { font-size: 17px; font-weight: 650; }
.qr-tip { font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.6; }

/* ---------- 图片 / 视频预览 ---------- */
.bubble.media-bubble {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.media-caption { font-size: 14px; margin-bottom: 6px; color: var(--text); }
.msg.mine .media-caption { color: var(--text); }

.media-box {
  position: relative;
  width: 200px;
  max-width: 100%;
  min-height: 104px;
  border-radius: 14px;
  overflow: hidden;
  background: #e9edf5;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 1px solid rgba(20, 24, 40, 0.06);
}
.media-box.video { width: 220px; }
.media-box img { display: block; width: 100%; height: auto; max-height: 280px; object-fit: cover; }
.media-loading { font-size: 12px; color: #8b91a1; padding: 26px 0; }
.media-fallback { font-size: 34px; padding: 30px 20px; color: #98a0b3; text-align: center; line-height: 1.5; }
.play-badge {
  position: absolute; inset: 0; margin: auto;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.45); color: #fff;
  display: grid; place-items: center; font-size: 14px;
  backdrop-filter: blur(2px);
}
.media-duration {
  position: absolute; right: 8px; bottom: 8px;
  font-size: 11px; color: #fff;
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 6px; border-radius: 6px;
}

.viewer {
  position: absolute; inset: 0; background: #000; color: #fff;
  pointer-events: auto; display: flex; flex-direction: column;
  align-items: center; justify-content: center; z-index: 60;
  animation: fade 0.18s ease;
}
.viewer-close {
  position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 14px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.14); color: #fff;
  font-size: 22px; line-height: 1; display: grid; place-items: center;
}
.viewer-stage {
  width: 100%; flex: 1; display: flex;
  align-items: center; justify-content: center; padding: 12px;
}
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.viewer-loading, .viewer-error { color: #b9c0d0; font-size: 13px; }
.viewer-name {
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  font-size: 12px; color: #9aa3b5;
}

/* ---------- 信息集市 ---------- */
.chips {
  display: flex;
  gap: 8px;
  padding: 2px 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: #5f6779;
  font-size: 13px;
  font-weight: 550;
  transition: all 0.15s;
}
.chip.on {
  background: #202a45;
  border-color: #202a45;
  color: #fff;
}

.post {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin: 0 4px 12px;
}
.post-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.post-cat {
  font-size: 11px;
  font-weight: 650;
  padding: 3px 9px;
  border-radius: 999px;
}
.cat-skill { background: #e8f0ff; color: #2f5fd0; }
.cat-housing { background: #e8f8ee; color: #1f7a45; }
.cat-jobs { background: #fff1e2; color: #a35b12; }
.cat-other { background: #f0f1f5; color: #636b7d; }
.post-time { font-size: 11.5px; color: var(--muted); }
.post h3 { font-size: 15.5px; font-weight: 650; line-height: 1.45; margin-bottom: 6px; }
.post p { font-size: 13.5px; color: #4d5566; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.post-contact {
  margin-top: 10px;
  font-size: 12.5px;
  color: #2f5fd0;
  background: #f2f6ff;
  padding: 8px 10px;
  border-radius: 10px;
}
.post-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 14px; }
.post-author { font-size: 12.5px; color: var(--muted); flex: 1; }
.post-del { font-size: 12px; color: #d24a3f; padding: 4px 8px; }

.post-input { margin-bottom: 10px; }
.post-textarea {
  width: 100%;
  min-height: 108px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.55;
  resize: none;
  margin-bottom: 10px;
}
.post-textarea:focus { border-color: var(--accent); }

/* ---------- AI 设置 ---------- */
.form-note {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
  background: #eef2ff;
  color: #4453a8;
  padding: 12px 14px;
  border-radius: 14px;
  margin: 12px 0 6px;
}
.form-tips {
  margin: 14px 0 4px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.form-tips p { font-size: 11.5px; color: var(--muted); line-height: 1.9; }
.text-btn {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border-radius: 13px;
  color: #d24a3f;
  font-size: 14px;
  font-weight: 550;
}

@media (min-width: 640px) {
  body { background: #dfe3ea; align-items: center; }
  #app {
    height: min(880px, calc(100dvh - 40px));
    border-radius: 26px;
    box-shadow: 0 30px 80px rgba(20, 26, 45, 0.18);
    overflow: hidden;
  }
}
