/* ═══════════════════════════════════════════════
   北海好消息 — 「现代都市」UI v2.0
   全新设计，与 style.css 完全隔离
   切换方式：替换 style.css 引用即可回退
   ═══════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════
   北海好消息 — 「现代都市」UI v2.0
   统一聊天入口 — 不再区分发消息/查消息
   ═══════════════════════════════════════════════ */
.publish-type-pills span:active {
  background: #e8e8e8;
}

@media (min-width: 768px) {
  .publish-type-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding-left: 12px;
    max-width: 100%;
    gap: 6px;
    scrollbar-width: none;
    min-height: auto;
  }
  .publish-type-pills::-webkit-scrollbar { display: none; }
  .publish-type-pills span {
    font-size: 12px;
    padding: 3px 8px;
    flex-shrink: 0;
  }
}

/* ── 首页快捷发布入口 ── */
.quick-publish-strip {
  padding: 6px 0 10px 0;
  overflow: hidden;
}
.quick-publish-strip .quick-publish-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px;
  scrollbar-width: none;
}
.quick-publish-scroll::-webkit-scrollbar { display: none; }
.quick-publish-item {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  min-width: 68px;
}
.quick-publish-item:active {
  transform: scale(0.95);
  background: #f8f8f8;
  border-color: #FF6B35;
}
.quick-publish-item .qp-icon { font-size: 22px; line-height: 1; }
.quick-publish-item .qp-label { font-size: 11px; color: #555; font-weight: 500; white-space: nowrap; }



/* ── 字体 ── */
@font-face {
  font-family: 'HandWrite';
  src: url('/fonts/MaShanZheng.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'LongCang';
  src: url('/fonts/LongCang.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ═══════════════════════════════════════════════
   设计系统
   ═══════════════════════════════════════════════ */
:root {
  /* 品牌色（保留橙色不变） */
  --primary: #FF6B35;
  --primary-light: #FF8A50;
  --primary-dark: #E55A2B;
  --primary-bg: #FFF0E8;
  --primary-gradient: linear-gradient(135deg, #FF6B35 0%, #FF8A50 100%);

  /* 新辅助色 */
  --accent-teal: #4ECDC4;
  --accent-yellow: #FFD93D;
  --accent-purple: #A78BFA;

  /* 基础色 */
  --bg: #F0F2F5;
  --bg-card: #FFFFFF;
  --text-primary: #1A1A2E;
  --text-secondary: #5A5A72;
  --text-tertiary: #9CA3AF;
  --border: rgba(0,0,0,0.06);
  --border-light: rgba(0,0,0,0.04);

  /* 毛玻璃 */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 4px 30px rgba(0,0,0,0.08);

  /* 尺寸 */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* 阴影系统 */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);

  /* 动画 */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }

/* 隐藏 body 滚动条（tabs 换行可能撑高 body），但保留可滚动，让 sticky 参照视口 */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: none;
}
body::-webkit-scrollbar { display: none; }
.scrollable-page {
  height: calc(100vh - 62px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(56px + var(--safe-bottom));
}

/* ═══════════════════════════════════════════════
   动画
   ═══════════════════════════════════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}
@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

/* ═══════════════════════════════════════════════
   顶部导航 — 毛玻璃渐变
   ═══════════════════════════════════════════════ */
.sticky-header-group {
  position: sticky;
  top: 0;
  z-index: 100;
}

.header {
  position: relative;
  background: var(--primary-gradient);
  color: white;
  padding: 14px 16px 12px;
  text-align: center;
}

/* 桌面端导航加宽 */
@media (min-width: 1024px) {
  .header {
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}

.header-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-left: 0;
}
.header-logo-img {
  height: 38px;
  width: 38px;
  border-radius: 10px;
  object-fit: cover;
}
.header-logo-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* ── 用户栏 ── */
.user-bar {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
}
.btn-user {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(4px);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 18px;
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  font-weight: 500;
}
.btn-user:hover {
  background: rgba(255,255,255,0.35);
  transform: translateY(-1px);
}
.btn-user:active {
  transform: translateY(0);
}
.btn-logout {
  background: transparent;
  border-color: rgba(255,255,255,0.3);
  margin-left: 6px;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
}
.user-nickname {
  font-size: 13px;
  font-weight: 500;
  color: white;
}

/* ── 登录/注册弹窗 ── */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal.active { display: flex; }

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
  width: 88%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.3s var(--ease-out);
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  position: relative;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.auth-tab {
  flex: 1;
  padding: 8px 0;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s var(--ease-out);
}
.auth-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.auth-close {
  position: absolute;
  right: -6px;
  top: -22px;
  font-size: 20px;
  color: #bbb;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}
.auth-close:hover { color: #666; }

.auth-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 10px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
  background: var(--bg);
}
.auth-input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}
.auth-error {
  font-size: 13px;
  color: #ef5350;
  margin-bottom: 6px;
  min-height: 18px;
}

/* ── 作者信息 ── */
.author-badge {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}
.author-badge .trust-badge {
  display: inline-block;
  background: var(--primary-gradient);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════
   分类 Tab — 横向滑动胶囊
   ═══════════════════════════════════════════════ */
.sticky-header-group {
  position: sticky;
  top: 0;
  z-index: 100;
}

.sticky-header-group .tabs {
  z-index: 99;
}

/* ── 分类导航：移动端 2×4 grid，大屏自动转为横向 scroll ── */
.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px 12px 8px;
  background: white;
  width: 100%;
  box-sizing: border-box;
}

/* 2 行硬性限制：第 9 个之后的 .tab 隐藏（保留 8 个） */
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 6px 4px;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all 0.25s var(--ease-out);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* 各分类专属淡底色 */
.tab[data-cat="全部"]    { background: #F0F0F0; color: #555; }
.tab[data-cat="北海有料"]  { background: #E3F2FD; color: #1976D2; }
.tab[data-cat="北海树洞"]  { background: #FCE4EC; color: #C2185B; }
.tab[data-cat="北海好嘢"]  { background: #FFF3E0; color: #E65100; }
.tab[data-cat="招聘求职"]  { background: #E8F5E9; color: #2E7D32; }
.tab[data-cat="房屋租售"]  { background: #E0F7FA; color: #00695C; }
.tab[data-cat="便民信息"]  { background: #F3E5F5; color: #6A1B9A; }
.tab[data-cat="北海知道"]  { background: #B2DFDB; color: #00695C; }

.tab:hover {
  filter: brightness(0.93);
}
.tab-icon {
  font-size: 26px;
  line-height: 1.2;
  margin-bottom: 2px;
}
.tab-text {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
}

/* 最小屏（<360px）：缩小字号和间距 */
@media (max-width: 360px) {
  .tabs { gap: 5px; padding: 6px 4px 4px; }
  .tab-icon { font-size: 22px; margin-bottom: 1px; }
  .tab-text { font-size: 12px; }
}

.tab:active {
  transform: scale(0.94);
}
.tab.active {
  background: var(--primary) !important;
  color: white !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

/* ═══════════════════════════════════════════════
   排序按钮
   ═══════════════════════════════════════════════ */
.sort-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px 6px;
  max-width: 640px;
  margin: 0 auto;
}

/* ── 图文轮播 ── */
  border: none;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s var(--ease-out);
  font-family: inherit;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.25);
}
.btn-primary:active {
  box-shadow: 0 1px 3px rgba(255, 107, 53, 0.3);
}

.btn-outline {
  background: white;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:active {
  background: var(--primary-bg);
}

.btn-small {
  padding: 7px 18px;
  font-size: 13px;
  border-radius: 18px;
  flex: none;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════
   消息卡片
   ═══════════════════════════════════════════════ */
.news-list {
  padding: 20px 12px 12px;
  max-width: 640px;
  margin: 0 auto;
}

.news-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  border: 1px solid var(--border-light);
  animation: fadeInUp 0.35s var(--ease-out);
  position: relative;
  overflow: hidden;
}
.news-card::after {
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.08;
}

/* PC hover */
@media (hover: hover) {
  .news-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 107, 53, 0.1);
  }
}
.news-card:active {
  transform: scale(0.98);
}

.news-card-inner {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.card-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.card-thumb {
  flex: 0 0 100px;
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  align-self: center;
  flex-shrink: 0;
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #e8e8e8;
  transition: transform 0.3s var(--ease-out);
}
.news-card:hover .card-thumb img {
  transform: scale(1.05);
}

.card-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

/* ── 标签系统 ── */
.news-card .tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: 500;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}
.tag-haoye { background: #FFF0E8; color: #FF6B35; }
.tag-discount {
  background: linear-gradient(135deg, #FFF0E8, #FFE4D6);
  color: #FF6B35;
}
.tag-event {
  background: linear-gradient(135deg, #E8F4FD, #D6EDFF);
  color: #1976D2;
}
.tag-notice {
  background: linear-gradient(135deg, #B2DFDB, #80CBC4);
  color: #004D40;
}
.tag-job {
  background: linear-gradient(135deg, #F3E8FF, #EBD9FF);
  color: #7C3AED;
}
.tag-service {
  background: linear-gradient(135deg, #FEF9E7, #FDF0CC);
  color: #D97706;
}
.tag-rental {
  background: linear-gradient(135deg, #FCE4EC, #F8CCD6);
  color: #E91E63;
}
.tag-secondhand {
  background: linear-gradient(135deg, #E0F7FA, #B2EBF2);
  color: #00838F;
}
.tag-treehole {
  background: linear-gradient(135deg, #F0FDF4, #DCFCE7);
  color: #16A34A;
  font-family: 'HandWrite', cursive;
  font-size: 12px;
}

.news-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.45;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card .desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}

.news-card .meta {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  gap: 10px;
  margin-top: auto;
  flex-wrap: wrap;
}

.news-card .meta span {
  display: flex;
  align-items: center;
  gap: 3px;
  line-height: 1.3;
}

/* ── 图片网格 ── */
.img-grid {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.img-grid img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  width: 100%;
  border-radius: var(--radius-sm);
  background: #f0f0f0;
  transition: transform 0.3s var(--ease-out);
}
.img-grid img:hover {
  transform: scale(1.03);
}
.img-grid-1 { width: 50%; }
.img-grid-2 img { width: calc(50% - 2px); }
.img-grid-3 img { width: calc(33.333% - 3px); }

/* ═══════════════════════════════════════════════
   聊天弹出层
   ═══════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════
   聊天弹出层
   ═══════════════════════════════════════════════ */
.chat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 56px;
  z-index: 200;
  background: var(--bg);
  display: none;
  flex-direction: column;
  max-width: 640px;
  margin: 0 auto;
}
.chat-overlay.active { display: flex; }

.chat-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
  border-bottom: 1px solid var(--border);
  background: white;
  flex-shrink: 0;
}
.chat-close-btn {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  font-size: 14px;
  color: #555;
  cursor: pointer;
  padding: 7px 16px;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  transition: all 0.15s;
  line-height: 1;
}
.chat-close-btn:active {
  opacity: 0.7;
  background: #e0e0e0;
}

.chat-detail-panel {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 10;
  display: none;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}
.chat-detail-panel.active {
  display: flex;
}
.chat-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: white;
  flex-shrink: 0;
}
.chat-detail-back {
  background: none;
  border: none;
  font-size: 14px;
  color: #FF6B35;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}
.chat-detail-back:active {
  opacity: 0.6;
}
.chat-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.chat-detail-body h2 {
  font-size: 18px;
  margin: 0 0 12px;
  line-height: 1.4;
}
.chat-detail-body .meta {
  font-size: 12px;
  color: #999;
  margin-bottom: 16px;
}
.chat-detail-body .meta .tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 8px;
}
.chat-detail-body .content {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  word-wrap: break-word;
}
.chat-detail-body .content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 12px 0;
}
.chat-detail-body .content p {
  margin: 0 0 12px;
}
.chat-overlay-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.msg {
  display: flex;
  margin-bottom: 14px;
  animation: fadeInUp 0.3s var(--ease-out);
}
.msg.assistant { justify-content: flex-start; }
.msg.user { justify-content: flex-end; }

.msg .bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  transition: box-shadow 0.2s;
}
.msg.assistant .bubble {
  max-width: 92%;
}
.msg.assistant .bubble {
  background: white;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
/* AI 回复 Markdown 排版 */
.msg.assistant .bubble.md-content {
  white-space: normal;
  line-height: 1.7;
  font-size: 14px;
  padding: 12px 16px;
}
.msg.assistant .bubble.md-content p {
  margin: 0 0 10px 0;
}
.msg.assistant .bubble.md-content p:last-child {
  margin-bottom: 0;
}
.msg.assistant .bubble.md-content hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 12px 0;
}
.msg.assistant .bubble.md-content strong {
  font-weight: 600;
}
.msg.assistant .bubble.md-content em {
  font-style: italic;
}
.msg.assistant .bubble.md-content code {
  background: #f0f0f0;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 13px;
  font-family: monospace;
  color: #d63384;
}
.msg.assistant .bubble.md-content blockquote {
  margin: 8px 0;
  padding: 6px 12px;
  border-left: 3px solid #FF6B35;
  background: #fff8f5;
  border-radius: 0 6px 6px 0;
  color: #666;
  font-size: 13px;
}
.msg.assistant .bubble.md-content blockquote p {
  margin: 0;
}
.msg.assistant .bubble.md-content ul,
.msg.assistant .bubble.md-content ol {
  margin: 0;
  padding-left: 20px;
}
.msg.assistant .bubble.md-content li {
  margin-bottom: 2px;
}
.msg.assistant .bubble.md-content h3,
.msg.assistant .bubble.md-content h4 {
  margin: 14px 0 6px 0;
  font-weight: 600;
  color: #333;
}
.msg.assistant .bubble.md-content h3 { font-size: 16px; }
.msg.assistant .bubble.md-content h4 { font-size: 15px; }
.msg.assistant .bubble.md-content a {
  color: #FF6B35;
  text-decoration: underline;
}
/* 表格容器（移动端可横向滚动） */
.msg.assistant .bubble.md-content .md-table-wrap {
  overflow-x: auto;
  margin: 8px 0;
  -webkit-overflow-scrolling: touch;
}
.msg.assistant .bubble.md-content table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 100%;
  white-space: nowrap;
}
.msg.assistant .bubble.md-content td {
  border: 1px solid #e0e0e0;
  padding: 6px 10px;
  text-align: left;
}
.msg.assistant .bubble.md-content tr:first-child td {
  background: #fafafa;
  font-weight: 600;
}
.msg.assistant .bubble.md-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 6px 0;
}
.msg.user .bubble {
  background: var(--primary-gradient);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.2);
}

.typing .bubble {
  display: flex;
  gap: 4px;
  padding: 16px 18px;
}
.typing .bubble span {
  width: 6px;
  height: 6px;
  background: #ccc;
  border-radius: 50%;
  animation: typing 1.2s infinite;
}
.typing .bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing .bubble span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ── 聊天输入区 ── */
.chat-input-area {
  padding: 8px 12px calc(8px + var(--safe-bottom));
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 10;
}
.chat-input-area textarea {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 14px;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  outline: none;
  font-family: inherit;
  background: var(--bg);
  transition: all 0.2s;
}
.chat-input-area textarea:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.08);
}
.chat-input-area .send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: white;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(255, 107, 53, 0.25);
  transition: all 0.2s var(--ease-out);
}
.chat-input-area .send-btn:active {
  transform: scale(0.9);
  box-shadow: 0 1px 3px rgba(255, 107, 53, 0.2);
}
.chat-input-area .send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.chat-input-area .home-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg);
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s var(--ease-out);
  color: var(--text-secondary);
}
.chat-input-area .home-btn:active {
  background: #e0e0e0;
  transform: scale(0.92);
}
.chat-input-area .voice-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s var(--ease-out);
}
.chat-input-area .voice-btn:active {
  transform: scale(0.9);
  background: #FFD4C0;
}

/* ── 全局聊天输入条（全站常驻底部） ── */
.global-chat-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: white;
  border-top: 1px solid var(--border);
  padding: 6px 12px calc(6px + var(--safe-bottom));
}
.global-chat-input-wrap {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  max-width: 640px;
  margin: 0 auto;
}

/* 图片按钮 */
.global-chat-input-wrap .img-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  color: #888;
}
.global-chat-input-wrap .img-btn:active {
  background: rgba(0,0,0,0.06);
  transform: scale(0.9);
}

.global-chat-input-wrap textarea {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 14px;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  outline: none;
  font-family: inherit;
  background: var(--bg);
  transition: all 0.2s;
}
.global-chat-input-wrap textarea:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.08);
}
.global-chat-input-wrap .send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: white;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(255, 107, 53, 0.25);
  transition: all 0.2s var(--ease-out);
}
.global-chat-input-wrap .send-btn:active {
  transform: scale(0.9);
}
.global-chat-input-wrap .send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ── 图片缩略条（聊天层内，消息区与输入框之间） ── */
.chat-image-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}
.chat-image-list {
  display: flex;
  gap: 6px;
}
.chat-image-item {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f0f0f0;
}
.chat-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.chat-image-item .progress-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 600;
  z-index: 1;
}
.chat-image-item .del-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.55);
  color: white;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  z-index: 2;
  padding: 0;
}
.chat-image-item .del-btn:active { background: rgba(0,0,0,0.8); }
.chat-image-item .del-btn:disabled { opacity: 0.4; }
.chat-image-item.fail { border: 2px solid #e74c3c; }
.chat-image-add {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: 2px dashed var(--border);
  background: transparent;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.chat-image-add:active { background: rgba(0,0,0,0.05); }

/* ── 九宫格图片（用户气泡内） ── */
.msg .msg-images {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  max-width: 240px;
}
.msg .msg-images.grid-1 {
  grid-template-columns: 1fr;
  max-width: 200px;
}
.msg .msg-images.grid-1 .msg-img-item { aspect-ratio: auto; max-height: 200px; }
.msg .msg-images.grid-2 { grid-template-columns: 1fr 1fr; }
.msg .msg-images.grid-3,
.msg .msg-images.grid-4,
.msg .msg-images.grid-5,
.msg .msg-images.grid-6,
.msg .msg-images.grid-7,
.msg .msg-images.grid-8,
.msg .msg-images.grid-9 { grid-template-columns: repeat(3, 1fr); }
.msg .msg-img-item {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
}
.msg .msg-img-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

/* ── 全屏图片预览 ── */
.lightbox {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
}
.lightbox .gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px; height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: white;
  font-size: 28px;
  line-height: 48px;
  text-align: center;
  cursor: pointer;
  z-index: 10000;
  transition: background 0.2s;
  user-select: none;
}
.lightbox .gallery-nav:active { background: rgba(255,255,255,0.3); }
.lightbox .gallery-prev { left: 12px; }
.lightbox .gallery-next { right: 12px; }
.lightbox .gallery-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  background: rgba(0,0,0,0.4);
  padding: 4px 14px;
  border-radius: 12px;
}

