:root {
  --bg: #1a120c;
  --bg2: #24180f;
  --panel: #2c1d13;
  --panel2: #352418;
  --ink: #f5e6d3;
  --muted: #b9a08a;
  --amber: #f59e0b;
  --amber2: #fbbf24;
  --ember: #ea580c;
  --wood: #6b4226;
  --line: rgba(245, 198, 120, 0.18);
  --ok: #86efac;
  --danger: #fca5a5;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0,0,0,.35);
  --font: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "Georgia", serif;
  --sans: "PingFang SC", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(245,158,11,.18), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(234,88,12,.12), transparent 50%),
    linear-gradient(180deg, #120c08 0%, var(--bg) 40%, #140e09 100%);
}
a { color: var(--amber2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px 64px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(12px);
  background: rgba(26,18,12,.82);
  border-bottom: 1px solid var(--line);
}
.top-inner { display: flex; align-items: center; gap: 14px; padding: 12px 0; }

/* language toggle */
.lang-toggle {
  display: inline-flex; align-items: stretch;
  border: 1px solid var(--line); border-radius: 999px;
  overflow: hidden; background: rgba(0,0,0,.25);
  flex-shrink: 0;
}
.lang-opt {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 12px; cursor: pointer; font-size: .78rem; font-weight: 700;
  letter-spacing: .02em; line-height: 1; min-width: 36px;
}
.lang-opt:hover { color: var(--ink); background: rgba(245,158,11,.08); }
.lang-opt.active {
  color: #1a120c; background: linear-gradient(135deg, var(--amber2), var(--amber));
  box-shadow: inset 0 0 0 1px rgba(251,191,36,.35);
}
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }
.brand-logo {
  height: 48px; width: auto; max-width: min(220px, 42vw);
  object-fit: contain; display: block;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.35));
}
.brand-text { min-width: 0; }
.brand h1 { margin: 0; font-family: var(--font); font-size: 1.15rem; letter-spacing: .04em; }
.brand small { display: block; color: var(--muted); font-size: .72rem; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  background: var(--panel2); border: 1px solid var(--line); vertical-align: middle;
  flex-shrink: 0;
}
.avatar.sm { width: 24px; height: 24px; }
.avatar.lg { width: 72px; height: 72px; }
.avatar.placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .7rem; color: var(--amber2); background: rgba(245,158,11,.15);
}
.user-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px;
  max-width: 180px;
}
.user-chip-text #userChipName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.profile-avatar-row { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.author-row { display: inline-flex; align-items: center; gap: 8px; }

