* {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
  font-family: Arial, sans-serif;
  background: #f3f4f6;
  color: #111827;
}

@supports not (overflow: clip) {
  html,
  body {
    overflow-x: hidden;
  }
}


body.route-loading #posts,
body.route-loading #profile-section,
body.route-loading #legal-document-section,
body.route-loading #support-tickets-section,
body.route-scroll-restoring #posts,
body.route-scroll-restoring #profile-section,
body.route-scroll-restoring #legal-document-section,
body.route-scroll-restoring #support-tickets-section {
  visibility: hidden;
}

html.route-scroll-restoring,
body.route-scroll-restoring {
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto 0;
  height: 180px;
  background: linear-gradient(180deg, #eef2ff 0%, rgba(238, 242, 255, 0) 100%);
  pointer-events: none;
  z-index: -1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  max-width: 100%;
  min-height: 64px;
  padding: 12px 24px;
  overflow-x: clip;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #e5e7eb;
  backdrop-filter: blur(10px);
}

@media (max-width: 780px) {
  .topbar {
    transition: transform 180ms ease, box-shadow 180ms ease;
    will-change: transform;
  }

  body.mobile-topbar-hidden:not(.mobile-sheet-visible) .topbar {
    transform: translateY(calc(-100% - 2px));
    box-shadow: none;
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: auto;
  height: 38px;
  max-width: 170px;
  object-fit: contain;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.topbar-nav a,
.small-link {
  padding: 8px 10px;
  border-radius: 999px;
  color: #374151;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.topbar-nav a:hover,
.small-link:hover {
  background: #f3f4f6;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 320px;
  gap: 20px;
  width: 100%;
  max-width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px;
  overflow-x: clip;
}

.sidebar,
.content-column {
  min-width: 0;
}

.sticky-card {
  position: sticky;
  top: 88px;
}

.card,
.post,
.feed-header-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.card,
.feed-header-card {
  padding: 16px;
  margin: 0 0 16px;
}

.post {
  padding: 16px;
  margin: 0 0 14px;
}

.feed-header-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.feed-header-card h1,
.card h2,
.post h3 {
  margin-top: 0;
}

.feed-header-card h1 {
  margin-bottom: 4px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

input,
textarea,
select {
  width: 100%;
  display: block;
  margin: 8px 0;
  padding: 10px 11px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font: inherit;
  background: white;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

button {
  margin: 6px 6px 6px 0;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: #111827;
  color: white;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  opacity: 0.9;
}

.meta {
  color: #6b7280;
  font-size: 14px;
}

.comment {
  border-left: 3px solid #e5e7eb;
  padding: 10px 0 10px 12px;
  margin: 10px 0;
  background: #f9fafb;
  border-radius: 0 12px 12px 0;
}

.error {
  color: #b91c1c;
}

.account-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 12px;
}

.account-switch button {
  margin: 0;
}

.secondary-btn {
  background: #e5e7eb;
  color: #111827;
  border: 1px solid #000000;
}

.secondary-btn.active {
  background: #111827;
  color: white;
}

.account-form {
  border-top: 1px solid #e5e7eb;
  padding-top: 8px;
}

.hidden {
  display: none !important;
}

.vote-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 6px 8px 6px 0;
  padding: 4px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #ffffff;
  vertical-align: middle;
}

.post-vote-row {
  gap: 12px;
}

.content-controls-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0;
}

.content-controls-row .vote-row {
  margin: 0;
}

.content-controls-row .content-action-menu {
  margin-top: 0;
  flex: 0 0 auto;
}

.vote-btn {
  min-width: 42px;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #f9fafb;
  color: #374151;
  font-size: 18px;
  line-height: 1;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.vote-score {
  min-width: 36px;
  text-align: center;
  color: #111827;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.post-vote-row .vote-score {
  min-width: 42px;
  font-size: 1.55rem;
}

.vote-btn:hover {
  transform: translateY(-1px) scale(1.05);
}

.active-vote {
  font-weight: bold;
  transform: scale(1.18);
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12);
}

.active-upvote {
  background: #dcfce7;
  border-color: #16a34a;
  color: #166534;
}

.active-downvote {
  background: #fee2e2;
  border-color: #dc2626;
  color: #991b1b;
}

.header-user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.header-user p {
  margin: 0;
  color: #4b5563;
  font-size: 14px;
  white-space: nowrap;
}


.profile-avatar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 999px;
}

.profile-avatar-btn:hover,
.avatar-profile-link:hover {
  opacity: 0.82;
}

.profile-avatar-btn:focus-visible,
.avatar-profile-link:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
}

.header-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.avatar-profile-link {
  color: inherit;
  text-decoration: none;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #e5e7eb;
}

.profile-bio {
  white-space: pre-wrap;
}


.profile-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0 6px;
}

.profile-tabs button.active {
  background: #111827;
  color: #fff;
}

.profile-post {
  border-top: 1px solid #e5e7eb;
  padding: 10px 0;
}

.profile-post h3 {
  margin: 0 0 0.5rem;
}

.profile-post h3 a.post-title-link,
.profile-post h3 a.post-title-link:visited,
.profile-post h3 a.post-title-link:hover,
.profile-post h3 a.post-title-link:focus {
  color: inherit;
  text-decoration: none;
}

.profile-post h3 a.post-title-link {
  cursor: pointer;
}

.link-btn {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #2563eb;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

.link-btn:hover {
  opacity: 0.75;
}

.content-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.small-btn {
  padding: 6px 9px;
  font-size: 15px;
}

.danger-btn {
  background: #dc2626;
  color: white;
}

.post-with-avatar,
.comment-with-avatar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.content-main {
  flex: 1;
  min-width: 0;
}

.small-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #374151;
  background: #e5e7eb;
}

a {
  color: #2563eb;
}

.communities-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 16px;
}