/* ── 详情页九宫格图片 ── */
.detail-images {
  display: grid;
  gap: 3px;
  margin-bottom: 12px;
  max-width: 100%;
}
.detail-images.grid-1 { grid-template-columns: 1fr; }
.detail-images.grid-2 { grid-template-columns: 1fr 1fr; }
.detail-images.grid-3,
.detail-images.grid-4,
.detail-images.grid-5,
.detail-images.grid-6,
.detail-images.grid-7,
.detail-images.grid-8,
.detail-images.grid-9 { grid-template-columns: repeat(3, 1fr); }
.detail-img-item {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
  background: #f0f0f0;
}
.detail-img-item.single {
  aspect-ratio: auto;
  max-height: 400px;
}
.detail-img-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: opacity 0.15s;
}
.detail-img-item.single img {
  object-fit: contain;
}
.detail-img-item img:active { opacity: 0.8; }

/* ── 发布确认框 ── */
.publish-confirm {
  background: linear-gradient(135deg, var(--primary-bg), white);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 8px 0;
  border: 1.5px solid var(--primary);
}
.publish-confirm h4 {
  color: var(--primary);
  margin-bottom: 10px;
  font-size: 14px;
}
.publish-confirm .actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

/* ═══════════════════════════════════════════════
   消息详情页
   ═══════════════════════════════════════════════ */
