.community-page-shell {
  padding: 1.25rem clamp(1rem, 2vw, 2rem) 2rem;
  min-height: calc(100vh - 180px);
}

.community-page-shell [hidden] {
  display: none !important;
}

.community-app {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(280px, 360px);
  gap: 1rem;
  min-height: calc(100vh - 240px);
}

.community-mode-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(57, 255, 136, 0.22);
  background: linear-gradient(135deg, rgba(9, 18, 15, 0.96), rgba(17, 29, 22, 0.9));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
}

.community-mode-banner__badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(57, 255, 136, 0.14);
  border: 1px solid rgba(57, 255, 136, 0.2);
  color: #bcffd8;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.4rem 0.7rem;
  white-space: nowrap;
}

.community-mode-banner__content strong {
  display: block;
  margin-bottom: 0.2rem;
}

.community-mode-banner__content p {
  margin: 0;
  color: rgba(220, 232, 226, 0.78);
  line-height: 1.5;
}

.community-sidebar,
.community-main,
.community-sidepanel {
  min-width: 0;
}

.community-sidebar,
.community-panel-card,
.community-main {
  border: 1px solid rgba(57, 255, 136, 0.14);
  background:
    linear-gradient(180deg, rgba(9, 14, 22, 0.96), rgba(13, 18, 28, 0.96)),
    radial-gradient(circle at top, rgba(57, 255, 136, 0.16), transparent 42%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.community-sidebar,
.community-panel-card {
  border-radius: 8px;
}

.community-sidebar {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.community-sidebar__brand h1 {
  margin: 0.5rem 0;
  font-size: clamp(1.3rem, 2vw, 1.9rem);
  line-height: 1.1;
}

.community-sidebar__brand p,
.community-user-status p,
.community-main__title p,
.community-empty-state p,
.community-topic-card p,
.community-thread__topic p,
.community-reply__body,
.community-guest-cta p {
  color: rgba(220, 232, 226, 0.76);
}

.community-user-status {
  padding: 0.85rem 0.95rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(57, 255, 136, 0.1);
}

.community-channel-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.community-channel-group__title {
  color: rgba(221, 236, 229, 0.52);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.community-channel {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  padding: 0.8rem 0.85rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #edf8f0;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.community-channel:hover,
.community-channel:focus-visible {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(57, 255, 136, 0.16);
}

.community-channel.is-active {
  background: linear-gradient(135deg, rgba(57, 255, 136, 0.16), rgba(57, 255, 136, 0.04));
  border-color: rgba(57, 255, 136, 0.3);
}

.community-channel__hash {
  color: #39ff88;
  font-size: 1rem;
  line-height: 1.2;
}

.community-channel__text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.community-channel__text strong {
  font-size: 0.95rem;
}

.community-channel__text small {
  color: rgba(221, 236, 229, 0.62);
  line-height: 1.35;
}

.community-main {
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.community-main__header,
.community-main__budget,
.community-feed__actions,
.community-composer {
  padding-inline: 1rem;
}

.community-main__header {
  padding-top: 1rem;
  padding-bottom: 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(57, 255, 136, 0.08);
}

.community-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0 1rem 0.75rem;
}

.community-view-tab {
  border: 1px solid rgba(57, 255, 136, 0.12);
  background: rgba(255, 255, 255, 0.025);
  color: rgba(242, 250, 245, 0.9);
  border-radius: 999px;
  padding: 0.44rem 0.8rem;
  cursor: pointer;
}

.community-view-tab.is-active {
  background: linear-gradient(135deg, rgba(57, 255, 136, 0.16), rgba(57, 255, 136, 0.04));
  border-color: rgba(57, 255, 136, 0.28);
  color: #f5fff8;
}

.community-rules-toggle {
  margin-left: auto;
}

.community-main__workspace {
  display: flex;
  flex-direction: column;
}

.community-main__title {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
}

.community-main__title h2 {
  margin: 0;
  font-size: 1rem;
}

.community-main__stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.2rem;
  font-size: 0.82rem;
  color: rgba(221, 236, 229, 0.62);
}

.community-channel-pill,
.community-budget-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(57, 255, 136, 0.12);
  border: 1px solid rgba(57, 255, 136, 0.18);
  color: #bcffd8;
}

.community-channel-pill {
  padding: 0.5rem 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.community-main__budget {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid rgba(57, 255, 136, 0.08);
}

.community-budget-chip {
  padding: 0.42rem 0.7rem;
  font-size: 0.8rem;
}

.community-feed {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.community-message {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.community-message.is-deleted {
  opacity: 0.8;
}

.community-avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #08110d;
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.community-message__body {
  min-width: 0;
}

.community-message__meta,
.community-thread__meta,
.community-topic-card__meta,
.community-reply__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.82rem;
  color: rgba(221, 236, 229, 0.62);
}

.community-message__meta strong {
  font-size: 0.95rem;
  color: #f4fff7;
}

.community-message__text,
.community-thread__topic p,
.community-reply__body {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
  line-height: 1.55;
}

.community-message__actions,
.community-reply__actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.community-message__action {
  border: 1px solid rgba(57, 255, 136, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(231, 244, 236, 0.82);
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}

.community-feed__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
  border-top: 1px solid rgba(57, 255, 136, 0.08);
}

.community-inline-note {
  color: rgba(221, 236, 229, 0.65);
  font-size: 0.84rem;
}

.community-inline-note[data-kind="error"] {
  color: #ff9b9b;
}

.community-inline-note[data-kind="success"] {
  color: #8dffbf;
}

.community-inline-note[data-kind="loading"] {
  color: #d1f8df;
}

.community-composer {
  padding-top: 0.9rem;
  padding-bottom: 1rem;
  border-top: 1px solid rgba(57, 255, 136, 0.08);
}

.community-composer__form,
.community-topic-form,
.community-thread__composer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.community-composer__label {
  font-size: 0.92rem;
  color: rgba(231, 244, 236, 0.88);
}

.community-composer textarea,
.community-topic-form textarea,
.community-topic-form input,
.community-topic-form select,
.community-thread__composer textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(57, 255, 136, 0.14);
  background: rgba(2, 6, 12, 0.55);
  color: #f3fff7;
  padding: 0.85rem 0.9rem;
  resize: vertical;
}

.community-composer__footer,
.community-topic-form__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.community-composer__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.community-counter {
  color: rgba(221, 236, 229, 0.56);
  font-size: 0.82rem;
}

.community-guest-cta,
.community-empty-state,
.community-loading-state,
.community-error-state {
  padding: 1rem;
  border-radius: 8px;
  border: 1px dashed rgba(57, 255, 136, 0.2);
  background: rgba(255, 255, 255, 0.02);
}

.community-sidepanel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.community-panel-card {
  padding: 1rem;
}

.community-panel-card--summary {
  position: sticky;
  top: 0;
}

.community-panel-card__summary {
  margin: 0 0 0.9rem;
  color: rgba(220, 232, 226, 0.76);
  line-height: 1.55;
}

.community-panel-card__shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.community-featured-topic {
  padding: 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(57, 255, 136, 0.1);
  background: rgba(255, 255, 255, 0.025);
}

.community-featured-topic strong {
  display: block;
  margin-bottom: 0.25rem;
}

.community-featured-topic p {
  margin: 0;
  color: rgba(220, 232, 226, 0.76);
}

.community-rules-modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 10, 0.72);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 1rem;
}

.community-rules-modal__dialog {
  width: min(100%, 460px);
  border-radius: 14px;
  border: 1px solid rgba(57, 255, 136, 0.2);
  background:
    linear-gradient(180deg, rgba(8, 12, 19, 0.98), rgba(11, 16, 24, 0.98)),
    radial-gradient(circle at top, rgba(57, 255, 136, 0.14), transparent 48%);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.42);
  padding: 1rem;
}

.community-rules-modal__header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}

