/* The KVS theme also uses .secondary for its absolute-positioned sidebar. */
.community-page .community-btn.secondary,
.community-modal .community-btn.secondary {
  position:static;
  inset:auto;
  height:auto;
  float:none;
  transform:none;
  display:inline-flex;
}
/* Mobile forum: contain intrinsic grid widths, not just the page overflow. */
@media (max-width: 900px) {
  .community-page, .community-page *, .community-modal, .community-modal * { box-sizing:border-box; }
  .community-page .community-grid { grid-template-columns:minmax(0,1fr); }
  .community-grid > *, .community-view, .topic-detail, .community-card,
  .forum-post > *, .community-hero > div, .topic-actions > *,
  .category-item > span:not(.category-icon), .forum-author > * { min-width:0; }
  .community-page { width:100%; max-width:100%; }
  .category-panel { order:2; max-width:100%; }
  .topic-panel { order:1; }
  #category-list { display:flex; max-width:100%; min-width:0; overflow-x:auto; overscroll-behavior-x:contain; }
  #category-list .category-item { width:190px; flex:0 0 190px; }
  .category-panel > .category-item { width:100%; }
  .category-item strong, .category-item small { overflow-wrap:anywhere; }
  .topic-toolbar { flex-wrap:wrap; }
  .topic-actions { flex-wrap:wrap; min-width:0; max-width:100%; }
  .forum-search { min-width:0; max-width:100%; flex:1 1 180px; }
  .forum-search input { min-width:0; width:100%; max-width:100%; }
  .community-pagination { flex-wrap:wrap; }
  .community-modal { padding:12px; }
  .community-modal .modal-card { width:100%; max-width:650px; max-height:calc(100dvh - 24px); padding:22px 16px; }
  .modal-card h2 { padding-right:28px; overflow-wrap:anywhere; }
}
@media (max-width: 900px) {
  .community-tabs { max-width:100%; margin-left:0; margin-right:0; scrollbar-width:thin; }
  .community-stats { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .topic-toolbar, .reply-form { padding:16px; }
  .topic-actions { width:100%; flex-direction:column; }
  .forum-search { flex:auto; width:100%; }
  .topic-actions .community-btn { width:100%; white-space:normal; }
  .topic-row { padding:16px; }
  .topic-copy h3 { white-space:normal; overflow-wrap:anywhere; line-height:1.35; }
  .topic-meta, .post-context, .forum-message h1 { overflow-wrap:anywhere; }
  .forum-post, .nested-reply { grid-template-columns:minmax(0,1fr); }
  .forum-author { display:flex; flex-wrap:wrap; justify-content:flex-start; gap:8px 10px; padding:14px; text-align:left; }
  .forum-author .member-avatar { flex:0 0 46px; }
  .forum-author a { max-width:100%; overflow-wrap:anywhere; }
  .forum-author .achievement-badges { justify-content:flex-start; }
  .forum-author .community-role-badge { white-space:normal; }
  .forum-message, .nested-reply .forum-message { padding:15px; }
  .forum-message h1 { font-size:22px; line-height:1.3; }
  .post-context { flex-wrap:wrap; margin-bottom:16px; }
  .post-controls { flex-wrap:wrap; gap:6px 12px; justify-content:flex-start; }
  .post-controls button, .post-controls a { min-height:40px; max-width:100%; overflow-wrap:anywhere; }
  .post-body img, .post-body video, .post-body iframe, .forum-image-link { max-width:100%; }
  .post-body pre { max-width:100%; overflow-x:auto; white-space:pre-wrap; overflow-wrap:anywhere; }
  .nested-replies { margin:0 6px 12px 12px; min-width:0; }
  .thread-reply-form, .inline-edit-form { padding:10px; }
  .thread-reply-actions, .inline-edit-actions { flex-wrap:wrap; }
  .thread-reply-actions .community-btn { flex:1 1 100px; }
  .forum-poll { min-width:0; padding:12px; }
  .poll-option { grid-template-columns:minmax(0,1fr) 44px 24px; gap:6px; padding:10px 8px; }
  .poll-option-result { display:none; }
  .poll-option-label { min-width:0; overflow-wrap:anywhere; }
  .composer-tools { max-width:100%; }
  .composer-status { overflow-wrap:anywhere; }
  .community-page input, .community-page textarea, .community-page select,
  .community-modal input, .community-modal textarea, .community-modal select { font-size:16px; min-width:0; max-width:100%; }
  .community-page textarea, .community-modal textarea { resize:vertical; }
  .community-page .community-btn { min-height:44px; max-width:100%; white-space:normal; }
  .community-page .reaction-button { min-height:40px; }
  .topic-poll-create { display:block; min-width:0; margin:14px; padding:14px; }
  .topic-poll-create > .community-btn { width:100%; margin-top:12px; }
  .topic-poll-form-heading { gap:10px; flex-wrap:wrap; }
  .topic-poll-create form, .topic-poll-create form > * { min-width:0; max-width:100%; }
}
