:root {
    --font-heading: "Lobster", "Inter", "Segoe UI", Arial, sans-serif;
    --font-body: "Roboto Flex", "Segoe UI", Roboto, Arial, sans-serif;
    color-scheme: light;
    --bg: #0b1020;
    --bg-soft: #151b31;
    --card: #ffffff;
    --text: #eaf0ff;
    --text-dark: #111827;
    --muted: #6b7280;
    --accent: #7c3aed;
    --accent-dark: #5b21b6;
    --danger: #dc2626;
    --border: #e5e7eb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background: linear-gradient(180deg, rgba(4, 8, 22, 0.78), rgba(5, 10, 25, 0.92)), url("bg.jpeg");
    color: var(--neon-title);
    background-size: auto;
    background-repeat: no-repeat;
    height: 100%;
}

body.modal-open {
    overflow: hidden;
}

h1 {
    font-family: var(--font-heading);
    font-weight: 100;
    text-align: center;
}

.container {
    width: min(1180px, 92vw);
    margin: 0 auto;
}

.site-header {
    padding: 36px 0 24px;
}

.site-header h1 {
    margin: 0 0 8px;
    font-size: 68px;
    font-weight: 100;
    filter: drop-shadow(1px 1px 1px black);
}

.site-header p {
    margin: 0 0 14px;
    color: #c7d2fe;
}

.admin-link {
    display: inline-block;
    color: #ddd6fe;
    text-decoration: none;
    border: 1px solid #a78bfa;
    border-radius: 10px;
    padding: 8px 12px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
    padding-bottom: 30px;
}

.card {
    background: var(--bg-soft);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-button {
    all: unset;
    cursor: pointer;
    display: block;
    width: 100%;
}

.card-button:focus-visible {
    outline: 2px solid rgba(105, 213, 255, 0.85);
    outline-offset: -2px;
}

.card img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
}

.card-meta {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
    padding: 10px 12px;
    color: #bfdbfe;
    font-size: 13px;
    align-items: center;
}

.card-meta .prompt-number {
    grid-column: 1 / -1;
    font-weight: 600;
    color: #93c5fd;
    letter-spacing: 0.02em;
}

.card-meta .card-source {
    grid-column: 1 / -1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #a5b4fc;
    font-size: 12px;
}

.card-source-link,
.modal-source-group a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.card-source-link:hover,
.modal-source-group a:hover {
    color: #c7d2fe;
}

.card-meta > span:nth-child(3) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta > span:nth-child(4) {
    justify-self: end;
    white-space: nowrap;
}

