.community-page {
  min-height: 100vh;
  padding: calc(var(--main-header-height) + 1.5rem) 0.75rem 1.5rem;
  background: #f8fafc;
  color: #0f172a;
}

.community-page button,
.community-page input,
.community-page select {
  font: inherit;
}

.community-shell {
  width: 100%;
  max-width: 96rem;
  margin-inline: auto;
}

.community-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.community-heading__icon {
  display: grid;
  width: 3rem;
  height: 3rem;
  flex: none;
  place-items: center;
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 1px 3px rgb(15 23 42 / 10%), 0 0 0 1px #e2e8f0;
  font-size: 1.5rem;
}

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

.community-heading h1 {
  overflow: hidden;
  margin: 0;
  color: #020617;
  font-family: Outfit, Inter, system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-heading p {
  margin: 0.25rem 0 0;
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1.5;
}

.community-tabs {
  display: inline-flex;
  max-width: 100%;
  overflow: hidden;
  margin-bottom: 1rem;
  border: 1px solid #dbe3ef;
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 1px 3px rgb(15 23 42 / 6%);
}

.community-tab {
  display: inline-flex;
  min-width: 8rem;
  min-height: 2.85rem;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  border-right: 1px solid #e2e8f0;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 900;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
}

.community-tab:last-child {
  border-right: 0;
}

.community-tab.active {
  background: #4f46e5;
  box-shadow: inset 0 -2px 0 rgb(255 255 255 / 28%);
  color: #fff;
}

.community-tab:hover:not(.active) {
  background: #eef2ff;
  color: #4338ca;
}

.community-tab:focus-visible,
.community-filter-button:focus-visible,
.question-button:focus-visible,
.community-page-button:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.community-game-panel {
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 1px 3px rgb(15 23 42 / 6%);
}

.community-game-filters {
  display: grid;
  gap: 1rem;
}

.community-field {
  display: grid;
  min-width: 0;
  gap: 0.375rem;
}

.community-field > span:first-child {
  color: #1e293b;
  font-size: 0.875rem;
  font-weight: 900;
}

.community-control {
  width: 100%;
  min-height: 2.75rem;
  padding-inline: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  outline: none;
  background: #fff;
  color: #1e293b;
  font-size: 0.875rem;
  font-weight: 700;
}

.community-control:focus,
.community-search-control:focus-within {
  border-color: #818cf8;
  box-shadow: 0 0 0 4px rgb(99 102 241 / 14%);
}

.community-control:disabled {
  cursor: not-allowed;
  background: #f8fafc;
  color: #94a3b8;
}

.community-search-control {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.5rem;
  padding-inline: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.community-search-control input {
  min-width: 0;
  flex: 1;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #0f172a;
  font-size: 0.875rem;
  font-weight: 600;
}

.community-search-control input::placeholder {
  color: #94a3b8;
}

.community-search-control > span {
  flex: none;
  color: #94a3b8;
}

.community-filter-button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  padding-inline: 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 900;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.community-filter-button--reset {
  border: 1px solid #c7d2fe;
  background: #fff;
  color: #4338ca;
}

.community-filter-button--reset:hover {
  background: #eef2ff;
}

.community-filter-button--search {
  border: 1px solid #4f46e5;
  background: #4f46e5;
  box-shadow: 0 10px 22px rgb(79 70 229 / 18%);
  color: #fff;
}

.community-filter-button--search:hover {
  background: #4338ca;
}

.community-mode-note {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border: 1px solid #e0e7ff;
  border-radius: 0.5rem;
  background: #eef2ff;
  color: #312e81;
  font-size: 0.875rem;
  line-height: 1.5rem;
}

.community-empty,
.question-empty-state {
  display: grid;
  place-items: center;
  border: 1px dashed #cbd5e1;
  border-radius: 0.5rem;
  background: #f8fafc;
  text-align: center;
}

.community-empty--games {
  min-height: 16rem;
  margin-top: 1.25rem;
  padding: 1.5rem;
}

.community-empty__icon {
  display: grid;
  width: 3.5rem;
  height: 3.5rem;
  margin-inline: auto;
  place-items: center;
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 1px 3px rgb(15 23 42 / 10%), 0 0 0 1px #e2e8f0;
  font-size: 1.5rem;
}

.community-empty h2 {
  margin: 1rem 0 0;
  color: #020617;
  font-family: Outfit, Inter, system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 900;
}

.community-empty p {
  max-width: 28rem;
  margin: 0.5rem auto 0;
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1.5rem;
}

.community-pagination {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
  color: #64748b;
  font-size: 0.875rem;
}

.community-pagination p {
  margin: 0;
}

.community-page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.community-page-button {
  display: inline-grid;
  width: auto;
  min-width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  color: #475569;
  font-weight: 900;
}

.community-page-button--active {
  border-color: #4f46e5;
  background: #4f46e5;
  color: #fff;
}

.community-page-button:disabled:not(.community-page-button--active) {
  cursor: not-allowed;
  opacity: 0.45;
}

.community-question-panel {
  display: grid;
  gap: 1rem;
}

.question-filter-surface {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 1px 3px rgb(15 23 42 / 6%);
}

.question-filter-row {
  display: grid;
  gap: 0.75rem;
}

.question-filter-row--selects {
  gap: 0.9rem;
}

.community-multi-select {
  position: relative;
  min-width: 0;
}

.community-multi-select summary {
  position: relative;
  display: grid;
  gap: 0.45rem;
  cursor: pointer;
  list-style: none;
}

.community-multi-select summary::-webkit-details-marker {
  display: none;
}

.community-multi-select__body {
  display: grid;
  min-width: 0;
  gap: 0.45rem;
}

.community-multi-select__body strong {
  color: #1e293b;
  font-size: 0.82rem;
  font-weight: 900;
}

.community-multi-select__body > span {
  display: flex;
  min-height: 2.9rem;
  align-items: center;
  padding: 0.35rem 2.2rem 0.35rem 0.6rem;
  overflow: hidden;
  border: 1px solid #dbe3ef;
  border-radius: 0.5rem;
  background: #fff;
  color: #94a3b8;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.6;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.community-multi-select summary > svg {
  position: absolute;
  right: 0.6rem;
  bottom: 0.95rem;
  width: 1rem;
  height: 1rem;
  color: #64748b;
  transition: transform 160ms ease;
}

.community-multi-select[open] .community-multi-select__body > span,
.community-multi-select summary:focus-visible .community-multi-select__body > span {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgb(99 102 241 / 14%);
  outline: none;
}

.community-multi-select[open] summary > svg {
  transform: rotate(180deg);
}

.community-multi-select__options {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  left: 0;
  z-index: 30;
  max-height: 16rem;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 18px 45px rgb(15 23 42 / 14%);
}

.community-multi-select__options label {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  color: #334155;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 800;
  text-align: left;
}

.community-multi-select__options label:hover {
  background: #eef2ff;
  color: #4338ca;
}

.community-multi-select__options input {
  accent-color: #4f46e5;
}

.question-search-box input,
.question-sort-control select {
  width: 100%;
  min-height: 2.75rem;
  padding-inline: 0.8rem;
  border: 1px solid #dbe3ef;
  border-radius: 0.5rem;
  outline: none;
  background: #fff;
  color: #1e293b;
  font-size: 0.9rem;
  font-weight: 700;
}

.question-search-box input:focus,
.question-sort-control select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgb(99 102 241 / 14%);
}

.question-button {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.86rem;
  font-weight: 900;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.question-button--primary {
  border: 1px solid #4f46e5;
  background: #4f46e5;
  box-shadow: 0 10px 22px rgb(79 70 229 / 18%);
  color: #fff;
}

.question-button--primary:hover {
  background: #4338ca;
}

.question-button--secondary {
  border: 1px solid #dbe3ef;
  background: #fff;
  color: #334155;
}

.question-button--secondary:hover {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #4338ca;
}

.question-list-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.question-list-toolbar h2 {
  margin: 0;
  color: #0f172a;
  font-family: Outfit, Inter, system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 900;
}

.question-list-toolbar p {
  margin: 0.2rem 0 0;
  color: #636b7a;
  font-size: 0.86rem;
  font-weight: 800;
}

.question-sort-control {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: #475569;
  font-size: 0.86rem;
  font-weight: 800;
}

.question-sort-control select {
  width: auto;
  min-width: 11rem;
}

.question-empty-state {
  min-height: 11rem;
  padding: 1.5rem;
}

.question-empty-state h3 {
  margin: 0;
  color: #0f172a;
  font-family: Outfit, Inter, system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 900;
}

.question-empty-state p {
  max-width: 28rem;
  margin: 0.4rem auto 0;
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.6;
}

@media (min-width: 520px) {
  .community-game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 640px) {
  .community-page {
    padding-inline: 1.25rem;
  }

  .community-heading h1 {
    font-size: 1.875rem;
  }
}

@media (min-width: 760px) {
  .question-filter-row--selects {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .question-filter-row--search {
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: end;
  }

  .question-list-toolbar,
  .community-pagination {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (min-width: 900px) {
  .community-game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .community-game-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto;
    align-items: end;
  }
}

@media (min-width: 1200px) {
  .community-game-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .community-tabs {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .community-tab {
    min-width: 0;
    padding-inline: 0.65rem;
    font-size: 0.82rem;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .community-page *,
  .community-page *::before,
  .community-page *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
