.nw-communities {
  --nw-live-card-padding: 14px;
  --nw-live-card-radius: 16px;
  --nw-live-card-gap: 10px;
  --nw-live-card-action-gap: 6px;
  --nw-live-card-action-min-height: 34px;
  --nw-live-card-title-size: 14px;
  --nw-live-card-meta-size: 9px;
}

.nw-communities .community-list,
.nw-communities .live-persistent-rooms {
  align-items: start;
  grid-auto-rows: auto;
  gap: var(--nw-live-card-gap);
}

.nw-communities .community-card,
.nw-communities .live-persistent-room {
  min-height: 0;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: var(--nw-live-card-radius);
  padding: var(--nw-live-card-padding);
}

.nw-communities .community-card {
  background: linear-gradient(145deg,rgba(24,20,33,.97),rgba(14,12,19,.98));
}

.nw-communities .live-persistent-room {
  background: rgba(255,255,255,.025);
}

.nw-communities .community-head {
  display: grid;
  grid-template-columns: 45px minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--nw-live-card-gap);
}

.nw-communities .community-copy {
  min-width: 0;
}

.nw-communities .community-icon {
  width: 45px;
  height: 45px;
  flex: 0 0 45px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg,#2a1e3e,#15101d);
  font-size: 20px;
}

.nw-communities .community-copy h3 {
  margin: 1px 0 3px;
  font-size: 16px;
}

.nw-communities .community-copy p {
  margin: 0;
  color: #938b9f;
  font-size: 14.08px;
  font-weight: 400;
  line-height: 22.528px;
}

/* Structural guard for legacy markup: duplicated pills never become card content. */
.nw-communities .community-card > .community-meta {
  display: none !important;
}

.nw-communities .community-state-actions,
.nw-communities .nw-live-card-actions {
  display: grid;
  align-content: start;
  gap: var(--nw-live-card-action-gap);
}

.nw-communities .community-state-actions {
  width: auto;
  padding-left: 0;
  display: flex;
  flex-flow: row wrap;
  justify-content: flex-end;
}

.nw-communities .community-state-actions button,
.nw-communities .live-persistent-actions button {
  min-height: var(--nw-live-card-action-min-height);
  padding: 7px 10px;
}

.nw-communities .join,
.nw-communities .follow {
  border: 1px solid rgba(139,92,246,.27);
  border-radius: 10px;
  background: rgba(139,92,246,.09);
  color: #d9cdff;
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
}

.nw-communities .join.joined,
.nw-communities .follow.followed {
  border-color: var(--line);
  background: rgba(255,255,255,.03);
  color: #a69dad;
}

.nw-communities .live-follow-toggle {
  white-space: nowrap;
}

.nw-communities .live-follow-toggle[data-follow] {
  min-width: 54px;
}

.nw-communities .live-follow-toggle[data-follow-room] {
  min-width: 72px;
}

.nw-communities .live-follow-toggle[data-follow-channel] {
  min-width: 108px;
}