.empty-state {
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed rgba(255, 255, 255, 0.35);
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 30px;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.modal-content {
    position: relative;
    margin: 10vh auto 0;
    width: min(1100px, 95vw);
    background: #fff;
    color: var(--text-dark);
    border-radius: 14px;
    padding: 20px;
    z-index: 2;
}

.modal-close {
    position: absolute;
    right: 12px;
    top: 8px;
    border: 0;
    background: transparent;
    font-size: 28px;
    cursor: pointer;
}

.modal-layout {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 18px;
    align-items: start;
}

.modal-image-wrap {
    background: #0b1020;
    border-radius: 12px;
    overflow: hidden;
    min-height: 460px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image-wrap img {
    width: 100%;
    max-height: 72vh;
    object-fit: contain;
    display: block;
}

.modal-text-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.modal-actions .primary-btn,
.modal-actions .secondary-btn {
    flex: 1 1 auto;
    min-width: 140px;
}

.modal-prompt-number {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #4338ca;
    letter-spacing: 0.02em;
}

.modal-source-group {
    margin: 0 0 8px;
    font-size: 13px;
    color: #6366f1;
}

.modal-source-group a {
    font-weight: 500;
}

.modal-text-wrap p {
    margin: 0;
    max-height: 52vh;
    overflow: auto;
    line-height: 1.5;
    white-space: pre-wrap;
}

.admin-page {
    padding-bottom: 30px;
}

.toolbar {
    margin-bottom: 20px;
}

.flash {
    background: #ede9fe;
    color: #312e81;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.primary-btn,
.secondary-btn,
.danger-btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
}

.primary-btn {
    background: var(--accent);
    color: #fff;
}

.primary-btn:hover {
    background: var(--accent-dark);
}

.secondary-btn {
    background: #0f172a;
    color: #fff;
}

.danger-btn {
    background: var(--danger);
    color: #fff;
}

.admin-list {
    display: grid;
    gap: 14px;
}

.admin-card {
    background: var(--card);
    color: var(--text-dark);
    border-radius: 5px;
    display: grid;
    grid-template-columns: 167px 1fr;
    overflow: hidden;
    border: 1px solid var(--border);
}

.admin-card.inactive {
    opacity: 0.75;
}

.admin-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-card-body {
    padding: 14px;
}

.admin-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 10px;
}

.status-badge {
    background: #fee2e2;
    color: #991b1b;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.admin-edit-form label {
    display: block;
    font-size: 13px;
    margin-bottom: 8px;
    color: #1f2937;
}

.admin-edit-form textarea,
.admin-edit-form input[type="url"],
.admin-edit-form input[type="file"] {
    width: 100%;
    margin-top: 4px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 9px;
    font: inherit;
}

.admin-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

@media (max-width: 840px) {
    .modal-layout {
        grid-template-columns: 1fr;
    }

    .modal-image-wrap {
        min-height: 280px;
    }

    .admin-card {
        grid-template-columns: 1fr;
    }

    .admin-card img {
        height: 240px;
    }
}

/* Neon redesign */
:root {
    --neon-bg-1: #040816;
    --neon-bg-2: #0b1430;
    --neon-card: rgba(14, 26, 56, 0.78);
    --neon-border: rgba(130, 170, 255, 0.26);
    --neon-title: #dbe8ff;
    --neon-text: #b6c6ea;
    --neon-accent: #69d5ff;
    --neon-accent-2: #8e7dff;
}


.site-header {
    padding: 42px 0 26px;
    text-align: center;
}

.site-header h1 {
    letter-spacing: 1px;
}

.site-header p {
    color: var(--neon-text);
}

.admin-link {
    border: 1px solid var(--neon-border);
    background: rgba(9, 18, 41, 0.72);
    color: #e9f5ff;
    box-shadow: 0 0 14px rgba(105, 213, 255, 0.16);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
    align-items: center;
}

.filters-caption {
    flex: 0 0 100%;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--neon-text);
    margin: 0 0 2px;
}

.filters-caption-row {
    flex: 0 0 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px 16px;
    margin-bottom: 2px;
}

.filters-caption-row .filters-caption {
    flex: 0 0 auto;
    margin: 0;
}

.category-order-toggle {
    padding: 0;
    border: none;
    background: none;
    color: #c4b5fd;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    font-family: inherit;
}

.category-order-toggle:hover,
.category-order-toggle.is-active {
    color: #e9d5ff;
}

.category-order-panel {
    flex: 0 0 100%;
    margin-bottom: 10px;
    padding: 14px 16px;
    border: 1px solid var(--neon-border);
    border-radius: 12px;
    background: rgba(8, 17, 38, 0.55);
}

.category-order-panel[hidden] {
    display: none !important;
}

.gallery-sources-panel {
    margin-bottom: 20px;
    padding: 18px 20px 16px;
    border: 1px solid var(--neon-border);
    border-radius: 14px;
    background: linear-gradient(160deg, rgba(10, 22, 48, 0.92), rgba(8, 17, 38, 0.72));
    box-shadow: 0 10px 28px rgba(2, 8, 24, 0.35);
}

.gallery-sources-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 16px;
}

.gallery-sources-title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #e9d5ff;
}

.gallery-sources-hint {
    margin: 0;
    max-width: 52ch;
    font-size: 13px;
    color: #c7d2fe;
    line-height: 1.5;
}

.gallery-sources-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(105, 213, 255, 0.45);
    background: rgba(45, 83, 146, 0.35);
    color: #e9f5ff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 0 16px rgba(105, 213, 255, 0.18);
}

.gallery-sources-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 14px;
}

