/* 社区 */
.bbs-view {
  gap: var(--space-md);
}

.community-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: 0 0 var(--space-md);
}

.community-tab {
  min-height: 40px;
  padding: 10px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

.community-tab.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
}

.qa-shell,
.bbs-shell {
  margin: 0;
  display: grid;
  gap: var(--space-md);
}

.bbs-board-shell,
.bbs-thread-shell {
  display: grid;
  gap: var(--space-md);
}

.bbs-board-head,
.bbs-thread-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.bbs-board-head {
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
}

.bbs-board-head > div {
  min-width: 0;
  flex: 1 1 auto;
}

.bbs-board-head h2,
.bbs-thread-detail h2 {
  margin: 0 0 var(--space-xs);
}

.bbs-board-head p:last-child,
.bbs-thread-detail .bbs-thread-content {
  margin: 0;
}

.bbs-thread-list {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 6px 16px 10px;
}

.bbs-post-item {
  display: grid;
  gap: var(--space-sm);
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.bbs-post-item .bbs-post-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-sm);
}

.bbs-answer-author {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin-right: auto;
}

.bbs-answer-author time {
  color: var(--muted);
  font-size: 12px;
}

.bbs-answer-author time::before {
  content: "·";
  margin-right: 7px;
}

.bbs-post-item .bbs-post-content {
  margin: 0;
  color: var(--text);
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bbs-post-item .bbs-topic-actions {
  justify-content: flex-start;
  gap: var(--space-sm);
  padding-top: var(--space-xs);
  margin-top: 0;
  border-top: 0;
}

.bbs-post-list .bbs-post-item + .bbs-post-item {
  margin-top: 0;
}

.my-privacy-form {
  display: grid;
  gap: 14px;
  max-width: 520px;
}

.my-privacy-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.profile-activity {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.profile-activity-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.profile-activity-item {
  display: grid;
  gap: 4px;
}

.profile-activity-type {
  font-size: 0.85rem;
  color: var(--muted);
}

.bbs-post-item.is-accepted {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.bbs-header,
.bbs-detail,
.bbs-replies,
.bbs-empty {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.bbs-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.bbs-header h2,
.bbs-detail-head h2,
.bbs-replies-head h3,
.bbs-composer-panel h2 {
  margin: 0 0 var(--space-xs);
}

.bbs-header p:last-child {
  margin: 8px 0 0;
}

.bbs-board-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.bbs-board-tabs a,
.bbs-sort button {
  flex: 0 0 auto;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.bbs-board-tabs a:hover,
.bbs-board-tabs a.active,
.bbs-sort button:hover,
.bbs-sort button.active {
  border-color: var(--accent);
  background: var(--surface-soft);
  color: var(--accent-strong);
}

.bbs-toolbar,
.bbs-replies-head,
.bbs-post-head,
.bbs-form-actions,
.bbs-compose-actions,
.bbs-topic-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bbs-toolbar {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.bbs-sort {
  display: flex;
  gap: 6px;
}

.bbs-sort button {
  min-height: 34px;
  padding-inline: 12px;
}

.bbs-thread-list {
  border-top: 1px solid var(--line);
}

.bbs-thread-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-md);
  align-items: center;
  padding: 18px 8px;
  border-bottom: 1px solid var(--line);
}

.bbs-thread-main {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.bbs-thread-title {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.45;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.bbs-thread-title:hover {
  color: var(--accent-strong);
}

.bbs-thread-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.community-primary-actions,
.community-item-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.community-item-heading .bbs-thread-title {
  min-width: 0;
}

.bbs-badge.bounty,
.bbs-badge.asking,
.bbs-badge.accepted {
  background: rgba(128, 91, 26, 0.12);
  color: #7d5818;
}

.bbs-badge.accepted {
  background: rgba(43, 126, 85, 0.14);
  color: #236b47;
}

.bbs-compose-page {
  max-width: 760px;
  margin: 0 auto;
}

.bbs-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.bbs-badge.pinned {
  color: #8a5a00;
  background: #fff4d6;
}

.bbs-badge.highlighted {
  color: var(--accent-strong);
  background: #e4f0ed;
}

.bbs-badge.locked {
  color: #7a1f1f;
  background: #ffe8e8;
}

.bbs-thread-item.is-pinned {
  background: linear-gradient(90deg, rgba(255, 244, 214, 0.45), transparent 180px);
}

.bbs-text-blocked {
  color: var(--muted);
  font-style: italic;
}

.bbs-thread-content.bbs-text-blocked {
  padding: 14px 0 0;
}

.bbs-board-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.bbs-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 12px;
}

.bbs-author {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.bbs-author:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.bbs-mentioned-user {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.bbs-mentioned-user:hover {
  text-decoration: underline;
}

.bbs-avatar {
  width: 26px;
  height: 26px;
}

.bbs-avatar-large {
  width: 34px;
  height: 34px;
}

.bbs-thread-stats {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.bbs-thread-stats span {
  display: grid;
  gap: 2px;
}

.bbs-thread-stats strong {
  color: var(--text);
  font-size: 15px;
}

.guide-more,
.bbs-more {
  margin-top: var(--space-md);
}

.bbs-more,
.bbs-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.bbs-status {
  margin: 20px 0;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  text-align: center;
}

.bbs-empty {
  text-align: center;
}

.bbs-back {
  display: inline-flex;
  margin-bottom: var(--space-md);
  text-decoration: none;
}

.bbs-detail-head {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.bbs-detail-head h2 {
  margin-bottom: 14px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.bbs-text {
  color: var(--text);
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bbs-rich-text {
  white-space: normal;
}

.bbs-rich-text :is(div, p, h2, h3, h4, ul, ol, li, span, a, b, strong, em, i, u, s, del, font, caption) {
  background: transparent;
}

.bbs-rich-text > :first-child {
  margin-top: 0;
}

.bbs-rich-text > :last-child {
  margin-bottom: 0;
}

.bbs-rich-text p,
.bbs-rich-text ul,
.bbs-rich-text ol,
.bbs-rich-text blockquote {
  margin: 0 0 14px;
}

.bbs-rich-text h2,
.bbs-rich-text h3 {
  margin: 22px 0 10px;
  line-height: 1.35;
}

.bbs-rich-text h2 {
  font-size: 1.35em;
}

.bbs-rich-text h3 {
  font-size: 1.16em;
}

.bbs-rich-text blockquote {
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: var(--muted);
}

.bbs-rich-text code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--accent-strong);
  font-size: 0.92em;
}

.bbs-rich-text hr {
  margin: 22px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.bbs-thread-content {
  padding: 24px 0;
  font-size: 16px;
}

.bbs-topic-actions {
  justify-content: flex-end;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  margin-top: var(--space-sm);
  border-top: 1px solid var(--line);
}

.bbs-replies {
  margin-top: var(--space-md);
}

.bbs-replies-head {
  margin-bottom: var(--space-md);
}

.bbs-replies-head span,
.bbs-action-status,
.bbs-form-message {
  color: var(--muted);
  font-size: 12px;
}

.bbs-post-list {
  display: grid;
  gap: 14px;
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
}

.bbs-post {
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.bbs-post.is-child {
  margin-left: 34px;
  border-left: 3px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  background: var(--surface-soft);
}

.bbs-post-floor {
  color: var(--muted);
  font-size: 12px;
}

.bbs-post .bbs-text {
  margin-top: var(--space-sm);
}

.bbs-post-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.bbs-post-actions .text-button,
.bbs-topic-actions .text-button {
  height: 32px;
  font-size: 12px;
}

.bbs-reply-form,
.bbs-write-gate {
  margin: var(--space-md) 0 0;
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.bbs-reply-form label,
.bbs-composer-form label,
.bbs-compose-form label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.bbs-reply-form textarea,
.bbs-composer-form input,
.bbs-composer-form textarea,
.bbs-compose-form input,
.bbs-compose-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
  line-height: 1.65;
  resize: vertical;
}

.bbs-composer-form input,
.bbs-compose-form input {
  min-height: 44px;
}

.bbs-reply-form textarea:focus,
.bbs-composer-form input:focus,
.bbs-composer-form textarea:focus,
.bbs-compose-form input:focus,
.bbs-compose-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.12);
}

.bbs-form-actions,
.bbs-compose-actions {
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.bbs-compose-actions > :is(a, button) {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.bbs-compose-actions > a {
  text-decoration: none;
}

.platform-more-link {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.bbs-reply-form .guide-comment-mention {
  margin-top: 10px;
}

.bbs-form-message {
  flex: 1 1 auto;
  color: var(--red);
}

.bbs-write-gate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.bbs-write-gate p {
  margin: 0;
}

body.bbs-dialog-open {
  overflow: hidden;
}

.bbs-composer-dialog {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 22, 20, 0.54);
  backdrop-filter: blur(4px);
}

.bbs-composer-panel {
  position: relative;
  width: min(820px, 100%);
  max-height: min(92vh, 860px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 22, 20, 0.24);
}

.bbs-composer-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.bbs-visual-editor-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.bbs-visual-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  min-height: 48px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: #f7faf8;
}

.bbs-visual-toolbar button,
.bbs-visual-toolbar select {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.bbs-visual-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  cursor: pointer;
}

.bbs-visual-toolbar button:hover,
.bbs-visual-toolbar button:focus-visible {
  border-color: var(--line);
  background: var(--surface);
  color: var(--accent-strong);
}

.bbs-visual-toolbar select {
  width: auto;
  padding: 0 28px 0 8px;
}

.bbs-toolbar-divider {
  flex: 0 0 1px;
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: var(--line);
}

.bbs-visual-editor {
  min-height: 390px;
  max-height: 56vh;
  overflow-y: auto;
  padding: 24px 28px;
  outline: none;
  color: var(--text);
  font-size: 16px;
  line-height: 1.8;
}

.bbs-visual-editor:focus {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.bbs-visual-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.bbs-visual-editor p {
  margin: 0 0 14px;
}

.bbs-visual-editor h2,
.bbs-visual-editor h3 {
  margin: 24px 0 12px;
  line-height: 1.35;
}

.bbs-visual-editor h2 {
  font-size: 23px;
}

.bbs-visual-editor h3 {
  font-size: 19px;
}

.bbs-visual-editor ul,
.bbs-visual-editor ol {
  margin: 0 0 16px;
  padding-left: 26px;
}

.bbs-visual-editor blockquote {
  margin: 16px 0;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--surface-soft);
  color: var(--muted);
}

.bbs-visual-editor code {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--accent-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
}

.bbs-visual-editor hr {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.bbs-visual-editor a {
  color: var(--accent-strong);
  text-decoration: underline;
}

.bbs-editor-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

/* ── QA compose dialog (same visual pattern as BBS composer) ── */

.bbs-compose-dialog {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 22, 20, 0.54);
  backdrop-filter: blur(4px);
}

.bbs-compose-dialog[hidden] {
  display: none;
}

.bbs-compose-panel {
  position: relative;
  width: min(680px, 100%);
  max-height: min(90vh, 760px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 22, 20, 0.24);
}

.bbs-compose-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

@media (max-width: 620px) {
  .bbs-header,
  .bbs-detail,
  .bbs-replies {
    padding: 16px;
  }

  .bbs-header {
    display: grid;
  }

  .bbs-header .primary-button {
    width: 100%;
  }

  .bbs-thread-item {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .bbs-thread-stats {
    justify-content: flex-start;
  }

  .bbs-thread-stats span {
    display: inline;
  }

  .bbs-post.is-child {
    margin-left: 14px;
  }

  .bbs-write-gate {
    align-items: stretch;
    flex-direction: column;
  }

  .bbs-composer-dialog,
  .bbs-compose-dialog {
    align-items: end;
    padding: 10px;
  }

  .bbs-composer-panel,
  .bbs-compose-panel {
    max-height: calc(100vh - 20px);
    padding: 20px;
  }

  .bbs-visual-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .bbs-visual-toolbar button,
  .bbs-visual-toolbar select,
  .bbs-toolbar-divider {
    flex: 0 0 auto;
  }

  .bbs-visual-toolbar button,
  .bbs-visual-toolbar select {
    min-height: 42px;
  }

  .bbs-visual-editor {
    min-height: calc(100dvh - 360px);
    max-height: none;
    padding: 18px;
    font-size: 15px;
  }
}

@media (max-width: 560px) {
  .portal-header-inner {
    gap: var(--space-sm);
  }

  .portal-tools {
    gap: var(--space-sm);
  }

  .site-language-control select {
    width: 82px;
    padding: 0 18px 0 28px;
  }

  .portal-actions {
    gap: 4px;
    min-height: 36px;
    justify-content: flex-end;
  }

  .portal-actions .ghost-button,
  .portal-actions .primary-button {
    width: auto;
    height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent-strong);
    font-size: 12px;
    line-height: 1;
    font-weight: 800;
  }

  .portal-actions .auth-compact-button + .auth-compact-button::before {
    content: "/";
    display: inline-block;
    margin: 0 6px;
    color: var(--muted);
    font-weight: 700;
  }

  .home-search-shell .topbar-search-panel {
    width: auto;
    max-width: none;
    grid-template-columns: 1fr;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

  .search-panel .primary-button {
    height: 46px;
  }

  .market-strip {
    margin-bottom: 12px;
  }

  .market-card {
    min-height: 40px;
  }

  .market-group {
    gap: 8px;
  }

  .market-track.is-marquee-ready .market-group {
    padding-right: 22px;
  }

  .market-label,
  .market-note-inline,
  .market-change {
    font-size: 10px;
  }

  .market-item strong {
    font-size: 12px;
  }

  .site-footer-inner {
    gap: 12px;
  }

  .footer-nav {
    gap: 8px 12px;
  }

}
