/* ==========================================================================
   Campus Wall v5.0 — Clean-Sheet Unified Frontend Stylesheet (app.css)
   零旧版代码、独立移动端设计、桌面居中模态 / 移动端底部抽屉体系
   ========================================================================== */

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* 1. 顶部导航 */
.cw-header {
  position: sticky;
  top: 0;
  z-index: 500;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
}
.cw-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  height: 60px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.cw-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  min-width: 0;
}
.cw-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform var(--dur-base) var(--ease-bounce);
}
.cw-brand:hover .cw-brand-mark { transform: scale(1.06); }
.cw-brand-mark svg { width: 20px; height: 20px; }

.cw-header-search {
  flex: 1;
  max-width: 380px;
  height: 38px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.cw-header-search:hover { border-color: var(--accent); background: var(--bg-surface); color: var(--text-main); }
.cw-header-search-left { display: flex; align-items: center; gap: 8px; }
.cw-header-search svg { width: 15px; height: 15px; }
.cw-kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.cw-header-nav { display: flex; align-items: center; gap: 6px; }
.cw-nav-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.cw-nav-btn:hover, .cw-nav-btn[aria-current="page"] { background: var(--bg-subtle); color: var(--text-main); }
.cw-nav-btn svg { width: 16px; height: 16px; }
.cw-nav-dot {
  min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.cw-nav-dot:empty { display: none; }
.cw-account-pill {
  height: 36px;
  padding: 0 13px 0 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.cw-account-pill:hover { border-color: var(--accent); box-shadow: var(--shadow-xs); }
.cw-mob-school-btn, .cw-mob-auth-bar, .cw-mob-auth-hero { display: none; }

/* 2. 桌面广场 Hero & 三栏布局 */
.cw-hero { max-width: 1240px; width: 100%; margin: 18px auto 0; padding: 0 20px; }
.cw-hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: var(--shadow-xs);
}
.cw-hero-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-sub); margin-bottom: 6px; }
.cw-hero-card h1 { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.025em; }
.cw-hero-card p { margin: 0; font-size: 13.5px; color: var(--text-sub); max-width: 560px; }
.cw-week-box {
  display: flex; align-items: flex-end; gap: 18px;
  padding: 12px 16px; border-radius: var(--r-md); background: var(--bg-subtle); flex-shrink: 0;
}
.cw-week-num strong { display: block; font-size: 24px; line-height: 1.1; }
.cw-week-num span { font-size: 11.5px; color: var(--text-sub); }
.cw-week-bars { display: flex; align-items: flex-end; gap: 7px; height: 52px; }
.cw-week-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cw-week-col i { display: block; width: 10px; border-radius: 4px 4px 2px 2px; background: var(--accent); opacity: 0.8; }
.cw-week-col small { font-size: 10px; color: var(--text-muted); }

.cw-plaza-grid {
  max-width: 1240px;
  width: 100%;
  margin: 18px auto 48px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 276px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) {
  .cw-plaza-grid { grid-template-columns: 230px minmax(0, 1fr); }
  .cw-right-rail { display: none; }
}
.cw-rail-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 14px;
}
.cw-rail-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cw-quick-links { display: flex; flex-direction: column; gap: 4px; }
.cw-quick-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 10px; border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--text-secondary);
  border: 0; background: transparent; width: 100%; text-align: left;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.cw-quick-link:hover { background: var(--bg-subtle); color: var(--text-main); }
.cw-quick-link-l { display: flex; align-items: center; gap: 9px; }
.cw-quick-link svg { width: 16px; height: 16px; color: var(--text-sub); }

/* 3. 公告栏、分类条与话题条 */
.cw-anno-bar {
  margin-bottom: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
}
.cw-anno-main { min-width: 0; flex: 1; display: flex; align-items: center; gap: 8px; }
.cw-anno-badge {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent); flex-shrink: 0;
}
.cw-anno-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cw-feed-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.cw-cat-strip {
  display: flex; align-items: center; gap: 7px;
  overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none;
}
.cw-cat-strip::-webkit-scrollbar { display: none; }
.cw-cat-pill {
  flex-shrink: 0; height: 32px; padding: 0 13px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--bg-surface);
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all var(--dur-fast) var(--ease-snappy);
}
.cw-cat-pill:hover { border-color: var(--accent); color: var(--text-main); }
.cw-cat-pill.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); font-weight: 600; }
.cw-cat-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cat-color, var(--accent)); }
.cw-cat-pill.is-active .cw-cat-dot { background: currentColor; }
.cw-chip-group { display: flex; gap: 8px; flex-wrap: wrap; }

.cw-topic-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; font-size: 12.5px; }
.cw-topic-chip {
  padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-sub);
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.cw-topic-chip:hover { border-color: var(--accent); color: var(--accent); }

/* 4. 全新帖子卡片、轻表态、PK、音乐与短视频卡片 */
.cw-post-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-base) ease;
  animation: cwFadeUp .32s var(--ease-spring) both;
}
.cw-post-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.cw-post-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.cw-post-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
}
.cw-post-badge.is-hot { background: var(--danger-soft); color: var(--danger); }
.cw-post-badge.is-featured { background: var(--warning-soft); color: var(--warning); }
.cw-post-badge.is-penalty { background: var(--danger-soft); color: var(--danger); }

