.gallery-wrap { width: min(100% - 32px, 1200px); margin: 0 auto; padding: 28px 0 60px; }

.gallery-header { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.gallery-header h1 { font-size: 26px; margin-bottom: 4px; }

.gallery-tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.gallery-tab { padding: 9px 16px; font-size: 14px; font-weight: 600; color: var(--text-3); background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer; }
.gallery-tab:hover { color: var(--text-2); }
.gallery-tab.active { color: var(--accent-2); border-bottom-color: var(--accent); }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.gallery-tile { display: flex; flex-direction: column; min-width: 0; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.gallery-tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.gallery-thumb { position: relative; aspect-ratio: 4 / 3; background: #07090c; overflow: hidden; }
.gallery-thumb img, .gallery-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-play { position: absolute; inset: auto 8px 8px auto; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: var(--r-tag); background: rgba(0,0,0,.65); color: #fff; font-size: 11px; font-weight: 600; }
.gallery-flag { position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: var(--r-tag); font-size: 11px; font-weight: 700; background: rgba(0,0,0,.7); color: #fff; }
.gallery-flag.is-pending { color: var(--accent-2); }
.gallery-flag.is-rejected, .gallery-flag.is-hidden { color: var(--danger); }
.gallery-tile-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gallery-tile-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-tile-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-3); min-width: 0; }
.gallery-tile-meta .gallery-by { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-stat { display: inline-flex; align-items: center; gap: 3px; }

/* Viewer */
.gallery-viewer { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.gallery-media { background: #07090c; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; display: flex; align-items: center; justify-content: center; max-height: calc(100vh - var(--nav-height) - 80px); position: sticky; top: calc(var(--nav-height) + 16px); }
.gallery-media img, .gallery-media video { max-width: 100%; max-height: calc(100vh - var(--nav-height) - 80px); display: block; object-fit: contain; }
.gallery-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.gallery-side h1 { font-size: 20px; line-height: 1.3; word-break: break-word; }
.gallery-author { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.gallery-author a { color: var(--text); font-weight: 600; text-decoration: none; }
.gallery-note { color: var(--text-2); font-size: 14px; word-break: break-word; }
.gallery-links { display: flex; flex-wrap: wrap; gap: 6px; }
.gallery-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 10px; border-radius: var(--r-chip); background: var(--bg-3); border: 1px solid var(--border); color: var(--text-2); font-size: 12px; text-decoration: none; }
.gallery-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-chip:hover { border-color: var(--accent); color: var(--text); }
.gallery-chip .chip-type { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0; }
.gallery-chip button { background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 0 0 0 2px; font-size: 13px; }
.gallery-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.gallery-upvote { display: inline-flex; align-items: center; gap: 6px; }
.gallery-upvote.is-on { color: var(--accent-2); border-color: var(--accent); background: var(--accent-dim); }
.gallery-status-note { padding: 10px 12px; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.gallery-status-note.is-danger { border-color: var(--danger); }

/* Comments */
.gallery-comments { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.gallery-comment { display: flex; gap: 10px; min-width: 0; }
.gallery-comment.is-reply { margin-left: 38px; }
.gallery-comment-main { flex: 1; min-width: 0; }
.gallery-comment-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: 13px; min-width: 0; }
.gallery-comment-head a { color: var(--text); font-weight: 600; text-decoration: none; }
.gallery-comment-head time { color: var(--text-3); font-size: 12px; }
.gallery-comment-body { font-size: 14px; color: var(--text-2); word-break: break-word; margin: 2px 0 4px; }
.gallery-comment-body.is-deleted { color: var(--text-3); font-style: italic; }
.gallery-comment-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 12px; color: var(--text-3); }
.gallery-comment-tools button { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.gallery-comment-tools button:hover { color: var(--text); }
.gallery-like { display: inline-flex; align-items: center; gap: 3px; }
.gallery-like.is-on { color: var(--danger); }
.gallery-pill { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--text-3); }
.gallery-pill.is-pinned { color: var(--accent-2); }
.gallery-more-replies { margin-left: 38px; background: none; border: 0; color: var(--text-3); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; text-align: left; }
.gallery-more-replies:hover { color: var(--text); }
.gallery-composer { display: flex; flex-direction: column; gap: 6px; }
.gallery-replying { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-3); }
.gallery-replying button { background: none; border: 0; color: var(--text-3); cursor: pointer; }
.gallery-comment.is-flash { animation: gallery-flash 1.6s ease-out; border-radius: var(--r); }
@keyframes gallery-flash { from { background: var(--accent-dim); } to { background: transparent; } }

/* Upload */
.gallery-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 160px; padding: 16px; border: 1px dashed var(--border); border-radius: var(--r); background: var(--bg-2); color: var(--text-3); cursor: pointer; text-align: center; }
.gallery-drop.is-over { border-color: var(--accent); color: var(--text-2); }
.gallery-drop img, .gallery-drop video { max-width: 100%; max-height: 220px; border-radius: 6px; }
.gallery-picker { position: relative; }
.gallery-picker-results { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); max-height: 240px; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.gallery-picker-results button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 8px 12px; background: none; border: 0; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.gallery-picker-results button:hover, .gallery-picker-results button:focus { background: var(--bg-3); }
.gallery-picker-results small { color: var(--text-3); font-size: 11px; }
.gallery-progress { height: 4px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.gallery-progress > div { height: 100%; background: var(--accent); transition: width .2s; }

@media (max-width: 900px) {
  .gallery-viewer { grid-template-columns: 1fr; }
  .gallery-media { position: static; max-height: none; }
  .gallery-media img, .gallery-media video { max-height: 70vh; }
}
@media (max-width: 520px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gallery-tile-body { padding: 8px; }
  .gallery-comment.is-reply, .gallery-more-replies { margin-left: 24px; }
}
.gallery-ico { width: 14px; height: 14px; flex: none; }
.gallery-like.is-on .gallery-ico { fill: currentColor; }
.gallery-flair-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 14px; }
.gallery-flair.is-static { align-self: flex-start; }
.gallery-flair-select { width: auto; min-width: 120px; }
