.community_bridge_frame {
  position: absolute;
  width: 1px;
  height: 1px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.community_portal_button {
  position: absolute;
  top: var(--space_6);
  right: var(--space_6);
  z-index: calc(var(--z_overlay) + 5);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid rgba(251, 180, 102, 0.58);
  border-radius: 999px;
  padding: 0.58rem 0.95rem;
  background: rgba(15, 21, 39, 0.88);
  color: var(--color_text_primary);
  cursor: pointer;
  transition: border-color var(--dur_fast) var(--ease_standard), transform var(--dur_fast) var(--ease_standard);
}

.community_portal_button:hover {
  transform: translateY(-1px);
}

.community_portal_button__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f8a34f;
  box-shadow: 0 0 12px rgba(248, 163, 79, 0.55);
}

.community_portal_button__label {
  font-size: var(--text_sm);
  font-weight: 600;
}

.community_portal_button.is_cta::before {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px solid rgba(251, 176, 90, 0.44);
  border-radius: 999px;
  animation: community_pulse 4s ease-out infinite;
}

.community_portal_button.is_joined {
  border-color: rgba(103, 214, 153, 0.58);
}

.community_portal_button.is_joined .community_portal_button__dot {
  background: #67d699;
  box-shadow: 0 0 12px rgba(103, 214, 153, 0.52);
}

.community_portal_button.is_joined.is_offline {
  border-color: rgba(147, 161, 182, 0.52);
}

.community_portal_button.is_joined.is_offline .community_portal_button__dot {
  background: #95a2b7;
  box-shadow: none;
}

.community_drawer {
  position: absolute;
  top: calc(var(--space_6) + 52px);
  right: var(--space_6);
  width: 320px;
  height: calc(100vh - var(--space_6) * 2 - 52px);
  z-index: calc(var(--z_overlay) + 4);
  border: 1px solid var(--color_border);
  border-radius: var(--radius_lg);
  background: rgba(8, 12, 24, 0.93);
  backdrop-filter: blur(10px);
  transform: translateX(116%);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--dur_med) var(--ease_standard), opacity var(--dur_med) var(--ease_standard);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.community_drawer.is_open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.community_drawer__header {
  padding: var(--space_4);
  border-bottom: 1px solid var(--color_border);
}

.community_drawer__header h3 {
  margin: 0;
  font-size: var(--text_md);
}

.community_drawer__body {
  padding: var(--space_4);
  overflow-y: auto;
}

.community_drawer__item {
  width: 100%;
  border: 1px solid var(--color_border);
  border-radius: var(--radius_md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--color_text_primary);
  padding: var(--space_3);
  text-align: left;
  cursor: pointer;
}

.community_drawer__item:hover {
  border-color: rgba(255, 255, 255, 0.48);
}

.community_drawer__footer {
  padding: var(--space_4);
  border-top: 1px solid var(--color_border);
  background: rgba(255, 255, 255, 0.02);
}

.community_drawer__username {
  margin: 0;
  font-size: var(--text_sm);
  color: var(--color_text_primary);
}

.community_drawer__presence {
  margin: 0.4rem 0 0;
  font-size: var(--text_xs);
  color: var(--color_text_secondary);
  text-transform: capitalize;
}

.community_drawer__actions {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.45rem;
}

.community_drawer__action_btn {
  border: 1px solid var(--color_border);
  border-radius: var(--radius_sm);
  background: transparent;
  color: var(--color_text_primary);
  padding: 0.5rem 0.65rem;
  cursor: pointer;
}

.community_drawer__action_btn:hover {
  border-color: rgba(255, 255, 255, 0.48);
}

.community_chat_window {
  position: absolute;
  right: calc(var(--space_6) + 200px);
  bottom: var(--space_6);
  width: min(672px, calc(100vw - 420px));
  height: min(560px, calc(100vh - 180px));
  min-width: 340px;
  z-index: calc(var(--z_overlay) + 3);
  border: 1px solid var(--color_border);
  border-radius: var(--radius_lg);
  background: rgba(8, 12, 24, 0.95);
  backdrop-filter: blur(8px);
  overflow: hidden;
  display: none;
  grid-template-rows: auto 1fr;
  transform: translateY(0);
  transition: transform 0.28s ease;
  will-change: transform;
}

.community_chat_window.is_open {
  display: grid;
}

.community_chat_window.is_minimized {
  transform: translateY(calc(100% - 48px));
}

.community_chat_window__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--color_border);
}

.community_chat_window__header h4 {
  margin: 0;
  font-size: var(--text_sm);
}

