.gd-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.82);
  display: flex; align-items: safe center; justify-content: center;
  overflow-y: auto; padding: 40px 16px;
  opacity: 0; transition: opacity .3s ease;
  pointer-events: none;
}
.gd-overlay.gd-visible { opacity: 1; pointer-events: all; }
.gd-card {
  width: 100%; max-width: 800px; margin: auto;
  background: #111; border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  transform: translateY(18px) scale(.97); opacity: 0;
  transition: transform .35s cubic-bezier(.22,1,.36,1), opacity .3s ease;
}
.gd-overlay.gd-visible .gd-card { transform: translateY(0) scale(1); opacity: 1; }
.gd-close {
  position: absolute; top: 12px; right: 12px; z-index: 10;
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.55); color: #fff;
  font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s; backdrop-filter: blur(6px);
}
.gd-close:hover { background: rgba(0,0,0,.8); }
.gd-image-wrap {
  position: relative; width: 100%; background: #0a0a0a;
  display: flex; align-items: center; justify-content: center; min-height: 200px;
}
.gd-image-wrap img { width: 100%; max-height: 60vh; object-fit: contain; display: block; }

/* Visual style for the AI-generated badge. Lives in the shared gallery
   CSS so every gallery (user + faction, grid + popup) renders the same
   pill — previously the gradient/padding lived inline on user_gallery
   only and the faction popups showed an unstyled bare div. */