.gallery-sources-search-wrap {
    flex: 1 1 220px;
    min-width: 0;
}

.gallery-sources-search {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--neon-border);
    background: rgba(6, 14, 32, 0.9);
    color: #e9f5ff;
    font: inherit;
    font-size: 14px;
}

.gallery-sources-search::placeholder {
    color: #8fa3cc;
}

.gallery-sources-search:focus {
    outline: none;
    border-color: rgba(105, 213, 255, 0.75);
    box-shadow: 0 0 0 3px rgba(105, 213, 255, 0.15);
}

.gallery-sources-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gallery-sources-quick-btn {
    padding: 8px 12px;
    font-size: 12px;
}

.gallery-sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
    max-height: min(52vh, 520px);
    overflow: auto;
    padding: 4px 2px 6px;
}

.gallery-source-card {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--neon-border);
    background: rgba(8, 17, 38, 0.88);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.gallery-source-card:hover {
    transform: translateY(-1px);
    border-color: rgba(130, 170, 255, 0.45);
}

.gallery-source-card.is-visible {
    border-color: rgba(105, 213, 255, 0.42);
    background: linear-gradient(135deg, rgba(18, 40, 78, 0.95), rgba(12, 24, 52, 0.9));
}

.gallery-source-card.is-hidden {
    border-color: rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.55);
    opacity: 0.82;
}

.gallery-source-card.is-filtered-out {
    display: none;
}

.gallery-source-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.gallery-source-switch {
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: rgba(71, 85, 105, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.35);
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.gallery-source-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e2e8f0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, background 0.2s ease;
}

.gallery-source-card.is-visible .gallery-source-switch {
    background: linear-gradient(135deg, #38bdf8, #6366f1);
    border-color: rgba(125, 211, 252, 0.65);
}

.gallery-source-card.is-visible .gallery-source-switch::after {
    transform: translateX(18px);
    background: #fff;
}

.gallery-source-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gallery-source-name {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5ff;
    word-break: break-word;
}

.gallery-source-link {
    font-size: 12px;
    color: #93c5fd;
    text-decoration: none;
}

.gallery-source-link:hover {
    color: #bfdbfe;
    text-decoration: underline;
}

.gallery-source-status {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 5px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.gallery-source-card.is-visible .gallery-source-status {
    color: #bae6fd;
    background: rgba(56, 189, 248, 0.16);
}

.gallery-source-card.is-hidden .gallery-source-status {
    color: #94a3b8;
    background: rgba(100, 116, 139, 0.2);
}

.gallery-sources-empty {
    margin: 0 0 12px;
    padding: 14px;
    border-radius: 10px;
    border: 1px dashed rgba(148, 163, 184, 0.35);
    color: #94a3b8;
    text-align: center;
    font-size: 13px;
}

.gallery-sources-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding-top: 4px;
    border-top: 1px solid rgba(130, 170, 255, 0.14);
}

.gallery-sources-status {
    min-height: 1.25em;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .gallery-sources-grid {
        grid-template-columns: 1fr;
        max-height: none;
    }

    .gallery-source-card {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
    }

    .gallery-source-status {
        grid-column: 2;
        justify-self: start;
    }
}

.category-order-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: #c7d2fe;
    line-height: 1.45;
}

.category-order-hint code {
    font-size: 12px;
    color: #e9d5ff;
}

.category-order-list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 420px;
}

.category-order-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--neon-border);
    background: rgba(8, 17, 38, 0.85);
    cursor: grab;
    user-select: none;
}

.category-order-item.is-dragging {
    opacity: 0.55;
    cursor: grabbing;
}

.category-order-grip {
    color: #94a3b8;
    font-size: 14px;
    letter-spacing: -2px;
}

.category-order-name {
    flex: 1;
    color: #eaf0ff;
    font-size: 14px;
}

.category-order-slug {
    font-size: 11px;
    color: #94a3b8;
}

.category-order-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.category-order-status {
    font-size: 13px;
    color: #a5f3fc;
}

.filters--sources {
    margin-top: 6px;
}