.cw-post-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cw-post-author { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cw-post-author-info { min-width: 0; }
.cw-post-author-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; font-weight: 600; }
.cw-post-author-row a:hover { color: var(--accent); }
.cw-post-meta { font-size: 12px; color: var(--text-sub); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.cw-post-cat-tag {
  font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: var(--r-pill);
  color: var(--cat-color, var(--accent));
  background: color-mix(in srgb, var(--cat-color, var(--accent)) 11%, transparent);
}
.cw-follow-btn {
  height: 28px; padding: 0 11px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--bg-surface);
  color: var(--accent); font-size: 12px; font-weight: 600; flex-shrink: 0;
  transition: all var(--dur-fast) ease;
}
.cw-follow-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.cw-follow-btn.is-following { background: var(--bg-subtle); color: var(--text-sub); border-color: var(--border); }

.cw-post-body {
  font-size: 14.5px; line-height: 1.75; color: var(--text-main);
  word-break: break-word; white-space: pre-wrap;
}
.cw-post-body a.cw-topic-link, .cw-post-body a.cw-ext-link { color: var(--accent); font-weight: 500; }
.cw-post-body a:hover { text-decoration: underline; }
.cw-post-img {
  margin-top: 12px; border-radius: var(--r-md); max-height: 460px; width: auto;
  object-fit: cover; cursor: zoom-in; border: 1px solid var(--border);
}
.cw-post-notice {
  margin-top: 10px; padding: 9px 12px; border-radius: var(--r-sm);
  font-size: 12.5px; line-height: 1.55; border-left: 3px solid var(--accent);
  background: var(--accent-soft); color: var(--text-secondary);
}
.cw-post-notice.warning { border-left-color: var(--warning); background: var(--warning-soft); color: var(--warning); }
.cw-post-notice.success { border-left-color: var(--success); background: var(--success-soft); color: var(--success); }
.cw-post-notice.danger { border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger); }

/* 扩列卡 */
.cw-friend-card {
  margin-bottom: 12px; padding: 12px; border-radius: var(--r-md);
  background: var(--bg-subtle); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.cw-friend-card img { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; flex-shrink: 0; }
.cw-friend-name { font-size: 15px; font-weight: 700; }
.cw-friend-contact { font-size: 12.5px; color: var(--accent); margin-top: 2px; }

/* PK 投票 */
.cw-pk-box { margin-top: 12px; }
.cw-pk-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cw-pk-btn {
  padding: 12px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--border-strong);
  background: var(--bg-subtle); font-weight: 600; font-size: 13.5px;
  transition: all var(--dur-fast) ease;
}
.cw-pk-btn.is-a:hover { border-color: #dc2626; background: rgba(220,38,38,.09); color: #dc2626; }
.cw-pk-btn.is-b:hover { border-color: #2563eb; background: rgba(37,99,235,.09); color: #2563eb; }
.cw-pk-bar {
  position: relative; height: 38px; border-radius: var(--r-sm); overflow: hidden;
  display: flex; background: var(--bg-subtle); margin-bottom: 6px;
}
.cw-pk-fill-a { background: #dc2626; height: 100%; transition: width .5s var(--ease-spring); }
.cw-pk-fill-b { background: #2563eb; height: 100%; transition: width .5s var(--ease-spring); }
.cw-pk-labels {
  position: absolute; inset: 0; padding: 0 12px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; font-weight: 600; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.cw-pk-foot { text-align: center; font-size: 12px; color: var(--text-sub); }

/* 音乐与短视频卡片 */
.cw-music-card {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--bg-subtle); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.cw-music-cover { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.cw-music-info { flex: 1; min-width: 0; }
.cw-music-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-music-artist { font-size: 12px; color: var(--text-sub); }

.cw-video-card {
  display: block; margin-top: 12px; border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--border); position: relative; background: #111; color: #fff;
}
.cw-video-bg { height: 200px; background-size: cover; background-position: center; display: flex; align-items: flex-end; position: relative; }
.cw-video-overlay { width: 100%; padding: 14px; background: linear-gradient(transparent, rgba(0,0,0,.8)); }
.cw-video-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,.55);
  display: grid; place-items: center;
}
.cw-video-play svg { width: 20px; height: 20px; fill: #fff; }

/* 底部互动栏 */
.cw-post-foot {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.cw-act-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cw-act-btn {
  height: 32px; padding: 0 11px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-sub); font-size: 12.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all var(--dur-fast) var(--ease-snappy);
}
.cw-act-btn:hover { background: var(--bg-subtle); color: var(--text-main); border-color: var(--border-strong); }
.cw-act-btn.is-active {
  background: var(--accent-soft); color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 28%, transparent); font-weight: 600;
}
.cw-act-btn.is-active svg { animation: cwHeartPop .35s var(--ease-bounce); }
.cw-act-btn svg { width: 15px; height: 15px; }

/* 右侧热榜 */
.cw-rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cw-rank-item {
  display: flex; align-items: flex-start; gap: 9px; padding: 7px 8px; border-radius: var(--r-sm);
  font-size: 13px; color: var(--text-secondary); transition: background-color var(--dur-fast) ease;
}
.cw-rank-item:hover { background: var(--bg-subtle); color: var(--text-main); }
.cw-rank-num {
  width: 20px; height: 20px; border-radius: 6px; background: var(--bg-subtle); color: var(--text-sub);
  font-size: 11px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0;
}
.cw-rank-item:nth-child(-n+3) .cw-rank-num { background: var(--accent-soft); color: var(--accent); }

/* 5. 统一模态弹窗 & 移动端底部抽屉体系 */
.cw-modal-overlay[hidden] { display: none !important; }
.cw-modal-overlay {
  position: fixed; inset: 0; z-index: 8800;
  background: rgba(15, 23, 42, 0.52);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; transition: opacity var(--dur-base) ease;
}
.cw-modal-overlay.is-open { opacity: 1; }
.cw-modal-panel {
  width: min(560px, 100%);
  max-height: min(86dvh, 740px);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--dur-slow) var(--ease-spring);
}
.cw-composer-panel { width: min(620px, 100%); }
.cw-modal-overlay.is-open .cw-modal-panel { transform: scale(1) translateY(0); }
.cw-sheet-handle { display: none; }
.cw-modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0;
}
.cw-modal-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cw-modal-head h3 { margin: 0; font-size: 16.5px; font-weight: 700; }
.cw-pill-sub { font-size: 12px; color: var(--text-sub); background: var(--bg-subtle); padding: 2px 9px; border-radius: var(--r-pill); }
.cw-pill-sub:empty { display: none; }
.cw-icon-close {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--bg-subtle); color: var(--text-sub);
  display: grid; place-items: center; flex-shrink: 0;
}
.cw-icon-close:hover { background: var(--bg-hover); color: var(--text-main); }
.cw-icon-close svg { width: 16px; height: 16px; }
.cw-modal-body {
  padding: 18px 20px; overflow-y: auto; overscroll-behavior: contain; flex: 1;
  display: flex; flex-direction: column; gap: 12px;
}
.cw-modal-foot {
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); background: var(--bg-surface);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-shrink: 0;
}
.cw-inline-form { display: flex; gap: 8px; width: 100%; }
.cw-inline-form .cw-input { flex: 1; min-width: 0; }
.cw-modal-list { display: flex; flex-direction: column; gap: 8px; }