.communities-create-drawer {
  margin: 10px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.communities-create-drawer + .communities-list {
  margin-top: 0;
}

.community-pill {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 12px;
  background: var(--community-post-background, #f8fafc);
  color: #1e40af;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid color-mix(in srgb, var(--community-post-background, #f8fafc) 72%, #94a3b8);
}

.community-pill:hover,
.community-pill.active {
  background: color-mix(in srgb, var(--community-post-background, #f8fafc) 84%, #e0e7ff);
  border-color: color-mix(in srgb, var(--community-post-background, #f8fafc) 55%, #6366f1);
}

.community-pill span {
  color: #6b7280;
  font-weight: normal;
}

.drawer {
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
}

.card.drawer {
  border-top: 1px solid #e5e7eb;
  padding-top: 16px;
}

.drawer summary {
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.drawer summary::-webkit-details-marker {
  display: none;
}

.drawer summary::after {
  content: '▾';
  float: right;
  color: #6b7280;
  transition: transform 0.2s ease;
}

.drawer[open] summary::after {
  transform: rotate(180deg);
}

.account-card summary,
.action-card summary,
.moderator-tools summary {
  font-size: 1.5em;
  margin-bottom: 12px;
}

.account-card:not([open]),
.action-card:not([open]),
.moderator-tools:not([open]) {
  padding-bottom: 16px;
}

.community-form {
  padding-top: 8px;
}

.account-card,
.action-card,
.info-card {
  position: relative;
}

.info-card strong {
  display: block;
  margin-bottom: 6px;
}

body.profile-view .info-card {
  display: none;
}

.feed-list:empty::before {
  content: 'Loading...';
  display: block;
  padding: 18px;
  color: #6b7280;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .sidebar-right {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (max-width: 780px) {
  body {
    background: #f8fafc;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px 12px;
    padding: 10px 14px;
  }

  .brand-logo {
    height: 34px;
    max-width: 150px;
  }

  .global-search-form {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    width: 100%;
    order: 3;
  }

  .global-search-form input {
    min-width: 0;
    margin: 0;
  }

  .global-search-form button {
    margin: 0;
    white-space: nowrap;
  }

  .topbar-nav {
    grid-column: 1 / -1;
    order: 4;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .topbar-nav a,
  .small-link {
    flex: 0 0 auto;
  }

  .header-user {
    justify-self: end;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }

  .header-user p {
    width: 100%;
    text-align: right;
    font-size: 14px;
  }

  .app-shell {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
  }

  .sidebar-right {
    order: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .account-card {
    order: -3;
    grid-column: 1 / -1;
  }

  .notifications-card {
    order: -2;
    grid-column: 1 / -1;
  }

  .action-card,
  .info-card {
    margin-bottom: 0;
  }

  .sidebar-left {
    order: -4;
  }

  .content-column {
    order: 1;
  }

  .sticky-card {
    position: static;
  }

  .communities-list {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

@media (max-width: 520px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .brand,
  .header-user {
    justify-self: stretch;
  }

  .header-user {
    justify-content: flex-start;
  }

  .header-user p {
    text-align: left;
  }

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

  .global-search-form button,
  .header-user button,
  .account-switch button,
  .account-form button,
  .action-card button {
    width: 100%;
    margin-right: 0;
  }

  .sidebar-right {
    grid-template-columns: 1fr;
  }

  .post-with-avatar,
  .comment-with-avatar {
    gap: 9px;
  }

  .small-avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .card,
  .post,
  .feed-header-card {
    border-radius: 14px;
    padding: 14px;
  }
}

.moderator-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 16px;
  display: grid;
  gap: 8px;
}

.moderator-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
}


.context-section-title {
  margin: 14px 0 6px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4b5563;
}

.context-moderator-list {
  margin-bottom: 10px;
}

.context-moderator-list li {
  justify-content: flex-start;
}

.small-danger-btn {
  padding: 6px 9px;
  font-size: 15px;
  background: #dc2626;
  color: white;
}


.content-image {
  display: block;
  max-width: min(100%, 640px);
  max-height: 520px;
  object-fit: contain;
  margin: 10px 0;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.comment .content-image {
  max-height: 360px;
}

.reports-list {
  display: grid;
  gap: 12px;
  margin: 12px 0 18px;
}

.report-card {
  padding: 12px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fff7f7;
}

.report-card h4 {
  margin: 6px 0;
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  color: #111827;
  text-decoration: none;
  background: white;
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.file-name {
  color: var(--muted);
  font-size: 0.9rem;
}

.badge {
  display: inline-flex;
  min-width: 1.4rem;
  height: 1.4rem;
  align-items: center;
  justify-content: center;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #ef4444;
  color: white;
}

.notifications-card .notification-actions {
  margin-bottom: 0.75rem;
}

.notification-item {
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 0.75rem;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--card-background, #fff);
}

.notification-item.unread {
  border-color: #f59e0b;
  background: #fffbeb;
}

.notification-item a {
  color: inherit;
  text-decoration: none;
}

.notification-details {
  margin: 0.35rem 0;
  white-space: normal;
}

.target-comment {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.pin-badge,
.thread-badge {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
}

.moderation-log-list {
  display: grid;
  gap: 0.75rem;
}

.moderation-log-item {
  border: 1px solid var(--border-color, #ddd);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: var(--card-bg, #fff);
}

.moderation-log-item p {
  margin: 0.35rem 0 0;
}

.community-sort-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 16px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #f9fafb;
}

.community-sort-tabs button.active {
  background: #111827;
  border-color: #111827;
  color: #fff;
  transform: translateY(-1px);
}

.top-period-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.top-period-tabs .meta {
  margin-right: 2px;
}

.comment-thread {
  margin-left: calc(var(--comment-depth, 0) * 22px);
}

.comment-replies {
  margin-left: 18px;
  padding-left: 14px;
  border-left: 2px solid #e5e7eb;
}

.comment-replies .comment {
  background: #ffffff;
}

@media (max-width: 640px) {
  .comment-thread {
    margin-left: calc(var(--comment-depth, 0) * 10px);
  }

  .comment-replies {
    margin-left: 8px;
    padding-left: 8px;
  }
}

.deleted-comment {
  opacity: 0.82;
}

.deleted-comment[data-deleted-comment-preview] {
  cursor: pointer;
}

.deleted-comment[data-deleted-comment-preview] :is(button, a, input, textarea, select, details, summary) {
  cursor: auto;
}

.deleted-comment-text {
  color: #6b7280;
  font-style: italic;
  margin: 0 0 6px;
}

.deleted-comment-body-preview {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.deleted-comment-expanded .deleted-comment-body-preview {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.deleted-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  background: #e5e7eb;
  border: 1px dashed #cbd5e1;
}

.mention-link {
  font-weight: 700;
  color: var(--accent-color, #4f46e5);
  text-decoration: none;
}

.mention-link:hover {
  text-decoration: underline;
}

.compact-card {
  margin-bottom: 16px;
  padding: 12px 14px;
}

.community-subscription-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.global-search-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  max-width: 520px;
  margin: 0 1rem;
  position: relative;
}

.global-search-field {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.global-search-form input {
  width: 100%;
  min-width: 180px;
}

.global-search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 50;
  display: grid;
  gap: 0.75rem;
  max-height: min(70vh, 520px);
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid var(--border-color, #2b2f3a);
  border-radius: 16px;
  background: var(--card-bg, #ffffff);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

.global-search-suggestion-group {
  display: grid;
  gap: 0.35rem;
}

.global-search-suggestion {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}

.global-search-suggestion:hover,
.global-search-suggestion:focus {
  background: rgba(99, 102, 241, 0.10);
}

.global-search-suggestion span {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.global-search-suggestion small {
  color: #6b7280;
}

.global-search-all {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  background: rgba(99, 102, 241, 0.12);
  color: inherit;
  font-weight: 700;
}

.global-search-empty {
  padding: 0.35rem 0.25rem;
}

.search-results {
  display: grid;
  gap: 1rem;
}

.search-section {
  display: grid;
  gap: 0.75rem;
}

.search-result-item {
  border-top: 1px solid var(--border-color, #2b2f3a);
  padding-top: 0.75rem;
}

.search-result-item:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.search-result-content-link {
  cursor: pointer;
  border-radius: 8px;
}

.search-result-content-link:focus-visible {
  outline: 2px solid var(--accent-color, #60a5fa);
  outline-offset: 3px;
}

.user-search-result {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .global-search-form {
    order: 3;
    width: 100%;
    max-width: none;
    margin: 0.75rem 0 0;
  }
}

.search-tabs {
  margin-bottom: 1rem;
}

.search-tabs .tab-button span {
  color: #4b5563;
  margin-left: 0.25rem;
}

.search-tabs .tab-button.active span {
  color: rgba(255, 255, 255, 0.85);
}


.community-logo {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
}

.community-logo.large {
  width: 64px;
  height: 64px;
  flex-basis: 64px;
  border-radius: 18px;
  font-size: 26px;
}

.community-logo-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #1f2937;
  background: linear-gradient(135deg, #e0e7ff, #f5f3ff);
}

.community-pill-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.community-pill .community-pill-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.community-pill .community-pill-name {
  color: #1e40af;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-pill .community-pill-count {
  color: #6b7280;
  font-size: 0.78rem;
  font-weight: 500;
  margin-top: 2px;
}

.community-page-header,
.community-logo-settings,
.community-context-header,
.community-search-result {
  display: flex;
  align-items: center;
  gap: 12px;
}

.community-page-header h2,
.community-logo-settings form,
.community-search-result p {
  margin: 0;
}

.community-logo-settings {
  align-items: flex-start;
}

.community-logo-settings form {
  flex: 1;
}

.community-context-header {
  margin-bottom: 8px;
}

.community-overview-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.community-overview-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.community-overview-copy {
  min-width: 0;
}

.community-overview-copy h2,
.community-overview-description {
  margin: 0;
}

.community-overview-description {
  margin-top: 4px;
}

.community-overview-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}


.avatar-presence-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: max-content;
  height: max-content;
}

.presence-badge {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: #9ca3af;
  box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.08);
}

.presence-badge.online {
  background: #22c55e;
}

.presence-badge.offline {
  background: #9ca3af;
}

.presence-text {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}

.presence-text::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9ca3af;
}

.presence-text.online {
  color: #15803d;
}

.presence-text.online::before {
  background: #22c55e;
}

.presence-text.offline {
  color: #6b7280;
}

.profile-header {
  position: relative;
}

.profile-header.profile-online #profile-avatar-img,
.profile-header.profile-offline #profile-avatar-img {
  position: relative;
}

.profile-header.profile-online::after,
.profile-header.profile-offline::after {
  content: '';
  position: absolute;
  left: 58px;
  bottom: 4px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 3px solid #fff;
  background: #9ca3af;
  box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.08);
}

.profile-header.profile-online::after {
  background: #22c55e;
}



.comment-composer {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--muted);
  display: grid;
  gap: 0.6rem;
}

.comment-textarea {
  min-height: 92px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.reply-form .comment-textarea {
  min-height: 76px;
}

.reply-form {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
}

.reply-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.confirm-password-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.48);
}

.confirm-password-modal {
  width: min(100%, 420px);
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.confirm-password-modal h3,
.confirm-password-modal p {
  margin: 0;
}

.confirm-password-modal label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.confirm-password-modal input {
  width: 100%;
}

.confirm-password-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}


/* Larger composer: opening "New Post" now expands it into a modal-like panel. */
.action-card.drawer[open] {
  position: fixed;
  z-index: 1000;
  top: 50%;
  left: 50%;
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  transform: translate(-50%, -50%);
  padding: 24px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.action-card.drawer[open] summary {
  position: sticky;
  top: -24px;
  z-index: 1;
  margin: -24px -24px 18px;
  padding: 20px 24px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 16px 16px 0 0;
}

.action-card.drawer[open] textarea#post-body {
  min-height: 260px;
}

.action-card.drawer[open] input#post-title {
  font-size: 1.1rem;
  padding: 13px 14px;
}

.action-card.drawer[open] select#post-community,
.action-card.drawer[open] textarea#post-body {
  padding: 13px 14px;
}

.action-card.drawer[open] button#create-post-btn {
  width: 100%;
  padding: 13px 16px;
  font-size: 1rem;
}

.post-body-preview {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.read-more-link {
  display: inline-block;
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  font-weight: 700;
}

.deleted-content-card {
  cursor: pointer;
}

.deleted-content-card :is(button, a, input, textarea, select, details, summary) {
  cursor: auto;
}

.deleted-content-body-preview {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.deleted-content-expanded .deleted-content-body-preview {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.deleted-content-controls {
  flex-wrap: wrap;
}

.notifications-card summary .badge {
  margin-left: 0.45rem;
  vertical-align: middle;
}

.community-overview-context-mobile {
  display: none;
}

@media (max-width: 760px) {
  body.community-feed-view .sidebar-right .info-card {
    display: none;
  }

  body.community-feed-view .community-overview-context-mobile {
    display: block;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
  }

  body.community-feed-view .community-overview-context-mobile .moderator-list {
    margin-bottom: 0;
  }
}

/* v5: collapsed moderator lists and improved mobile community/header layout */
.moderator-drawer {
  margin: 12px 0;
}

.moderator-drawer summary {
  cursor: pointer;
  font-weight: 700;
}

.moderator-drawer .moderator-list {
  margin-bottom: 0;
}

@media (max-width: 760px) {
  .community-overview-card {
    align-items: flex-start;
  }

  .community-overview-main {
    width: 100%;
  }

  .community-overview-actions {
    width: 100%;
    justify-content: flex-start;
    padding-left: 78px;
    margin-top: -8px;
  }
}

@media (max-width: 520px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .brand {
    justify-self: start;
  }

  .header-user {
    justify-self: end;
    justify-content: flex-end;
    flex-wrap: nowrap;
    width: auto;
  }

  .header-user p {
    display: none;
  }

  .header-user button:not(.profile-avatar-btn) {
    width: auto;
    padding: 6px 10px;
    font-size: 14px;
    line-height: 1.15;
    white-space: nowrap;
  }

  .header-avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .global-search-form,
  .topbar-nav {
    grid-column: 1 / -1;
  }

  .community-overview-main {
    align-items: flex-start;
  }

  .community-overview-actions {
    padding-left: 0;
    margin-top: 0;
  }

  .community-overview-actions button,
  .community-overview-actions .secondary-btn {
    width: 100%;
  }
}

.content-action-menu {
  position: relative;
  width: max-content;
  max-width: 100%;
  margin-top: 4px;
}

.content-action-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  list-style: none;
}

.content-action-menu summary::-webkit-details-marker {
  display: none;
}

.content-action-menu summary:hover,
.content-action-menu[open] summary {
  background: #f8fafc;
}

.content-action-menu-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  display: grid;
  min-width: 170px;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
}

.content-action-menu-panel button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.comment .content-action-menu-panel {
  left: auto;
  right: 0;
}

@media (max-width: 760px) {
  .content-action-menu-panel {
    min-width: 155px;
  }

  .post .content-action-menu-panel,
  .comment .content-action-menu-panel {
    left: 0;
    right: auto;
  }
}

/* v8: remove redundant headers and place community subscription action under the description */
body.general-feed-view .feed-header-card,
body.community-feed-view .feed-header-card,
body.post-detail-view .feed-header-card {
  display: none;
}

.community-overview-card {
  justify-content: flex-start;
}

.community-overview-actions {
  justify-content: flex-start;
  margin-top: 8px;
}

.community-overview-actions button,
.community-overview-actions .secondary-btn {
  margin-left: 0;
}

@media (max-width: 760px) {
  .community-overview-actions {
    width: auto;
    padding-left: 0;
    margin-top: 8px;
  }
}

/* v9: stack community metadata under the main community information on mobile */
@media (max-width: 760px) {
  body.community-feed-view .community-overview-card {
    flex-direction: column;
    align-items: stretch;
  }

  body.community-feed-view .community-overview-main {
    width: 100%;
  }

  body.community-feed-view .community-overview-context-mobile {
    width: 100%;
    box-sizing: border-box;
    margin-top: 10px;
    padding-left: 78px;
  }
}

@media (max-width: 520px) {
  body.community-feed-view .community-overview-context-mobile {
    padding-left: 0;
  }
}

/* v11: keep desktop communities panel accessible while scrolling long pages */
@media (min-width: 781px) {
  .sidebar-left .sticky-card {
    max-height: calc(100vh - 104px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
    scrollbar-gutter: stable;
  }
}

.community-picker {
  display: grid;
  gap: 10px;
}

.community-picker-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
}

.community-picker-results {
  display: grid;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
}

.community-picker-option {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--community-post-background, #fff) 72%, #94a3b8);
  border-radius: 12px;
  background: var(--community-post-background, #fff);
  color: #111827;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}

.community-picker-option:hover,
.community-picker-option.active {
  border-color: #94a3b8;
  background: color-mix(in srgb, var(--community-post-background, #f8fafc) 82%, #f8fafc);
}

.community-picker-locked {
  color: #b91c1c;
  font-size: 0.8rem;
  font-weight: 700;
}

.community-picker-selected,
.community-picker-empty {
  margin: 0;
}

.action-card.drawer[open] .community-picker input#post-community-search {
  padding: 13px 14px;
}

.community-rules-drawer {
  margin-top: 0.75rem;
}

.community-rule-list {
  display: grid;
  gap: 0.75rem;
  padding-left: 1.25rem;
}

.community-rule-list li {
  padding: 0.75rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 0.75rem;
}

.community-rule-copy p {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
}

.manageable-rule-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: flex-start;
}

.community-rule-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.community-rule-delete {
  grid-column: 2;
  justify-self: end;
  align-self: end;
}

@media (max-width: 780px) {
  .manageable-rule-list li {
    display: block;
  }

  .community-rule-actions {
    margin-top: 0.75rem;
  }

  .community-rule-delete {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
  }
}

.comment-collapse-btn {
  min-width: 30px;
  padding: 4px 10px;
  font-weight: 700;
  line-height: 1;
}

.comment-reply-count {
  display: inline-flex;
  align-items: center;
  margin: 0 4px 0 0;
  white-space: nowrap;
}

.supermoderator-panel {
  display: grid;
  gap: 0.85rem;
}

.supermoderator-panel.hidden {
  display: none;
}

.supermoderator-panel h2 {
  margin-bottom: 0;
}

.stat-line {
  margin: 0;
}

.nested-drawer {
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 0.85rem;
  padding: 0.75rem;
  background: var(--card-background, #fff);
}

.nested-drawer summary {
  cursor: pointer;
  font-weight: 700;
}

.compact-list li {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.compact-list li .small-danger-btn {
  margin-left: auto;
}

#supermoderator-notifications-drawer summary .badge {
  margin-left: 0.45rem;
  vertical-align: middle;
}

.notification-item.handled {
  opacity: 0.72;
}


/* Mobile app shell v2: keeps the desktop layout untouched and turns side panels into quick bottom sheets. */
.mobile-tabbar,
.mobile-sheet-scrim {
  display: none;
}

@media (max-width: 780px) {
  :root {
    --mobile-tabbar-height: 74px;
    --mobile-sheet-gap: 10px;
  }

  body {
    padding-bottom: calc(var(--mobile-tabbar-height) + env(safe-area-inset-bottom, 0px));
    background: #f8fafc;
  }

  body.mobile-sheet-visible {
    overflow: hidden;
  }

  .topbar {
    z-index: 900;
    grid-template-columns: auto minmax(0, 1fr);
    min-height: auto;
    padding: 10px 12px;
  }

  .brand-logo {
    height: 32px;
    max-width: 138px;
  }

  .header-user {
    min-width: 0;
  }

  .header-user p {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-nav {
    display: none;
  }

  .global-search-form {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    width: 100%;
    order: 3;
  }

  .global-search-form input {
    min-width: 0;
    margin: 0;
  }

  .global-search-form button {
    margin: 0;
    white-space: nowrap;
  }

  .app-shell {
    display: block;
    max-width: 720px;
    padding: 12px;
  }

  .content-column {
    display: block;
  }

  .feed-header-card {
    position: sticky;
    top: 112px;
    z-index: 15;
    margin-bottom: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  }

  .feed-header-card h1 {
    font-size: 1.35rem;
  }

  .sidebar-left,
  .sidebar-right {
    display: contents;
  }

  #communities-panel,
  #account-drawer,
  #notifications-drawer,
  #post-drawer,
  #supermoderator-panel:not(.mobile-account-supermoderator),
  .sidebar-right > .info-card {
    display: none !important;
  }

  #communities-panel.mobile-sheet-active,
  #account-drawer.mobile-sheet-active,
  #notifications-drawer.mobile-sheet-active,
  #post-drawer.mobile-sheet-active,
  #supermoderator-panel.mobile-sheet-active,
  .sidebar-right > .info-card.mobile-sheet-active {
    display: block !important;
    position: fixed;
    left: var(--mobile-sheet-gap);
    right: var(--mobile-sheet-gap);
    bottom: calc(var(--mobile-tabbar-height) + var(--mobile-sheet-gap) + env(safe-area-inset-bottom, 0px));
    z-index: 1300;
    max-height: min(82vh, 720px);
    overflow: auto;
    overscroll-behavior: contain;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    padding: 16px;
    box-shadow: 0 26px 80px rgba(15, 23, 42, 0.32);
    transform: none;
  }

  #communities-panel.mobile-sheet-active .sticky-card {
    position: static;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  #communities-panel.mobile-sheet-active .section-heading h2,
  #account-drawer.mobile-sheet-active summary,
  #notifications-drawer.mobile-sheet-active summary,
  #post-drawer.mobile-sheet-active summary {
    position: sticky;
    top: -16px;
    z-index: 2;
    margin: -16px -16px 14px;
    padding: 16px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 22px 22px 0 0;
  }

  #communities-panel.mobile-sheet-active .communities-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #communities-panel.mobile-sheet-active .community-link {
    min-height: 48px;
  }

  #create-community-drawer {
    margin: 0 0 14px;
  }

  #post-drawer.mobile-sheet-active textarea#post-body {
    min-height: 180px;
  }

  #post-drawer.mobile-sheet-active input#post-title,
  #post-drawer.mobile-sheet-active textarea#post-body,
  #post-drawer.mobile-sheet-active input#post-community-search {
    font-size: 16px;
  }

  #post-drawer.mobile-sheet-active button#create-post-btn {
    width: 100%;
    min-height: 46px;
  }

  .mobile-sheet-scrim {
    position: fixed;
    inset: 0;
    z-index: 1250;
    background: rgba(15, 23, 42, 0.34);
    backdrop-filter: blur(2px);
  }

  body.mobile-sheet-visible .mobile-sheet-scrim {
    display: block;
  }

  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    z-index: 1400;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    min-height: var(--mobile-tabbar-height);
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -14px 40px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(12px);
  }

  .mobile-tabbar-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 54px;
    margin: 0;
    max-width: 100%;
    overflow: hidden;
    padding: 7px 2px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: #4b5563;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
  }

  .mobile-tabbar-item:hover,
  .mobile-tabbar-item:focus-visible,
  .mobile-tabbar-item.mobile-tabbar-active {
    background: #eef2ff;
    color: #111827;
    outline: none;
  }

  .mobile-tabbar-primary {
    background: #111827;
    color: white;
  }

  .mobile-tabbar-primary:hover,
  .mobile-tabbar-primary:focus-visible,
  .mobile-tabbar-primary.mobile-tabbar-active {
    background: #111827;
    color: white;
  }

  .mobile-tabbar-icon {
    font-size: 19px;
    line-height: 1;
  }

  .mobile-tabbar-badge {
    position: absolute;
    top: 4px;
    right: 11px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    line-height: 18px;
  }

  .card,
  .post,
  .feed-header-card {
    border-radius: 16px;
  }

  .post {
    padding: 14px;
    margin-bottom: 12px;
  }

  .post-with-avatar,
  .comment-with-avatar {
    gap: 9px;
  }

  .small-avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
}


@media (max-width: 780px) {
  #account-drawer.mobile-sheet-active > summary,
  #notifications-drawer.mobile-sheet-active > summary,
  #post-drawer.mobile-sheet-active > summary {
    cursor: default;
    user-select: none;
  }

  #account-drawer.mobile-sheet-active > summary::-webkit-details-marker,
  #notifications-drawer.mobile-sheet-active > summary::-webkit-details-marker,
  #post-drawer.mobile-sheet-active > summary::-webkit-details-marker {
    display: none;
  }

  #account-drawer.mobile-sheet-active > summary::marker,
  #notifications-drawer.mobile-sheet-active > summary::marker,
  #post-drawer.mobile-sheet-active > summary::marker {
    content: "";
  }

  #post-drawer.mobile-sheet-active {
    top: max(14px, env(safe-area-inset-top, 0px));
    bottom: calc(var(--mobile-tabbar-height) + 8px + env(safe-area-inset-bottom, 0px));
    max-height: none;
    display: flex !important;
    flex-direction: column;
  }

  #post-drawer.mobile-sheet-active textarea#post-body {
    min-height: 260px;
    flex: 1 1 auto;
  }

  #post-drawer.mobile-sheet-active .community-picker-results {
    max-height: 170px;
    overflow: auto;
  }

  .global-search-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
  }

  .global-search-form button {
    width: auto;
    align-self: stretch;
  }

}

