.cg-gallery-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr);
    align-items: end;
    gap: clamp(24px, 4vw, 56px);
    overflow: hidden;
}

.cg-gallery-hero::after {
    content: '';
    position: absolute;
    width: 340px;
    height: 340px;
    right: -120px;
    bottom: -190px;
    border: 1px solid rgba(255, 201, 92, .24);
    border-radius: 50%;
    box-shadow: 0 0 0 34px rgba(213, 168, 74, .035), 0 0 0 82px rgba(213, 168, 74, .025);
    pointer-events: none;
}

.cg-gallery-hero__copy,
.cg-gallery-hero__stats { position: relative; z-index: 1; }

.cg-gallery-hero__copy p {
    max-width: 780px;
    margin: 16px 0 20px;
    color: var(--muted-strong, #c1beb4);
}

.cg-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.cg-gallery-hero__stats {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.2fr) minmax(0, .9fr);
    border: 1px solid var(--border, rgba(221, 177, 83, .22));
    background: rgba(4, 6, 7, .42);
}

.cg-gallery-hero__stats > div {
    display: grid;
    align-content: center;
    min-height: 108px;
    padding: 18px 12px;
    text-align: center;
}

.cg-gallery-hero__stats > div + div { border-left: 1px solid var(--border-soft, rgba(255,255,255,.09)); }

.cg-gallery-hero__stats strong {
    color: var(--gold-bright, #ffc95c);
    font: 600 clamp(1.7rem, 3vw, 2.4rem)/1 Georgia, "Times New Roman", serif;
}

.cg-gallery-hero__stats span {
    margin-top: 8px;
    color: var(--muted, #aaa89f);
    font-size: .66rem;
    font-weight: 850;
    line-height: 1.2;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.cg-gallery-panel { min-width: 0; }

.cg-gallery-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-soft, rgba(255,255,255,.09));
}

.cg-gallery-toolbar h2 {
    margin: 10px 0 4px;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.cg-gallery-toolbar p,
.cg-section-intro { margin: 0; color: var(--muted, #aaa89f); }

.cg-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted-strong, #c1beb4);
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .065em;
    text-transform: uppercase;
}

.cg-live-badge i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green, #6ed184);
    box-shadow: 0 0 11px rgba(110, 209, 132, .72);
}

.cg-per-page {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted, #aaa89f);
    font-size: .78rem;
    font-weight: 800;
}

.cg-per-page label { margin: 0; }

.cg-per-page select,
.cg-per-page button {
    min-height: 40px;
    padding: 8px 11px;
    border: 1px solid var(--border, rgba(221, 177, 83, .22));
    border-radius: 3px;
    color: var(--text, #f4efe5);
    background: #0b0f11;
    font: inherit;
}

.cg-grid { display: grid; min-width: 0; gap: 18px; }
.cg-grid--gallery { grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); }
.cg-grid--home { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.cg-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border-soft, rgba(255,255,255,.09));
    border-radius: 4px;
    background: linear-gradient(145deg, rgba(22, 27, 30, .98), rgba(10, 13, 15, .98));
    box-shadow: 0 14px 32px rgba(0, 0, 0, .23);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.cg-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 201, 92, .42);
    box-shadow: 0 20px 42px rgba(0, 0, 0, .34);
}

.cg-image-link {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-bottom: 1px solid var(--border-soft, rgba(255,255,255,.09));
    background: #060808;
    text-decoration: none;
}

.cg-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease, filter .35s ease;
}

.cg-image-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 54%, rgba(0,0,0,.48));
    opacity: .74;
    transition: opacity .25s ease;
}

.cg-card:hover .cg-image { transform: scale(1.035); filter: saturate(1.06); }
.cg-card:hover .cg-image-shade { opacity: 1; }

.cg-view-pill {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 6px 9px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 2px;
    color: #fff;
    background: rgba(6, 8, 9, .78);
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}

.cg-image-link--broken::before {
    content: 'Image unavailable — waiting for Discord sync';
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    padding: 28px;
    color: var(--muted, #aaa89f);
    background: #0b0e0f;
    font-size: .82rem;
    font-weight: 800;
    text-align: center;
}

.cg-card-body { padding: 15px; }

.cg-author-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.cg-avatar {
    display: inline-grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--border, rgba(221, 177, 83, .22));
    border-radius: 50%;
    background: #202426;
    object-fit: cover;
}