/* 发帖器专属组件 */
.cw-composer-meta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cw-composer-textarea { min-height: 132px; font-size: 15px; }
.cw-extra-box { display: flex; gap: 12px; align-items: center; }
.cw-extra-box[hidden] { display: none !important; }
.cw-extra-col { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.cw-avatar-picker {
  width: 60px; height: 60px; border-radius: 14px; background: var(--bg-subtle);
  border: 1.5px dashed var(--border-strong); display: grid; place-items: center;
  cursor: pointer; overflow: hidden; flex-shrink: 0; font-size: 22px; color: var(--text-sub);
}
.cw-avatar-picker img { width: 100%; height: 100%; object-fit: cover; }
.cw-pk-inputs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; }
.cw-vs-tag { font-weight: 800; font-style: italic; color: var(--text-muted); }
.cw-attach-preview { position: relative; width: fit-content; }
.cw-attach-preview img { max-height: 180px; border-radius: var(--r-md); border: 1px solid var(--border); }
.cw-attach-del {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 14px;
}
.cw-attach-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--r-md); background: var(--bg-subtle); border: 1px solid var(--border);
}
.cw-attach-card[hidden] { display: none !important; }
.cw-attach-thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.cw-attach-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cw-attach-info strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-attach-info span { font-size: 11.5px; color: var(--text-sub); }
.cw-composer-foot { justify-content: space-between; flex-wrap: wrap; }
.cw-tool-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cw-tool-btn {
  height: 34px; padding: 0 11px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--bg-subtle);
  color: var(--text-secondary); font-size: 12.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
}
.cw-tool-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.cw-tool-btn svg { width: 15px; height: 15px; }

/* 评论列表与回复 */
.cw-comment-composer { flex-direction: column; align-items: stretch; gap: 8px; }
.cw-reply-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); font-size: 12.5px;
}
.cw-reply-bar[hidden] { display: none !important; }
.cw-cmt-item { padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-subtle); }
.cw-cmt-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-sub); margin-bottom: 5px; }
.cw-cmt-body { font-size: 13.5px; line-height: 1.6; color: var(--text-main); word-break: break-word; }
.cw-cmt-ops { display: flex; gap: 12px; margin-top: 7px; font-size: 12px; color: var(--text-sub); }
.cw-cmt-ops button { border: 0; background: transparent; padding: 0; color: inherit; font-weight: 500; }
.cw-cmt-ops button:hover, .cw-cmt-ops button.is-active { color: var(--accent); }
.cw-cmt-children { margin-top: 8px; padding-left: 12px; border-left: 2px solid var(--border-strong); display: flex; flex-direction: column; gap: 6px; }

/* 搜索结果 / 分享 / 灯箱 / 12355 / 维护页 */
.cw-search-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 13px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--bg-surface);
}
.cw-search-row:hover { border-color: var(--accent); }
.cw-share-box { padding: 14px; border-radius: var(--r-md); background: var(--bg-subtle); border: 1px solid var(--border); font-size: 13.5px; line-height: 1.6; }
.cw-lightbox[hidden] { display: none !important; }
.cw-lightbox {
  position: fixed; inset: 0; z-index: 9700; background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.cw-lightbox img { max-width: 94vw; max-height: 90dvh; border-radius: var(--r-md); object-fit: contain; }
.cw-lightbox-close {
  position: fixed; top: 18px; right: 18px; width: 40px; height: 40px;
  border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: 24px;
}
.cw-crisis-hotline {
  padding: 16px; border-radius: var(--r-md); background: var(--accent-soft);
  text-align: center; display: flex; flex-direction: column; gap: 4px;
}
.cw-crisis-hotline strong { font-size: 32px; color: var(--accent); letter-spacing: 0.08em; }
.cw-crisis-hotline span { font-size: 12.5px; color: var(--text-sub); }
.cw-maint-screen {
  position: fixed; inset: 0; z-index: 9600; background: var(--bg-canvas);
  display: grid; place-items: center; padding: 24px;
}
.cw-maint-card {
  width: min(440px, 100%); background: var(--bg-surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-xl); padding: 32px; box-shadow: var(--shadow-lg);
}

/* 6. 登录注册、个人中心、校园纸条、公开主页与阅读页 */
.cw-auth-shell { max-width: 980px; width: 100%; margin: 40px auto 72px; padding: 0 20px; }
.cw-auth-card {
  display: grid; grid-template-columns: 0.92fr 1.18fr;
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-md);
}
.cw-auth-aside {
  background: var(--bg-subtle); padding: 42px 36px;
  display: flex; flex-direction: column; justify-content: space-between;
  border-right: 1px solid var(--border);
}
.cw-auth-main { padding: 42px 44px; }
.cw-auth-form { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.cw-auth-features { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; }
.cw-auth-features > div { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); }
.cw-auth-features svg { width: 17px; height: 17px; color: var(--accent); flex-shrink: 0; }
.cw-auth-aside-foot { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-sub); }
.cw-auth-tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  border-radius: var(--r-sm); background: var(--bg-subtle); border: 1px solid var(--border); margin-bottom: 22px;
}
.cw-auth-tabs a { padding: 7px 18px; border-radius: calc(var(--r-sm) - 3px); font-size: 13.5px; font-weight: 600; color: var(--text-sub); }
.cw-auth-tabs a[aria-current="page"] { background: var(--bg-surface); color: var(--accent); box-shadow: var(--shadow-xs); }
.cw-consent-box { display: flex; flex-direction: column; gap: 9px; padding: 13px 15px; border-radius: var(--r-sm); background: var(--bg-subtle); border: 1px solid var(--border); }