@media (max-width: 430px) {
  #communities-panel.mobile-sheet-active .communities-list {
    grid-template-columns: 1fr;
  }

  .mobile-tabbar {
    gap: 2px;
    padding-left: 5px;
    padding-right: 5px;
  }

  .mobile-tabbar-item {
    font-size: 10px;
    border-radius: 14px;
  }
}


/* Mobile v5 refinements: non-collapsible quick panels and matching sheet sizes. */
@media (max-width: 780px) {
  #account-drawer.mobile-sheet-active > summary,
  #notifications-drawer.mobile-sheet-active > summary,
  #post-drawer.mobile-sheet-active > summary {
    cursor: default;
    list-style: none;
    pointer-events: none;
  }

  #account-drawer.mobile-sheet-active > summary::-webkit-details-marker,
  #notifications-drawer.mobile-sheet-active > summary::-webkit-details-marker,
  #post-drawer.mobile-sheet-active > summary::-webkit-details-marker {
    display: none !important;
  }

  #account-drawer.mobile-sheet-active > summary::marker,
  #notifications-drawer.mobile-sheet-active > summary::marker,
  #post-drawer.mobile-sheet-active > summary::marker {
    content: "" !important;
    font-size: 0 !important;
  }

  #account-drawer.mobile-sheet-active > summary::before,
  #notifications-drawer.mobile-sheet-active > summary::before,
  #post-drawer.mobile-sheet-active > summary::before,
  #account-drawer.mobile-sheet-active > summary::after,
  #notifications-drawer.mobile-sheet-active > summary::after,
  #post-drawer.mobile-sheet-active > summary::after {
    content: none !important;
    display: none !important;
  }

  #notifications-drawer.mobile-sheet-active,
  #post-drawer.mobile-sheet-active {
    top: max(14px, env(safe-area-inset-top, 0px));
    bottom: calc(var(--mobile-tabbar-height) + 8px + env(safe-area-inset-bottom, 0px));
    max-height: none;
    display: flex !important;
    flex-direction: column;
  }

  #notifications-drawer.mobile-sheet-active #notifications-list {
    flex: 1 1 auto;
    overflow: auto;
    min-height: 0;
  }
}