/* avatar badges: 蓝标 / 红标 / 金标 */
.avatar-wrap {
  position: relative; display: inline-flex; flex-shrink: 0;
  border-radius: 50%; padding: 2px;
  background: transparent;
}
.avatar-wrap .avatar { border: 2px solid var(--bg2); display: block; }
.avatar-wrap.lv-0 { background: transparent; box-shadow: none; }
.avatar-wrap.lv-1 {
  background: conic-gradient(from 210deg, #60a5fa, #2563eb, #93c5fd, #1d4ed8);
  box-shadow: 0 0 0 1px rgba(59,130,246,.35), 0 0 10px rgba(59,130,246,.25);
}
.avatar-wrap.lv-2 {
  background: conic-gradient(from 210deg, #f87171, #dc2626, #fca5a5, #b91c1c);
  box-shadow: 0 0 0 1px rgba(239,68,68,.4), 0 0 12px rgba(239,68,68,.3);
}
.avatar-wrap.lv-3 {
  background: conic-gradient(from 210deg, #fbbf24, #f59e0b, #fff7ed, #eab308);
  box-shadow: 0 0 0 1px rgba(251,191,36,.5), 0 0 14px rgba(251,191,36,.45);
}
.level-pip {
  position: absolute; right: -4px; bottom: -4px;
  min-width: 18px; height: 16px; padding: 0 4px;
  border-radius: 999px; font-size: 9px; font-weight: 800;
  line-height: 16px; text-align: center;
  background: #1a120c; color: #93c5fd;
  border: 1px solid rgba(96,165,250,.55);
  pointer-events: none;
}
.avatar-wrap.lv-0 .level-pip { display: none; }
.avatar-wrap.lv-1 .level-pip { color: #93c5fd; border-color: rgba(59,130,246,.55); }
.avatar-wrap.lv-2 .level-pip { color: #fca5a5; border-color: rgba(239,68,68,.55); }
.avatar-wrap.lv-3 .level-pip { color: #fde68a; border-color: rgba(251,191,36,.7); }
.level-chip {
  display: inline-block; font-size: .68rem; font-weight: 700;
  padding: 1px 7px; border-radius: 999px; margin-left: 2px;
  border: 1px solid var(--line); color: var(--muted);
  background: rgba(0,0,0,.2); white-space: nowrap; vertical-align: middle;
}
.level-chip.lv-0 { display: none; }
.level-chip.lv-1 { color: #93c5fd; border-color: rgba(59,130,246,.45); background: rgba(37,99,235,.18); }
.level-chip.lv-2 { color: #fca5a5; border-color: rgba(239,68,68,.5); background: rgba(220,38,38,.18); }
.level-chip.lv-3 { color: #fde68a; border-color: rgba(251,191,36,.55); background: rgba(251,191,36,.16); }
.author-meta { display: inline-flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.2; }
.author-name { font-size: .9rem; }
.author-row { gap: 10px; align-items: center; }
.user-chip { gap: 10px; max-width: 240px; padding-right: 12px; }
.user-chip-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.user-chip-text #userChipName { font-size: .82rem; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.user-chip .level-chip { margin-left: 0; font-size: .62rem; }
.levels-box { display: flex; flex-direction: column; gap: 8px; }
.level-legend-row { display: flex; flex-direction: column; gap: 2px; }
.level-legend-row .desc { color: var(--muted); font-size: .75rem; }
.profile-level-row { margin: 0 0 10px; }
@media (max-width: 820px) {
  .brand-logo { height: 40px; max-width: 140px; }
  .brand small { display: none; }
}
.spacer { flex: 1; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; min-width: 200px;
}
.search input {
  background: transparent; border: 0; outline: 0; color: var(--ink); width: 160px;
}
.btn {
  border: 1px solid var(--line); background: var(--panel2); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; cursor: pointer;
}
.btn:hover { border-color: var(--amber); }
.btn.primary {
  background: linear-gradient(135deg, var(--amber), var(--ember));
  color: #1a1008; border: 0; font-weight: 700;
}
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; margin-top: 18px; }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side { order: 2; }
  .search input { width: 100px; }
}

.side .card, .main .card {
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.side .card { padding: 14px; margin-bottom: 14px; }
.side h3 { margin: 0 0 10px; font-family: var(--font); font-size: 1rem; color: var(--amber2); }
.board-item {
  display: block; padding: 10px 12px; border-radius: 10px; color: var(--ink);
  margin-bottom: 4px; border: 1px solid transparent;
}
.board-item:hover, .board-item.active {
  background: rgba(245,158,11,.12); border-color: var(--line); text-decoration: none;
}
.board-item .desc { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: rgba(245,158,11,.12); color: var(--amber2); font-size: .78rem; border: 1px solid var(--line);
  cursor: pointer;
}
.tag:hover { background: rgba(245,158,11,.22); }

.hero {
  padding: 22px; margin-bottom: 14px;
  background:
    linear-gradient(120deg, rgba(245,158,11,.16), transparent 50%),
    linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line); border-radius: var(--radius);
}
.hero h2 { margin: 0 0 8px; font-family: var(--font); font-weight: 700; }
.hero p { margin: 0; color: var(--muted); line-height: 1.6; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; align-items: center; }

.post-list { display: flex; flex-direction: column; gap: 10px; }
.post-item {
  padding: 14px 16px; border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line); cursor: pointer;
}
.post-item:hover { border-color: rgba(245,158,11,.45); }
.post-item h3 { margin: 0 0 6px; font-size: 1.05rem; font-family: var(--font); }
.meta { color: var(--muted); font-size: .8rem; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: .72rem; padding: 2px 8px; border-radius: 999px;
  background: rgba(234,88,12,.2); color: #fdba74; border: 1px solid rgba(234,88,12,.35);
}
.badge.pin { background: rgba(251,191,36,.2); color: #fde68a; }
.badge.digest { background: rgba(134,239,172,.15); color: var(--ok); }
.badge.bounty { background: rgba(96,165,250,.15); color: #93c5fd; }
.badge.promo { background: rgba(244,114,182,.15); color: #f9a8d4; }
.excerpt { color: var(--muted); margin: 8px 0 0; line-height: 1.55; font-size: .92rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.detail { padding: 18px; }
.detail h2 { margin: 0 0 8px; font-family: var(--font); }
.detail .body { white-space: pre-wrap; line-height: 1.7; margin: 14px 0; }
.detail .imgs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.detail .imgs img { max-width: 220px; max-height: 160px; border-radius: 10px; border: 1px solid var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.quote-box {
  border-left: 3px solid var(--amber); padding: 10px 12px; margin: 10px 0;
  background: rgba(0,0,0,.2); border-radius: 0 10px 10px 0; color: var(--muted);
}

.replies { margin-top: 18px; }
.reply {
  padding: 12px; border-top: 1px solid var(--line);
}
.reply.nested { margin-left: 22px; border-left: 2px solid var(--wood); padding-left: 12px; }
.composer textarea, .composer input, .modal input, .modal textarea, .modal select {
  width: 100%; background: #1a120c; color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; outline: none;
}
.composer textarea { min-height: 90px; resize: vertical; }
.composer { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }

.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  width: min(560px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px; box-shadow: var(--shadow); max-height: 90vh; overflow: auto;
}
.modal h3 { margin: 0 0 12px; font-family: var(--font); }
.modal label { display: block; font-size: .85rem; color: var(--muted); margin: 8px 0 4px; }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.hidden { display: none !important; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #111; color: #fff; padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line); z-index: 80; opacity: 0; transition: .2s;
}
.toast.show { opacity: 1; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 28px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* ---- mobile polish + new panels ---- */
.icon-btn { position: relative; min-width: 40px; padding: 8px 10px; }
.badge-dot {
  position: absolute; top: 2px; right: 2px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444; border: 1px solid #1a120c;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.modal-head h3 { margin: 0; }
.modal-wide { width: min(720px, 100%); }
.notif-list { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow: auto; }
.notif-item {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(0,0,0,.18); cursor: pointer;
}
.notif-item.unread { border-color: rgba(245,158,11,.45); background: rgba(245,158,11,.08); }
.notif-item .meta { margin-top: 4px; }
.dm-layout { display: grid; grid-template-columns: 220px 1fr; gap: 0; min-height: 0; flex: 1; height: 100%; }
.dm-threads { overflow: auto; max-height: none; height: 100%; padding-right: 10px; margin-right: 6px; }
.dm-thread {
  padding: 10px 12px; border-radius: 14px; cursor: pointer; margin-bottom: 2px;
  border: none; background: transparent;
}
.dm-thread:hover, .dm-thread.active { background: rgba(245,158,11,.12); border: none; }
.dm-thread .preview { color: var(--muted); font-size: .78rem; margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-chat { display: flex; flex-direction: column; min-height: 0; padding-left: 4px; }
.dm-peer { font-weight: 700; margin-bottom: 8px; color: var(--amber2); }

.dm-peer-title { margin-bottom: 6px; }
.dm-peer-actions {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin: 0 0 6px;
}
.dm-peer-actions .btn {
  flex-shrink: 0;
  font-weight: 600;
}

.dm-messages {
  flex: 1 1 auto; overflow: auto; min-height: 0; max-height: none;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 6px; border: none; background: transparent;
}
.dm-bubble {
  max-width: 82%; padding: 10px 15px; border-radius: 18px;
  background: rgba(255,255,255,.08); border: none; align-self: flex-start;
  white-space: pre-wrap; word-break: break-word; box-shadow: none;
  font-size: .98rem; line-height: 1.45;
}
.dm-bubble.mine {
  align-self: flex-end; background: rgba(245,158,11,.28); border: none;
  border-radius: 18px 18px 4px 18px;
}
.dm-bubble:not(.mine) { border-radius: 18px 18px 18px 4px; }
.dm-bubble.pending { opacity: .65; }
.dm-compose { display: flex; gap: 8px; align-items: flex-end; margin-top: 6px; border: none; flex-shrink: 0; }
.dm-compose textarea {
  flex: 1; min-height: 44px; max-height: 96px; border-radius: 16px; border: none;
  background: rgba(255,255,255,.06); padding: 10px 14px; resize: none;
  font-size: 1rem;
}
.dm-modal.modal {
  width: min(920px, 100%);
  height: min(88vh, 820px);
  max-height: 92vh;
  display: flex; flex-direction: column;
  padding: 12px 14px 10px;
  overflow: hidden;
  border-radius: 22px; border: none;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
  background: rgba(28,20,14,.96);
}
.dm-modal .modal-head { border-bottom: none; padding-bottom: 2px; margin-bottom: 6px; flex-shrink: 0; }
.dm-modal .dm-layout { min-height: 0; flex: 1 1 auto; height: auto; }
.dm-modal .dm-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dm-modal .dm-peer { flex-shrink: 0; margin-bottom: 4px; }
.dm-modal .modal textarea,
.dm-compose textarea {
  border: none !important; border-radius: 16px !important;
  background: rgba(255,255,255,.07) !important;
}
.mod-reports { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow: auto; }
.mod-card {
  padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.18);
}
.mod-card .actions { margin-top: 8px; }
.side-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 35;
}
.side-close { margin-bottom: 8px; width: 100%; }
#menuBtn { display: none; }

@media (max-width: 820px) {
  #menuBtn { display: inline-flex; }
  .top-inner { flex-wrap: wrap; gap: 8px; padding: 10px 0; }
  .search { order: 5; flex: 1 1 100%; min-width: 0; }
  .search input { width: 100%; }
  .brand-logo { height: 36px; max-width: 120px; }
  .user-chip { max-width: 120px; }
  .user-chip-text #userChipName { max-width: 70px; }
  #profileBtn { display: none !important; }
  .side {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(86vw, 300px);
    z-index: 36; overflow: auto; padding: 14px;
    background: rgba(26,18,12,.97); border-right: 1px solid var(--line);
    transform: translateX(-105%); transition: transform .2s ease;
    order: 0;
  }
  .side.open { transform: translateX(0); }
  .side-close { display: block !important; }
  .layout { margin-top: 12px; gap: 12px; }
  .hero { padding: 16px; }
  .post-item { padding: 12px; }
  .post-item h3 { font-size: 1rem; }
  .detail { padding: 14px; }
  .detail .imgs img { max-width: 100%; }
  .reply.nested { margin-left: 12px; }
  .actions .btn { flex: 1 1 auto; justify-content: center; }
  .dm-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 0; height: 100%; }
  .dm-threads { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.06); max-height: 88px; padding-bottom: 6px; margin-right: 0; padding-right: 0; }
  .dm-modal.modal {
    width: 100%;
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
    border-radius: 16px;
    padding: 8px 10px 8px;
  }
  .dm-modal .modal-head { margin-bottom: 4px; }
  .dm-modal .modal-head h3 { font-size: 1rem; }
  .dm-peer-title { margin-bottom: 4px; font-size: .95rem; }
  .dm-peer-actions { margin: 2px 0 4px !important; gap: 5px !important; }
  .dm-peer-actions .btn { padding: 5px 10px; font-size: .82rem; }
  .dm-messages { padding: 6px 2px; gap: 7px; }
  .dm-bubble { max-width: 88%; padding: 10px 13px; font-size: 1.02rem; line-height: 1.48; }
  .dm-bubble .from-name { font-size: .7rem; }
  .dm-compose { margin-top: 4px; gap: 6px; }
  .dm-compose textarea { min-height: 42px; font-size: 1.02rem; padding: 9px 12px; }
  .modal { padding: 14px; border-radius: 14px; }
  .modal-back { padding: 6px; align-items: stretch; }
  .toast { left: 12px; right: 12px; transform: none; width: auto; text-align: center; }
}
@media (max-width: 420px) {
  .btn.primary#newPostBtn { padding: 8px 12px; }
  #authBtn { padding: 8px 10px; font-size: .85rem; }
  .lang-opt { padding: 6px 8px; min-width: 30px; }
}

.wechat-share-tip {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.35);
}
.wechat-share-tip p {
  margin: 0 0 8px;
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.45;
}
.share-actions { gap: 8px; }

.tips-box {
  margin: 14px 0 8px;
  padding: 12px 14px;
  border: 1px solid var(--wood);
  border-radius: 10px;
  background: rgba(255, 180, 80, 0.06);
}
.tips-box h3 { margin: 0 0 8px; font-size: .95rem; }
.tip-list { display: flex; flex-direction: column; gap: 6px; }
.tip-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  font-size: .85rem; color: var(--muted);
}
.tip-row .tip-amt { color: var(--amber2); font-weight: 600; min-width: 72px; }
.tip-row .tip-from { font-family: ui-monospace, monospace; color: var(--text); }
.tip-row .tip-time { opacity: .85; }
.tip-row .tip-tx { color: var(--amber2); text-decoration: none; font-size: .75rem; }
.tip-row .tip-tx:hover { text-decoration: underline; }
.tip-row.muted { opacity: .7; }

.user-card-body { margin: 8px 0 14px; }
.user-card-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.user-card-stats { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: .85rem; margin: 8px 0; }
.user-card-stats b { color: var(--text); }
.author-row { cursor: pointer; }
.author-row:hover .author-name { color: var(--amber2); text-decoration: underline; }
.user-hit-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.user-hit {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--wood); border-radius: 10px;
  background: rgba(255,180,80,.05); cursor: pointer;
}
.user-hit:hover { border-color: var(--amber2); }
.user-hit-meta { color: var(--muted); font-size: .78rem; }
.notif-item .tip-amt-hl { color: var(--amber2); font-weight: 600; }

.group-pick-list {
  max-height: 220px; overflow: auto; margin: 8px 0 12px;
  border: 1px solid var(--wood); border-radius: 8px; padding: 6px;
}
.group-pick-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
}
.group-pick-item:hover { background: rgba(255,180,80,.08); }
.group-pick-item input { accent-color: var(--amber2); }
.dm-thread .kind-tag {
  font-size: .7rem; color: var(--amber2); margin-right: 4px;
}
.dm-bubble .from-name { font-size: .72rem; color: var(--muted); margin-bottom: 2px; }

.user-hit-title {
  font-weight: 600; color: var(--amber2); margin-bottom: 6px; font-size: .9rem;
}
.user-hit {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.user-hit-main { min-width: 0; flex: 1; }
.user-hit-follow { flex-shrink: 0; }

/* —— group hongbao —— */
.hongbao-btn {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
  border: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.hongbao-btn:hover { filter: brightness(1.05); }

.dm-compose .hongbao-btn:not(.hidden) {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 36px;
  padding: 0 12px;
  font-weight: 700;
  z-index: 2;
}

.dm-bubble.hb-wrap {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  max-width: 240px;
}
.dm-bubble.hb-wrap.mine { align-self: flex-end; }
.hb-card {
  background: linear-gradient(145deg, #e74c3c 0%, #c0392b 60%, #a93226 100%);
  color: #fff7e6;
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 180px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(192, 57, 43, .35);
  position: relative;
  overflow: hidden;
}
.hb-card::after {
  content: '';
  position: absolute;
  right: -10px; top: -10px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(255, 215, 0, .15);
}
.hb-card .hb-title { font-weight: 700; font-size: .95rem; letter-spacing: .02em; }
.hb-card .hb-sub { font-size: .75rem; opacity: .9; margin-top: 4px; }
.hb-card .hb-status { font-size: .72rem; margin-top: 8px; opacity: .85; }
.hb-card.hb-done { filter: grayscale(.35) brightness(.9); cursor: default; }
.hb-card.hb-claimable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hb-card .hb-open {
  display: flex; align-items: center; justify-content: center;
  margin: 14px auto 6px; width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(160deg, #ffe08a 0%, #f1c40f 55%, #e0a800 100%);
  color: #7b241c; font-weight: 900; font-size: 1.35rem; line-height: 1;
  border: 2px solid rgba(255,255,255,.65);
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
  cursor: pointer; position: relative; z-index: 2;
  touch-action: manipulation; user-select: none;
  flex-shrink: 0;
}
.hb-card .hb-open:active { transform: scale(.94); filter: brightness(.95); }
.hb-claim-line { font-size: .8rem; }

.dm-peer-actions {
  display: flex !important;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  position: relative;
  z-index: 20;
  overflow: visible !important;
}
.dm-peer {
  overflow: visible !important;
  position: relative;
  z-index: 15;
}

/* dm-peer-actions-mobile-safe */
.dm-peer {
  overflow: visible !important;
  position: relative;
  z-index: 15;
  min-height: 0;
}
.dm-peer-actions {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  align-items: center;
  position: relative;
  z-index: 20;
  overflow: visible !important;
  margin: 4px 0 8px;
}
.dm-peer-actions #groupInviteBtn {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  flex-shrink: 0;
  z-index: 30;
}
.dm-chat { overflow: visible; }

/* image picker preview + remove */
.img-picks { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.img-pick { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.06); }
.img-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-pick .img-pick-x {
  position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.7); color: #fff; font-size: 15px; line-height: 24px;
  padding: 0; cursor: pointer; touch-action: manipulation;
}
.img-picks-clear { font-size: .8rem; align-self: center; }

/* mobile WeChat-style list/chat toggle */
.dm-back { display: none; }
@media (max-width: 820px) {
  .dm-modal .dm-layout { display: flex !important; flex-direction: column; }
  .dm-modal .dm-threads { max-height: none !important; height: auto; flex: 1 1 auto; min-height: 0; overflow: auto; border-bottom: none; }
  .dm-modal .dm-chat { flex: 1 1 auto; min-height: 0; }
  .dm-layout.m-list .dm-chat { display: none !important; }
  .dm-layout.m-chat .dm-threads { display: none !important; }
  .dm-layout.m-chat .dm-back { display: inline-flex; align-self: flex-start; margin-bottom: 4px; flex-shrink: 0; }
  .dm-modal .dm-thread { padding: 12px; border-bottom: 1px solid rgba(255,255,255,.05); border-radius: 10px; }
}

#dmMuteBtn { min-width: 36px; padding: 6px 8px; font-size: 1rem; line-height: 1; }
#dmMuteBtn.muted { opacity: .55; }

/* lightbox */
.detail .imgs img, .imgs img { cursor: zoom-in; }
html.lb-open, html.lb-open body { overflow: hidden; }
.lb { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.94); touch-action: none; user-select: none; }
.lb-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.lb-img { max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; transform-origin: center center; will-change: transform; -webkit-user-drag: none; }
.lb-x { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; width: 42px; height: 42px; border-radius: 50%; border: none; background: rgba(255,255,255,.18); color: #fff; font-size: 28px; line-height: 40px; cursor: pointer; z-index: 2; }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: none; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; font-size: 36px; cursor: pointer; z-index: 2; }
.lb-prev { left: 8px; } .lb-next { right: 8px; }
.lb-count { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: #ddd; font-size: .9rem; z-index: 2; }
@media (max-width: 820px) { .lb-prev, .lb-next { width: 36px; height: 52px; font-size: 30px; background: rgba(255,255,255,.08); } }

/* ---------- voice messages ---------- */
.voice-btn { flex: 0 0 auto; font-size: 1.05rem; padding: 4px 10px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.voice-btn.recording { background: #e5484d; color: #fff; border-color: #e5484d; animation: voicePulse 1s infinite; }
@keyframes voicePulse { 0%,100% { box-shadow: 0 0 0 0 rgba(229,72,77,.5); } 50% { box-shadow: 0 0 0 6px rgba(229,72,77,0); } }
.voice-hint { position: fixed; left: 50%; top: 45%; transform: translate(-50%,-50%); z-index: 9999; background: rgba(0,0,0,.78); color: #fff; padding: 14px 20px; border-radius: 12px; font-size: .95rem; pointer-events: none; }
.voice-hint.cancel { background: rgba(200,40,40,.9); }
.voice-hint.hidden { display: none; }
.voice-msg { position: relative; display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 32px; padding: 4px 10px; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; font: inherit; }
.dm-bubble.mine .voice-msg { flex-direction: row-reverse; }
.voice-waves { display: inline-flex; align-items: center; gap: 2px; height: 16px; }
.dm-bubble.mine .voice-waves { transform: scaleX(-1); }
.voice-waves i { display: block; width: 3px; border-radius: 2px; background: currentColor; opacity: .85; }
.voice-waves i:nth-child(1) { height: 6px; } .voice-waves i:nth-child(2) { height: 11px; } .voice-waves i:nth-child(3) { height: 16px; }
.voice-msg.playing .voice-waves i { animation: voiceWave .9s infinite ease-in-out; }
.voice-msg.playing .voice-waves i:nth-child(2) { animation-delay: .15s; } .voice-msg.playing .voice-waves i:nth-child(3) { animation-delay: .3s; }
@keyframes voiceWave { 0%,100% { opacity: .25; } 50% { opacity: 1; } }
.voice-dur { font-size: .85rem; opacity: .9; }
.voice-dot { display: none; position: absolute; right: -14px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: #e5484d; }
.voice-msg.unplayed .voice-dot { display: block; }
.dm-bubble.voice-wrap { padding-right: 18px; }

/* ---------- WeChat-style compose bar ---------- */
.dm-compose { position: relative; align-items: center !important; gap: 8px; }
.dm-compose textarea.hidden, .dm-compose .hidden { display: none !important; }
.dm-round-btn { flex: 0 0 auto; width: 40px; height: 40px; min-width: 40px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.35); background: transparent; color: inherit; font-size: 1.15rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.dm-plus-btn { font-size: 1.4rem; }
.dm-compose textarea { min-height: 40px !important; }
.dm-talk-bar { flex: 1; height: 42px; min-height: 40px; border-radius: 10px; border: none; background: rgba(255,255,255,.1); color: inherit; font-size: 1rem; font-weight: 600; letter-spacing: 2px; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
.dm-talk-bar.recording { background: rgba(255,255,255,.22); }
.dm-talk-bar.cancel { background: #e5484d; color: #fff; }
.dm-send-btn { flex: 0 0 auto; min-height: 40px; min-width: 56px; background: #f07c1f !important; border-color: #f07c1f !important; color: #fff !important; border-radius: 10px; }
.dm-plus-panel { position: absolute; right: 0; bottom: calc(100% + 8px); display: flex; gap: 12px; padding: 12px; border-radius: 12px; background: #23262d; box-shadow: 0 6px 24px rgba(0,0,0,.4); z-index: 30; }
.dm-plus-item { display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 64px !important; height: 64px !important; border-radius: 12px; border: none; background: rgba(255,255,255,.08); color: inherit; font-size: .8rem; cursor: pointer; padding: 0 !important; }
.dm-plus-item .ico { font-size: 1.5rem; }
.dm-plus-item.hidden { display: none !important; }
.voice-hint { min-width: 150px; text-align: center; padding: 22px 24px; font-size: 1rem; }
.voice-hint.cancel { background: rgba(229,72,77,.95); }

/* ---------- chat images ---------- */
.dm-bubble.img-wrap { padding: 4px; background: transparent !important; }
.chat-img { display: block; max-width: 200px; max-height: 200px; min-width: 60px; min-height: 60px; border-radius: 10px; object-fit: cover; background: rgba(255,255,255,.08); cursor: zoom-in; }
.dm-bubble.img-wrap.pending .chat-img { opacity: .55; }
.dm-bubble.img-wrap .meta { padding: 0 4px; }

/* iOS: no text selection / callout around the talk bar */
.dm-talk-bar, .dm-talk-bar * { -webkit-user-select: none !important; user-select: none !important; -webkit-touch-callout: none !important; touch-action: none; }
body.voice-holding, body.voice-holding * { -webkit-user-select: none !important; user-select: none !important; -webkit-touch-callout: none !important; }
body.voice-holding #dmMessages { pointer-events: none; }

/* tap-to-talk + no selection in chat panel (except textarea) */
#dmModal, #dmModal * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#dmModal textarea { -webkit-user-select: text !important; user-select: text !important; -webkit-touch-callout: default !important; }
.dm-talk-bar { touch-action: manipulation !important; letter-spacing: 1px; }
.dm-talk-bar.recording { background: #e5484d !important; color: #fff; }
.dm-voice-cancel { flex: 0 0 auto; height: 40px; min-width: 64px; border-radius: 10px; border: 1.5px solid rgba(255,255,255,.35); background: transparent; color: inherit; font-size: .9rem; cursor: pointer; }
.dm-compose .dm-voice-cancel.hidden { display: none !important; }
body.voice-holding #dmMessages { pointer-events: auto; }

/* ---------- quote / message menu ---------- */
.dm-compose { flex-wrap: wrap; }
.dm-quote-strip { order: 10; flex: 1 0 100%; display: flex; align-items: center; gap: 6px; margin: 0 48px; padding: 5px 6px 5px 10px; border-radius: 6px; background: rgba(255,255,255,.08); color: var(--muted, #aaa); font-size: .82rem; min-width: 0; box-sizing: border-box; }
.dm-quote-strip.hidden { display: none !important; }
.dm-quote-strip span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-quote-strip button { flex: 0 0 auto; width: 28px; height: 28px; border: 0; background: transparent; color: inherit; font-size: 1rem; cursor: pointer; }
.dm-quote-ref { align-self: flex-start; max-width: 70%; margin-top: -4px; padding: 5px 9px; border-radius: 6px; background: rgba(255,255,255,.06); color: var(--muted, #999); font-size: .78rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; flex-shrink: 0; }
.dm-quote-ref.mine { align-self: flex-end; }
.dm-msg-menu { position: fixed; z-index: 10000; display: flex; gap: 4px; padding: 8px 10px; border-radius: 10px; background: #2c2c2e; box-shadow: 0 6px 22px rgba(0,0,0,.45); }
.dm-msg-menu.hidden { display: none; }
.dm-msg-menu button { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 52px; min-height: 48px; padding: 4px 6px; border: 0; background: transparent; color: #fff; font-size: .78rem; cursor: pointer; -webkit-user-select: none; user-select: none; }
.dm-msg-menu button .ic { font-size: 1.15rem; line-height: 1; }
.dm-msg-menu .tail { position: absolute; bottom: -6px; width: 12px; height: 12px; margin-left: -6px; background: #2c2c2e; transform: rotate(45deg); }
.dm-msg-menu.below .tail { bottom: auto; top: -6px; }
.dm-bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.dm-bubble.menu-on { filter: brightness(1.25); }
.dm-bubble.flash { animation: dmFlash 1.2s ease; }
@keyframes dmFlash { 0%,60% { box-shadow: 0 0 0 3px rgba(245,158,11,.8); } 100% { box-shadow: none; } }
.dm-quote-strip { flex: 0 0 calc(100% - 96px) !important; max-width: calc(100% - 96px); margin: 0 48px !important; }

/* ---------- @mentions ---------- */
.dm-mention-picker { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); max-height: 240px; overflow-y: auto; -webkit-overflow-scrolling: touch; background: #2c2c2e; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.45); z-index: 40; padding: 4px 0; }
.dm-mention-picker.hidden { display: none !important; }
.mp-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 14px; border: 0; background: transparent; color: #fff; font-size: .95rem; text-align: left; cursor: pointer; }
.mp-item:active, .mp-item:hover { background: rgba(255,255,255,.08); }
.mp-av { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 6px; object-fit: cover; background: rgba(255,255,255,.15); display: inline-flex; align-items: center; justify-content: center; font-size: .9rem; }
.mp-all { background: #f07c1f; color: #fff; font-weight: 700; }
.mp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-mention { color: #5aa9ff; }
.at-mention.at-me { color: #fff; background: rgba(240,124,31,.85); border-radius: 4px; padding: 0 3px; }
.at-flag { color: #ff4d4f; margin-right: 4px; font-weight: 600; }

.group-mem-chip { display: inline; color: #5aa9ff; margin-right: 6px; cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.group-mem-chip:active { opacity: .7; }
.from-name[data-author] { cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* ---------- chat performance ---------- */
.dm-messages { contain: layout paint; }
.dm-bubble { contain: layout style; }
.dm-thread { contain: layout style; }
.dm-compose { contain: layout; }
.voice-msg.playing .voice-waves i { will-change: opacity; }
.dm-msg-menu, .dm-mention-picker, .dm-plus-panel { contain: layout paint; }

/* ---------- recall + confirm ---------- */
.dm-recall-tip { align-self: center; max-width: 90%; margin: 4px 0; padding: 4px 10px; border-radius: 6px; background: transparent; color: var(--muted, #888); font-size: .78rem; text-align: center; line-height: 1.4; -webkit-user-select: none; user-select: none; }
.recall-reedit { margin-left: 8px; border: 0; background: transparent; color: #5aa9ff; font-size: .78rem; cursor: pointer; padding: 0; }
.confirm-modal { max-width: 320px; }
.confirm-body { color: var(--muted, #aaa); font-size: .92rem; line-height: 1.5; margin: 8px 0 16px; white-space: pre-wrap; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.confirm-actions .btn.primary { background: #e5484d; border-color: #e5484d; }

/* ---------- video ---------- */
.img-pick.is-video video { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.img-pick .vid-badge { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 28px; height: 28px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .8rem; pointer-events: none; }
.img-pick.is-video { position: relative; }
.post-video-wrap, .chat-video { position: relative; display: block; max-width: 100%; border-radius: 10px; overflow: hidden; background: #000; cursor: pointer; }
.post-video-wrap video, .chat-video video { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.vid-play-btn { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 1.1rem; cursor: pointer; }
.chat-video .vid-play-btn { width: 36px; height: 36px; font-size: .95rem; display: flex; align-items: center; justify-content: center; }
.vid-dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: .72rem; padding: 1px 5px; border-radius: 4px; }
.video-player-overlay { position: fixed; inset: 0; z-index: 10050; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; padding: 16px; }
.video-player-overlay.hidden { display: none; }
.vpo-inner { position: relative; width: min(920px, 100%); max-height: 90vh; }
.vpo-inner video { width: 100%; max-height: 85vh; background: #000; border-radius: 8px; }
.vpo-close { position: absolute; right: -4px; top: -36px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; font-size: 1.4rem; cursor: pointer; }

/* post author recall/delete menu */
.post-author-menu{position:relative;display:inline-flex;margin-left:auto;z-index:3}
.post-item-top{display:flex;align-items:flex-start;gap:8px;margin-bottom:4px}
.post-item-top .badges{flex:1}
.detail-top-row{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:4px}
.post-more-btn{font-size:18px;line-height:1;padding:4px 10px;min-width:36px;border-radius:8px}
.post-menu-drop{position:absolute;right:0;top:100%;margin-top:4px;min-width:148px;background:#2a1c12;border:1px solid rgba(245,230,211,.25);border-radius:10px;box-shadow:0 10px 28px rgba(0,0,0,.45);padding:6px;z-index:50;color:#f5e6d3}
.post-menu-drop.hidden{display:none}
.post-menu-item{display:block;width:100%;text-align:left;border:0;background:transparent;padding:10px 12px;border-radius:8px;font-size:14px;cursor:pointer;color:#f5e6d3}
.post-menu-item:hover,.post-menu-item:active{background:rgba(245,230,211,.1)}
.post-menu-item.danger{color:#ff7a6e}
.post-recalled-banner{background:#fff7e6;border:1px solid #ffd591;color:#ad6800;padding:10px 12px;border-radius:10px;margin:8px 0;display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;font-size:13px}
.badge.recalled{background:#fff7e6;color:#ad6800;border:1px solid #ffd591}
