:root {
  --community-cyan: #29dcff;
  --community-violet: #9b74ff;
  --community-green: #56f1a7;
  --community-line: rgba(151, 181, 224, 0.16);
  --community-panel: linear-gradient(145deg, rgba(16, 29, 48, 0.88), rgba(7, 14, 25, 0.94));
}

body.community-page {
  color: #eef6ff;
  background:
    radial-gradient(circle at 18% -10%, rgba(30, 117, 255, 0.15), transparent 34rem),
    radial-gradient(circle at 92% 8%, rgba(164, 71, 255, 0.12), transparent 30rem),
    #040913;
}

.community-page .community-topbar {
  border-bottom-color: var(--community-line);
  background: rgba(4, 9, 19, 0.88);
  backdrop-filter: blur(20px);
}

.community-page .forums-page {
  display: block;
  width: var(--site-frame);
  max-width: none;
  min-height: calc(100dvh - 4.35rem);
  padding: 44px 0 64px;
}

body.community-chat-active.community-page .forums-page {
  padding-top: 44px;
}

.community-page .community-hub-band {
  display: grid;
  gap: 0;
  margin: 0;
}

.community-page .forums-page .chat-heading {
  display: block;
  width: 100%;
  min-height: 202px;
  margin: 0;
  padding: 22px 8px 34px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.community-page .forum-hero-title,
.community-page .forum-hero-title > div {
  display: grid;
  width: 100%;
  gap: 0;
  justify-items: start;
  text-align: left;
}

.community-page .forum-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--community-cyan);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.community-page .forum-hero-kicker .lucide {
  width: 15px;
  height: 15px;
}

.community-page .forum-hero-title h2 {
  margin: 7px 0 12px;
  color: #f4f9ff;
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.community-page .forum-hero-subtext {
  max-width: 760px;
  margin: 0;
  color: #9aacc4;
  font-size: 16px;
  line-height: 1.65;
}

.community-page .forum-hero-controls {
  display: block;
  width: 100%;
  margin-top: 18px;
}

.community-page.community-live-chat-page .forum-hero-controls {
  display: none;
}

.community-page .forum-page-map {
  min-height: 0;
  color: #7f91ac;
  font-size: 12px;
}

.community-page .forum-page-map:empty {
  display: none;
}

.community-page .community-panels,
body.community-chat-active.community-page .community-panels {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.community-page .hub-mode-switch {
  position: static;
  z-index: 1;
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--community-line);
  border-radius: 16px;
  background: rgba(8, 16, 29, 0.74);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.16);
}

.community-page .hub-mode-switch a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #8192aa;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.community-page .hub-mode-switch a:hover,
.community-page .hub-mode-switch a:focus-visible {
  color: #eaf6ff;
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}

.community-page .hub-mode-switch a.active,
.community-page .hub-mode-switch a[aria-current="page"] {
  border-color: rgba(70, 211, 255, 0.23);
  color: #fff;
  background: linear-gradient(120deg, rgba(36, 173, 236, 0.2), rgba(123, 80, 255, 0.2));
  box-shadow: inset 0 0 0 1px rgba(70, 211, 255, 0.08);
}

.community-page .hub-mode-switch .lucide {
  width: 17px;
  height: 17px;
}

.community-page .community-panel {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}

.community-page .forum-shell {
  display: grid;
  grid-template-columns: minmax(210px, 240px) minmax(0, 1fr) minmax(210px, 240px) !important;
  gap: 15px;
  align-items: start;
  width: 100%;
  height: auto;
  min-height: 760px;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.community-page :is(
  .forum-categories,
  .forum-board-header,
  .forum-dashboard-section,
  .forum-sidebar-panel,
  .forum-post-card,
  .forum-reply-card,
  .room-rail,
  .chat-main,
  .member-panel
) {
  border: 1px solid var(--community-line) !important;
  border-radius: 15px !important;
  background: var(--community-panel) !important;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18) !important;
}

.community-page .forum-categories,
.community-page .forum-sidebar {
  position: sticky;
  top: calc(4.35rem + 18px);
}

.community-page .forum-categories {
  padding: 14px;
}

.community-page .forum-category-group {
  border-color: rgba(151, 181, 224, 0.1);
}

.community-page .forum-categories button:not(.solid-button) {
  border-radius: 9px;
}

.community-page .forum-categories button:not(.solid-button):hover,
.community-page .forum-categories button:not(.solid-button):focus-visible,
.community-page .forum-categories button.active {
  color: #f2fbff;
  background: linear-gradient(120deg, rgba(41, 220, 255, 0.11), rgba(155, 116, 255, 0.1));
}