.ai-label {
  background: linear-gradient(45deg, #161616, #780707);
  font-size: 0.7rem;
  border-radius: 10px;
  padding: 5px 10px;
}
.gd-image-wrap .ai-label { position: absolute; top: 10px; left: 10px; max-width: max-content; }
.gd-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.gd-author { display: flex; align-items: center; gap: 10px; position: relative; }
.gd-avatar { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; background: #1a1a1a; flex-shrink: 0; }
.gd-author-info { display: flex; flex-direction: column; gap: 1px; }
.gd-username { font-size: 0.88rem; font-weight: 600; color: #fff; text-decoration: none; transition: color .15s; }
.gd-username:hover { color: #ccc; }
.gd-date { font-size: 0.75rem; color: #555; }
.gd-title { font-size: 1rem; font-weight: 700; color: #fff; line-height: 1.35; }
.gd-description { font-size: 0.85rem; color: #888; line-height: 1.55; white-space: pre-line; }
.gd-bean-row { display: flex; align-items: center; gap: 8px; padding-top: 2px; }
.gd-bean-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 20px;
  border: 1px solid #2a2a2a; background: #141414; color: #ccc;
  font-size: 0.82rem; font-weight: 600; cursor: pointer; font-family: inherit;
  line-height: 1; transition: color .15s, background .15s, border-color .15s;
}
.gd-bean-btn:hover:not(:disabled) { color: #fff; background: #1a1a1a; border-color: #444; }
.gd-bean-btn.liked { background: rgba(120,80,30,.35); border-color: rgba(200,150,90,.45); color: #c8965a; }
.gd-bean-btn:disabled { cursor: default; }
.gd-bean-static {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 20px;
  border: 1px solid transparent; background: transparent;
  color: #555; font-size: 0.82rem; font-weight: 600; font-family: inherit; line-height: 1;
}
.gd-menu-wrap { margin-left: auto; position: relative; flex-shrink: 0; }
.gd-menu-trigger {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: transparent; color: #555;
  font-size: 1.2rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s;
}
.gd-menu-trigger:hover { color: #ccc; background: rgba(255,255,255,.06); }
.gd-menu-drop {
  position: absolute; right: 0; top: 100%; margin-top: 4px;
  background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 10px;
  padding: 4px 0; min-width: 150px; z-index: 10;
  opacity: 0; pointer-events: none; transform: translateY(-4px);
  transition: opacity .15s, transform .15s;
}
.gd-menu-drop.open { opacity: 1; pointer-events: all; transform: translateY(0); }
.gd-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 14px; border: none; background: none;
  color: #aaa; font-size: 0.8rem; font-family: inherit;
  cursor: pointer; text-align: left;
  transition: color .12s, background .12s;
}
.gd-menu-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.gd-menu-item--danger:hover { color: #e05050; background: rgba(220,50,50,.06); }
.gd-menu-item svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gd-edit-field {
  width: 100%; background: #0e0e0e; border: 1px solid #2a2a2a;
  border-radius: 8px; color: #fff; font-family: inherit;
  padding: 8px 10px; font-size: 0.85rem; outline: none;
  transition: border-color .15s;
}
.gd-edit-field:focus { border-color: #444; }
.gd-edit-field--title { font-size: 1rem; font-weight: 700; }
.gd-edit-actions { display: flex; gap: 6px; padding-top: 4px; }
.gd-edit-save {
  padding: 5px 14px; border-radius: 8px; border: 1px solid #333;
  background: rgba(255,255,255,.06); color: #fff; font-size: 0.78rem;
  font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background .15s, border-color .15s;
}
.gd-edit-save:hover { background: rgba(255,255,255,.1); border-color: #444; }
.gd-edit-save:disabled { opacity: .4; cursor: default; }
.gd-edit-cancel {
  padding: 5px 14px; border-radius: 8px; border: 1px solid #222;
  background: transparent; color: #666; font-size: 0.78rem;
  cursor: pointer; font-family: inherit;
  transition: color .15s, border-color .15s;
}
.gd-edit-cancel:hover { color: #aaa; border-color: #333; }
.gd-divider { height: 1px; background: #1a1a1a; border: none; margin: 0; }
.cmt-section { display: flex; flex-direction: column; gap: 12px; }
.cmt-heading { font-size: 0.85rem; font-weight: 600; color: #888; }
.cmt-input-row { display: flex; gap: 10px; align-items: flex-start; position: relative; }
.cmt-input-avatar { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; background: #1a1a1a; flex-shrink: 0; }
.cmt-input-wrap { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.cmt-textarea {
  width: 100%; min-height: 60px; max-height: 160px; resize: vertical;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid #2a2a2a; background: #0a0a0a; color: #fff;
  font-family: inherit; font-size: 0.82rem; line-height: 1.5;
  outline: none; transition: border-color .3s ease;
}
.cmt-textarea::placeholder { color: #444; }
.cmt-textarea:focus { border-color: #444; }
.cmt-send-btn {
  align-self: flex-end; padding: 6px 16px; border-radius: 10px;
  border: none; background: #fff; color: #000;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  transition: background .2s, transform .15s;
}
.cmt-send-btn:hover { background: #e0e0e0; transform: translateY(-1px); }
.cmt-send-btn:disabled { opacity: .4; cursor: default; transform: none; }
.cmt-list { display: flex; flex-direction: column; gap: 14px; }
.cmt-empty { font-size: 0.8rem; color: #444; text-align: center; padding: 10px 0; }
.cmt-item { display: flex; gap: 10px; align-items: flex-start; }
.cmt-item-avatar { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; background: #1a1a1a; flex-shrink: 0; }
.cmt-item-body { flex: 1; min-width: 0; }
.cmt-item-header { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cmt-item-username { font-size: 0.82rem; font-weight: 600; color: #fff; text-decoration: none; transition: color .15s; }
.cmt-item-username:hover { color: #ccc; }
.cmt-item-date { font-size: 0.7rem; color: #555; }
.cmt-item-edited { font-size: 0.65rem; color: #444; font-style: italic; }
.cmt-item-content { font-size: 0.82rem; color: #ccc; line-height: 1.5; margin-top: 3px; white-space: pre-line; word-break: break-word; }
.cmt-item-actions { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.cmt-like-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 14px;
  border: 1px solid #1a1a1a; background: transparent; color: #555;
  font-size: 0.72rem; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: color .15s, border-color .15s;
}
.cmt-like-btn:hover { color: #888; border-color: #2a2a2a; }
.cmt-like-btn.liked { color: #c8965a; border-color: rgba(200,150,90,.35); }
.cmt-delete-btn {
  background: none; border: none; color: #444;
  font-size: 0.72rem; cursor: pointer; font-family: inherit;
  transition: color .15s;
}
.cmt-delete-btn:hover { color: #b44; }
.cmt-load-more {
  align-self: center; padding: 5px 18px; border-radius: 10px;
  border: 1px solid #2a2a2a; background: transparent;
  color: #888; font-size: 0.75rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: color .2s, border-color .2s;
}
.cmt-load-more:hover { color: #ccc; border-color: #444; }
.cmt-mention-dropdown {
  position: absolute; bottom: 100%; left: 0; right: 0;
  background: #141414; border: 1px solid #2a2a2a; border-radius: 10px;
  overflow: hidden; box-shadow: 0 -8px 24px rgba(0,0,0,.5);
  z-index: 50; display: none; margin-bottom: 6px;
}
.cmt-mention-dropdown.visible { display: block; }
.cmt-mention-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer;
  transition: background .1s;
}
.cmt-mention-item:hover, .cmt-mention-item.active { background: #1e1e1e; }
.cmt-mention-item img { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: #222; }
.cmt-mention-item span { font-size: .82rem; color: #ccc; }
.cmt-mention-link { color: #7a9a5a; font-weight: 600; text-decoration: none; }
.cmt-mention-link:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .gd-overlay { padding: 20px 8px; }
  .gd-card { max-width: 92vw; }
  .gd-body { padding: 16px 16px 20px; }
}