.detail-page {
  display: none;
  max-width: 640px;
  margin: 0 auto;
}
.detail-page.active { display: block; }

.float-back {
  position: fixed;
  top: 76px;
  left: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  color: var(--primary);
  font-size: 24px;
  font-weight: 600;
  cursor: pointer;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease-out);
}
.float-back:active {
  transform: scale(0.88);
  box-shadow: var(--shadow-sm);
}

.detail-scroll {
  padding: 16px;
  padding-bottom: calc(56px + var(--safe-bottom));
}

/* 桌面端详情加宽 */
@media (min-width: 1024px) {
  .detail-scroll {
    max-width: 800px;
    margin: 0 auto;
  }
}

.detail-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  animation: fadeInUp 0.35s var(--ease-out);
}

.detail-card h2 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.detail-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}
.detail-meta span {
  display: flex;
  align-items: center;
  gap: 3px;
}

.detail-content {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.detail-content p { margin: 0 0 14px 0; }
.detail-content p:last-child { margin-bottom: 0; }
.detail-content img { display: block; max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; }
.detail-content img:only-of-type { max-width: min(100%, 600px); margin: 8px auto; }

.detail-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 16px 8px 8px;
  max-width: 480px;
  margin: 0 auto;
}

.nav-arrow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg);
  border: none;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease-out);
  color: var(--text-secondary);
}
.nav-arrow:active {
  background: var(--primary-bg);
  color: var(--primary);
  transform: scale(0.9);
}
.nav-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.like-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 24px;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1.5px solid rgba(255, 107, 53, 0.2);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s var(--ease-out);
  font-family: inherit;
}
.like-btn:active {
  background: var(--primary);
  color: white;
  transform: scale(0.94);
}