.filter-chip--domain {
    max-width: min(100%, 320px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-chip {
    text-decoration: none;
    color: #cfe6ff;
    border: 1px solid var(--neon-border);
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(8, 17, 38, 0.75);
    font-size: 13px;
}

.filter-chip.active {
    border-color: rgba(105, 213, 255, 0.8);
    box-shadow: 0 0 14px rgba(105, 213, 255, 0.35);
    background: linear-gradient(135deg, rgba(45, 83, 146, 0.9), rgba(84, 61, 152, 0.9));
    color: #fff;
}

.gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 22px;
}

.card {
    background: var(--neon-card);
    border: 1px solid var(--neon-border);
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 18px 36px rgba(1, 4, 13, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(105, 213, 255, 0.58);
    box-shadow: 0 16px 38px rgba(1, 7, 24, 0.6), 0 0 18px rgba(105, 213, 255, 0.2);
}

.card img {
    height: 300px;
}

.card-meta {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
    color: #d0ddff;
    font-size: 12px;
    line-height: 1.4;
    align-items: center;
}

.card-meta .prompt-number {
    grid-column: 1 / -1;
    font-weight: 600;
    color: var(--neon-accent);
    letter-spacing: 0.02em;
}

.card-meta .card-source {
    grid-column: 1 / -1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #b8c7ff;
    font-size: 11px;
}

.card-source-link,
.modal-source-group a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.card-source-link:hover,
.modal-source-group a:hover {
    color: #dbe4ff;
}

.card-meta > span:nth-child(3) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta > span:nth-child(4) {
    justify-self: end;
    white-space: nowrap;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sync-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(550px, 100%);
}

.sync-sources-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--neon-text);
    font-size: 13px;
}

.sync-sources-label textarea {
    width: 100%;
    border: 1px solid var(--neon-border);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    color: #e9f5ff;
    background: rgba(8, 17, 38, 0.72);
    resize: vertical;
}

.cache-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: flex-start;
}

.sync-status {
    display: block;
    font-size: 13px;
    color: var(--neon-text);
    max-width: min(720px, 100%);
}

.login-card {
    width: min(520px, 94vw);
    margin: 8vh auto 0;
    padding: 24px;
    border-radius: 14px;
    border: 1px solid var(--neon-border);
    background: rgba(8, 17, 38, 0.8);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: var(--neon-text);
}

.login-form input {
    border: 1px solid var(--neon-border);
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
    color: #e9f5ff;
    background: rgba(8, 17, 38, 0.7);
}

.primary-btn,
.secondary-btn,
.danger-btn {
    background: linear-gradient(135deg, #2a4b89, #4e3f8f);
    color: #fff;
    border: 1px solid rgba(151, 194, 255, 0.35);
}

.danger-btn {
    background: linear-gradient(135deg, #8e2647, #ba2f38);
}

.flash {
    background: rgba(34, 56, 104, 0.65);
    color: #d6e7ff;
    border: 1px solid rgba(136, 185, 255, 0.28);
}

.admin-card {
    background: rgba(255, 255, 255, 0.97);
}

.admin-edit-form select {
    width: 100%;
    margin-top: 4px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 9px;
    font: inherit;
    min-height: 126px;
}

.gallery-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    color: var(--neon-text);
    font-size: 14px;
}

.admin-scope-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.per-page-form label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.per-page-form select {
    background: rgba(8, 17, 38, 0.85);
    color: #e9f5ff;
    border: 1px solid var(--neon-border);
    border-radius: 8px;
    padding: 6px 10px;
    font: inherit;
}

.counter {
    opacity: 0.85;
}

.counter-hint {
    margin-left: 6px;
    color: #9fb6dd;
    font-size: 12px;
}

.gallery-prompt-flash {
    margin-bottom: 14px;
    border-radius: 10px;
    padding: 12px 14px;
}

.gallery-prompt-flash--error {
    border-color: rgba(248, 113, 113, 0.55);
    background: rgba(80, 20, 30, 0.45);
    color: #fecaca;
}

.gallery-prompt-access {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
}

.gallery-prompt-access--open .gallery-prompt-hint {
    font-size: 12px;
    color: #9fb6dd;
    opacity: 0.95;
}

.gallery-prompt-unlock-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 12px;
}