.community-page .forum-new-thread-button {
  min-height: 42px;
  border-radius: 10px !important;
  background: linear-gradient(120deg, #168db8, #6650ca);
}

.community-page .forum-board {
  gap: 15px;
  min-height: 760px;
}

.community-page .forum-board-header,
.community-page .forum-dashboard-section,
.community-page .forum-sidebar-panel {
  padding: 18px;
}

.community-page .forum-board-header {
  grid-template-columns: minmax(0, 24.5rem) minmax(0, 1fr);
  border-radius: 15px !important;
}

.community-page .forum-board-controls {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

.community-page .forum-board-search,
.community-page .forum-game-toggle {
  border-color: var(--community-line);
  border-radius: 10px;
  background: rgba(4, 12, 21, 0.48);
}

.community-page .forum-board-search {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}

.community-page .forum-dashboard-section h4,
.community-page .forum-sidebar-panel h3 {
  color: #dcecff;
}

.community-page .forum-topic {
  border-color: rgba(151, 181, 224, 0.12);
  border-radius: 11px !important;
  background: rgba(4, 12, 21, 0.36);
}

.community-page .forum-topic:hover,
.community-page .forum-topic:focus-within {
  border-color: rgba(41, 220, 255, 0.28);
  background: linear-gradient(120deg, rgba(41, 220, 255, 0.07), rgba(155, 116, 255, 0.05));
}

.community-page .forum-sidebar {
  display: grid;
  gap: 15px;
  margin-top: 0;
}

.community-page .chat-shell,
body.community-chat-active.community-page .chat-shell {
  display: grid;
  grid-template-columns: minmax(190px, 220px) minmax(0, 1fr) minmax(210px, 240px);
  gap: 15px;
  align-items: stretch;
  width: 100%;
  height: clamp(680px, calc(100dvh - 250px), 920px);
  min-height: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.community-page .room-rail,
.community-page .chat-main,
.community-page .member-panel,
body.community-chat-active.community-page .chat-shell .room-rail,
body.community-chat-active.community-page .chat-shell .member-panel {
  position: static;
  align-self: stretch;
  width: auto;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  margin: 0;
}

.community-page .room-rail,
.community-page .member-panel {
  padding: 12px;
  overflow-y: auto;
}

.community-page .room-rail button {
  min-height: 38px;
  border-radius: 9px;
  padding: 0 11px;
}

.community-page .room-rail button:hover,
.community-page .room-rail button:focus-visible,
.community-page .room-rail button.active {
  color: #fff;
  background: linear-gradient(120deg, rgba(41, 220, 255, 0.12), rgba(155, 116, 255, 0.11));
}

.community-page .chat-main {
  overflow: hidden;
}

.community-page .chat-main-header,
.community-page .chat-composer {
  border-color: var(--community-line);
  background: rgba(4, 12, 21, 0.48);
}

.community-page .chat-preview {
  scrollbar-color: rgba(93, 125, 166, 0.6) transparent;
}

.community-page .chat-composer textarea,
.community-page .chat-composer input {
  border-radius: 10px;
  background: rgba(4, 12, 21, 0.62);
}

@media (max-width: 1180px) {
  .community-page .forum-shell {
    grid-template-columns: minmax(190px, 220px) minmax(0, 1fr) !important;
  }

  .community-page .forum-sidebar {
    position: static;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .community-page .chat-shell,
  body.community-chat-active.community-page .chat-shell {
    grid-template-columns: minmax(180px, 210px) minmax(0, 1fr);
  }

  .community-page .member-panel {
    display: none;
  }
}

@media (max-width: 820px) {
  .community-page .forums-page {
    padding-top: 26px;
  }

  body.community-chat-active.community-page .forums-page {
    padding-top: 26px;
  }

  .community-page .forums-page .chat-heading {
    min-height: 0;
    padding: 16px 2px 24px;
  }

  .community-page .forum-hero-title h2 {
    font-size: clamp(32px, 9vw, 46px);
  }

  .community-page .forum-hero-subtext {
    font-size: 14px;
  }

  .community-page .forum-shell {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .community-page .forum-board-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .community-page .forum-board-controls,
  .community-page .forum-board-search {
    grid-column: 1;
    width: 100%;
    max-width: none;
    justify-self: stretch;
  }

  .community-page .forum-board-controls {
    grid-row: 1;
  }

  .community-page .forum-board-search {
    grid-row: 2;
  }

  .community-page .forum-categories,
  .community-page .forum-sidebar {
    position: static;
  }

  .community-page .forum-sidebar {
    grid-column: auto;
    grid-template-columns: minmax(0, 1fr);
  }

  .community-page .chat-shell,
  body.community-chat-active.community-page .chat-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100dvh - 210px);
    min-height: 580px;
  }

  .community-page .room-rail {
    display: flex;
    gap: 7px;
    height: auto !important;
    max-height: none !important;
    padding: 9px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .community-page .room-rail-heading {
    display: none;
  }

  .community-page .room-rail button {
    flex: 0 0 auto;
    min-height: 36px;
  }
}

@media (max-width: 560px) {
  .community-page .hub-mode-switch a {
    min-height: 42px;
    font-size: 12px;
  }

  .community-page .forum-board-header {
    padding: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .community-page .hub-mode-switch a {
    transition: none;
  }
}