.share-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 24px;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1.5px solid rgba(255, 107, 53, 0.2);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s var(--ease-out);
  font-family: inherit;
}
.share-btn:active {
  background: var(--primary);
  color: white;
  transform: scale(0.94);
}

/* ── 更多相关推荐 ── */
.related-section {
  margin-top: 16px;
  animation: fadeInUp 0.35s var(--ease-out);
}
.related-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  padding: 6px 2px 4px;
  border-top: 1px solid var(--border);
}
.related-list {
  display: flex;
  flex-direction: column;
}
.related-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 4px;
  cursor: pointer;
  transition: opacity 0.15s;
  border-bottom: 1px solid var(--border-light);
}
.related-item:last-child {
  border-bottom: none;
}
.related-item:active {
  opacity: 0.6;
}
@media (hover: hover) {
  .related-item:hover {
    opacity: 0.7;
  }
}
.related-item .related-cat-tag {
  flex-shrink: 0;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 500;
  line-height: 1.4;
}
.related-item .related-text {
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* ═══════════════════════════════════════════════
   设置页
   ═══════════════════════════════════════════════ */
.settings-page {
  display: none;
  flex-direction: column;
  height: calc(100vh - 62px);
  max-width: 640px;
  margin: 0 auto;
}
.settings-page.active { display: flex; }

.settings-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid var(--border);
}
.settings-topbar .back {
  background: none;
  border: none;
  font-size: 15px;
  color: var(--primary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.settings-topbar .back:active {
  background: var(--primary-bg);
}

.settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(56px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}

.settings-header {
  text-align: center;
  padding: 24px 0 20px;
  background: linear-gradient(180deg, var(--primary-bg) 0%, white 100%);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.settings-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-gradient);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 4px 14px rgba(255, 107, 53, 0.3);
}
.settings-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.settings-username {
  font-size: 13px;
  color: var(--text-tertiary);
}

.settings-section {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  margin-bottom: 12px;
  overflow: hidden;
}
.settings-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 16px 6px;
}
.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.setting-item:active {
  background: var(--bg);
}
.setting-item + .setting-item {
  border-top: 1px solid var(--border-light);
}
.setting-badge {
  font-size: 13px;
  color: var(--text-tertiary);
}
.setting-badge.setting-bound {
  color: #388E3C;
}
.setting-badge.setting-loading {
  color: var(--text-tertiary);
  font-style: italic;
}