.cw-center-wrap { max-width: 1120px; width: 100%; margin: 24px auto 80px; padding: 0 20px; }
.cw-center-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.cw-dm-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; min-height: 440px; }
.cw-dm-list { border-right: 1px solid var(--border); background: var(--bg-subtle); overflow-y: auto; max-height: 520px; }
.cw-dm-peer { width: 100%; border: 0; background: transparent; padding: 12px 14px; display: flex; align-items: center; gap: 10px; text-align: left; border-bottom: 1px solid var(--border); }
.cw-dm-peer:hover, .cw-dm-peer.is-active { background: var(--bg-surface); }
.cw-dm-thread { display: flex; flex-direction: column; height: 520px; background: var(--bg-surface); }
.cw-dm-thread-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.cw-dm-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.cw-dm-bubble { max-width: 78%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; word-break: break-word; }
.cw-dm-bubble.is-other { align-self: flex-start; background: var(--bg-subtle); color: var(--text-main); border-bottom-left-radius: 4px; }
.cw-dm-bubble.is-me { align-self: flex-end; background: var(--accent); color: var(--accent-contrast); border-bottom-right-radius: 4px; }
.cw-dm-bubble small { display: block; font-size: 10.5px; opacity: .7; margin-top: 3px; }
.cw-dm-input-bar { padding: 10px 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

.reading { max-width: 780px; width: 100%; margin: 24px auto 80px; padding: 0 18px; }
.reading .back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-sub); margin-bottom: 14px; }
.reading .panel.content { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px 30px; box-shadow: var(--shadow-xs); }
.reading h1 { margin: 0 0 14px; font-size: 22px; }
.reading h2 { margin: 20px 0 8px; font-size: 16.5px; }
.reading p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.75; color: var(--text-secondary); }
.saved-record { padding: 14px 0; border-bottom: 1px solid var(--border); }
.inbox-tools { margin-bottom: 14px; }
.inbox-event { margin-bottom: 8px; }
.event-link { width: 100%; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-surface); padding: 12px 14px; display: flex; align-items: center; gap: 12px; text-align: left; }
.event-link > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.signal { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; }
.signal.fresh { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.empty { padding: 30px 14px; text-align: center; color: var(--text-muted); font-size: 13.5px; }
button.outline { height: 36px; padding: 0 14px; border-radius: var(--r-sm); background: var(--bg-surface); border: 1px solid var(--border-strong); font-size: 13px; font-weight: 600; }
button.link { background: transparent; border: 0; color: var(--text-sub); font-size: 13px; }

.cw-footer { margin-top: auto; border-top: 1px solid var(--border); background: var(--bg-surface); padding: 18px 20px; }
.cw-footer-inner { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-sub); }
.cw-footer-inner nav { display: flex; gap: 16px; }
.cw-mobile-dock { display: none; }

/* ==========================================================================
   7. 移动端独立设计体系（<= 820px，零压缩感，原生 App 级体验）
   ========================================================================== */