.community_chat_window__header_actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.community_chat_window__toggle,
.community_chat_window__close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--color_border);
  border-radius: 6px;
  background: transparent;
  color: var(--color_text_primary);
  cursor: pointer;
}

.community_chat_window__toggle:hover,
.community_chat_window__close:hover {
  border-color: rgba(255, 255, 255, 0.5);
}

.community_chat_window__content {
  min-height: 0;
  position: relative;
  transition: opacity 0.18s ease;
}

.community_chat_window__frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #0a1020;
}

.community_chat_window__loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 16, 32, 0.92);
  color: var(--color_text_primary);
  font-size: var(--text_sm);
  letter-spacing: 0.01em;
  z-index: 2;
  transition: opacity 0.2s ease;
}

.community_chat_window__loading[aria-hidden="true"] {
  opacity: 0;
  pointer-events: none;
}

.community_chat_window.is_loading .community_chat_window__frame {
  visibility: hidden;
}

.community_chat_window.is_minimized .community_chat_window__content {
  opacity: 0;
  pointer-events: none;
}

.community_modal,
.community_profile_modal {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z_overlay) + 20);
  display: none;
}

.community_modal.is_open,
.community_profile_modal.is_open {
  display: block;
}

.community_modal__backdrop,
.community_profile_modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 24, 0.72);
}

.community_modal__dialog,
.community_profile_modal__dialog {
  position: relative;
  width: min(560px, calc(100vw - 2rem));
  margin: 10vh auto 0;
  border: 1px solid var(--color_border);
  border-radius: var(--radius_lg);
  background: rgba(8, 12, 24, 0.98);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
  padding: 1.25rem;
}

.community_profile_modal__dialog {
  width: min(620px, calc(100vw - 2rem));
}

.community_modal__close,
.community_profile_modal__close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  border: 1px solid var(--color_border);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  background: transparent;
  color: var(--color_text_primary);
  cursor: pointer;
}

.community_modal__close:hover,
.community_profile_modal__close:hover {
  border-color: rgba(255, 255, 255, 0.45);
}

.community_modal__title,
.community_profile_modal__title {
  margin: 0;
  font-size: 1.2rem;
  color: var(--color_text_primary);
}

.community_modal__copy {
  margin: 0.6rem 0 1.1rem;
  color: var(--color_text_secondary);
}

.community_modal__actions {
  display: flex;
  justify-content: flex-start;
}

.community_modal__join_btn {
  border: 1px solid var(--color_border);
  border-radius: 8px;
  padding: 0.62rem 0.95rem;
  background: rgba(64, 129, 112, 0.26);
  color: var(--color_text_primary);
  cursor: pointer;
  font-weight: 600;
}

.community_modal__join_btn:hover {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(64, 129, 112, 0.36);
}

.community_modal__join_btn:disabled {
  opacity: 0.7;
  cursor: progress;
}

.community_modal__status {
  min-height: 1.2rem;
  margin: 0.8rem 0 0;
  color: var(--color_text_secondary);
}

.community_modal__status.is_error {
  color: #ff9f9f;
}

.community_modal__profile {
  margin-top: 1rem;
  border: 1px solid var(--color_border);
  border-radius: var(--radius_md);
  padding: 0.9rem;
  background: rgba(255, 255, 255, 0.03);
}

.community_modal__profile_title {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
  color: var(--color_text_primary);
}

.community_modal__profile p,
.community_profile_modal__grid p {
  margin: 0.4rem 0;
  color: var(--color_text_secondary);
}

.community_modal__profile strong,
.community_profile_modal__grid strong {
  color: var(--color_text_primary);
}

.community_profile_modal__grid {
  margin-top: 1rem;
  border: 1px solid var(--color_border);
  border-radius: var(--radius_md);
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.03);
}

@keyframes community_pulse {
  0% {
    transform: scale(0.96);
    opacity: 0.56;
  }
  70% {
    transform: scale(1.03);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .community_portal_button.is_cta::before {
    animation: none;
  }
}

@media (max-width: 1400px) {
  .community_chat_window {
    right: var(--space_6);
    width: min(672px, calc(100vw - 2rem));
  }
}

@media (max-width: 980px) {
  .community_drawer {
    width: min(360px, calc(100vw - 2rem));
    right: 1rem;
  }

  .community_chat_window {
    right: 1rem;
    bottom: 1rem;
    width: min(768px, calc(100vw - 2rem));
    height: min(65vh, 560px);
    min-width: 0;
  }
}