.community-rules-modal__header h2 {
  margin: 0.2rem 0 0;
  font-size: 1.2rem;
}

.community-rules-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.community-panel-card__header {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.community-topics-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.community-rule-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.55rem;
  color: rgba(231, 244, 236, 0.82);
}

.community-topics-list,
.community-thread {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.community-topic-card {
  border: 1px solid rgba(57, 255, 136, 0.12);
  background: rgba(255, 255, 255, 0.025);
  color: inherit;
  border-radius: 8px;
  padding: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.community-topic-card.is-active {
  border-color: rgba(57, 255, 136, 0.28);
  background: linear-gradient(135deg, rgba(57, 255, 136, 0.12), rgba(57, 255, 136, 0.03));
}

.community-topic-card strong,
.community-thread__topic h3 {
  display: block;
  margin-top: 0.35rem;
}

.community-thread__topic,
.community-reply {
  border-radius: 8px;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.community-thread__topic h3 {
  margin-bottom: 0.4rem;
}

.community-topic-form label,
.community-thread__composer label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: rgba(231, 244, 236, 0.9);
}

.community-panel-card--thread .community-thread {
  max-height: 520px;
  overflow: auto;
}

@media (max-width: 1180px) {
  .community-app {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .community-sidepanel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .community-page-shell {
    padding-inline: 0.75rem;
  }

  .community-app {
    grid-template-columns: 1fr;
  }

  .community-sidepanel {
    grid-template-columns: 1fr;
  }

  .community-main__header,
  .community-feed__actions,
  .community-composer__footer,
  .community-topic-form__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .community-view-tabs {
    align-items: stretch;
  }

  .community-rules-toggle {
    margin-left: 0;
  }

  .community-main__title {
    flex-direction: column;
  }

  .community-main__stats {
    align-items: flex-start;
  }

  .community-message {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .community-message__actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .community-panel-card--summary {
    position: static;
  }
}