/* Mobile v6: expose Super Moderator tools inside the Account sheet only. */
@media (max-width: 780px) {
  #account-drawer.mobile-sheet-active > #supermoderator-panel.mobile-account-supermoderator:not(.hidden) {
    display: grid !important;
    position: static !important;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: auto;
    max-height: min(42vh, 360px);
    overflow: auto;
    overscroll-behavior: contain;
    margin: 0 0 14px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    box-shadow: none;
  }

  #account-drawer.mobile-sheet-active > #supermoderator-panel.mobile-account-supermoderator.hidden {
    display: none !important;
  }

  #account-drawer.mobile-sheet-active > #supermoderator-panel.mobile-account-supermoderator h2 {
    position: sticky;
    top: -14px;
    z-index: 1;
    margin: -14px -14px 12px;
    padding: 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 18px 18px 0 0;
    font-size: 1rem;
  }

  #account-drawer.mobile-sheet-active > #supermoderator-panel.mobile-account-supermoderator .nested-drawer {
    background: white;
  }
}

/* Mobile v7: keep Communities and Account sheets the same usable size as Notifications and New Post. */
@media (max-width: 780px) {
  #communities-panel.mobile-sheet-active,
  #account-drawer.mobile-sheet-active {
    top: max(14px, env(safe-area-inset-top, 0px));
    bottom: calc(var(--mobile-tabbar-height) + 8px + env(safe-area-inset-bottom, 0px));
    max-height: none;
    overflow: auto;
    overscroll-behavior: contain;
  }

  #communities-panel.mobile-sheet-active .sticky-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  #account-drawer.mobile-sheet-active > #supermoderator-panel.mobile-account-supermoderator:not(.hidden) {
    max-height: none;
    flex: 0 0 auto;
  }
}


/* Mobile v8: compact Account sheet for non-super-moderators */
@media (max-width: 780px) {
  #account-drawer.mobile-sheet-active {
    height: auto;
  }

  #account-drawer.mobile-sheet-active:not(:has(#supermoderator-panel.mobile-account-supermoderator:not(.hidden))) {
    top: auto;
    max-height: min(60vh, 520px);
  }

  #account-drawer.mobile-sheet-active:has(#supermoderator-panel.mobile-account-supermoderator:not(.hidden)) {
    top: max(14px, env(safe-area-inset-top, 0px));
    bottom: calc(var(--mobile-tabbar-height) + 8px + env(safe-area-inset-bottom, 0px));
  }
}