@media (max-width: 820px) {
  .cw-header-inner { height: 54px; padding: 0 14px; gap: 10px; }
  .cw-header-search { display: none; }

  /* 广场页顶栏：右侧【仅保留】学校选择胶囊 */
  body.page-plaza .cw-header-nav { display: none; }
  body.page-plaza .cw-mob-school-btn {
    display: inline-flex; align-items: center; gap: 7px;
    max-width: 56vw; height: 36px; padding: 0 12px 0 10px;
    border-radius: var(--r-pill); border: 1px solid var(--border-strong);
    background: var(--bg-subtle); color: var(--text-main);
    font-size: 13px; font-weight: 600;
  }
  body.page-plaza .cw-mob-school-btn:active { transform: scale(0.96); border-color: var(--accent); }
  .cw-mob-school-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cw-mob-school-chev { width: 14px; height: 14px; color: var(--text-sub); flex-shrink: 0; }

  /* 隐藏桌面左侧学校卡片，底层 #school-select 仍驱动底部学校面板 */
  body.page-plaza .cw-left-rail {
    position: fixed; left: -9999px; width: 1px; height: 1px; overflow: hidden; pointer-events: none;
  }
  body.page-plaza .cw-hero { display: none; }
  body.page-plaza .cw-plaza-grid {
    grid-template-columns: minmax(0, 1fr);
    margin: 10px auto 0;
    padding: 0 12px calc(86px + env(safe-area-inset-bottom));
    gap: 0;
  }
  body.page-plaza .cw-feed-toolbar #write-button { display: none; }
  body.page-plaza .cw-segment { width: 100%; border-radius: var(--r-md); }
  body.page-plaza .cw-segment-btn { flex: 1; text-align: center; padding: 7px 0; }
  body.page-plaza .cw-cat-strip { margin: 0 -12px 6px; padding: 2px 12px 8px; }
  .cw-post-card { padding: 15px 14px; border-radius: var(--r-md); margin-bottom: 12px; }
  .cw-pk-btns { grid-template-columns: 1fr; }

  /* 全部弹窗在移动端变为原生级底部抽屉 */
  .cw-modal-overlay.cw-sheet-mobile { padding: 0; align-items: flex-end; }
  .cw-modal-overlay.cw-sheet-mobile .cw-modal-panel {
    width: 100%; max-width: none !important; max-height: 92dvh;
    border-radius: var(--r-xl) var(--r-xl) 0 0; border-left: 0; border-right: 0; border-bottom: 0;
    transform: translateY(100%);
  }
  .cw-modal-overlay.cw-sheet-mobile.is-open .cw-modal-panel { transform: translateY(0); }
  .cw-modal-overlay.cw-sheet-mobile .cw-sheet-handle {
    display: block; width: 40px; height: 4px; border-radius: var(--r-pill);
    background: var(--border-strong); margin: 10px auto 2px; flex-shrink: 0;
  }
  .cw-composer-meta-row { grid-template-columns: 1fr 1fr; }
  .cw-composer-foot { flex-direction: column; align-items: stretch; }
  .cw-tool-row { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .cw-tool-btn { flex-shrink: 0; height: 36px; }
  .cw-composer-submit { width: 100%; height: 44px; font-size: 15px; border-radius: var(--r-md); }

  /* 移动端独立登录/注册全屏页面 */
  body.page-auth { background: var(--bg-surface); }
  body.page-auth .cw-header, body.page-auth .cw-footer, body.page-auth .cw-mobile-dock { display: none !important; }
  body.page-auth .cw-mob-auth-bar {
    display: flex; align-items: center; justify-content: space-between;
    height: 54px; padding: 0 16px; border-bottom: 1px solid var(--border);
    background: var(--bg-surface); position: sticky; top: 0; z-index: 20;
  }
  .cw-mob-auth-back { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 600; color: var(--text-secondary); }
  body.page-auth .cw-auth-shell { margin: 0; padding: 0; max-width: none; }
  body.page-auth .cw-auth-card {
    display: flex; flex-direction: column; border: 0; border-radius: 0; box-shadow: none;
    min-height: calc(100dvh - 54px);
  }
  body.page-auth .cw-auth-aside { display: none; }
  body.page-auth .cw-auth-main { padding: 26px 20px calc(32px + env(safe-area-inset-bottom)); }
  body.page-auth .cw-mob-auth-hero { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
  body.page-auth .cw-mob-auth-hero .cw-brand-mark { width: 44px; height: 44px; border-radius: 13px; }
  body.page-auth .cw-auth-tabs { width: 100%; border-radius: var(--r-md); }
  body.page-auth .cw-auth-tabs a { flex: 1; text-align: center; padding: 10px 0; font-size: 14.5px; }
  body.page-auth .cw-input { height: 48px; font-size: 15.5px; border-radius: var(--r-md); background: var(--bg-canvas); }
  body.page-auth .cw-select-trigger { min-height: 48px; border-radius: var(--r-md); background: var(--bg-canvas); font-size: 15px; }
  body.page-auth .cw-auth-submit { height: 48px !important; border-radius: var(--r-md) !important; font-size: 15.5px !important; }

  /* 移动端个人中心与公开主页 */
  .cw-center-wrap { margin: 14px auto calc(86px + env(safe-area-inset-bottom)); padding: 0 12px; }
  .cw-center-grid { grid-template-columns: 1fr; gap: 12px; }
  .cw-center-grid > aside nav.cw-quick-links {
    display: flex; flex-direction: row; overflow-x: auto; gap: 6px; padding: 8px !important; scrollbar-width: none;
  }
  .cw-center-grid > aside nav.cw-quick-links::-webkit-scrollbar { display: none; }
  .cw-center-grid > aside nav.cw-quick-links .cw-quick-link {
    width: auto; flex-shrink: 0; padding: 7px 12px; border-radius: var(--r-pill); border: 1px solid var(--border); white-space: nowrap;
  }
  .cw-dm-layout { grid-template-columns: 1fr; min-height: auto; }
  .cw-dm-list { border-right: 0; border-bottom: 1px solid var(--border); max-height: 180px; }
  .cw-dm-thread { height: 380px; }
  .cw-profile-actions-mob { width: 100%; display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; }
  .cw-profile-actions-mob form { display: contents; }
  .cw-profile-actions-mob .cw-btn { width: 100%; height: 42px; }

  /* 移动端底部 5 键 Dock（突出中央 + 发帖按钮） */
  .cw-mobile-dock {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 600;
    background: var(--bg-header); border-top: 1px solid var(--border);
    padding: 5px 8px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.06);
  }
  .cw-mobile-dock a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 11px; color: var(--text-sub); padding: 4px 0;
  }
  .cw-mobile-dock a[aria-current="page"] { color: var(--accent); font-weight: 600; }
  .cw-mobile-dock svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .cw-mobile-dock a.dock-write .dock-write-pill {
    width: 46px; height: 34px; border-radius: var(--r-pill);
    background: var(--accent); color: var(--accent-contrast);
    display: grid; place-items: center; box-shadow: 0 4px 12px var(--accent-ring);
  }
  .cw-mobile-dock a.dock-write span:last-child { display: none; }

  .cw-footer { padding: 16px 14px calc(76px + env(safe-area-inset-bottom)); }
  .cw-footer-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
}