.btn-unbind {
  background: none;
  border: 1px solid #ef5350;
  color: #ef5350;
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-unbind:active {
  background: #ef5350;
  color: white;
}

/* ── 搜索样板编辑器 ── */
.ss-editor-input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: var(--bg);
  color: var(--text-primary);
  transition: border-color 0.2s;
}
.ss-editor-input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.08);
}
@media (prefers-color-scheme: dark) {
  .ss-editor-input:focus {
    background: #2A2A38;
  }
}

/* ═══════════════════════════════════════════════
   树洞贴纸墙
   ═══════════════════════════════════════════════ */
.treehole-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, 160px);
  gap: 14px;
  padding: 16px 0;
  max-width: 640px;
  margin: 0 auto;
  justify-content: center;
  min-height: 300px;
  position: relative;
}

.treehole-note {
  width: auto;
  min-width: 0;
  background: var(--note-bg, #FFF8E7);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 8px;
  padding: 14px 14px 10px;
  box-shadow: 1px 2px 8px rgba(0,0,0,0.08), 0 0 0 1px rgba(255,255,255,0.7) inset;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  background-image: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, transparent 50%);
}

.treehole-note::before {
  content: '📌';
  position: absolute;
  top: -5px;
  right: -3px;
  font-size: 14px;
  transform: rotate(15deg);
  opacity: 0.7;
  pointer-events: none;
  transition: opacity 0.2s;
}

