.community-window {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: none;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  color: #f3f8ff;
  background:
    radial-gradient(80% 60% at 50% 0%, #173f68 0, transparent 70%),
    #07111f;
}
.community-window.is-open { display: grid; }
.community-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid #ffffff1a;
}
.community-header h2 { margin: 0; color: #fff; font-size: clamp(18px, 3vw, 24px); }
.community-heading { min-width: 0; }
.community-stats {
  margin: 3px 0 0;
  color: #a9bed4;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.community-header-actions { display: flex; align-items: center; gap: 8px; }
.community-alerts, .community-close {
  padding: 8px 12px;
  border: 1px solid #ffffff40;
  border-radius: 9px;
  background: #ffffff10;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.community-alerts.is-on {
  border-color: #86e8bd88;
  background: #36c78924;
  color: #b9ffdc;
}
.community-close {
  padding: 8px 16px;
}
.community-toasts {
  position: fixed;
  z-index: 12000;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.community-toast {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #8ad9ff77;
  border-radius: 12px;
  background: linear-gradient(145deg, #153855f5, #091827f5);
  box-shadow: 0 12px 35px #0008;
  color: #f3f8ff;
  text-align: left;
  font: inherit;
  line-height: 1.45;
  pointer-events: auto;
  animation: toastIn .2s ease-out both;
}
.community-toast strong { display: block; color: #9ee3ff; margin-bottom: 2px; }
.community-toast span { display: block; overflow-wrap: anywhere; }
.community-toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.community-tabs {
  display: flex;
  gap: 8px;
  padding: 12px clamp(16px, 4vw, 48px);
  overflow-x: auto;
  border-bottom: 1px solid #ffffff1a;
}
.community-tabs button {
  flex: 0 0 auto;
  padding: 8px 13px;
  border: 1px solid #ffffff2b;
  border-radius: 999px;
  background: #ffffff0b;
  color: #d4e5f8;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.community-tabs button.active {
  border-color: #8ad9ff;
  background: #38a9e944;
  color: #fff;
}
.community-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  align-items: start;
  gap: 20px;
  padding: 20px clamp(16px, 4vw, 48px) 40px;
  overflow: auto;
}
.community-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #ffffff20;
  border-radius: 14px;
  background: linear-gradient(150deg, #172a40, #0c1827 68%);
  box-shadow: 0 12px 34px #0003;
}
.community-video {
  display: block;
  width: 100%;
  max-height: 62vh;
  aspect-ratio: 16 / 10;
  background: #02070d;
  object-fit: contain;
}
.community-card-info { padding: 13px 14px 14px; }
.community-author {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #e6f0ff;
  text-decoration: none;
  font-size: 12px;
}
.community-author img, .comment-author img {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  object-fit: cover;
  background: #33475d;
}
.community-owner-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border: 1px solid #f7c96b88;
  border-radius: 999px;
  background: #f7c96b1c;
  color: #ffd986;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.community-title {
  margin: 9px 0 7px;
  color: #fff;
  font-size: 15px;
  overflow-wrap: anywhere;
}
.community-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: #a9bed4;
  font-size: 11px;
}
.community-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.community-actions button, .comment-form button {
  padding: 6px 10px;
  border: 1px solid #ffffff28;
  border-radius: 8px;
  background: #ffffff0b;
  color: #e9f4ff;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.community-actions button.is-selected {
  border-color: #77d4ff;
  background: #2fa7e33d;
  color: #fff;
}
.community-comment-panel {
  display: none;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #ffffff1b;
}
.community-comment-panel.is-visible { display: block; }
.comment-list { display: grid; gap: 10px; max-height: 210px; overflow: auto; }
.community-comment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  color: #d9e6f5;
  font-size: 11px;
}
.comment-author {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
  color: #a9dfff;
  text-decoration: none;
  font-size: 10px;
}
.comment-author img { width: 18px; height: 18px; }
.comment-content { overflow-wrap: anywhere; line-height: 1.4; }
.comment-empty, .community-message {
  padding: 28px 14px;
  color: #b8cce0;
  text-align: center;
  font-size: 13px;
}
.community-message { grid-column: 1 / -1; padding-top: 70px; }
.community-page-footer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  color: #b8cce0;
  font-size: 12px;
}
.community-page-footer button {
  padding: 9px 15px;
  border: 1px solid #8ad9ff77;
  border-radius: 999px;
  background: #38a9e922;
  color: #e9f4ff;
  font: inherit;
  cursor: pointer;
}
.community-page-footer button:disabled { opacity: .65; cursor: wait; }
.community-message button {
  margin-top: 14px;
  padding: 8px 13px;
  border: 1px solid #ffffff40;
  border-radius: 8px;
  background: #ffffff12;
  color: white;
  font: inherit;
  cursor: pointer;
}
.comment-form { display: flex; gap: 7px; margin-top: 11px; }
.comment-form input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #ffffff28;
  border-radius: 8px;
  outline: none;
  background: #06101c;
  color: #fff;
  font: inherit;
  font-size: 12px;
}
.comment-form input:focus { border-color: #77d4ff; }
.comment-error { margin-top: 7px; color: #ffb9aa; font-size: 11px; }
.comment-error:empty { display: none; }
body.community-open { overflow: hidden; }
@media (max-width: 600px) {
  .community-feed { grid-template-columns: 1fr; gap: 14px; padding-top: 14px; }
  .community-tabs { padding-top: 9px; padding-bottom: 9px; }
  .community-header { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .community-header-actions { gap: 5px; }
  .community-alerts, .community-close { padding: 7px 8px; font-size: 11px; }
  .community-stats { max-width: 48vw; line-height: 1.35; }
  .community-toasts { right: 10px; bottom: 10px; width: calc(100vw - 20px); }
}