/* ==========================================================================
   Campus Wall v5.1 — 独立学校选择面板、可折叠话题、每日签到与个人中心安全区修复
   ========================================================================== */

/* 1. 独立学校选择底部抽屉选项 */
.cw-school-picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cw-school-opt {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.cw-school-opt:active { transform: scale(0.985); }
.cw-school-opt:hover { border-color: var(--accent); background: var(--bg-subtle); }
.cw-school-opt.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.cw-school-opt-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.cw-school-opt-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  display: block;
}
.cw-school-opt.is-selected .cw-school-opt-name { color: var(--accent); }
.cw-school-opt-sub { font-size: 12px; color: var(--text-sub); }
.cw-school-opt-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cw-school-opt-check {
  width: 18px; height: 18px; color: var(--accent); display: none;
}
.cw-school-opt.is-selected .cw-school-opt-check { display: block; }

/* 2. 可收起话题条 */
.cw-topic-strip {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cw-topic-chip.is-extra[hidden] { display: none !important; }
.cw-topic-toggle {
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 600;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.cw-topic-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* 3. 每日签到卡片（桌面右侧）与移动端紧凑签到条 */
.cw-checkin-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cw-checkin-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  font-size: 12.5px;
}
.cw-checkin-stats strong { font-size: 17px; color: var(--accent); }
.cw-mob-checkin-bar {
  display: none;
}
@media (max-width: 820px) {
  .cw-mob-checkin-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 13px;
    margin-bottom: 10px;
    border-radius: var(--r-md);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
  }
  .cw-mob-checkin-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .cw-mob-checkin-info strong { font-size: 13.5px; color: var(--text-main); }
  .cw-mob-checkin-info span { font-size: 11.5px; color: var(--text-sub); }
}

/* 4. 个人中心移动端安全区与防溢出彻底修复（杜绝 CSS Grid 子项撑破屏幕） */
.cw-center-wrap {
  max-width: 1120px;
  width: 100%;
  overflow-x: clip;
}
.cw-center-grid > *,
.cw-center-grid > aside,
.cw-center-grid > section,
.cw-center-grid .cw-rail-card {
  min-width: 0;
  max-width: 100%;
}
.cw-center-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.cw-center-head-ops {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cw-center-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 820px) {
  .cw-center-wrap {
    margin: 12px auto calc(86px + env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .cw-center-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .cw-center-grid > aside {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .cw-center-grid > aside .cw-rail-card {
    margin-bottom: 0;
    padding: 16px 14px !important;
  }
  .cw-center-grid > aside nav.cw-quick-links {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    gap: 7px;
    padding: 8px 10px !important;
    scrollbar-width: none;
  }
  .cw-center-grid > aside nav.cw-quick-links::-webkit-scrollbar { display: none; }
  .cw-center-grid > aside nav.cw-quick-links .cw-quick-link {
    flex: 0 0 auto;
    width: auto;
    padding: 7px 13px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border);
    white-space: nowrap;
  }
  .cw-center-grid > section.cw-rail-card {
    padding: 16px 14px !important;
    overflow-x: hidden;
  }
  .cw-center-two-col {
    grid-template-columns: minmax(0, 1fr);
  }
  .cw-center-head h1 { font-size: 19px; }
  .cw-center-head-ops { width: 100%; }
  .cw-center-head-ops .cw-btn,
  .cw-center-head-ops form { flex: 1; }
  .cw-center-head-ops form .cw-btn { width: 100%; }
}


/* ==========================================================================
   Campus Wall v5.2 — 个人中心移动端顶栏彻底防越界 + 精致签到卡 + 动效话题折叠卡
   ========================================================================== */

/* 1. 非首页（个人中心 / 主页 / 阅读页）移动端顶栏精简，杜绝 5 键顶栏撑爆屏幕 */
@media (max-width: 820px) {
  body:not(.page-plaza) .cw-header-inner {
    height: 54px;
    padding: 0 14px;
  }
  body:not(.page-plaza) .cw-header-nav {
    display: flex !important;
    gap: 4px;
    flex-shrink: 0;
  }
  body:not(.page-plaza) .cw-header-nav a[href*="search"],
  body:not(.page-plaza) .cw-header-nav a[href*="messages"],
  body:not(.page-plaza) .cw-header-nav a[href="account.php"] {
    display: none !important;
  }
  body:not(.page-plaza) .cw-header-nav .cw-nav-btn {
    padding: 0 10px;
    height: 34px;
    font-size: 13px;
  }
}

/* 2. 独立设计的动效话题折叠面板（grid-template-rows 弹簧手风琴） */
.cw-topic-shelf {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 13px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-xs);
}
.cw-topic-shelf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}
.cw-topic-shelf-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
}
.cw-topic-shelf-title svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}
.cw-topic-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-sub);
  font-size: 11.5px;
  font-weight: 600;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.cw-topic-expand-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.cw-topic-expand-btn svg {
  width: 13px;
  height: 13px;
  transition: transform var(--dur-base) var(--ease-spring);
}
.cw-topic-shelf.is-expanded .cw-topic-expand-btn svg {
  transform: rotate(180deg);
}
.cw-topic-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.cw-topic-extra-wrap {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows var(--dur-slow) var(--ease-spring), opacity var(--dur-base) ease, margin-top var(--dur-base) ease;
  margin-top: 0;
}
.cw-topic-shelf.is-expanded .cw-topic-extra-wrap {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 7px;
}
.cw-topic-extra-inner {
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.cw-topic-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  background: var(--bg-subtle);
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  transition: all var(--dur-fast) var(--ease-snappy);
}
.cw-topic-pill:hover {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 26%, transparent);
  color: var(--accent);
  transform: translateY(-1px);
}
.cw-topic-pill .t-hash {
  color: var(--accent);
  font-weight: 700;
}