.treehole-note .note-header {
  font-size: 11px;
  color: #888;
  margin-bottom: 6px;
  font-weight: 500;
}

.treehole-note .note-text {
  font-family: 'LongCang', 'KaiTi', 'STKaiti', 'Noto Serif CJK SC', serif;
  font-size: 15px;
  line-height: 1.6;
  color: #333;
  word-break: break-all;
  max-height: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: max-height 0.3s var(--ease-out);
}

.treehole-note .note-meta {
  font-size: 11px;
  color: #bbb;
  margin-top: 8px;
}

.treehole-note.note-focus {
  transform: rotate(0deg) translateY(0) !important;
  z-index: 9999 !important;
  box-shadow: 0 8px 36px rgba(0,0,0,0.18), 0 0 0 1px rgba(255,255,255,0.8) inset;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.treehole-note.note-focus .note-text {
  max-height: none;
}

.treehole-note.note-focus::before {
  opacity: 1;
}

/* 回复角标 */
.treehole-note .note-reply-badge {
  display: inline-block;
  font-size: 10px;
  color: #E53935;
  margin-left: 6px;
  background: rgba(229,57,53,0.08);
  padding: 1px 6px;
  border-radius: 10px;
  vertical-align: middle;
}
.treehole-note .note-reply-badge b { font-weight: 600; }

/* 有回复的纸条 — 波纹动画 */
.treehole-note.has-replies::after {
  content: '';
  position: absolute;
  bottom: 8px; right: 10px;
  width: 8px; height: 8px;
  background: #E53935;
  border-radius: 50%;
  animation: reply-pulse 2s infinite;
}
@keyframes reply-pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.6); opacity: 1; }
}

/* 操作按钮 */
.treehole-note .note-actions {
  position: absolute;
  top: 6px; right: 18px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 5;
}
.treehole-note:hover .note-actions,
.treehole-note.note-focus .note-actions { opacity: 1; }

/* 手机端（没有hover）：始终半透明显示，点击能发现 */
@media (hover: none) and (pointer: coarse) {
  .treehole-note .note-actions { opacity: 0.55; }
}

.note-btn-reply, .note-btn-report {
  background: rgba(255,255,255,0.8);
  border: none;
  border-radius: 50%;
  width: 22px; height: 22px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: background 0.15s;
}
.note-btn-reply:hover { background: rgba(76,175,80,0.2); }
.note-btn-report:hover { background: rgba(244,67,54,0.2); }

/* 纸条点赞按钮 — 与回应气泡一致 */
.note-like-btn {
  background: none;
  border: none;
  font-size: 11px;
  cursor: pointer;
  color: #E53935;
  padding: 1px 5px;
  border-radius: 8px;
  transition: background 0.15s;
  font-family: inherit;
}
.note-like-btn:hover { background: rgba(229,57,53,0.08); }
.note-like-btn:active { transform: scale(1.15); }

