/* ── Gallery Page ─────────────────────────────────── */

.gallery-page {
    min-height: 100vh;
    background: var(--bg);
    background-image: radial-gradient(circle at 50% 0%, rgba(0,212,170,0.06), transparent 50%);
    overflow-y: auto;
    padding-bottom: 48px;
}

/* ── Header ──────────────────────────────────────── */

.gallery-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: rgba(10, 10, 11, 0.82);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
}

.gallery-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: 18px;
    transition: all 0.15s;
    flex-shrink: 0;
}
.gallery-back:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.gallery-header h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ── Controls (filters) ──────────────────────────── */

.gallery-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-page .gallery-filter-btn {
    flex: none;
    padding: 7px 16px;
    font-size: 12px;
}

/* ── Card Grid ───────────────────────────────────── */

#galleryGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    padding: 8px 24px 0;
    max-width: 1400px;
    margin: 0 auto;
}

/* ── Card ────────────────────────────────────────── */

.gallery-card {
    background: rgba(20, 20, 22, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}
.gallery-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,212,170,0.1);
}

/* ── Thumbnail ───────────────────────────────────── */

.gallery-thumb-canvas,
.gallery-thumb-img {
    width: 100%;
    aspect-ratio: 1;
    display: block;
    background: var(--bg);
    object-fit: contain;
}

/* ── Card Info ───────────────────────────────────── */

.gallery-card-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
}

.gallery-card-label {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-card-type {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.gallery-card-type.block  { background: var(--accent); color: #000; }
.gallery-card-type.entity { background: var(--purple); color: #fff; }
.gallery-card-type.item   { background: var(--gold);   color: #000; }

/* ── Loading / Empty ─────────────────────────────── */

.gallery-page-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
    font-size: 13px;
}

/* ── Responsive ──────────────────────────────────── */

@media (max-width: 640px) {
    .gallery-header { padding: 12px 16px; }
    .gallery-controls { padding: 10px 16px; }
    #galleryGrid {
        grid-template-columns: 1fr;
        padding: 8px 16px 0;
        gap: 12px;
    }
}
