/* TASK 1: 科创广场共用 Header 与社区首页。所有规则均限定于专属 class 或 forum View。 */

#main-topbar.plaza-redesign-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  max-width: 1520px;
  min-height: 68px;
  margin: 0 auto;
  padding: 0 clamp(16px, 1.8vw, 28px);
  gap: 20px;
  border: 0;
  border-bottom: 1px solid rgba(218, 224, 237, 0.9);
  border-radius: 0;
  background: rgba(250, 251, 254, 0.92);
  box-shadow: none;
  backdrop-filter: blur(18px) saturate(1.1);
}

#main-topbar.plaza-redesign-topbar .brand { min-width: max-content; }
#main-topbar.plaza-redesign-topbar .brand-mark { width: 34px; height: 34px; border-radius: 10px; box-shadow: none; }
#main-topbar.plaza-redesign-topbar .plaza-channels { min-width: 0; }
#main-topbar.plaza-redesign-topbar .plaza-channels-list {
  height: 68px;
  gap: clamp(3px, 0.6vw, 11px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
#main-topbar.plaza-redesign-topbar .plaza-channel {
  position: relative;
  min-height: 68px;
  padding: 0 clamp(8px, 0.9vw, 13px);
  border-radius: 0;
  color: #667085;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  font-weight: 650;
}
#main-topbar.plaza-redesign-topbar .plaza-channel:hover { color: #273252; background: transparent; }
#main-topbar.plaza-redesign-topbar .plaza-channel.active { color: #5158df; background: transparent; box-shadow: none; }
#main-topbar.plaza-redesign-topbar .plaza-channel.active::after {
  display: block;
  right: 11px;
  bottom: 0;
  left: 11px;
  width: auto;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(90deg, #5b64f2, #7a62ee);
}
#main-topbar.plaza-redesign-topbar .plaza-channel-icon,
#main-topbar.plaza-redesign-topbar .plaza-channel-icon svg { width: 17px; height: 17px; }
#main-topbar.plaza-redesign-topbar .plaza-channel-count { color: #a1a8ba; font-size: 11px; }
#main-topbar.plaza-redesign-topbar .top-actions { gap: 8px; margin-left: auto; }
#main-topbar.plaza-redesign-topbar .plaza-top-publish {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #5963ed, #705ae5);
  box-shadow: 0 5px 14px rgba(83, 92, 225, 0.17);
  font-size: 13px;
  font-weight: 700;
}
#main-topbar.plaza-redesign-topbar .plaza-top-publish:hover { filter: brightness(1.04); transform: translateY(-1px); }
#main-topbar.plaza-redesign-topbar .role-switch-btn,
#main-topbar.plaza-redesign-topbar .account-btn,
#main-topbar.plaza-redesign-topbar .points-chip { min-height: 36px; border-radius: 9px; box-shadow: none; }