/* 3. 精致化每日签到卡片与移动端签到条（签前/签后双态精美排版） */
.cw-checkin-widget {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  margin-bottom: 12px;
  transition: border-color var(--dur-base) ease, background-color var(--dur-base) ease;
}
.cw-checkin-widget.is-done {
  border-color: color-mix(in srgb, var(--success) 26%, var(--border));
  background: color-mix(in srgb, var(--success) 4%, var(--bg-surface));
}
.cw-checkin-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1;
}
.cw-checkin-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background-color var(--dur-base) ease, color var(--dur-base) ease, transform var(--dur-base) var(--ease-bounce);
}
.cw-checkin-widget.is-done .cw-checkin-icon {
  background: var(--success-soft);
  color: var(--success);
}
.cw-checkin-icon svg { width: 19px; height: 19px; }
.cw-checkin-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.cw-checkin-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}
.cw-checkin-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.cw-checkin-meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--bg-subtle);
  color: var(--text-sub);
  font-size: 11px;
  font-weight: 600;
}
.cw-checkin-meta-pill.is-rep {
  background: var(--accent-soft);
  color: var(--accent);
}
.cw-checkin-btn {
  flex-shrink: 0;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease-snappy);
}
.cw-checkin-btn:active { transform: scale(0.95); }
.cw-checkin-btn.is-done,
.cw-checkin-btn:disabled {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 25%, transparent);
  cursor: default;
  opacity: 1;
}
.cw-checkin-btn svg { width: 14px; height: 14px; }

/* 仅在移动端展示信息流顶部签到条，桌面端使用右侧栏签到卡 */
.cw-mob-only-checkin { display: none; }
@media (max-width: 820px) {
  .cw-mob-only-checkin { display: flex; }
}


/* v5.3 Mobile UX Polish */
@media (max-width: 820px) {
  .cw-act-btn { min-height: 36px; padding: 0 12px; font-size: 13px; }
  .cw-act-btn:active, .cw-cat-pill:active, .cw-topic-pill:active, .cw-mobile-dock a:active { transform: scale(0.95); }
  .cw-cat-strip, .cw-tool-row, .cw-modal-body { -webkit-overflow-scrolling: touch; }
  .cw-modal-overlay.cw-sheet-mobile .cw-modal-head { padding: 12px 16px; }
  .cw-modal-overlay.cw-sheet-mobile .cw-modal-body { padding: 14px 16px; }
  .cw-comment-composer { padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); }
  .cw-post-body { font-size: 15px; line-height: 1.72; }
  .cw-post-img { width: 100%; max-height: 380px; }
}


/* ==========================================================================
   Campus Wall v5.4 — 移动端精致紧凑比例与单行轻量互动栏调优
   ========================================================================== */
@media (max-width: 820px) {
  /* 1. 整体紧凑轻盈比例 */
  body { font-size: 13.5px; }
  .cw-header-inner { height: 48px; padding: 0 12px; }
  .cw-brand { font-size: 14.5px; gap: 8px; }
  .cw-brand-mark { width: 28px; height: 28px; border-radius: 8px; }
  .cw-brand-mark svg { width: 17px; height: 17px; }
  body.page-plaza .cw-mob-school-btn {
    height: 30px; padding: 0 10px 0 9px; font-size: 12px; gap: 5px;
  }

  /* 2. 顶部流切换、签到条、分区胶囊、话题折叠卡紧凑排版 */
  body.page-plaza .cw-plaza-grid {
    margin-top: 8px;
    padding: 0 10px calc(74px + env(safe-area-inset-bottom));
  }
  body.page-plaza .cw-feed-toolbar { margin-bottom: 8px; }
  body.page-plaza .cw-segment { padding: 2px; border-radius: 10px; }
  body.page-plaza .cw-segment-btn { padding: 5px 0; font-size: 12.5px; }

  .cw-checkin-widget {
    padding: 9px 11px; margin-bottom: 8px; border-radius: 12px; gap: 9px;
  }
  .cw-checkin-icon { width: 32px; height: 32px; border-radius: 9px; }
  .cw-checkin-icon svg { width: 16px; height: 16px; }
  .cw-checkin-title { font-size: 12.5px; }
  .cw-checkin-meta-pill { font-size: 10.5px; padding: 1px 6px; }
  .cw-checkin-btn { height: 28px; padding: 0 11px; font-size: 11.5px; }

  body.page-plaza .cw-cat-strip {
    margin: 0 -10px 6px; padding: 1px 10px 6px; gap: 6px;
  }
  .cw-cat-pill { height: 28px; padding: 0 11px; font-size: 12px; gap: 5px; }
  .cw-cat-dot { width: 6px; height: 6px; }

  .cw-topic-shelf { padding: 9px 11px; margin-bottom: 9px; border-radius: 12px; }
  .cw-topic-shelf-head { margin-bottom: 7px; }
  .cw-topic-shelf-title { font-size: 12px; }
  .cw-topic-expand-btn { height: 23px; padding: 0 8px; font-size: 11px; }
  .cw-topic-row, .cw-topic-extra-inner { gap: 5px; }
  .cw-topic-pill { height: 24px; padding: 0 9px; font-size: 11.5px; }

  /* 3. 帖子卡片精致比例与单行轻量互动按钮（零拥挤、不换行） */
  .cw-post-card {
    padding: 13px 13px 10px;
    margin-bottom: 9px;
    border-radius: 12px;
  }
  .cw-post-head { margin-bottom: 9px; gap: 8px; }
  .cw-post-author { gap: 8px; }
  .cw-post-card .avatar { width: 32px; height: 32px; font-size: 12px; }
  .cw-post-author-row { font-size: 13.5px; gap: 5px; }
  .cw-post-meta { font-size: 11px; gap: 5px; }
  .cw-post-cat-tag { font-size: 10.5px; padding: 1px 6px; }
  .cw-follow-btn { height: 25px; padding: 0 9px; font-size: 11.5px; }

  .cw-post-body { font-size: 14px; line-height: 1.65; }
  .cw-post-img { margin-top: 9px; max-height: 300px; border-radius: 10px; }
  .cw-post-notice { padding: 7px 10px; font-size: 11.5px; margin-top: 8px; }

  .cw-post-foot {
    margin-top: 10px;
    padding-top: 8px;
    gap: 4px;
    flex-wrap: nowrap;
  }
  .cw-act-group {
    gap: 4px;
    flex-wrap: nowrap;
    min-width: 0;
  }
  .cw-act-btn {
    min-height: 28px;
    height: 28px;
    padding: 0 8px;
    font-size: 11.5px;
    gap: 4px;
    border-color: transparent;
    background: var(--bg-subtle);
    white-space: nowrap;
  }
  .cw-act-btn svg { width: 13.5px; height: 13.5px; }
  .cw-act-btn[data-action="report"] {
    width: 28px;
    padding: 0;
    justify-content: center;
    background: transparent;
    color: var(--text-muted);
    flex-shrink: 0;
  }

  /* 4. 移动端底部 Dock 精致比例 */
  .cw-mobile-dock {
    padding: 4px 6px calc(5px + env(safe-area-inset-bottom));
  }
  .cw-mobile-dock a { font-size: 10px; padding: 3px 0; gap: 2px; }
  .cw-mobile-dock svg { width: 18px; height: 18px; }
  .cw-mobile-dock a.dock-write .dock-write-pill {
    width: 40px; height: 30px;
  }
}


