/* ================= COMMUNITY SHELL ================= */
.community-topbar {
  gap: 18px;
}

.brand-button {
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  color: inherit;
}

.brand-button:hover .brand-title {
  color: #1e40af;
}

.brand-button .brand-title,
.brand-button .brand-sub {
  display: block;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: #f1f5f9;
}

.nav-btn {
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #475569;
  font-weight: 800;
  font-size: 0.86rem;
  padding: 7px 12px;
}

.nav-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.nav-btn.active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  color: var(--ink);
  max-width: 220px;
}

.account-chip:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.account-chip.muted {
  padding: 8px 14px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: default;
}

.account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.account-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  min-width: 0;
}

.account-text strong {
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.account-text small {
  font-size: 0.7rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.community-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* ================= DISCOVERY ================= */
.community-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.9fr);
  gap: 28px;
  align-items: center;
  background:
    radial-gradient(circle at 88% 10%, rgba(124, 58, 237, 0.16), transparent 45%),
    radial-gradient(circle at 5% 95%, rgba(14, 165, 233, 0.14), transparent 42%),
    linear-gradient(135deg, #eff6ff 0%, #faf5ff 55%, #fff 100%);
  border: 1px solid #dbeafe;
  border-radius: 24px;
  padding: 34px;
  margin-bottom: 20px;
  box-shadow: 0 20px 50px rgba(37, 99, 235, 0.08);
}

.community-hero::after {
  content: '🎮';
  position: absolute;
  right: -12px;
  bottom: -34px;
  font-size: 10rem;
  opacity: 0.06;
  transform: rotate(-12deg);
  pointer-events: none;
}

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #2563eb;
  margin-bottom: 10px;
}

.community-hero h1,
.page-heading h1,
.auth-card h1,
.detail-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.community-hero p,
.page-heading p,
.auth-card > p,
.detail-copy > p {
  margin: 0;
  max-width: 62ch;
  color: #475569;
  line-height: 1.6;
  font-size: 0.98rem;
}

.community-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.community-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.community-stat {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(191, 219, 254, 0.9);
  backdrop-filter: blur(6px);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.community-stat:nth-child(1) {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: transparent;
}

.community-stat:nth-child(1) strong,
.community-stat:nth-child(1) span {
  color: #fff;
}

.community-stat strong {
  font-size: 1.55rem;
  color: #0f172a;
  letter-spacing: -0.03em;
}

.community-stat span {
  font-size: 0.76rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.community-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin: 26px 0 18px;
}

.community-filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.community-search {
  display: flex;
  gap: 8px;
}

.community-search .search-input {
  min-width: 250px;
}

.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.community-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(30, 41, 59, 0.055);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.community-card:hover {
  transform: translateY(-3px);
  border-color: #bfdbfe;
  box-shadow: 0 18px 40px rgba(30, 41, 59, 0.1);
}

.community-card-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.community-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eff6ff, #f5f3ff);
  border: 1px solid #dbeafe;
  font-size: 1.55rem;
  flex-shrink: 0;
}

.community-card-title-wrap {
  min-width: 0;
}

.community-card-title {
  margin: 0 0 4px;
  font-size: 1.02rem;
  line-height: 1.25;
  color: #0f172a;
}

.author-line {
  border: 0;
  background: none;
  padding: 0;
  color: #64748b;
  font-size: 0.77rem;
  font-weight: 700;
  text-align: left;
}

.author-line:hover {
  color: #2563eb;
  text-decoration: underline;
}

.community-card-desc {
  margin: 0;
  color: #475569;
  font-size: 0.87rem;
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.community-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  font-size: 0.76rem;
  font-weight: 800;
  color: #475569;
  background: #f8fafc;
  border-radius: 10px;
  padding: 8px 10px;
}

.community-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #f1f5f9;
  padding-top: 11px;
}

.community-card-actions {
  display: flex;
  gap: 7px;
}

.community-card-actions .primary-btn,
.community-card-actions .secondary-btn {
  padding: 7px 11px;
  font-size: 0.82rem;
}

.share-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.share-badge {
  font-size: 0.7rem;
  font-weight: 800;
  color: #5b21b6;
  background: #ede9fe;
  padding: 3px 8px;
  border-radius: 999px;
}