.cg-avatar--fallback {
    color: #10100d;
    background: var(--gold-bright, #ffc95c);
    font-size: .78rem;
    font-weight: 900;
}

.cg-author-copy { display: grid; min-width: 0; flex: 1; line-height: 1.2; }

.cg-author-copy strong {
    overflow: hidden;
    color: var(--text, #f4efe5);
    font-size: .84rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cg-author-copy time {
    margin-top: 4px;
    color: var(--muted, #aaa89f);
    font-size: .7rem;
}

.cg-discord-source {
    flex: 0 0 auto;
    padding: 4px 6px;
    border: 1px solid rgba(88, 101, 242, .38);
    border-radius: 2px;
    color: #c7ccff;
    background: rgba(88, 101, 242, .12);
    font-size: .6rem;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.cg-thread-title {
    margin: 13px 0 0;
    font-size: 1.08rem;
    line-height: 1.25;
}

.cg-thread-title a {
    color: var(--text, #f4efe5);
    text-decoration: none;
}

.cg-thread-title a:hover { color: var(--gold-bright, #ffc95c); }

.cg-description {
    display: -webkit-box;
    margin: 9px 0 0;
    overflow: hidden;
    color: var(--muted-strong, #c1beb4);
    font-size: .84rem;
    line-height: 1.55;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.cg-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.cg-tag {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 7px;
    border: 1px solid var(--border-soft, rgba(255,255,255,.09));
    border-radius: 99px;
    color: var(--muted-strong, #c1beb4);
    background: rgba(255,255,255,.035);
    font-size: .67rem;
    font-weight: 750;
}

.cg-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.cg-reaction {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    gap: 6px;
    padding: 4px 9px;
    border: 1px solid rgba(88, 101, 242, .42);
    border-radius: 8px;
    color: #d9dcff;
    background: rgba(88, 101, 242, .12);
    font-size: .78rem;
    font-weight: 800;
}

.cg-reaction__image {
    display: block;
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.cg-reaction__emoji {
    font-size: 1.05rem;
    line-height: 1;
}

.cg-reaction__count { line-height: 1; }

.cg-card--compact .cg-card-body { padding: 13px; }
.cg-card--compact .cg-thread-title { font-size: 1rem; }

.cg-home-heading { margin-bottom: 18px; }
.cg-section-intro { margin-top: 10px; }
.cg-home-footnote { display: flex; justify-content: flex-end; margin-top: 15px; }

.cg-home-empty,
.cg-empty-state {
    display: grid;
    justify-items: center;
    gap: 9px;
    padding: 44px 24px;
    border: 1px dashed var(--border, rgba(221, 177, 83, .22));
    background: rgba(0,0,0,.14);
    text-align: center;
}

.cg-home-empty strong { color: var(--text, #f4efe5); }
.cg-home-empty span { color: var(--muted, #aaa89f); font-size: .86rem; }
.cg-empty-state > span { font-size: 2.3rem; }
.cg-empty-state h1,
.cg-empty-state h2 { margin: 0; font-size: clamp(1.65rem, 4vw, 2.4rem); }
.cg-empty-state p { max-width: 620px; margin: 0 0 8px; }

.cg-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.cg-pagination a,
.cg-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    padding: 7px 12px;
    border: 1px solid var(--border-soft, rgba(255,255,255,.09));
    color: var(--muted-strong, #c1beb4);
    background: rgba(255,255,255,.035);
    font-size: .78rem;
    font-weight: 850;
    text-decoration: none;
}

.cg-pagination a:hover,
.cg-pagination a.active {
    border-color: var(--gold-bright, #ffc95c);
    color: #11100d;
    background: var(--gold-bright, #ffc95c);
}

.cg-share-card { overflow: hidden; }

.cg-share-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.cg-share-header .section-kicker + .highlight-title { margin-top: 8px; }

.cg-share-image-link {
    display: grid;
    min-height: 220px;
    max-height: 78vh;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--border-soft, rgba(255,255,255,.09));
    background: #050707;
}

.cg-share-image { display: block; max-width: 100%; max-height: 78vh; object-fit: contain; }

.cg-share-author {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-top: 16px;
}

.cg-share-author > div { display: grid; }
.cg-share-author strong { color: var(--text, #f4efe5); }
.cg-share-author span { margin-top: 3px; color: var(--muted, #aaa89f); font-size: .78rem; }
.cg-share-description { max-width: 900px; margin: 18px 0 0; color: var(--text-soft, #d8d3c8); white-space: pre-wrap; }

body.cg-modal-open { overflow: hidden; }

.cg-lightbox[hidden] { display: none; }

.cg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: grid;
    place-items: center;
    padding: 20px;
}

.cg-lightbox__backdrop { position: absolute; inset: 0; background: rgba(2, 3, 4, .92); backdrop-filter: blur(12px); }

.cg-lightbox__dialog {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(1180px, 100%);
    max-height: calc(100vh - 40px);
    overflow: hidden;
    border: 1px solid rgba(255, 201, 92, .32);
    border-radius: 5px;
    background: #0b0f11;
    box-shadow: 0 30px 100px rgba(0,0,0,.72);
}

.cg-lightbox__top,
.cg-lightbox__footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 15px;
    border-bottom: 1px solid var(--border-soft, rgba(255,255,255,.09));
}

.cg-lightbox__top-copy { display: grid; min-width: 0; flex: 1; }
.cg-lightbox__author { overflow: hidden; color: var(--text, #f4efe5); font-size: .86rem; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.cg-lightbox__source { color: var(--muted, #aaa89f); font-size: .7rem; }

.cg-lightbox__close,
.cg-lightbox__nav {
    display: inline-grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--border-soft, rgba(255,255,255,.12));
    border-radius: 50%;
    color: #fff;
    background: rgba(255,255,255,.06);
    font-size: 1.5rem;
    cursor: pointer;
}

.cg-lightbox__close:hover,
.cg-lightbox__nav:hover { border-color: var(--gold-bright, #ffc95c); color: var(--gold-bright, #ffc95c); }

.cg-lightbox__stage {
    position: relative;
    display: grid;
    min-height: 260px;
    place-items: center;
    overflow: hidden;
    background: #030404;
}

.cg-lightbox__image { display: block; max-width: 100%; max-height: calc(100vh - 235px); object-fit: contain; }

.cg-lightbox__nav { position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); background: rgba(5,7,8,.78); }
.cg-lightbox__prev { left: 14px; }
.cg-lightbox__next { right: 14px; }
.cg-lightbox__nav[disabled] { display: none; }

.cg-lightbox__error {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    padding: 28px;
    color: var(--muted-strong, #c1beb4);
    background: #070909;
    font-weight: 800;
    text-align: center;
}

.cg-lightbox__stage.is-error .cg-lightbox__error { display: grid; }
.cg-lightbox__footer { align-items: flex-start; border-top: 1px solid var(--border-soft, rgba(255,255,255,.09)); border-bottom: 0; }
.cg-lightbox__caption { min-width: 0; flex: 1; }
.cg-lightbox__title { color: var(--text, #f4efe5); font: 600 1.08rem/1.25 Georgia, "Times New Roman", serif; }
.cg-lightbox__description { margin-top: 4px; color: var(--muted, #aaa89f); font-size: .78rem; white-space: pre-wrap; }
.cg-lightbox__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.cg-lightbox__action {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 7px 11px;
    border: 1px solid var(--border, rgba(221,177,83,.22));
    border-radius: 2px;
    color: var(--gold-bright, #ffc95c);
    background: rgba(213,168,74,.06);
    font: 800 .7rem/1 "Segoe UI", Arial, sans-serif;
    letter-spacing: .045em;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
}

.cg-lightbox__action:hover { border-color: var(--gold-bright, #ffc95c); background: rgba(213,168,74,.14); }
.cg-lightbox__copy-status { min-height: 1em; margin-top: 5px; color: var(--green, #6ed184); font-size: .68rem; }

@media (max-width: 920px) {
    .cg-gallery-hero { grid-template-columns: 1fr; }
    .cg-gallery-hero__stats { max-width: 620px; }
}

@media (max-width: 760px) {
    .cg-grid--home { grid-template-columns: 1fr; }
    .cg-grid--gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
    .cg-gallery-toolbar,
    .cg-share-header { display: grid; align-items: start; }
    .cg-per-page { justify-self: start; }
    .cg-share-header .button-row { width: 100%; }
    .cg-lightbox { padding: 0; }
    .cg-lightbox__dialog { width: 100%; max-height: 100vh; min-height: 100vh; border: 0; border-radius: 0; }
    .cg-lightbox__image { max-height: calc(100vh - 270px); }
    .cg-lightbox__footer { display: grid; }
    .cg-lightbox__actions { justify-content: flex-start; }
}

@media (max-width: 520px) {
    .cg-gallery-hero__stats { grid-template-columns: 1fr; }
    .cg-gallery-hero__stats > div { min-height: 76px; }
    .cg-gallery-hero__stats > div + div { border-top: 1px solid var(--border-soft, rgba(255,255,255,.09)); border-left: 0; }
    .cg-grid--gallery { grid-template-columns: 1fr; }
    .cg-image-link { aspect-ratio: 16 / 11; }
    .cg-view-pill { display: none; }
    .cg-lightbox__top { padding: 10px; }
    .cg-lightbox__footer { padding: 11px; }
    .cg-lightbox__nav { width: 38px; height: 38px; }
    .cg-lightbox__prev { left: 8px; }
    .cg-lightbox__next { right: 8px; }
    .cg-lightbox__action { flex: 1 1 auto; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .cg-card,
    .cg-image { transition: none; }
}