.gallery-prompt-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    color: var(--neon-text);
}

.gallery-prompt-label input {
    min-width: min(220px, 72vw);
    border: 1px solid var(--neon-border);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    color: #e9f5ff;
    background: rgba(8, 17, 38, 0.85);
}

.gallery-prompt-status--ok {
    font-size: 13px;
    color: #a7f3d0;
}

.gallery-prompt-lock-link {
    text-decoration: none;
    font-size: 13px;
    padding: 8px 14px;
}

.load-more-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 28px 0 36px;
}

.load-more-wrap .primary-btn {
    padding: 12px 28px;
    font-size: 15px;
    border-radius: 999px;
    box-shadow: 0 0 18px rgba(105, 213, 255, 0.25);
}

.load-more-status {
    color: var(--neon-text);
    font-size: 13px;
    min-height: 18px;
}

/* Admin: full width */
body.admin-body .container--admin {
    width: 100%;
    max-width: none;
    padding-left: 14px;
    padding-right: 14px;
}

/* Gallery: full width (категории без изменений) */
body.gallery-body .container--gallery {
    width: 100%;
    max-width: none;
    padding-left: 14px;
    padding-right: 14px;
}

body.gallery-body .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

@media (min-width: 1400px) {
    body.gallery-body .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

.admin-toolbar-primary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    flex: 1 1 100%;
    width: 100%;
}

.admin-view-toggle {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 0 0 auto;
}

.admin-ai-filters {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
}

.filter-chip--ai {
    font-size: 12px;
    padding: 6px 12px;
}

.admin-ai-run-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.admin-ai-status {
    flex: 1 1 200px;
    font-size: 12px;
    color: rgba(233, 245, 255, 0.75);
    min-height: 1.2em;
}

body.ai-classify-busy::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(4, 10, 24, 0.45);
    z-index: 9000;
    pointer-events: none;
}

.admin-view-btn {
    border: 1px solid var(--neon-border);
    background: rgba(8, 17, 38, 0.75);
    color: #e9f5ff;
    border-radius: 999px;
    padding: 8px 14px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-view-btn:hover {
    border-color: rgba(105, 213, 255, 0.55);
}

.admin-view-btn.active {
    border-color: rgba(105, 213, 255, 0.85);
    background: linear-gradient(135deg, rgba(45, 83, 146, 0.95), rgba(84, 61, 152, 0.95));
    box-shadow: 0 0 12px rgba(105, 213, 255, 0.28);
}

/* Массовое выделение */
.admin-bulk-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--neon-border);
    background: rgba(8, 17, 38, 0.85);
    color: var(--neon-text);
    font-size: 14px;
}

.admin-bulk-bar[hidden] {
    display: none !important;
}

.admin-bulk-select-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.admin-bulk-count {
    font-weight: 600;
    min-width: 100px;
}

.admin-bulk-mode-label,
.admin-bulk-category-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.admin-bulk-mode-select,
.admin-bulk-category-select {
    min-width: 180px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--neon-border);
    background: rgba(4, 10, 24, 0.9);
    color: #e9f5ff;
    font: inherit;
}

.admin-bulk-status {
    flex: 1 1 160px;
    font-size: 12px;
    color: rgba(233, 245, 255, 0.75);
}

.admin-card-select {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(4, 10, 24, 0.72);
    border: 1px solid rgba(105, 213, 255, 0.45);
    cursor: pointer;
}

.admin-card-select input {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: #69d5ff;
}

.admin-card--bulk-selected .admin-tile,
.admin-list--edit .admin-card--bulk-selected {
    outline: 2px solid rgba(105, 213, 255, 0.85);
    outline-offset: 2px;
}

/* Compact admin */
.admin-list {
    gap: 10px;
}

.admin-card {
    position: relative;
    background: rgba(255, 255, 255, 0.97);
    color: var(--text-dark);
    border-radius: 12px;
    border: 1px solid var(--border);
    min-width: 0;
}