/* 回复气泡 */
.reply-bubble {
  position: absolute;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 14px;
  padding: 12px 14px 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  animation: bubbleIn 0.25s var(--ease-out);
  pointer-events: auto;
}
/* 气泡被点中：提升到最上一层 */
.reply-bubble.bubble-raised {
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  transition: box-shadow 0.2s;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: scale(0.85) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* 气泡尾巴 — 指向纸条 */
.reply-bubble.bubble-right::before {
  content: '';
  position: absolute;
  left: -8px; top: 18px;
  width: 0; height: 0;
  border: 8px solid transparent;
  border-right-color: #fff;
  border-left: 0;
  filter: drop-shadow(-1px 1px 1px rgba(0,0,0,0.06));
}
.reply-bubble.bubble-left::after {
  content: '';
  position: absolute;
  right: -8px; top: 18px;
  width: 0; height: 0;
  border: 8px solid transparent;
  border-left-color: #fff;
  border-right: 0;
  filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.06));
}
.reply-bubble.bubble-bottom::before {
  content: '';
  position: absolute;
  left: 16px; top: -8px;
  width: 0; height: 0;
  border: 8px solid transparent;
  border-bottom-color: #fff;
  border-top: 0;
  filter: drop-shadow(0 -1px 1px rgba(0,0,0,0.06));
}

.reply-bubble-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #888;
  margin-bottom: 6px;
  font-weight: 500;
}
.reply-bubble-body {
  font-family: 'LongCang', 'KaiTi', 'STKaiti', serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  word-break: break-all;
}
.reply-bubble-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 11px;
  color: #bbb;
}
.reply-next-btn {
  background: rgba(76,175,80,0.12);
  color: #4CAF50;
  border: none;
  border-radius: 50%;
  width: 24px; height: 24px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}
.reply-next-btn:hover { background: rgba(76,175,80,0.25); }

.reply-like-btn {
  background: none;
  border: none;
  font-size: 12px;
  cursor: pointer;
  color: #E53935;
  padding: 2px 6px;
  border-radius: 8px;
  transition: background 0.15s;
}
.reply-like-btn:hover { background: rgba(229,57,53,0.08); }
.reply-like-btn:active { transform: scale(1.15); }

/* 回复/举报弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.reply-modal-content {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  width: 90%;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  animation: slideUp 0.25s var(--ease-out);
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.reply-modal-content .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 15px;
}
.modal-close-btn {
  background: none; border: none;
  font-size: 18px; cursor: pointer;
  color: #999; padding: 0 4px;
}
.reply-input, .reply-name-input {
  width: 100%;
  border: 1px solid #E0E0E0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 10px;
  resize: none;
  transition: border-color 0.2s;
}
.reply-input:focus, .reply-name-input:focus { border-color: var(--primary); }
.reply-name-input { font-size: 13px; padding: 8px 12px; }
.reply-submit-btn {
  width: 100%; padding: 11px;
  border: none; border-radius: 10px;
  background: var(--primary);
  color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.reply-submit-btn:hover { opacity: 0.9; }
.reply-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* 举报选项 */
.report-options { margin-bottom: 14px; }
.report-option {
  display: block;
  padding: 8px 0;
  font-size: 14px;
  color: #333;
  cursor: pointer;
}
.report-option input { margin-right: 8px; }

/* ═══════════════════════════════════════════════
   公共组件
   ═══════════════════════════════════════════════ */

/* ── 加载状态 ── */
.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
  font-size: 14px;
}
.loading .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 14px;
}

/* ── 空状态 ── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
  font-size: 14px;
  line-height: 1.8;
}
.empty .icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}

/* ── Toast ── */
.toast {
  display: none;
  position: fixed;
  bottom: calc(90px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.78);
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 300;
  white-space: nowrap;
  animation: fadeIn 0.2s;
  backdrop-filter: blur(4px);
}

/* ── 隐藏工具类 ── */
.hidden { display: none !important; }

/* ═══════════════════════════════════════════════
   PC 响应式适配
   ═══════════════════════════════════════════════ */
@media (min-width: 1024px) {


  /* 首页整体加宽居中 */
  .page-home {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
  }

  /* 头部布局 */
  .header-logo {
    margin-left: 0;
  }
  .user-bar {
    position: static;
    transform: none;
  }

  /* Tab 栏 PC 上改为横向滚动 */
  .tabs {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding: 10px 16px;
    background: white;
  }
  .tab {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 4px;
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 20px;
  }
  .tab-icon { font-size: 16px; margin-bottom: 0; }
  .tab-text { font-size: 15px; }

  /* 排序按钮居中 */
  .sort-bar {
    justify-content: center;
    padding: 10px 0 12px;
  }
  .sort-bar button {
    flex: none !important;
    padding: 7px 28px;
  }

  /* 消息列表：两列网格 */
  .news-list {
    max-width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 20px 12px 12px;
  }

  .news-card {
    margin-bottom: 0;
  }

  /* 树洞墙在 PC 上居中并加宽 */
  .treehole-wall {
    max-width: 100%;
    margin: 0;
    padding: 24px 0;
    min-height: 500px;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, 180px);
    justify-content: start;
    grid-column: 1 / -1;
  }

  /* 聊天弹出层 PC 加宽 */
  .chat-overlay {
    max-width: 640px;
  }