.nw-communities .live-favorite-toggle {
  width: var(--nw-live-card-action-min-height);
  min-width: var(--nw-live-card-action-min-height);
  height: var(--nw-live-card-action-min-height);
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.nw-communities .live-favorite-toggle.favorited {
  color: #f5cf62;
}

.nw-communities .live-follow-toggle[aria-busy="true"],
.nw-communities .live-favorite-toggle[aria-busy="true"] {
  cursor: progress;
  opacity: .66;
}

.nw-communities .community-live {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.nw-communities .live-title {
  margin-bottom: 7px;
}

.nw-communities .live-title b { font-size: 11.52px; font-weight: 400; line-height: normal; }
.nw-communities .room-list { display: grid; gap: 7px; }
.nw-communities .room-row { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 12px; padding: 9px; background: rgba(255,255,255,.022); }
.nw-communities .room-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 11px rgba(110,231,183,.36); }
.nw-communities .room-copy { min-width: 0; flex: 1; }
.nw-communities .room-copy b { display: block; font-size: 14.08px; font-weight: 400; line-height: 22.528px; }
.nw-communities .room-copy span { display: block; margin-top: 2px; color: #847c91; font-size: 11.52px; font-weight: 400; line-height: normal; }
.nw-communities .room-row button { border: 0; border-radius: 9px; padding: 7px 9px; background: rgba(139,92,246,.1); color: #d8ccff; font-size: 12px; font-weight: 400; line-height: normal; }
.nw-communities .empty-live { border: 1px dashed rgba(255,255,255,.09); border-radius: 12px; padding: 10px; color: #867e92; font-size: 14.08px; font-weight: 400; line-height: 22.528px; }

.nw-communities .community-actions {
  margin-top: 8px;
}

.nw-communities .community-actions button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: rgba(255,255,255,.025);
  color: #b8b0c5;
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
  text-align: center;
}

.nw-communities .community-actions button.accent { border-color: rgba(139,92,246,.25); background: rgba(139,92,246,.07); color: #d8ccff; }
.nw-communities .community-actions button[aria-disabled="true"] { border-color: var(--line); background: rgba(255,255,255,.02); color: #82798f; }

.nw-communities .live-persistent-rooms {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.nw-communities .live-persistent-room {
  display: grid;
  gap: 12px;
}

.nw-communities .live-persistent-room-cover {
  position: relative;
  min-height: 132px;
  overflow: hidden;
  border: 1px solid rgba(139,92,246,.18);
  border-radius: 12px;
  background: radial-gradient(circle at 28% 24%,rgba(139,92,246,.35),transparent 42%),#100c17;
}

.nw-communities .live-persistent-room-cover>img {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  object-fit: cover;
}

.nw-communities .live-persistent-room-cover.has-room-cover>img { display: block; }
.nw-communities .live-persistent-room-cover>span { position: absolute; inset: 0; display: grid; place-items: center; }
.nw-communities .live-persistent-room-cover.has-room-cover>span { display: none; }
.nw-communities .live-persistent-room-cover .live-persistent-mode-icon { width: 34px; height: 34px; }
.nw-communities .live-persistent-room-cover .live-persistent-mode-icon svg { width: 28px; height: 28px; }

.nw-communities .live-persistent-room-main {
  min-width: 0;
}

.nw-communities .live-persistent-room-footer {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.nw-communities .live-persistent-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.nw-communities .live-persistent-mode-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: grid;
  place-items: center;
  color: #cdbdff;
}

.nw-communities .live-persistent-mode-icon svg {
  width: 15px;
  height: 15px;
}

.nw-communities .live-persistent-room h3 {
  min-width: 0;
  margin: 0;
  font-size: 16px;
}

.nw-communities .live-persistent-description {
  display: -webkit-box;
  overflow: hidden;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14.08px;
  font-weight: 400;
  line-height: 22.528px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.nw-communities .live-persistent-room-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.nw-communities .live-persistent-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
}

.nw-communities .live-persistent-status-dot.live {
  background: var(--good);
}

.nw-communities .live-persistent-status-dot.ready {
  background: #d58cff;
}

.nw-communities .live-persistent-status-dot.offline {
  background: #77707f;
}

.nw-communities .live-persistent-access,
.nw-communities .live-persistent-count {
  text-transform: uppercase;
}

.nw-communities .live-persistent-access {
  font-size: 10.88px;
  font-weight: 850;
  line-height: normal;
}

.nw-communities .live-persistent-count {
  font-size: 11.52px;
  font-weight: 400;
  line-height: normal;
}

.nw-communities .live-persistent-actions {
  flex: 0 0 auto;
  margin-left: auto;
}

.nw-communities .live-persistent-room-footer .live-persistent-actions {
  display: flex;
  flex-flow: row wrap;
  justify-content: flex-end;
}

.nw-communities .live-persistent-viewer-actions {
  display: flex;
  flex-flow: row wrap;
  justify-content: flex-end;
}

.nw-communities .live-persistent-actions button {
  border: 1px solid rgba(139,92,246,.28);
  border-radius: 10px;
  background: rgba(139,92,246,.1);
  font-size: 10px;
  font-weight: 850;
}

.nw-communities .live-persistent-actions button:not(.live-favorite-toggle) {
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
}

@media (max-width: 430px) {
  .nw-communities {
    --nw-live-card-padding: 12px;
    --nw-live-card-gap: 9px;
    --nw-live-card-action-min-height: 36px;
  }

  .nw-communities .community-head {
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }

  .nw-communities .community-icon {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .nw-communities .live-persistent-rooms {
    grid-template-columns: 1fr;
  }

  .nw-communities .live-persistent-room {
    gap: 10px;
  }

  .nw-communities .live-persistent-actions {
    width: auto;
    min-width: 0;
    display: flex;
    flex-flow: row wrap;
  }

  .nw-communities .live-persistent-viewer-actions {
    width: auto;
    min-width: 0;
    display: flex;
  }

  .nw-communities .community-copy h3,
  .nw-communities .live-persistent-room h3 {
    font-size: 15px;
  }

  .nw-communities .community-copy p,
  .nw-communities .live-persistent-description {
    font-size: 14.08px;
    font-weight: 400;
    line-height: 22.528px;
  }

  .nw-communities .room-copy b,
  .nw-communities .empty-live {
    font-size: 14.08px;
    font-weight: 400;
    line-height: 22.528px;
  }

  .nw-communities .room-copy span,
  .nw-communities .live-title b,
  .nw-communities .live-persistent-count {
    font-size: 11.52px;
    font-weight: 400;
    line-height: normal;
  }

  .nw-communities .live-persistent-access {
    font-size: 10.88px;
    font-weight: 850;
    line-height: normal;
  }

  .nw-communities .join,
  .nw-communities .follow,
  .nw-communities .room-row button,
  .nw-communities .community-actions button,
  .nw-communities .live-persistent-actions button:not(.live-favorite-toggle) {
    font-size: 12px;
    font-weight: 400;
    line-height: normal;
  }
}

@media (max-width: 359px) {
  .nw-communities .community-head {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }

  .nw-communities .community-state-actions button {
    min-width: 48px;
    padding-inline: 6px;
  }

  .nw-communities .live-persistent-room {
    gap: 9px;
  }

  .nw-communities .live-persistent-room-footer {
    align-items: flex-start;
  }

  .nw-communities .live-persistent-actions {
    margin-left: 0;
  }
}