/* Режим просмотра: плитка */
.admin-list--grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.admin-list--grid .admin-card {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.admin-list--grid .admin-card-editor {
    display: none !important;
}

.admin-tile {
    all: unset;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 100%;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--neon-border);
    background: var(--neon-card);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px rgba(1, 4, 13, 0.35);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-tile:hover {
    transform: translateY(-2px);
    border-color: rgba(105, 213, 255, 0.55);
    box-shadow: 0 12px 28px rgba(1, 7, 24, 0.45), 0 0 14px rgba(105, 213, 255, 0.18);
}

.admin-tile img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
}

.admin-tile-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 4px 6px;
    padding: 8px 10px;
    font-size: 12px;
    color: #d0ddff;
    background: rgba(8, 17, 38, 0.88);
}

.admin-tile-meta .prompt-number {
    font-weight: 700;
    color: var(--neon-accent);
}

.admin-tile-date {
    color: #b6c6ea;
    white-space: nowrap;
}

.admin-tile-categories {
    flex: 1 1 100%;
    font-size: 11px;
    line-height: 1.3;
    color: #9eb8e8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Режим редактирования: список */
.admin-list--edit {
    grid-template-columns: 1fr;
}

.admin-list--edit .admin-tile {
    display: none;
}

.admin-list--edit .admin-card {
    padding: 10px;
    grid-template-columns: 100% 1fr;
}

.admin-list--edit .admin-card-editor {
    display: grid;
    grid-template-columns: 240px 1fr;
    align-items: start;
    gap: 12px;
    width: 100%;
}

.admin-list--edit .admin-card-actions [data-close-edit] {
    display: none;
}

.admin-card-editor-thumb {
    width: 100px;
    max-height: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.admin-card-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.admin-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: var(--muted);
}

.admin-card-meta .prompt-number {
    font-weight: 700;
    color: var(--neon-accent);
    letter-spacing: 0.02em;
}

.admin-card-form .field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    color: #1f2937;
}

.admin-card-form .field span {
    font-weight: 600;
}

.admin-card-form textarea,
.admin-card-form input[type="url"],
.admin-card-form input[type="file"] {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 7px 9px;
    font: inherit;
    font-size: 13px;
}

.admin-card-form textarea {
    resize: vertical;
    min-height: 250px;
}

.category-chips {
    border: 1px dashed #d1d5db;
    border-radius: 10px;
    padding: 8px 10px;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.category-chips legend {
    font-size: 11px;
    color: #4b5563;
    padding: 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.category-chip input {
    display: none;
}

.category-chip:hover {
    border-color: #c7d2fe;
}

.category-chip.selected {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    border-color: #4338ca;
}

.admin-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.autosave-status {
    margin-left: auto;
    font-size: 12px;
    color: var(--muted);
}

.autosave-status[data-kind="ok"] {
    color: #16a34a;
}

.autosave-status[data-kind="pending"] {
    color: #2563eb;
}

.autosave-status[data-kind="error"] {
    color: #dc2626;
}

/* Модальное редактирование (из режима плитки) */
.admin-edit-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
}

.admin-edit-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.admin-edit-modal-panel {
    position: relative;
    z-index: 1;
    margin: 4vh auto;
    width: min(1100px, 96vw);
    max-height: 92vh;
    overflow: auto;
    background: rgba(255, 255, 255, 0.98);
    color: var(--text-dark);
    border-radius: 14px;
    padding: 16px 18px 20px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

.admin-edit-modal-close {
    position: absolute;
    right: 10px;
    top: 8px;
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
}

.admin-edit-modal-title {
    margin: 0 32px 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.admin-edit-modal-body .admin-card-editor {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 12px;
    align-items: start;
}

.admin-edit-modal-body .admin-card-editor-thumb {
    width: 100px;
    max-height: 130px;
}

@media (max-width: 840px) {
    .admin-list--edit .admin-card-editor,
    .admin-edit-modal-body .admin-card-editor {
        grid-template-columns: 1fr;
    }

    .admin-card-editor-thumb,
    .admin-edit-modal-body .admin-card-editor-thumb {
        width: 100%;
        max-height: 220px;
    }

    .admin-list--grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}
