.gallery-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin: 0 0 1rem;
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(43, 108, 176, 0.08), rgba(15, 23, 42, 0.04));
    border: 1px solid var(--border-color, #d7e0ea);
}

.gallery-stats__item {
    display: flex;
    flex-direction: column;
    min-width: 8rem;
    gap: 0.15rem;
}

.gallery-stats__item strong {
    font-size: 1.45rem;
    line-height: 1.1;
    color: var(--text-primary, #1a2332);
}

.gallery-stats__item span {
    font-size: 0.86rem;
    color: var(--text-secondary, #667788);
}

.gallery-stats--admin {
    max-width: 720px;
    margin-bottom: 1.25rem;
}

.gallery-settings-form {
    max-width: 420px;
    margin-bottom: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
}

.gallery-settings-form label {
    flex: 1 1 220px;
    margin: 0;
}

.gallery-toolbar {
    margin-bottom: 1.25rem;
}

.list-results-info {
    font-size: 0.9rem;
    color: var(--text-secondary, #667788);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.gallery-card {
    margin: 0;
    background: var(--bg-card, #fff);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.gallery-card-open {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: #0f172a;
    cursor: zoom-in;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.gallery-card-open img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}

.gallery-card:hover .gallery-card-open img {
    transform: scale(1.04);
}

.gallery-card-caption {
    padding: 0.65rem 0.85rem 0.25rem;
    font-size: 0.92rem;
    color: var(--text-primary, #222);
    line-height: 1.35;
}

.gallery-card-actions {
    display: flex;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem 0.35rem;
}

.gallery-reactions {
    padding: 0 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.gallery-reactions__summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-height: 0;
}

.gallery-reactions__summary:empty {
    display: none;
}

.gallery-reaction-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #eef2f6;
    border: 1px solid #e0e6ed;
    font-size: 0.85rem;
    line-height: 1.2;
    color: #334155;
}

.gallery-reaction-chip.is-mine {
    background: #e8f1fb;
    border-color: #9db8d6;
}

.gallery-reaction-chip__emoji {
    font-size: 1rem;
    line-height: 1;
}

.gallery-reaction-chip__count {
    font-weight: 700;
    font-size: 0.82rem;
}

.gallery-reactions__picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.gallery-reaction-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    border-radius: 999px;
    border: 1px solid #e0e6ed;
    background: #f5f7fa;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.gallery-reaction-btn:hover {
    transform: translateY(-1px) scale(1.06);
    background: #fff;
    border-color: #9db8d6;
}

.gallery-reaction-btn.is-active {
    background: #e8f1fb;
    border-color: #0F4685;
    box-shadow: 0 0 0 2px rgba(15, 70, 133, 0.12);
}

.gallery-reactions--viewer {
    padding: 0.35rem 0 0.15rem;
    align-items: center;
}

.gallery-reactions--viewer .gallery-reaction-chip {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.gallery-reactions--viewer .gallery-reaction-chip.is-mine {
    background: rgba(252, 111, 26, 0.25);
    border-color: rgba(252, 111, 26, 0.55);
}

.gallery-reactions--viewer .gallery-reaction-btn {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
}

.gallery-reactions--viewer .gallery-reaction-btn.is-active {
    background: rgba(255, 255, 255, 0.28);
    border-color: #fff;
    box-shadow: none;
}

.gallery-admin-reactions__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.gallery-card-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    border: 1px solid var(--border-color, #d5dce4);
    color: var(--text-secondary, #556);
    text-decoration: none;
}

.gallery-card-action:hover {
    color: var(--accent, #2b6cb0);
    border-color: currentColor;
}

.gallery-viewer {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-viewer[hidden] {
    display: none !important;
}

.gallery-viewer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 20, 0.88);
}

.gallery-viewer__dialog {
    position: relative;
    z-index: 1;
    width: min(96vw, 1100px);
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.gallery-viewer__toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
}

.gallery-viewer__tool,
.gallery-viewer__nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
}

.gallery-viewer__tool:hover,
.gallery-viewer__nav:hover {
    background: rgba(255, 255, 255, 0.28);
}

.gallery-viewer__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.gallery-viewer__nav--prev { left: 0.75rem; }
.gallery-viewer__nav--next { right: 0.75rem; }

.gallery-viewer__stage {
    overflow: auto;
    max-height: calc(94vh - 7rem);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
}

.gallery-viewer__img {
    max-width: 100%;
    max-height: calc(94vh - 7rem);
    object-fit: contain;
    transform-origin: center center;
    transition: transform 0.15s ease;
    user-select: none;
}

.gallery-viewer__caption,
.gallery-viewer__counter {
    margin: 0;
    color: #f3f6fb;
    text-align: center;
}

.gallery-viewer__caption {
    font-size: 1rem;
    min-height: 1.4em;
}

.gallery-viewer__counter {
    font-size: 0.85rem;
    opacity: 0.8;
}

.gallery-admin-thumb {
    width: 72px;
    height: 54px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.gallery-admin-source-title {
    font-size: 0.82rem;
    color: var(--text-secondary, #667);
    margin-top: 0.2rem;
}

.gallery-admin-note {
    font-size: 0.78rem;
    color: #a05a00;
}

.gallery-form-preview {
    margin: 0.5rem 0 1rem;
}

.gallery-form-preview img {
    max-width: 280px;
    max-height: 180px;
    border-radius: 8px;
    object-fit: cover;
}

.admin-hint {
    color: var(--text-secondary, #667);
    max-width: 720px;
}

@media (max-width: 1100px) {
    .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gallery-viewer__nav--prev { left: 0.25rem; }
    .gallery-viewer__nav--next { right: 0.25rem; }
}

@media (max-width: 480px) {
    .gallery-grid { grid-template-columns: 1fr; }
}