.skeleton {
  min-height: 260px;
  pointer-events: none;
}

.skeleton-line {
  height: 13px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%);
  background-size: 400% 100%;
  animation: skeleton 1.4s ease infinite;
}

.skeleton-line.short {
  width: 40%;
  height: 20px;
}

.skeleton-line.medium {
  width: 70%;
}

@keyframes skeleton {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.community-loading {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 80px 20px;
  color: var(--muted);
  font-weight: 700;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 4px solid #dbeafe;
  border-top-color: #2563eb;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 18px;
}

.alert {
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.alert.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
}

.alert p {
  margin: 0;
  color: #991b1b;
}

.community-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 54px 24px;
}

.community-empty h3 {
  margin: 0;
  font-size: 1.2rem;
}

.community-empty p {
  margin: 0 0 8px;
  color: var(--muted);
}

.empty-icon {
  font-size: 3rem;
}

/* ================= GAME DETAIL ================= */
.text-btn {
  border: 0;
  background: none;
  color: #2563eb;
  font-weight: 800;
  padding: 6px 0;
  margin-bottom: 12px;
}

.text-btn:hover {
  text-decoration: underline;
}

.detail-hero {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 65%, #faf5ff 100%);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 26px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.detail-icon {
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  background: linear-gradient(135deg, #eff6ff, #ede9fe);
  border: 1px solid #dbeafe;
  font-size: 3rem;
  flex-shrink: 0;
}

.detail-copy {
  min-width: 0;
  flex: 1;
}

.detail-kicker {
  font-size: 0.76rem;
  font-weight: 800;
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.detail-copy h1 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.detail-author {
  margin: 14px 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.detail-stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-stat strong {
  font-size: 1.3rem;
}

.detail-stat span {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.play-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  color: #fff;
  border-radius: 18px;
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: 0 18px 36px rgba(30, 58, 138, 0.18);
}

.play-panel h2 {
  margin: 0 0 5px;
  font-size: 1.25rem;
}

.play-panel p {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.88rem;
  max-width: 60ch;
}

.play-controls {
  display: flex;
  gap: 9px;
  align-items: center;
}

.play-controls .filter-select {
  background: #fff;
  border-color: transparent;
}

.manage-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  border: 1px dashed #c4b5fd;
  background: #faf5ff;
  border-radius: 14px;
  padding: 13px 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: #5b21b6;
}

.manage-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.danger-btn {
  border: 1px solid #fecaca;
  background: #fff;
  color: #b91c1c;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 10px;
}

.danger-btn:hover {
  background: #fef2f2;
  border-color: #f87171;
}

.section-heading {
  margin: 26px 0 12px;
  font-size: 1.2rem;
}

.shared-resources {
  display: grid;
  gap: 10px;
}

.share-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.share-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 800;
  list-style: none;
}

.share-panel summary::-webkit-details-marker {
  display: none;
}

.share-panel[open] summary {
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.share-hint {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.share-text {
  margin: 0;
  padding: 18px;
  max-height: 460px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  background: #0f172a;
  color: #e2e8f0;
}

.share-text.source {
  background: #111827;
  color: #d1fae5;
}

.share-note {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  padding: 18px;
  color: var(--muted);
}

.share-note p {
  margin: 4px 0 0;
  font-size: 0.88rem;
  line-height: 1.55;
}

.stats-footnote {
  margin: 22px 0 0;
  color: #94a3b8;
  font-size: 0.78rem;
  line-height: 1.5;
}

/* ================= PLAYER / SUMMARY EXTRAS ================= */
.community-player-header {
  border-left: 5px solid #7c3aed;
}

.community-summary .save-state {
  margin: 16px auto;
  max-width: 620px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 700;
  background: #f8fafc;
  color: var(--muted);
}

.community-summary .save-state.saving {
  background: #eff6ff;
  color: #1d4ed8;
}

.community-summary .save-state.saved {
  background: #ecfdf5;
  color: #047857;
}

.community-summary .save-state.error {
  background: #fef2f2;
  color: #b91c1c;
}

/* ================= PAGE HEADINGS ================= */
.page-heading {
  margin-bottom: 22px;
}

.page-heading h1 {
  font-size: clamp(1.7rem, 3vw, 2.3rem);
}

.dashboard-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
}

/* ================= UPLOAD FORM ================= */
.upload-form {
  display: grid;
  gap: 16px;
}

.form-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 8px 26px rgba(30, 41, 59, 0.045);
}

.form-section h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.form-help,
.form-hint {
  display: block;
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.45;
}

.form-help {
  margin: 0 0 16px;
}

.form-hint {
  margin-top: 4px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: #334155;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: #fff;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: 3px solid rgba(59, 130, 246, 0.16);
  border-color: #60a5fa;
}

.form-field textarea {
  resize: vertical;
  line-height: 1.5;
}

.form-field textarea.monospace {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', 'Apple Color Emoji',
    'Segoe UI Emoji', monospace;
  font-size: 0.8rem;
  background: #0f172a;
  color: #e2e8f0;
  border-color: #1e293b;
  tab-size: 2;
}

.wide-field {
  grid-column: 1 / -1;
  margin-top: 14px;
}

.section-heading-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 12px;
}