@media (prefers-color-scheme: dark) {

  .modal-content {
    background: #1C1C26;
  }
  .auth-tab.active {
    background: #2A2A38;
  }
  .auth-input {
    background: #2A2A38;
    border-color: rgba(255,255,255,0.1);
    color: var(--text-primary);
  }
  .auth-input:focus {
    background: #333;
    border-color: var(--primary);
  }

  .tabs {
    background: white;
    border-bottom-color: var(--border);
  }
  .tab {
    background: rgba(255,255,255,0.06) !important;
    color: var(--text-secondary);
  }
  .tab.active {
    background: var(--primary) !important;
    color: white !important;
  }

  .chat-input-area {
    background: #1C1C26;
  }
  .chat-input-area textarea {
    background: #2A2A38;
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.1);
  }
  .chat-input-area textarea:focus {
    background: #333;
  }

  .global-chat-bar {
    background: #1C1C26;
    border-top-color: #333;
  }
  .chat-overlay {
    background: #1C1C26;
  }
  .chat-overlay-header {
    background: #1C1C26;
    border-bottom-color: #333;
  }
  .chat-detail-header {
    background: #1C1C26;
    border-bottom-color: #333;
  }
  .chat-detail-back {
    color: #FF8C5A;
  }
  .chat-detail-body .content {
    color: #e0e0e0;
  }
  .chat-close-btn {
    background: #333;
    border-color: #444;
    color: #ccc;
  }
  .chat-close-btn:active {
    background: #444;
  }
  .chat-overlay-msgs .msg.assistant .bubble {
    background: #2C2C3A;
    border-color: #3A3A4A;
    color: #e0e0e0;
  }
  .chat-overlay-msgs .msg.assistant .bubble.md-content code {
    background: #3A3A4A;
    color: #f0a8c0;
  }
  .chat-overlay-msgs .msg.assistant .bubble.md-content blockquote {
    background: rgba(255,107,53,0.08);
    border-left-color: #FF6B35;
    color: #bbb;
  }
  .chat-overlay-msgs .msg.assistant .bubble.md-content hr {
    border-top-color: #3A3A4A;
  }
  .chat-overlay-msgs .msg.assistant .bubble.md-content h3,
  .chat-overlay-msgs .msg.assistant .bubble.md-content h4 {
    color: #e0e0e0;
  }
  .chat-overlay-msgs .msg.assistant .bubble.md-content td {
    border-color: #3A3A4A;
  }
  .chat-overlay-msgs .msg.assistant .bubble.md-content tr:first-child td {
    background: rgba(255,255,255,0.06);
  }
  .global-chat-input-wrap textarea {
    background: #2C2C3A;
    border-color: #3A3A4A;
    color: #e0e0e0;
  }
  .global-chat-input-wrap textarea:focus {
    background: #333;
  }

  .detail-card {
    background: #1C1C26;
  }

  .settings-topbar {
    background: #1C1C26;
  }
  .settings-section {
    background: #1C1C26;
  }
  .setting-item:active {
    background: #2A2A38;
  }

  .msg.assistant .bubble {
    background: #1C1C26;
    border-color: var(--border);
    color: var(--text-primary);
  }

  .publish-confirm {
    background: #2A2A38;
    border-color: var(--primary);
  }

  .sort-bar .btn-outline {
    background: transparent;
  }

  .float-back {
    background: rgba(28, 28, 38, 0.88);
    color: var(--primary);
  }

  .like-btn {
    background: rgba(255, 107, 53, 0.12);
    border-color: rgba(255, 107, 53, 0.25);
    color: var(--primary-light);
  }
  .like-btn:active {
    background: var(--primary);
    color: white;
  }

  .treehole-note {
    background-image: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 50%);
  }

  .share-btn {
    background: rgba(255, 107, 53, 0.12);
    border-color: rgba(255, 107, 53, 0.25);
    color: var(--primary-light);
  }
  .share-btn:active {
    background: var(--primary);
    color: white;
  }

  /* 图片缩略条 - 深色 */
  .chat-image-bar {
    background: #1C1C26;
    border-top-color: #333;
  }
  .chat-image-item {
    background: #333;
  }
  .chat-image-add {
    border-color: #444;
    color: #666;
  }
  .chat-image-add:active { background: rgba(255,255,255,0.08); }
}

/* 备案号 */
.beian-footer {
  text-align: center;
  padding: 12px 20px 8px;
  margin-bottom: 56px; /* 给底部聊天栏留空间 */
}
.beian-footer a {
  color: #999;
  font-size: 12px;
  text-decoration: none;
}
.beian-footer a:hover {
  color: #666;
}