/* v6.0 评论署名/匿名切换条与署名作者展示 */
.cw-cmt-id-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.cw-cmt-id-seg { padding: 2px; }
.cw-cmt-id-seg .cw-segment-btn { padding: 4px 10px; font-size: 12px; }
.cw-cmt-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cw-cmt-author .avatar.xs {
  width: 22px;
  height: 22px;
  font-size: 10px;
}


/* ==========================================================================
   Campus Wall v6.1 — 评论头像球身份切换、评论图片与移动端紧凑评论界面
   ========================================================================== */
.cw-cmt-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
}
.cw-id-orb {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  position: relative;
  transition: transform var(--dur-fast) var(--ease-bounce), border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.cw-id-orb:active { transform: scale(0.88); }
.cw-id-orb img { width: 100%; height: 100%; object-fit: cover; }
.cw-id-orb.is-anon {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-sub);
}
.cw-id-orb svg { width: 17px; height: 17px; }

.cw-cmt-img-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-sub);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.cw-cmt-img-btn:hover { color: var(--accent); border-color: var(--accent); }
.cw-cmt-img-btn svg { width: 17px; height: 17px; }
.cw-cmt-input { flex: 1; min-width: 0; height: 36px !important; padding: 0 11px !important; }
.cw-cmt-send { height: 36px; padding: 0 13px; font-size: 13px; flex-shrink: 0; }

.cw-mini-img-preview {
  position: relative;
  width: fit-content;
  margin-bottom: 4px;
}
.cw-mini-img-preview img {
  height: 62px;
  width: auto;
  max-width: 140px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-strong);
}
.cw-mini-img-preview button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

.cw-cmt-img {
  margin-top: 7px;
  max-height: 180px;
  max-width: 220px;
  border-radius: 8px;
  object-fit: cover;
  cursor: zoom-in;
  border: 1px solid var(--border);
}

/* 移动端评论界面整体比例缩小，换取更大可读区域 */
@media (max-width: 820px) {
  #commentsModal .cw-modal-panel {
    max-height: 90dvh;
  }
  #commentsModal .cw-modal-head {
    padding: 9px 14px;
  }
  #commentsModal .cw-modal-head h3 {
    font-size: 14.5px;
  }
  #commentsModal .cw-icon-close {
    width: 28px;
    height: 28px;
  }
  #commentsModal .cw-modal-body {
    padding: 10px 12px;
    gap: 7px;
  }
  #commentsModal .cw-cmt-item {
    padding: 9px 10px;
    border-radius: 10px;
  }
  #commentsModal .cw-cmt-head {
    font-size: 11px;
    margin-bottom: 3px;
  }
  #commentsModal .cw-cmt-body {
    font-size: 13px;
    line-height: 1.52;
  }
  #commentsModal .cw-cmt-ops {
    margin-top: 5px;
    gap: 10px;
    font-size: 11px;
  }
  #commentsModal .cw-cmt-children {
    margin-top: 6px;
    padding-left: 8px;
    gap: 5px;
  }
  #commentsModal .cw-cmt-img {
    max-height: 140px;
    max-width: 180px;
  }
  #commentsModal .cw-comment-composer {
    padding: 7px 10px calc(8px + env(safe-area-inset-bottom));
    gap: 5px;
  }
  .cw-id-orb, .cw-cmt-img-btn {
    width: 32px;
    height: 32px;
  }
  .cw-cmt-input { height: 34px !important; font-size: 14px !important; }
  .cw-cmt-send { height: 34px; padding: 0 11px; font-size: 12.5px; }
}