.challenge-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.module-hint {
  flex: 1 1 260px;
  font-size: 0.8rem;
  color: #5b21b6;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 9px;
  padding: 8px 11px;
}

.file-button {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.checkbox-field {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  background: #f8fafc;
}

.checkbox-field input {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}

.checkbox-field span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checkbox-field strong {
  font-size: 0.86rem;
}

.checkbox-field small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.upload-errors {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 0.85rem;
}

.upload-errors ul {
  margin: 8px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
}

.upload-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
}

.publish-note {
  margin: 0;
  max-width: 64ch;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  gap: 9px;
}

.form-error {
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 0.83rem;
  font-weight: 700;
}

.dev-note {
  margin-top: 14px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 0.8rem;
}

/* ================= CREATOR DASHBOARD ================= */
.creator-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.creator-stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 15px 17px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.creator-stat strong {
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.creator-stat span {
  font-size: 0.73rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-list {
  display: grid;
  gap: 12px;
}

.dashboard-card {
  display: grid;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 6px 18px rgba(30, 41, 59, 0.04);
}

.dashboard-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-game-identity {
  display: flex;
  gap: 12px;
  align-items: center;
}

.dashboard-game-icon {
  font-size: 1.8rem;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.dashboard-game-identity h3 {
  margin: 0 0 2px;
  font-size: 1rem;
}

.dashboard-sub {
  font-size: 0.77rem;
  color: var(--muted);
  font-weight: 700;
}

.status-badge {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 999px;
  padding: 5px 10px;
}

.status-badge.published {
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

.status-badge.hidden {
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
}

.dashboard-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid #f1f5f9;
  padding-top: 11px;
}

/* ================= AUTH ================= */
.auth-card {
  max-width: 620px;
  margin: 20px auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px;
  box-shadow: 0 20px 48px rgba(30, 41, 59, 0.08);
}

.auth-card h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.profile-card {
  max-width: 760px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
}

.profile-avatar {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
}

.profile-info h1 {
  margin: 2px 0 2px;
  font-size: 1.6rem;
}

.profile-handle {
  margin: 0 0 4px;
  color: #2563eb;
  font-weight: 800;
  font-size: 0.86rem;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.clerk-mount {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.auth-switch {
  text-align: center;
  margin: 14px 0 0;
}

.auth-gate {
  max-width: 620px;
  margin: 40px auto;
  text-align: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 38px 28px;
  box-shadow: var(--shadow);
  display: grid;
  justify-items: center;
  gap: 10px;
}

.auth-gate-icon {
  font-size: 2.8rem;
}

.auth-gate h2 {
  margin: 0;
}

.auth-gate p {
  margin: 0 0 8px;
  color: var(--muted);
  max-width: 48ch;
  line-height: 1.55;
}

.demo-auth-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.dev-warning {
  margin-top: 20px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 12px;
  padding: 13px 15px;
  font-size: 0.8rem;
}

.dev-warning p {
  margin: 4px 0 0;
  line-height: 1.5;
}

.setup-code {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.6;
}

/* ================= TOAST ================= */
.community-toast {
  position: fixed;
  right: 20px;
  bottom: 22px;
  z-index: 100;
  max-width: min(380px, calc(100vw - 40px));
  border-radius: 12px;
  padding: 13px 17px;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.28);
  font-size: 0.88rem;
  font-weight: 700;
  animation: toast-in 0.18s ease-out;
}

.community-toast.error {
  background: #991b1b;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= RESPONSIVE ================= */
@media (max-width: 980px) {
  .community-hero {
    grid-template-columns: 1fr;
    padding: 26px;
  }

  .community-stats {
    grid-template-columns: repeat(4, 1fr);
  }

  .profile-card {
    grid-template-columns: auto 1fr;
  }

  .profile-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .community-topbar {
    align-items: flex-start;
  }

  .site-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .nav-btn {
    white-space: nowrap;
  }

  .community-main {
    padding: 16px 14px 48px;
  }

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

  .community-filter-controls,
  .community-search {
    width: 100%;
  }

  .community-search .search-input {
    min-width: 0;
    width: 100%;
  }

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

  .detail-hero {
    flex-direction: column;
    padding: 20px;
  }

  .detail-icon {
    width: 66px;
    height: 66px;
    font-size: 2.3rem;
  }

  .play-panel {
    align-items: flex-start;
  }

  .play-controls {
    flex-wrap: wrap;
  }

  .form-grid,
  .form-grid.two-column {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 22px;
  }

  .profile-card {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }

  .profile-actions {
    justify-content: center;
  }

  .manage-actions {
    margin-left: 0;
  }
}

/* ================= SANDBOXED HTML5 GAMES ================= */
.upload-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.upload-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  border: 2px solid var(--border);
  background: #fff;
  color: var(--ink);
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 0.95rem;
  font-weight: 900;
  text-align: left;
}

.upload-tab small {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--muted);
}

.upload-tab.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.html-player-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sandbox-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 14px;
  padding: 13px 16px;
  margin-bottom: 14px;
  color: #4c1d95;
}

.sandbox-lock {
  font-size: 1.5rem;
  line-height: 1;
}

.sandbox-banner strong {
  font-size: 0.9rem;
}

.sandbox-banner p {
  margin: 3px 0 0;
  color: #6d28d9;
  font-size: 0.8rem;
  line-height: 1.45;
}

.html-game-stage {
  position: relative;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.html-game-frame {
  display: block;
  width: 100%;
  height: min(72vh, 760px);
  min-height: 460px;
  border: 0;
  background: #020617;
}

.html-game-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  background: rgba(2, 6, 23, 0.92);
  color: #e2e8f0;
  text-align: center;
}

.html-game-overlay p {
  margin: 0;
  max-width: 52ch;
  color: #94a3b8;
  font-size: 0.86rem;
  line-height: 1.5;
}

.html-game-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #0b1120;
  color: #94a3b8;
  border-top: 1px solid #1e293b;
  padding: 10px 14px;
  font-size: 0.76rem;
  font-weight: 700;
}

.html-status-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.html-status-text::before {
  content: '●';
  color: #22c55e;
  font-size: 0.62rem;
}

.html-footer-actions {
  display: flex;
  gap: 8px;
}

.html-game-footer .secondary-btn {
  background: #111827;
  border-color: #334155;
  color: #e2e8f0;
  font-size: 0.76rem;
  padding: 6px 10px;
}

.bridge-help {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  overflow: hidden;
}

.bridge-help summary {
  cursor: pointer;
  padding: 11px 14px;
  font-weight: 800;
  font-size: 0.84rem;
}

.bridge-help > div {
  border-top: 1px solid var(--border);
  padding: 14px;
}

.bridge-help p {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.5;
}

.bridge-code {
  margin: 0;
  background: #0f172a;
  color: #d1fae5;
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
  font-size: 0.76rem;
  line-height: 1.55;
}

.sandbox-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 18px;
  margin: 14px 0 0;
  padding-left: 20px;
  color: #475569;
  font-size: 0.8rem;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .upload-tabs,
  .sandbox-checklist {
    grid-template-columns: 1fr;
  }

  .html-game-frame {
    height: 65vh;
    min-height: 400px;
  }
}