/* 覆盖早期广场视觉层中更高特异度的悬浮导航规则；只命中科创广场域 View。 */
body:has(:is(#view-plaza.active, #view-forum.active, #view-project-detail.active, #view-idea-detail.active, #view-forum-post.active, #view-maker-profile.active, #view-publish-project.active, #view-publish-idea.active)) #main-topbar.plaza-redesign-topbar {
  top: 0;
  min-height: 68px;
  margin: 0 auto;
  padding: 0 clamp(16px, 1.8vw, 28px);
  border: 0;
  border-bottom: 1px solid rgba(218, 224, 237, 0.9);
  border-radius: 0;
  background: rgba(250, 251, 254, 0.92);
  box-shadow: none;
}
body:has(:is(#view-plaza.active, #view-forum.active, #view-project-detail.active, #view-idea-detail.active, #view-forum-post.active, #view-maker-profile.active, #view-publish-project.active, #view-publish-idea.active)) #main-topbar.plaza-redesign-topbar .plaza-channels-list {
  height: 68px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
body:has(:is(#view-plaza.active, #view-forum.active, #view-project-detail.active, #view-idea-detail.active, #view-forum-post.active, #view-maker-profile.active, #view-publish-project.active, #view-publish-idea.active)) #main-topbar.plaza-redesign-topbar .plaza-channel {
  min-height: 68px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body:has(:is(#view-plaza.active, #view-forum.active, #view-project-detail.active, #view-idea-detail.active, #view-forum-post.active, #view-maker-profile.active, #view-publish-project.active, #view-publish-idea.active)) #main-topbar.plaza-redesign-topbar .plaza-channel.active {
  color: #5158df;
  background: transparent;
  box-shadow: none;
}
body:has(:is(#view-plaza.active, #view-forum.active, #view-project-detail.active, #view-idea-detail.active, #view-forum-post.active, #view-maker-profile.active, #view-publish-project.active, #view-publish-idea.active)) #main-topbar.plaza-redesign-topbar .plaza-channel.active::after { display: block; }

#view-forum.plaza-forum {
  width: min(100%, 1520px);
  margin: 0 auto;
  padding: 26px clamp(16px, 1.8vw, 28px) 48px;
  color: #1e293b;
}
#view-forum .plaza-forum-layout {
  display: grid;
  grid-template-columns: minmax(180px, 204px) minmax(0, 820px) minmax(270px, 300px);
  justify-content: center;
  gap: 0;
  align-items: start;
}
#view-forum .plaza-forum-sidebar,
#view-forum .plaza-forum-feed,
#view-forum .plaza-forum-rail { min-width: 0; }
#view-forum .plaza-forum-sidebar {
  position: sticky;
  top: 88px;
  margin: 0;
  padding: 4px 26px 18px 0;
  border: 0;
  border-right: 1px solid #e8ebf2;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#view-forum .plaza-forum-sidebar-title { margin: 0 0 14px; color: #1f2937; font-size: 18px; font-weight: 760; letter-spacing: -0.02em; }
#view-forum .plaza-forum-sidebar .board-list { gap: 3px; }
#view-forum .plaza-forum-sidebar .board-item { min-height: 38px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; }
#view-forum .plaza-forum-sidebar .board-item b { margin: 0; color: #667085; font-size: 14px; font-weight: 600; }
#view-forum .plaza-forum-sidebar .board-item small { display: none; }
#view-forum .plaza-forum-sidebar .board-item:hover { background: #f3f5fa; }
#view-forum .plaza-forum-sidebar .board-item.active { border: 0; background: #eef0ff; }
#view-forum .plaza-forum-sidebar .board-item.active b { color: #5158dd; font-weight: 700; }

#view-forum .plaza-forum-feed { padding: 0 clamp(24px, 2.2vw, 34px); border-right: 1px solid #e8ebf2; }
#view-forum .plaza-forum-feed .forum-filters {
  margin: 0;
  padding: 0 0 13px;
  border: 0;
  border-bottom: 1px solid #e7eaf1;
  border-radius: 0;
  background: transparent;
}
#view-forum .plaza-forum-feed .forum-filters .filter-row { min-height: 38px; margin: 0; }
#view-forum .plaza-forum-feed .forum-filters .tabs { gap: 18px; }
#view-forum .plaza-forum-feed .forum-filters .tab { min-height: 36px; padding: 0; border: 0; border-radius: 0; color: #7a8498; background: transparent; font-size: 14px; font-weight: 650; }
#view-forum .plaza-forum-feed .forum-filters .tab.active { position: relative; border: 0; color: #4f57db; background: transparent; box-shadow: none; }
#view-forum .plaza-forum-feed .forum-filters .tab.active::after { position: absolute; right: 0; bottom: -14px; left: 0; height: 2px; border-radius: 2px; background: #5962eb; content: ''; }
#view-forum .plaza-forum-feed .filter-row-right { gap: 8px; }
#view-forum .plaza-forum-feed .filter-toggle { min-height: 32px; padding: 0 7px; border: 0; border-radius: 7px; background: transparent; }
#view-forum .plaza-forum-feed .search-box input { width: 150px; height: 34px; padding: 0 11px; border: 1px solid #e1e5ed; border-radius: 8px; background: #fff; }
#view-forum .plaza-forum-filter-summary { display: flex; justify-content: space-between; align-items: center; margin-top: 11px; color: #98a1b2; font-size: 12px; }
#view-forum .plaza-forum-filter-summary .linkish { color: #737ce0; font-size: 12px; }
#view-forum .plaza-forum-feed .filter-advanced { margin-top: 12px; border: 1px solid #e9ecf3; border-radius: 10px; background: #fafbfe; box-shadow: none; }

#view-forum .plaza-forum-compose {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 70px;
  margin: 0;
  padding: 17px 0;
  gap: 12px;
  border-bottom: 1px solid #e7eaf1;
  color: #8c95a8;
  background: transparent;
  text-align: left;
}
#view-forum .plaza-forum-compose-avatar { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(135deg, #6670ee, #7c65e9); font-size: 17px; font-weight: 500; }
#view-forum .plaza-forum-compose > span:not(.plaza-forum-compose-avatar) { font-size: 14px; }
#view-forum .plaza-forum-compose b { color: #5861df; font-size: 13px; }
#view-forum .plaza-forum-compose:hover > span:not(.plaza-forum-compose-avatar) { color: #5c6679; }

#view-forum .post-list { display: block; margin: 0; }
#view-forum .post-card {
  min-height: 0;
  padding: 24px 0 25px;
  border: 0;
  border-bottom: 1px solid #e7eaf1;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  text-align: left;
  transition: background-color 160ms ease;
}
#view-forum .post-card:hover { transform: none; border-color: #e1e5ef; background: rgba(248, 249, 253, 0.58); box-shadow: none; }
#view-forum .plaza-forum-post-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
#view-forum .plaza-forum-post-head .p-avatar { width: 32px; height: 32px; flex: 0 0 32px; font-size: 12px; }
#view-forum .plaza-forum-post-author { min-width: 0; }
#view-forum .plaza-forum-post-author b { display: block; overflow: hidden; color: #35405a; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
#view-forum .plaza-forum-post-author span { display: block; margin-top: 1px; color: #98a1b1; font-size: 11px; }
#view-forum .post-card-top { display: flex; gap: 5px; margin: 0 0 0 auto; }
#view-forum .post-card .badge { padding: 2px 6px; border-radius: 5px; font-size: 10px; }
#view-forum .post-card h3 { margin: 0 0 8px; color: #1d273b; font-family: var(--font) !important; font-size: 17px; font-weight: 720; line-height: 1.5; letter-spacing: 0; }
#view-forum .post-card-excerpt { display: -webkit-box; overflow: hidden; margin: 0 0 10px; color: #5f6a7e; font-size: 14px; line-height: 1.72; -webkit-box-orient: vertical; -webkit-line-clamp: 5; line-clamp: 5; }
#view-forum .post-card-relation { margin: 0 0 11px; }
#view-forum .post-card-entity { display: inline-flex; max-width: 100%; overflow: hidden; padding: 5px 8px; border: 1px solid #e4e7fa; border-radius: 7px; color: #5c65ca; background: #f7f8ff; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
#view-forum .post-card-meta { display: flex; align-items: center; gap: 7px 13px; color: #8f98aa; font-size: 12px; }
#view-forum .post-card-meta .tags { gap: 4px; margin: 0; }
#view-forum .post-card-meta .tags i { padding: 2px 6px; border-radius: 5px; color: #6872c8; background: #f1f3ff; font-size: 10px; font-style: normal; }
#view-forum .post-card-full { margin-left: auto; color: #5a63dc; font-size: 12px; font-weight: 650; }

#view-forum .plaza-forum-rail { padding: 3px 0 0 clamp(22px, 2vw, 30px); }
#view-forum .plaza-forum-rail-section { padding: 0; }
#view-forum .plaza-forum-rail-heading { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 10px; }
#view-forum .plaza-forum-rail-heading h2 { margin: 0; color: #253048; font-size: 15px; font-weight: 750; }
#view-forum .plaza-forum-rail-heading span { color: #9ca5b5; font-size: 11px; }
#view-forum .plaza-forum-hot-list { display: grid; }
#view-forum .plaza-forum-hot-item { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: baseline; gap: 7px; min-height: 43px; padding: 8px 0; border-bottom: 1px solid #eceef4; text-align: left; }
#view-forum .plaza-forum-hot-item > span { color: #828cea; font-size: 12px; font-weight: 750; }
#view-forum .plaza-forum-hot-item b { overflow: hidden; color: #59647a; font-size: 12px; font-weight: 600; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
#view-forum .plaza-forum-hot-item small { color: #a1a8b6; font-size: 10px; }
#view-forum .plaza-forum-hot-item:hover b { color: #525bdd; }

/* 当前 API 未提供图片字段；以下只为未来已有图片数据时保留自然比例显示，不产生占位。 */
#view-forum .post-card-media { display: flex; margin: 2px 0 12px; }
#view-forum .post-card-media img { width: auto; max-width: min(100%, 620px); max-height: 440px; border-radius: 8px; object-fit: contain; }
#view-forum .post-card-media img[data-orientation="portrait"] { max-width: min(58%, 330px); }

/* TASK 1.1: precise visual refinement. The outer bar is deliberately full bleed;
   only its dedicated inner row is constrained to the plaza content width. */
body:has(:is(#view-plaza.active, #view-forum.active, #view-project-detail.active, #view-idea-detail.active, #view-forum-post.active, #view-maker-profile.active, #view-publish-project.active, #view-publish-idea.active)) #main-topbar.plaza-redesign-topbar {
  display: block;
  width: 100vw;
  max-width: none;
  min-height: 68px;
  margin: 0 0 0 calc(50% - 50vw);
  padding: 0;
  background: #fff;
  border-bottom-color: #e6e8ee;
  backdrop-filter: none;
}
body:has(:is(#view-plaza.active, #view-forum.active, #view-project-detail.active, #view-idea-detail.active, #view-forum-post.active, #view-maker-profile.active, #view-publish-project.active, #view-publish-idea.active)) #main-topbar.plaza-redesign-topbar[hidden] { display: none; }
body:has(:is(#view-plaza.active, #view-forum.active, #view-project-detail.active, #view-idea-detail.active, #view-forum-post.active, #view-maker-profile.active, #view-publish-project.active, #view-publish-idea.active)) #main-topbar.plaza-redesign-topbar .plaza-redesign-topbar-inner {
  display: flex;
  align-items: center;
  width: min(calc(100% - 48px), 1520px);
  min-height: 68px;
  margin: 0 auto;
  gap: 20px;
}
body:has(:is(#view-plaza.active, #view-forum.active, #view-project-detail.active, #view-idea-detail.active, #view-forum-post.active, #view-maker-profile.active, #view-publish-project.active, #view-publish-idea.active)) #main-topbar.plaza-redesign-topbar .plaza-channel-icon,
body:has(:is(#view-plaza.active, #view-forum.active, #view-project-detail.active, #view-idea-detail.active, #view-forum-post.active, #view-maker-profile.active, #view-publish-project.active, #view-publish-idea.active)) #main-topbar.plaza-redesign-topbar .plaza-channel-count { display: none; }
body:has(:is(#view-plaza.active, #view-forum.active, #view-project-detail.active, #view-idea-detail.active, #view-forum-post.active, #view-maker-profile.active, #view-publish-project.active, #view-publish-idea.active)) #main-topbar.plaza-redesign-topbar .plaza-channel { padding-inline: 12px; color: #596376; font-weight: 620; }
body:has(:is(#view-plaza.active, #view-forum.active, #view-project-detail.active, #view-idea-detail.active, #view-forum-post.active, #view-maker-profile.active, #view-publish-project.active, #view-publish-idea.active)) #main-topbar.plaza-redesign-topbar .role-switch-btn,
body:has(:is(#view-plaza.active, #view-forum.active, #view-project-detail.active, #view-idea-detail.active, #view-forum-post.active, #view-maker-profile.active, #view-publish-project.active, #view-publish-idea.active)) #main-topbar.plaza-redesign-topbar .account-btn {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #485266;
}
body:has(:is(#view-plaza.active, #view-forum.active, #view-project-detail.active, #view-idea-detail.active, #view-forum-post.active, #view-maker-profile.active, #view-publish-project.active, #view-publish-idea.active)) #main-topbar.plaza-redesign-topbar .role-switch-kicker { color: #8b94a6; }
body:has(#view-forum.active),
body:has(#view-forum.active) #app,
body:has(#view-forum.active) #view-forum { background: #fff; }
body:has(#view-forum.active) #app > .bg { display: none; }

#view-forum .plaza-forum-sidebar .board-item { position: relative; padding-left: 12px; }
#view-forum .plaza-forum-sidebar .board-item:hover { background: #f8f9fc; }
#view-forum .plaza-forum-sidebar .board-item.active { background: transparent; }
#view-forum .plaza-forum-sidebar .board-item.active::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #5962e9;
  content: '';
}
#view-forum .plaza-forum-sidebar .board-item.active b { color: #1f2937; }

#view-forum .plaza-forum-post-head { gap: 10px; margin-bottom: 11px; }
#view-forum .plaza-forum-post-head .p-avatar { width: 38px; height: 38px; flex-basis: 38px; font-size: 14px; }
#view-forum .plaza-forum-post-author b { color: #273247; font-size: 14px; font-weight: 720; }
#view-forum .plaza-forum-post-author span { margin-top: 2px; color: #9099a8; font-size: 12px; }
#view-forum .post-card .badge { color: #7b8494; background: #f6f7f9; }
#view-forum .post-card-type { display: inline-block; margin: 0 0 6px; color: #626cf0; font-size: 12px; font-weight: 700; }
#view-forum .post-card--regular h3 { margin-bottom: 7px; color: #2b3547; font-size: 15px; font-weight: 620; line-height: 1.55; }
#view-forum .post-card--emphasis h3 { margin-bottom: 8px; font-size: 17px; font-weight: 720; }
#view-forum .post-card-excerpt { margin-bottom: 10px; color: #596478; font-size: 14px; line-height: 1.72; }
#view-forum .post-card-media { margin: 4px 0 13px; }
#view-forum .post-card-media img { display: block; max-width: min(100%, 640px); max-height: 420px; border-radius: 8px; }
#view-forum .post-card-media img[data-orientation="portrait"] { max-width: min(56%, 308px); max-height: 410px; }
#view-forum .post-card-full[hidden] { display: none; }

/* Tieba-like reading flow: the browser owns the far-right scrollbar; cards never form an inner scroller. */
#view-forum.plaza-forum {
  margin-left: 0;
  margin-right: auto;
  padding-top: 10px;
}
#view-forum .plaza-forum-layout {
  justify-content: start;
}
#view-forum .plaza-forum-sidebar {
  top: 84px;
  padding-top: 0;
}
#view-forum .post-card--regular h3,
#view-forum .post-card--emphasis h3,
#view-forum .post-card > .post-card-excerpt { font-size: 17px; }
#view-forum .post-card > .post-card-excerpt { font-weight: 500; line-height: 1.68; }

/* In the community reading view, navigation and both rails remain anchored while the document Feed moves. */
body:has(#view-forum.active) #main-topbar.plaza-redesign-topbar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  margin-left: 0;
}
body:has(#view-forum.active) #app {
  overflow-x: clip;
  overflow-y: visible;
}
body:has(#view-forum.active) #view-forum.plaza-forum { margin-top: 68px; }
#view-forum .plaza-forum-sidebar,
#view-forum .plaza-forum-rail {
  position: sticky;
  top: 84px;
  align-self: start;
}

/* Feed body and its three compact, data-backed actions. */
#view-forum .post-card > .post-card-excerpt {
  color: #172033;
  font-family: "Songti SC", "STSong", "SimSun", serif !important;
  font-weight: 500;
}
#view-forum .post-card-meta { gap: 6px 26px; }
#view-forum .post-card-meta .tags { display: none; }
#view-forum .post-card-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #586273;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
}
#view-forum .post-card-action > span:first-child { color: #3f495b; font-size: 15px; line-height: 1; }
#view-forum .post-card-action b { color: #394355; font-weight: 600; }
#view-forum .post-card-action:hover { color: #565fe0; }
#view-forum .post-card-action:hover > span:first-child,
#view-forum .post-card-action:hover b { color: #565fe0; }

/* The count stays as a JS hook only; reset is available inside the expanded filter sheet. */
#view-forum #forum-result-count[hidden],
#view-forum .plaza-forum-compose[hidden] { display: none; }
#view-forum .plaza-forum-filter-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e7eaf1;
}
#view-forum .plaza-forum-filter-actions .linkish {
  padding: 0;
  color: #5a63dc;
  background: transparent;
  font-size: 12px;
  font-weight: 650;
}

@media (max-width: 1180px) {
  #main-topbar.plaza-redesign-topbar { gap: 12px; }
  #main-topbar.plaza-redesign-topbar .plaza-channel { padding-inline: 7px; }
  #view-forum .plaza-forum-layout { grid-template-columns: 180px minmax(0, 1fr) 250px; }
  #view-forum .plaza-forum-feed { padding-inline: 22px; }
  #view-forum .plaza-forum-rail { padding-left: 20px; }
}
@media (max-width: 940px) {
  #view-forum .plaza-forum-layout { grid-template-columns: 168px minmax(0, 1fr); }
  #view-forum .plaza-forum-rail { display: none; }
}
@media (max-width: 720px) {
  #main-topbar.plaza-redesign-topbar { min-height: 58px; padding-inline: 12px; }
  #main-topbar.plaza-redesign-topbar .plaza-channels-list,
  #main-topbar.plaza-redesign-topbar .plaza-channel { min-height: 58px; }
  #main-topbar.plaza-redesign-topbar .plaza-channel-icon,
  #main-topbar.plaza-redesign-topbar .plaza-channel-count,
  #main-topbar.plaza-redesign-topbar .plaza-top-publish { display: none; }
  #view-forum.plaza-forum { padding: 18px 14px 32px; }
  #view-forum .plaza-forum-layout { display: block; }
  #view-forum .plaza-forum-sidebar { position: static; padding: 0 0 14px; border: 0; }
  #view-forum .plaza-forum-sidebar-title { display: none; }
  #view-forum .plaza-forum-sidebar .board-list { display: flex; overflow-x: auto; gap: 5px; }
  #view-forum .plaza-forum-sidebar .board-item { flex: 0 0 auto; border: 1px solid #e8ebf2; }
  #view-forum .plaza-forum-feed { padding: 0; border: 0; }
  #view-forum .plaza-forum-feed .forum-filters .filter-row { align-items: flex-start; flex-wrap: wrap; }
  #view-forum .plaza-forum-feed .filter-row-right { width: 100%; justify-content: space-between; }
  #view-forum .plaza-forum-feed .search-box input { width: min(100%, 220px); }
}
