.tg-community-shell { max-width: 1100px; }
.tg-community-top { align-items: flex-start; }
.tg-community-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.tg-community-nav button {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
}
.tg-community-nav button.active {
  background: rgba(37, 99, 235, .18);
  border-color: rgba(59, 130, 246, .45);
  color: #bfdbfe;
}
.tg-community-panel { display: none; }
.tg-community-panel.active { display: block; }
.tg-community-head { margin-bottom: 12px; }
.tg-community-head h2 { margin: 0 0 6px; }
.tg-community-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.tg-community-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}
.tg-community-card h2 { margin: 0 0 12px; font-size: 18px; }
.tg-community-card label {
  display: block;
  font-size: 13px;
  margin-bottom: 12px;
}
.tg-community-card input,
.tg-community-card select,
.tg-community-card textarea {
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #e2e8f0;
  display: block;
  font: inherit;
  margin-top: 6px;
  padding: 10px 12px;
  width: 100%;
}
.tg-community-card textarea { resize: vertical; min-height: 80px; }
.tg-community-msg { color: var(--muted); font-size: 13px; margin: 10px 0 0; min-height: 18px; }
.tg-community-msg.ok { color: #86efac; }
.tg-community-msg.err { color: #fca5a5; }
.tg-community-stats {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-bottom: 16px;
}
.tg-community-stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.tg-community-stat span { color: var(--muted); display: block; font-size: 12px; }
.tg-community-stat strong { font-size: 22px; }
.tg-community-table { width: 100%; }
.tg-community-table td, .tg-community-table th { font-size: 13px; padding: 10px 8px; }
.tg-pill.pending { background: rgba(245,158,11,.16); color: #fbbf24; }
.tg-pill.approved { background: rgba(34,197,94,.16); color: #86efac; }
.tg-pill.rejected, .tg-pill.banned { background: rgba(239,68,68,.16); color: #fca5a5; }
.tg-community-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tg-community-actions button {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #e2e8f0;
  cursor: pointer;
  font-size: 12px;
  padding: 6px 10px;
}
.tg-community-actions button.approve { border-color: rgba(34,197,94,.4); color: #86efac; }
.tg-community-actions button.reject { border-color: rgba(239,68,68,.4); color: #fca5a5; }
#adminCodeSource {
  background: #020617;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}
.tg-code-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 10px;
  padding: 12px;
}
.tg-community-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 0 0 14px;
}
.tg-rank-badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  white-space: nowrap;
}
.tg-rank-badge.top1 { background: rgba(234, 179, 8, .22); color: #fde047; }
.tg-rank-badge.top2 { background: rgba(148, 163, 184, .2); color: #e2e8f0; }
.tg-rank-badge.top3 { background: rgba(180, 83, 9, .22); color: #fdba74; }
tr.tg-rank-top1 { background: rgba(234, 179, 8, .06); }
tr.tg-rank-top2 { background: rgba(148, 163, 184, .05); }
tr.tg-rank-top3 { background: rgba(180, 83, 9, .06); }

@media (max-width: 768px) {
  .tg-community-shell .tg-top {
    flex-direction: column;
    gap: 12px;
  }

  .tg-community-shell .tg-top h1 {
    font-size: 1.25rem;
    line-height: 1.25;
  }

  .tg-community-shell .tg-top-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .tg-community-shell .tg-top-actions .tg-btn-compact {
    min-width: 0;
    text-align: center;
  }

  .tg-community-nav {
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .tg-community-nav::-webkit-scrollbar { display: none; }

  .tg-community-nav button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .tg-community-grid { grid-template-columns: 1fr; }

  .tg-table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .tg-community-table { min-width: 560px; }
}

@media (max-width: 480px) {
  .tg-community-shell .tg-top-actions {
    grid-template-columns: 1fr;
  }

  .tg-community-card { padding: 14px; }

  .tg-community-stats { grid-template-columns: 1fr 1fr; }
}