/* v9: keep post/comment action menus inside the mobile viewport */
@media (max-width: 780px) {
  .content-action-menu {
    position: static;
  }

  .content-action-menu summary {
    touch-action: manipulation;
  }

  .content-action-menu-panel {
    position: fixed;
    z-index: 1600;
    top: auto;
    left: auto;
    right: auto;
    width: max-content;
    min-width: 172px;
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .post .content-action-menu-panel,
  .comment .content-action-menu-panel {
    left: auto;
    right: auto;
  }

  .content-action-menu-panel button {
    min-height: 40px;
    white-space: nowrap;
  }
}

/* Place post/comment age in the top-right corner of content cards. */
.has-content-age {
  position: relative;
  padding-right: 68px;
}

.content-age {
  position: absolute;
  top: 0;
  right: 0;
  color: #6b7280;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
}

.post .content-age,
.comment .content-age,
.profile-post .content-age,
.search-result-item .content-age {
  top: 2px;
}

@media (max-width: 640px) {
  .has-content-age {
    padding-right: 56px;
  }

  .content-age {
    font-size: 14px;
  }
}

/* Mobile nested comments: keep hierarchy visible without crushing reply content. */
@media (max-width: 640px) {
  .comment-thread {
    margin-left: 0;
  }

  .comment-replies {
    margin-left: 0;
    padding-left: 10px;
    border-left-width: 2px;
  }

  .comment {
    padding: 9px 0 9px 9px;
  }

  .comment-with-avatar {
    gap: 7px;
  }

  .comment-replies .small-avatar {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .comment .content-controls-row {
    gap: 6px;
  }
}

/* Compact nested comments on every screen size, not only mobile. */
.comment-thread {
  margin-left: 0;
}

.comment-replies {
  margin-left: 0;
  padding-left: 10px;
  border-left-width: 2px;
}

.comment {
  padding: 9px 0 9px 9px;
}

.comment-with-avatar {
  gap: 8px;
}

.comment-replies .small-avatar {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
}

.comment .content-controls-row {
  gap: 5px;
  margin: 4px 0;
}

.comment .vote-row {
  gap: 4px;
}

.comment .vote-btn {
  min-width: 30px;
  padding: 4px 6px;
  font-size: 14px;
}

.comment .vote-score {
  min-width: 24px;
  font-size: 1rem;
}

.comment .small-btn,
.comment-thread-link {
  padding: 4px 7px;
  font-size: 13px;
  line-height: 1.1;
}

.comment .content-action-menu summary {
  min-width: 28px;
  padding: 3px 6px;
  font-size: 14px;
  line-height: 1;
}

.comment-collapse-btn {
  min-width: 26px;
  padding: 3px 7px;
}

.comment-thread-link {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  text-decoration: none;
}

.comment-thread-page .comment-thread-context {
  padding: 14px;
}

.comment-thread-page .comment-thread > .comment {
  background: #ffffff;
}

/* Wider post/comment text flow: keep avatar + title aligned at the top,
   then let the main content use the horizontal space below the avatar. */
.post-with-avatar,
.comment-with-avatar {
  --content-avatar-offset: 54px;
}

.comment-with-avatar {
  --content-avatar-offset: 38px;
}

.post-with-avatar > .content-main > :is(p, .content-image, .read-more-link, .content-controls-row, .comment-composer, h4, [id^="comments-container-"]),
.comment-with-avatar > .content-main > :is(p, .content-image, .content-controls-row, .reply-form) {
  margin-left: calc(-1 * var(--content-avatar-offset));
  max-width: calc(100% + var(--content-avatar-offset));
}

.post-with-avatar > .content-main > :is(p, .content-controls-row, .comment-composer, h4, [id^="comments-container-"]),
.comment-with-avatar > .content-main > :is(p, .content-controls-row, .reply-form) {
  width: calc(100% + var(--content-avatar-offset));
}

.post-with-avatar > .content-main > .content-image,
.comment-with-avatar > .content-main > .content-image {
  width: auto;
  max-width: min(calc(100% + var(--content-avatar-offset)), 720px);
}

.post-with-avatar > .content-main > h3,
.comment-with-avatar > .content-main > p:first-of-type {
  overflow-wrap: anywhere;
}

.comment-with-avatar > .content-main > p:first-of-type {
  margin-top: 0;
}

.comment-with-avatar > .content-main > .meta {
  margin-top: 6px;
}

@media (max-width: 640px) {
  .post-with-avatar {
    --content-avatar-offset: 45px;
  }

  .comment-with-avatar {
    --content-avatar-offset: 37px;
  }

  .post-with-avatar > .content-main > :is(p, .content-image, .read-more-link, .content-controls-row, .comment-composer, h4, [id^="comments-container-"]),
  .comment-with-avatar > .content-main > :is(p, .content-image, .content-controls-row, .reply-form) {
    max-width: calc(100% + var(--content-avatar-offset));
  }
}

/* Let card bodies use the space below the timestamp too; only the top line keeps room for it. */
.post-with-avatar > .content-main.has-content-age,
.comment-with-avatar > .content-main.has-content-age {
  padding-right: 0;
}

.post-with-avatar > .content-main > h3,
.comment-with-avatar > .content-main > p:first-of-type {
  padding-right: 68px;
}

@media (max-width: 640px) {
  .post-with-avatar > .content-main > h3,
  .comment-with-avatar > .content-main > p:first-of-type {
    padding-right: 56px;
  }
}

/* v11: keep widened post/comment bodies from sliding into the avatar area.
   Posts keep their wide body below a title area at least as tall as the avatar.
   Comments keep their first body line and direct image in the normal content column,
   while controls/replies can still expand below the avatar. */
.post-with-avatar > .content-main > h3 {
  min-height: var(--content-avatar-offset);
  display: block;
}

.comment-with-avatar > .content-main > p:first-of-type,
.comment-with-avatar > .content-main > .content-image {
  margin-left: 0;
  width: auto;
  max-width: min(100%, 720px);
}

.comment-with-avatar > .content-main > p:first-of-type {
  padding-right: 56px;
}

@media (max-width: 640px) {
  .comment-with-avatar > .content-main > p:first-of-type,
  .comment-with-avatar > .content-main > .content-image {
    margin-left: 0;
    width: auto;
    max-width: 100%;
  }
}


/* v12: header/avatar on first row, full-width content below avatar */
.comment-with-avatar,
.post-with-avatar{
  display:grid;
  grid-template-columns:auto 1fr;
  align-items:start;
}

.comment-with-avatar > .small-avatar,
.post-with-avatar > .avatar,
.post-with-avatar > .content-avatar{
  grid-column:1;
  grid-row:1;
}

.comment-with-avatar > .content-main,
.post-with-avatar > .content-main{
  grid-column:2;
  grid-row:1;
}

.comment-with-avatar > .content-main > p:first-of-type,
.comment-with-avatar > .content-main > .content-image,
.comment-with-avatar > .content-main > .content-controls-row,
.comment-with-avatar > .content-main > .reply-form{
  margin-left: calc(-1 * var(--content-avatar-offset));
  width: calc(100% + var(--content-avatar-offset));
  max-width: calc(100% + var(--content-avatar-offset));
}

.comment-with-avatar > .content-main > p:first-of-type{
  margin-top: var(--content-avatar-offset);
  padding-right:0;
}

.comment-with-avatar > .content-main > .content-image{
  max-width:min(calc(100% + var(--content-avatar-offset)),720px);
}

.post-with-avatar > .content-main > h3{
  min-height:auto;
}

/* v12: strict two-stage post/comment layout.
   Row 1 is only avatar + title/age header; every body/media/action block starts below it
   and can use the full card width without ever sliding over the avatar. */
.post-with-avatar,
.comment-with-avatar {
  display: grid !important;
  grid-template-columns: 42px minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 0;
  align-items: start;
}

.post-with-avatar > :is(.small-avatar, .avatar-placeholder),
.comment-with-avatar > :is(.small-avatar, .avatar-placeholder) {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
}

.post-with-avatar > .content-main,
.comment-with-avatar > .content-main {
  display: contents;
  min-width: 0;
  padding-right: 0 !important;
}


.post-with-avatar.post-without-avatar {
  grid-template-columns: minmax(0, 1fr);
}

.post-with-avatar.post-without-avatar > .content-main > .content-age {
  grid-column: 1;
}

.post-with-avatar.post-without-avatar > .content-main > h3 {
  grid-column: 1;
}

.post-with-avatar > .content-main > .content-age,
.comment-with-avatar > .content-main > .content-age {
  position: static !important;
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  margin-top: 2px;
  z-index: 1;
}

.post-with-avatar > .content-main > h3 {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 42px;
  margin-top: 0;
  margin-bottom: 10px;
  padding-right: 68px !important;
  overflow-wrap: anywhere;
}

.comment-with-avatar > .content-main > p:first-of-type,
.comment-with-avatar > .content-main > .deleted-comment-text {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 10px !important;
  margin-left: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  padding-right: 0 !important;
  overflow-wrap: anywhere;
}

.post-with-avatar > .content-main > p,
.post-with-avatar > .content-main > .read-more-link,
.post-with-avatar > .content-main > .content-image,
.post-with-avatar > .content-main > .meta,
.post-with-avatar > .content-main > .content-controls-row,
.post-with-avatar > .content-main > h4,
.post-with-avatar > .content-main > .comment-composer,
.post-with-avatar > .content-main > [id^="comments-container-"],
.comment-with-avatar > .content-main > .content-image,
.comment-with-avatar > .content-main > .meta,
.comment-with-avatar > .content-main > .content-controls-row,
.comment-with-avatar > .content-main > .reply-form {
  grid-column: 1 / -1;
  margin-left: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  min-width: 0;
}

.post-with-avatar > .content-main > p {
  grid-row: 2;
  margin-top: 0;
  padding-right: 0 !important;
  overflow-wrap: anywhere;
}

.post-with-avatar > .content-main > .content-image,
.comment-with-avatar > .content-main > .content-image {
  justify-self: stretch;
}

.post-with-avatar > .content-main > .content-image img,
.comment-with-avatar > .content-main > .content-image img,
.post-with-avatar > .content-main > .content-image video,
.comment-with-avatar > .content-main > .content-image video {
  max-width: 100%;
  height: auto;
}

@media (max-width: 640px) {
  .post-with-avatar,
  .comment-with-avatar {
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: 9px;
  }

  .post-with-avatar > .content-main > h3 {
    min-height: 36px;
    padding-right: 56px !important;
  }

  .comment-with-avatar > .content-main > p:first-of-type,
  .comment-with-avatar > .content-main > .deleted-comment-text {
    margin-top: 9px !important;
  }
}

/* v13: keep the strict header/body split, but restore metadata below real content.
   Body/media/action blocks remain full-width under the avatar; metadata is never promoted
   into the first body row, including image-only comments. */
.post-with-avatar > .content-main > .post-body,
.comment-with-avatar > .content-main > .comment-body,
.comment-with-avatar > .content-main > .deleted-comment-text {
  grid-column: 1 / -1;
  grid-row: auto !important;
  margin-top: 10px !important;
  margin-left: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  padding-right: 0 !important;
  overflow-wrap: anywhere;
}

.post-with-avatar > .content-main > .post-body {
  margin-top: 0 !important;
}

.comment-with-avatar > .content-main > p.meta,
.post-with-avatar > .content-main > p.meta {
  grid-column: 1 / -1;
  grid-row: auto !important;
  margin-top: 6px !important;
  margin-left: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  padding-right: 0 !important;
}

.comment-with-avatar > .content-main > p:first-of-type:not(.comment-body):not(.meta) {
  grid-column: 1 / -1;
  grid-row: auto !important;
  margin-top: 10px !important;
  margin-left: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  padding-right: 0 !important;
}

.post-with-avatar > .content-main > .content-image,
.comment-with-avatar > .content-main > .content-image {
  grid-column: 1 / -1;
  grid-row: auto !important;
  margin-top: 8px;
}

.post-with-avatar > .content-main > .read-more-link,
.post-with-avatar > .content-main > .content-controls-row,
.comment-with-avatar > .content-main > .content-controls-row,
.post-with-avatar > .content-main > h4,
.post-with-avatar > .content-main > .comment-composer,
.post-with-avatar > .content-main > [id^="comments-container-"],
.comment-with-avatar > .content-main > .reply-form {
  grid-column: 1 / -1;
  grid-row: auto !important;
}

/* Inline comment editing: textarea supports line breaks while keeping images immutable. */
.comment-edit-form {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
}

.comment-edit-form .comment-textarea {
  min-height: 108px;
}

.comment-with-avatar > .content-main > .comment-edit-form {
  grid-column: 1 / -1;
  width: auto;
  max-width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.moderator-order-controls {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
}

.moderator-order-controls button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.danger-zone {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid rgba(220, 38, 38, 0.45);
  border-radius: 12px;
  background: rgba(220, 38, 38, 0.08);
}

.danger-zone h3 {
  margin-top: 0;
}

.profile-settings-panel {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.profile-settings-panel > summary {
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.profile-settings-panel > summary::-webkit-details-marker {
  display: none;
}

.profile-settings-panel > summary::after {
  content: '▾';
  float: right;
  color: #6b7280;
  transition: transform 0.2s ease;
}

.profile-settings-panel[open] > summary::after {
  transform: rotate(180deg);
}

.profile-settings-panel > form {
  margin-top: 0.85rem;
}

.ban-duration-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 0.65rem 0;
}

.ban-duration-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.ban-duration-options input[type='number'] {
  max-width: 120px;
}

.network-ban-drawer {
  flex: 1 1 100%;
  width: 100%;
  margin: 0.35rem 0 0;
}

.network-ban-drawer > form {
  margin-top: 0.75rem;
}


.collapsible-comment-body {
  cursor: pointer;
}

.collapsible-comment-body:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.collapsed-comment-body {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clickable-post-content {
  cursor: pointer;
}

.clickable-post-content:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* Clickable post titles keep the regular title appearance. */
.post h3 a.post-title-link,
.post h3 a.post-title-link:visited,
.post h3 a.post-title-link:hover,
.post h3 a.post-title-link:focus {
  color: inherit;
  text-decoration: none;
}

.post h3 a.post-title-link {
  cursor: pointer;
}

/* The super moderator panel is now a closed-by-default drawer. */
.supermoderator-panel-body {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.supermoderator-panel > summary {
  cursor: pointer;
  font-weight: 700;
}

@media (max-width: 780px) {
  #account-drawer.mobile-sheet-active > #supermoderator-panel.mobile-account-supermoderator > summary {
    position: sticky;
    top: -14px;
    z-index: 1;
    margin: -14px -14px 0;
    padding: 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 18px 18px 0 0;
    font-size: 1rem;
  }
}

.topbar-more-menu {
  position: relative;
  z-index: 120;
  display: inline-flex;
  align-items: center;
}

.topbar-more-btn {
  min-width: 38px;
  white-space: nowrap;
}

.topbar-more-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 1000;
  min-width: 150px;
  display: grid;
  gap: 4px;
  padding: 6px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
}

.topbar-more-dropdown.hidden {
  display: none;
}

.topbar-more-item {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #374151;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.topbar-more-item:hover,
.topbar-more-item:focus-visible {
  background: #f3f4f6;
  outline: none;
}

.topbar-ticket-btn {
  white-space: nowrap;
}

.support-ticket-form {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
}

.support-ticket-list {
  display: grid;
  gap: 0.5rem;
  margin: 1rem 0;
}

.support-ticket-list-item {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.support-ticket-list-item.active,
.support-ticket-list-item:hover {
  background: var(--surface-muted, rgba(127, 127, 127, 0.08));
}

.support-ticket-chat {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.support-ticket-chat-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.support-ticket-messages {
  display: grid;
  gap: 0.75rem;
}

.support-ticket-message {
  padding: 0.75rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 0.75rem;
  background: var(--card-bg, rgba(255, 255, 255, 0.04));
}

.support-ticket-message.own {
  margin-left: 2rem;
}


@media (max-width: 780px) {
  .topbar {
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
  }

  .brand {
    grid-column: 1;
    justify-self: start;
  }

  .topbar-ticket-btn {
    grid-column: 2;
    justify-self: start;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.15;
  }


  .topbar-more-menu {
    grid-column: 2;
    justify-self: start;
    z-index: 1200;
  }

  .topbar-more-btn {
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.15;
  }

  .topbar-more-dropdown {
    left: 0;
    right: auto;
    z-index: 1300;
  }

  .header-user {
    grid-column: 3;
    justify-self: end;
    justify-content: flex-end;
    width: auto;
  }

  .header-user p {
    display: none;
  }

  .profile-avatar-btn {
    display: inline-flex;
  }

  .global-search-form,
  .topbar-nav {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .topbar {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  .brand,
  .header-user {
    justify-self: initial;
  }

  .brand {
    grid-column: 1;
  }

  .topbar-ticket-btn {
    grid-column: 2;
  }


  .topbar-more-menu {
    grid-column: 2;
    justify-self: start;
    z-index: 1200;
  }

  .topbar-more-btn {
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.15;
  }

  .topbar-more-dropdown {
    left: 0;
    right: auto;
    z-index: 1300;
  }

  .header-user {
    grid-column: 3;
    justify-self: end;
    justify-content: flex-end;
  }

  .global-search-form,
  .topbar-nav {
    grid-column: 1 / -1;
  }
}

/* v14: make post and comment attachments more compact so media does not dominate the viewport. */
.post-with-avatar > .content-main > .content-image,
.content-card.post .content-image,
.post .content-image {
  max-width: min(100%, 520px) !important;
  max-height: 340px !important;
  width: auto !important;
  height: auto !important;
  justify-self: start !important;
  object-fit: contain;
}

.comment-with-avatar > .content-main > .content-image,
.comment .content-image {
  max-width: min(100%, 360px) !important;
  max-height: 220px !important;
  width: auto !important;
  height: auto !important;
  justify-self: start !important;
  object-fit: contain;
}

@media (max-width: 640px) {
  .post-with-avatar > .content-main > .content-image,
  .content-card.post .content-image,
  .post .content-image {
    max-width: min(100%, 440px) !important;
    max-height: 260px !important;
  }

  .comment-with-avatar > .content-main > .content-image,
  .comment .content-image {
    max-width: min(100%, 300px) !important;
    max-height: 180px !important;
  }
}

/* v15: multi-image posts use a carousel from 2 to 10 images. */
/* v16: custom carousel avoids the compact .content-image rules used for single post/comment attachments. */
.manual-post-carousel {
  position: relative;
  width: min(100%, 760px);
  margin: 12px 0;
  border-radius: 16px;
  overflow: hidden;
  background: #f9fafb;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.24);
}

.manual-carousel-viewport {
  position: relative;
  display: grid;
  width: 100%;
  min-height: clamp(280px, 58vh, 620px);
  max-height: 72vh;
}

.manual-carousel-slide {
  grid-area: 1 / 1;
  display: none;
  width: 100%;
  height: 100%;
  min-height: inherit;
  max-height: inherit;
  margin: 0;
  place-items: center;
  background: #f9fafb;
}

.manual-carousel-slide.active {
  display: grid;
}

.manual-carousel-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
  max-height: inherit;
  object-fit: contain;
  border-radius: 0;
  cursor: zoom-in;
}

.manual-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 0;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 32px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  z-index: 2;
}

.manual-carousel-prev { left: 12px; }
.manual-carousel-next { right: 12px; }

.manual-carousel-counter {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 13px;
  z-index: 2;
}

.manual-carousel-dots {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 2;
}

.manual-carousel-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

.manual-carousel-dot.active {
  width: 20px;
  background: rgba(255, 255, 255, 0.95);
}

@media (max-width: 640px) {
  .manual-post-carousel {
    width: 100%;
  }

  .manual-carousel-viewport {
    min-height: clamp(240px, 52vh, 500px);
    max-height: 68vh;
  }

  .manual-carousel-btn {
    width: 36px;
    height: 36px;
    font-size: 28px;
  }
}

/* v17: make the custom multi-image carousel use the same visual limits as single post images,
   while still scaling each image up inside that box without cropping. */
.post-with-avatar > .content-main > .manual-post-carousel,
.content-card.post .manual-post-carousel,
.post .manual-post-carousel {
  grid-column: 1 / -1;
  grid-row: auto !important;
  justify-self: start;
  width: min(100%, 520px) !important;
  max-width: min(100%, 520px) !important;
  height: 340px !important;
  max-height: 340px !important;
  margin: 10px 0 !important;
  border-radius: 14px;
}

.post-with-avatar > .content-main > .manual-post-carousel .manual-carousel-viewport,
.content-card.post .manual-post-carousel .manual-carousel-viewport,
.post .manual-post-carousel .manual-carousel-viewport {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
}

.post-with-avatar > .content-main > .manual-post-carousel .manual-carousel-slide,
.content-card.post .manual-post-carousel .manual-carousel-slide,
.post .manual-post-carousel .manual-carousel-slide {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
}

.post-with-avatar > .content-main > .manual-post-carousel .manual-carousel-image,
.content-card.post .manual-post-carousel .manual-carousel-image,
.post .manual-post-carousel .manual-carousel-image {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
}

@media (max-width: 640px) {
  .post-with-avatar > .content-main > .manual-post-carousel,
  .content-card.post .manual-post-carousel,
  .post .manual-post-carousel {
    width: 100% !important;
    max-width: 100% !important;
    height: 260px !important;
    max-height: 260px !important;
  }
}

.manual-carousel-btn:disabled{opacity:.35;cursor:default;}
.manual-carousel-btn{line-height:0;}

/* v18: continuous hierarchy guides for nested comments.
   Draw the level marker on the thread container instead of on each comment card,
   so the vertical line is not interrupted by spacing between sibling comments. */
.comment-thread {
  position: relative;
  margin-left: 0 !important;
  padding-left: 12px;
}

.comment-thread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 999px;
  background: #111827;
  pointer-events: none;
}

.comment-thread + .comment-thread {
  margin-top: 0;
}

.comment-replies {
  position: relative;
  margin-left: 8px !important;
  padding-left: 14px !important;
  border-left: 0 !important;
}

.comment-replies:not(.hidden) {
  display: block;
}

.comment-replies > .comment-thread {
  margin-top: 0;
}

.comment {
  border-left: 0 !important;
  margin: 0 !important;
  padding: 9px 0 9px 9px;
}

.comment-replies > .comment-thread:first-child > .comment {
  padding-top: 9px;
}

.comment-replies > .comment-thread:last-child > .comment {
  padding-bottom: 9px;
}

@media (max-width: 640px) {
  .comment-thread {
    padding-left: 9px;
  }

  .comment-replies {
    margin-left: 4px !important;
    padding-left: 9px !important;
  }

  .comment {
    padding-left: 7px;
  }
}

.translation-toggle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.85rem;
  color: var(--muted-text, #666);
  white-space: nowrap;
  cursor: pointer;
}


.translation-toggle-label {
  order: 1;
  line-height: 1;
}

.translation-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.translation-toggle-track {
  order: 2;
  width: 2.2rem;
  height: 1.2rem;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.28);
  position: relative;
  transition: background 0.18s ease;
  flex: 0 0 auto;
}

.translation-toggle-track::after {
  content: '';
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: currentColor;
  transition: transform 0.18s ease;
}

.translation-toggle input:checked + .translation-toggle-track {
  background: rgba(127, 127, 127, 0.45);
}

.translation-toggle input:checked + .translation-toggle-track::after {
  transform: translateX(1rem);
}

.translation-toggle input:focus-visible + .translation-toggle-track {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}


.translation-status {
  font-size: 0.78rem;
  color: var(--muted-text);
  max-width: 16rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.translation-status-error {
  color: var(--danger);
}

.translated-content::after {
  content: ' translated';
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.72em;
  opacity: 0.7;
}

.translation-pending {
  opacity: 0.72;
}

.translation-error {
  text-decoration: underline dotted;
}

#translation-status,.translation-status{display:none!important;}
.translated-content::after{display:none!important;content:none!important;}

/* Keep Translate + profile avatar together on the top-right, especially on mobile. */
.topbar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
  min-width: max-content;
}

.topbar-actions .header-user {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  flex-wrap: nowrap !important;
}

.topbar-actions .header-user p {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions .profile-avatar-btn,
.topbar-actions .header-avatar {
  flex: 0 0 auto;
}

@media (max-width: 780px) {
  .topbar {
    display: grid !important;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    column-gap: 10px;
    row-gap: 8px;
  }

  .brand {
    grid-column: 1;
    justify-self: start;
  }

  .topbar-ticket-btn {
    grid-column: 2;
    justify-self: start;
  }

  .topbar-actions {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    margin-left: 0;
    max-width: 100%;
  }

  .topbar-actions .header-user {
    justify-self: auto;
    justify-content: flex-end;
  }

  .topbar-actions .header-user p {
    display: none !important;
  }

  .global-search-form {
    grid-column: 1 / -1 !important;
    grid-row: 2;
    width: 100%;
    margin: 0;
    order: initial;
  }

  .topbar-nav {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 420px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .topbar-actions {
    gap: 6px;
  }

  .translation-toggle {
    gap: 3px;
    font-size: 0.72rem;
  }

  .translation-toggle-track {
    width: 2rem;
    height: 1.1rem;
  }

  .translation-toggle-track::after {
    top: 0.14rem;
    left: 0.14rem;
    width: 0.82rem;
    height: 0.82rem;
  }

  .translation-toggle input:checked + .translation-toggle-track::after {
    transform: translateX(0.9rem);
  }

  .topbar-actions .header-avatar {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }
}

/* Desktop: keep the search bar before the Translate/profile group so the avatar stays at the far right.
   Mobile rules below keep Translate + avatar on the first row and move search to the second row. */
.topbar > .global-search-form {
  order: 3;
}

.topbar > .topbar-actions {
  order: 4;
  margin-left: 0;
}

@media (min-width: 781px) {
  .topbar > .global-search-form {
    flex: 1 1 420px;
  }

  .topbar > .topbar-actions {
    margin-left: 8px;
  }
}

@media (max-width: 780px) {
  .topbar > .topbar-actions {
    order: initial;
    margin-left: 0;
  }

  .topbar > .global-search-form {
    order: initial;
  }
}


/* Mobile v10: keep quick sheets fully inside the viewport while preserving their visual proportions. */
@media (max-width: 780px) {
  #communities-panel.mobile-sheet-active,
  #account-drawer.mobile-sheet-active,
  #notifications-drawer.mobile-sheet-active,
  #post-drawer.mobile-sheet-active {
    width: min(calc(100vw - 24px), 420px) !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: calc(var(--mobile-tabbar-height) + 10px + env(safe-area-inset-bottom, 0px)) !important;
    max-height: min(70dvh, 560px) !important;
    overflow: auto !important;
    padding: clamp(12px, 3.5vw, 16px) !important;
    border-radius: clamp(18px, 5vw, 22px) !important;
    transform: translateX(-50%) !important;
  }

  #communities-panel.mobile-sheet-active .section-heading h2,
  #account-drawer.mobile-sheet-active summary,
  #notifications-drawer.mobile-sheet-active summary,
  #post-drawer.mobile-sheet-active summary {
    top: calc(-1 * clamp(12px, 3.5vw, 16px));
    margin: calc(-1 * clamp(12px, 3.5vw, 16px)) calc(-1 * clamp(12px, 3.5vw, 16px)) 12px;
    padding: clamp(12px, 3.5vw, 16px);
  }

  #post-drawer.mobile-sheet-active,
  #notifications-drawer.mobile-sheet-active {
    display: block !important;
    flex-direction: initial !important;
  }

  #post-drawer.mobile-sheet-active textarea#post-body {
    min-height: clamp(130px, 30dvh, 220px) !important;
    flex: initial !important;
  }

  #post-drawer.mobile-sheet-active .community-picker-results,
  #notifications-drawer.mobile-sheet-active #notifications-list,
  #communities-panel.mobile-sheet-active .communities-list {
    max-height: min(42dvh, 330px);
    overflow: auto;
  }
}

@media (max-width: 430px) {
  #communities-panel.mobile-sheet-active,
  #account-drawer.mobile-sheet-active,
  #notifications-drawer.mobile-sheet-active,
  #post-drawer.mobile-sheet-active {
    width: calc(100vw - 20px) !important;
    max-height: min(66dvh, 500px) !important;
  }
}

/* Mobile v13: sheets are bottom-anchored to the visible viewport, with small side gutters. */
@media (max-width: 780px) {
  :root {
    --mobile-sheet-top: calc(96px + env(safe-area-inset-top, 0px));
    --mobile-sheet-bottom: calc(var(--mobile-tabbar-height) + 10px + env(safe-area-inset-bottom, 0px));
    --mobile-sheet-side: clamp(8px, 2.4vw, 12px);
    --mobile-sheet-height: calc(100dvh - var(--mobile-sheet-top) - var(--mobile-sheet-bottom));
  }

  #communities-panel.mobile-sheet-active,
  #account-drawer.mobile-sheet-active,
  #notifications-drawer.mobile-sheet-active,
  #post-drawer.mobile-sheet-active {
    left: var(--mobile-sheet-side) !important;
    right: var(--mobile-sheet-side) !important;
    top: auto !important;
    bottom: var(--mobile-sheet-bottom) !important;
    width: auto !important;
    max-width: calc(100vw - (2 * var(--mobile-sheet-side))) !important;
    min-width: 0 !important;
    height: var(--mobile-sheet-height) !important;
    max-height: var(--mobile-sheet-height) !important;
    margin: 0 !important;
    transform: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 22px !important;
    padding: 16px !important;
    box-sizing: border-box !important;
  }

  #account-drawer.mobile-sheet-active:not(:has(#supermoderator-panel.mobile-account-supermoderator:not(.hidden))) {
    top: auto !important;
    bottom: var(--mobile-sheet-bottom) !important;
    height: var(--mobile-sheet-height) !important;
    max-height: var(--mobile-sheet-height) !important;
  }

  #post-drawer.mobile-sheet-active,
  #notifications-drawer.mobile-sheet-active {
    display: flex !important;
    flex-direction: column !important;
  }

  #communities-panel.mobile-sheet-active .section-heading h2,
  #account-drawer.mobile-sheet-active > summary,
  #notifications-drawer.mobile-sheet-active > summary,
  #post-drawer.mobile-sheet-active > summary {
    top: -16px !important;
    margin: -16px -16px 14px !important;
    padding: 16px !important;
    border-radius: 22px 22px 0 0 !important;
  }

  #post-drawer.mobile-sheet-active textarea#post-body {
    min-height: clamp(220px, 42dvh, 420px) !important;
  }

  #post-drawer.mobile-sheet-active .community-picker-results,
  #notifications-drawer.mobile-sheet-active #notifications-list,
  #communities-panel.mobile-sheet-active .communities-list {
    max-height: none !important;
  }
}

/* Mobile v14: remove horizontal overflow so mobile browsers do not start zoomed out or expose empty space on the right. */
@media (max-width: 780px) {
  html,
  body {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: clip !important;
  }

  @supports not (overflow: clip) {
    html {
      overflow-x: hidden !important;
    }
  }

  body {
    position: relative;
    overflow-y: visible !important;
  }

  .topbar,
  .app-shell,
  .content-column,
  #posts,
  .post,
  .card,
  .feed-header-card,
  .profile-header,
  .community-header,
  .community-overview,
  .mobile-tabbar {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  img,
  video,
  canvas,
  iframe,
  pre,
  code,
  .post-body,
  .comment-body,
  .post-title,
  .community-description,
  .profile-bio {
    max-width: 100% !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .app-shell {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  #communities-panel.mobile-sheet-active,
  #account-drawer.mobile-sheet-active,
  #notifications-drawer.mobile-sheet-active,
  #post-drawer.mobile-sheet-active {
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    right: max(10px, env(safe-area-inset-right, 0px)) !important;
    width: auto !important;
    max-width: calc(100vw - 20px) !important;
  }
}


/* Mobile account actions: compact login/register buttons, matching desktop proportions. */
.login-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.login-action-row #login-btn,
.login-action-row #show-password-reset-request-btn {
  flex: 0 0 auto;
}

@media (max-width: 780px) {
  #account-drawer.mobile-sheet-active .login-action-row {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
  }

  #account-drawer.mobile-sheet-active .login-action-row #login-btn {
    width: auto !important;
    min-width: 96px;
    max-width: 150px;
    min-height: 0;
    margin: 6px 0;
    padding: 8px 14px;
    font-size: 0.9rem;
    line-height: 1.15;
    white-space: nowrap;
  }

  #account-drawer.mobile-sheet-active .login-action-row #show-password-reset-request-btn {
    width: auto !important;
    min-width: 0;
    max-width: none;
    min-height: 0;
    margin: 6px 0;
    padding: 6px 4px;
    font-size: 0.85rem;
    line-height: 1.15;
    white-space: nowrap;
  }

  #account-drawer.mobile-sheet-active #register-btn {
    width: auto !important;
    min-width: 138px;
    max-width: 190px;
    min-height: 0;
    align-self: flex-start;
    margin: 6px 0;
    padding: 8px 14px;
    font-size: 0.9rem;
    line-height: 1.15;
    white-space: nowrap;
  }
}


/* Mobile v16: keep the topbar sticky/auto-hide while preventing horizontal overflow.
   overflow-x:hidden on body can make sticky elements stick to the wrong scroll container on mobile browsers. */
@media (max-width: 780px) {
  .topbar {
    position: sticky !important;
    top: 0 !important;
    left: 0;
    right: 0;
    width: 100% !important;
    max-width: 100vw !important;
  }

  body.mobile-topbar-hidden:not(.mobile-sheet-visible) .topbar {
    transform: translate3d(0, calc(-100% - 2px), 0) !important;
  }
}


.supermoderator-summary-list li {
  align-items: flex-start;
  gap: 0.5rem;
}

.supermoderator-list-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.supermoderator-list-main .meta {
  overflow-wrap: anywhere;
}

.supermoderator-card-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.supermoderator-summary-card {
  margin-bottom: 0;
}

.supermoderator-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.supermoderator-user-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
}

.supermoderator-summary-actions {
  display: flex;
  justify-content: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.65rem;
}

.support-ticket-status {
  font-weight: 700;
}

.support-ticket-status.open {
  color: #2563eb;
}

.support-ticket-status.closed {
  color: #dc2626;
}

.supermoderator-summary-card .notification-details {
  overflow-wrap: anywhere;
}

#supermoderator-open-reports-drawer summary .badge {
  margin-left: 0.45rem;
  vertical-align: middle;
}

.supermoderator-report-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.supermoderator-report-link:hover strong,
.supermoderator-report-link:focus-visible strong {
  text-decoration: none;
}


/* Desktop overflow guard: prevents wide content from creating an empty horizontal scroll area. */
@media (min-width: 781px) {
  .topbar,
  .app-shell,
  .sidebar,
  .content-column,
  .sidebar-right,
  .card,
  .post,
  .feed-header-card {
    min-width: 0;
  }

  img,
  video,
  canvas,
  iframe,
  pre,
  code,
  .post-body,
  .comment-body,
  .post-title,
  .notification-details,
  .supermoderator-list-main,
  .supermoderator-summary-card {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

.legal-links-panel {
  display: grid;
  gap: 0.35rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
}

.legal-links-panel h3 {
  margin: 0 0 0.25rem;
}

.legal-links-panel a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  line-height: 1.35;
}

.checkbox-row input[type="checkbox"] {
  margin-top: 0.2rem;
  width: auto;
}

.legal-consent-row {
  font-size: 0.9rem;
}

.legal-consent-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
}

.legal-document-section {
  max-width: 920px;
}

.legal-document-content h2 {
  margin-top: 1.6rem;
}

.legal-document-content p {
  line-height: 1.65;
}

/* Mobile v17: account sheet super-moderation scrolling fixes.
   Keep only the main sheet title sticky; nested drawer titles must scroll normally
   so they cannot cover the Account header while the mobile Account sheet scrolls. */
@media (max-width: 780px) {
  #account-drawer.mobile-sheet-active {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  #account-drawer.mobile-sheet-active > summary {
    position: sticky !important;
    top: -16px !important;
    z-index: 10 !important;
    background: #fff !important;
  }

  #account-drawer.mobile-sheet-active > #supermoderator-panel.mobile-account-supermoderator:not(.hidden) {
    display: block !important;
    overflow: visible !important;
    max-height: none !important;
    min-height: 0 !important;
  }

  #account-drawer.mobile-sheet-active > #supermoderator-panel.mobile-account-supermoderator > summary {
    position: relative !important;
    top: auto !important;
    z-index: 1 !important;
    margin: 0 0 12px !important;
    padding: 0 0 12px !important;
    border-radius: 0 !important;
    background: #f8fafc !important;
  }

  #account-drawer.mobile-sheet-active > #supermoderator-panel.mobile-account-supermoderator .supermoderator-panel-body {
    overflow: visible !important;
    min-height: 0 !important;
  }

  #account-drawer.mobile-sheet-active > #supermoderator-panel.mobile-account-supermoderator .nested-drawer,
  #account-drawer.mobile-sheet-active > #supermoderator-panel.mobile-account-supermoderator .nested-drawer > summary {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
  }

  #account-drawer.mobile-sheet-active > #supermoderator-panel.mobile-account-supermoderator .nested-drawer > summary {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    pointer-events: auto !important;
  }
}

.bbcode-toolbar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0.35rem 0 0.75rem;
}

.bbcode-toolbar .bbcode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 2.15rem;
  margin: 0;
  padding: 0.3rem 0.55rem;
  line-height: 1.1;
  font-weight: 400;
}

.bbcode-toolbar .bbcode-btn:first-child {
  font-weight: 700;
}

.bbcode-btn em,
.bbcode-btn u,
.bbcode-btn s {
  font-weight: 400;
  pointer-events: none;
}

/* v21: post composer upload button and carousel arrow alignment polish. */
.file-picker label[for="post-image"].file-label {
  min-height: 42px;
  padding: 0.72rem 1.1rem;
  font-size: 0.96rem;
}

.manual-post-carousel .manual-carousel-btn {
  line-height: 1 !important;
  padding: 0 0 4px 0 !important;
  box-sizing: border-box;
}

/* Search UX fixes: keep mobile suggestion rows tappable and show community logos in every result type. */
.search-result-item.community-search-result {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.search-result-item.community-search-result > div {
  min-width: 0;
}

.search-result-item.community-search-result .content-age {
  right: 0;
}

.global-search-suggestion,
.global-search-all {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(99, 102, 241, 0.18);
}

@media (max-width: 780px) {
  .topbar {
    overflow: visible !important;
  }

  .global-search-form,
  .global-search-field {
    position: relative;
    z-index: 1501;
  }

  .global-search-suggestions {
    z-index: 1600;
    max-height: min(62dvh, 460px);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
}

/* v22: harmonize image/GIF picker buttons, tighten comment composer spacing, and add small-text BBCode. */
.file-picker .file-label {
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid #000000;
  border-radius: 10px;
  font-weight: 700;
  line-height: 1.15;
  box-sizing: border-box;
  text-decoration: none;
  user-select: none;
}

.file-picker .file-label:hover {
  opacity: 0.9;
}

.post-with-avatar > .content-main > h4 + .comment-composer {
  margin-top: 0;
}

.post-with-avatar > .content-main > h4:has(+ .comment-composer) {
  margin-bottom: 0.35rem;
}

.bbcode-small {
  font-size: 0.82em;
  line-height: 1.35;
}

.bbcode-toolbar-small {
  font-size: 0.82em;
  pointer-events: none;
}


.community-overview-card,
.community-context-themed {
  background: var(--community-post-background, white);
}

.community-context-themed {
  border-radius: 14px;
  padding: 12px;
  margin: -4px;
}

.moderator-tools .moderator-drawer > summary strong {
  font-weight: 800;
}

/* Community post background customization */
.post {
  background: var(--community-post-background, white);
}

.post .comment,
.comment-thread-context .comment {
  background: var(--community-post-background, #f9fafb);
}

.profile-post {
  border-radius: 12px;
  padding: 12px;
}

.community-theme-settings {
  display: grid;
  gap: 10px;
}

.community-theme-save-btn {
  justify-self: start;
  width: auto;
  padding: 6px 12px;
  font-size: 0.9rem;
  line-height: 1.2;
}

.community-theme-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
  max-width: 100%;
}

.community-theme-option {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  line-height: 1.2;
}

.community-theme-option input {
  margin: 0;
  flex: 0 0 auto;
}

.community-theme-option span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.community-theme-swatch {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: var(--theme-option-color, #fff);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}


@media (max-width: 640px) {
  .community-theme-settings {
    gap: 12px;
  }

  .community-theme-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .community-theme-option {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "input swatch"
      "label label";
    justify-items: center;
    min-height: 78px;
    padding: 10px 8px;
    text-align: center;
  }

  .community-theme-option input {
    grid-area: input;
    justify-self: end;
  }

  .community-theme-option .community-theme-swatch {
    grid-area: swatch;
    justify-self: start;
  }

  .community-theme-option span:last-child {
    grid-area: label;
    width: 100%;
    white-space: normal;
  }

  .community-theme-save-btn {
    justify-self: stretch;
    width: 100%;
    min-height: 42px;
  }
}

@media (max-width: 360px) {
  .community-theme-options {
    grid-template-columns: 1fr;
  }

  .community-theme-option {
    grid-template-columns: auto auto 1fr;
    grid-template-areas: "input swatch label";
    justify-items: start;
    min-height: 48px;
    text-align: left;
  }
}

.moderator-profile-link {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.moderator-profile-link:hover {
  text-decoration: underline;
}

.deleted-content-post .content-image {
  max-width: min(100%, 520px) !important;
  max-height: 340px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
}

.deleted-content-comment .content-image {
  max-width: min(100%, 360px) !important;
  max-height: 220px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
}

.deleted-content-post .manual-post-carousel {
  width: min(100%, 520px) !important;
  max-width: min(100%, 520px) !important;
  height: 340px !important;
  max-height: 340px !important;
}

.deleted-content-post .manual-post-carousel .manual-carousel-viewport,
.deleted-content-post .manual-post-carousel .manual-carousel-slide {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
}

.deleted-content-post .manual-post-carousel .manual-carousel-image {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
}

@media (max-width: 640px) {
  .deleted-content-post .content-image {
    max-width: min(100%, 440px) !important;
    max-height: 260px !important;
  }

  .deleted-content-comment .content-image {
    max-width: min(100%, 300px) !important;
    max-height: 180px !important;
  }

  .deleted-content-post .manual-post-carousel {
    width: 100% !important;
    max-width: 100% !important;
    height: 260px !important;
    max-height: 260px !important;
  }
}


.leaderboard-card {
  display: grid;
  gap: 0.75rem;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}

.leaderboard-rank {
  font-weight: 800;
  color: var(--muted);
}

.leaderboard-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.leaderboard-user a {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.leaderboard-score {
  font-size: 1.1rem;
}

.leaderboard-score.negative {
  color: #991b1b;
}

@media (max-width: 560px) {
  .leaderboard-row {
    grid-template-columns: 3rem 1fr auto;
    gap: 0.65rem;
    padding: 0.75rem;
  }
}


/* Keep the topbar overflow menu above the search row on small screens. */
@media (max-width: 780px) {
  .topbar {
    overflow: visible;
  }

  .topbar-more-menu {
    position: relative;
    z-index: 1200;
  }

  .topbar-more-dropdown {
    z-index: 1300;
  }

  .global-search-form {
    z-index: 1;
  }
}


/* Mobile search: the result-page header should scroll with the page.
   Feed/community/post views hide or intentionally stick their own headers, but search uses
   the shared .feed-header-card for guidance text. Keep it static so the description does
   not stay pinned at the top while browsing results. */
@media (max-width: 780px) {
  body.search-view .feed-header-card {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
  }
}

/* Edit profile: separate avatar and bio controls. */
.edit-profile-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.edit-profile-block {
  padding: 0.85rem;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.edit-profile-block h3 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
}

.edit-profile-block textarea {
  min-height: 110px;
}

.black-btn {
  background: #000;
  color: #fff;
  border-color: #000;
}

.black-btn:hover {
  background: #111;
  border-color: #111;
}

.comment-edit-history {
  margin: 0.65rem 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.9);
}

.comment-edit-history > summary {
  cursor: pointer;
  font-weight: 800;
  color: #111827;
}

.comment-edit-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.comment-edit-history-version {
  padding: 0.6rem;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  background: #fff;
}

.comment-edit-history-version.current-version {
  border-color: #9ca3af;
}

.comment-edit-history-version .meta {
  margin-bottom: 0.35rem;
}

.comment-edit-history-body p:last-child {
  margin-bottom: 0;
}

.comment-version-navigator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.35rem 0;
  padding: 0.25rem 0.4rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.92);
}

.comment-version-arrow {
  min-width: 2rem;
  padding: 0.2rem 0.45rem;
  font-size: 1.05rem;
  line-height: 1;
}

.comment-version-arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.comment-version-label {
  white-space: nowrap;
}

.comment[data-collapsible-comment-id] .content-image {
  cursor: pointer;
}

/* Keep upload picker labels visible on gray community themes. */
.file-label.secondary-btn,
label.secondary-btn[for*="image"],
label.secondary-btn[for*="gif"],
label.secondary-btn[for*="avatar"] {
  border: 1px solid #000000;
}

.list-sort-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.list-sort-tabs .secondary-btn.active {
  border-color: #000000;
  box-shadow: inset 0 0 0 1px #000000;
}

.post-community-selected-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.post-community-selected-row .community-picker-selected {
  margin: 0;
}

.community-rules-modal {
  z-index: 1700;
}

.community-rules-modal.hidden {
  display: none;
}

.community-rules-modal-card {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.modal-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.community-rules-popup-body {
  display: grid;
  gap: 10px;
}

.community-rules-popup-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.community-rule-popup-panel {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.community-rule-popup-title {
  margin: 0;
  padding: 12px 14px;
  background: #f8fafc;
  color: inherit;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
}

.community-rule-popup-content {
  margin: 0;
  padding: 12px 14px 14px;
  white-space: pre-wrap;
}

.comment-sort-tabs {
  margin: 8px 0 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.48);
}

.community-rule-edit-modal.hidden {
  display: none;
}

.community-rule-edit-modal-card {
  width: min(620px, calc(100vw - 32px));
}

.community-rule-edit-form {
  display: grid;
  gap: 10px;
}

.community-rule-edit-form label {
  font-weight: 800;
}

.community-rule-edit-form input,
.community-rule-edit-form textarea {
  width: 100%;
}

.community-rule-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .mobile-tabbar-item.mobile-tabbar-disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
  }
}

.post-spoiler-toggle {
  margin: 0.35rem 0 0.25rem;
}

.post-spoiler-placeholder {
  display: block;
  grid-column: 1 / -1;
  grid-row: auto !important;
  border: 1px dashed var(--border-color, #c8c8c8);
  border-radius: 12px;
  padding: 0.85rem;
  margin: 0.5rem 0;
  background: rgba(0, 0, 0, 0.04);
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
}

.post-spoiler-placeholder p {
  margin: 0.35rem 0 0;
}

.spoiler-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.12);
}

.post-thread-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin: 0.75rem 0;
}

.post-thread-nav a:last-child {
  margin-left: auto;
}

.post-thread-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: auto;
  min-width: max-content;
  white-space: nowrap;
  text-decoration: none;
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  line-height: 1;
}
