#gal-image-search-page {
    --gis-surface: rgba(255, 255, 255, 0.94);
    --gis-surface-soft: rgba(255, 255, 255, 0.96);
    --gis-border: rgba(31, 41, 55, 0.10);
    --gis-text: #342735;
    --gis-muted: #766678;
    --gis-muted-soft: #9aa0ab;
    --gis-accent: #ef8fb1;
    --gis-accent-strong: #e56d99;
    --gis-accent-soft: rgba(239, 143, 177, 0.12);
    --gis-shadow: 0 18px 40px rgba(223, 150, 180, 0.10);
    --gis-success: #22a06b;
    --gis-success-soft: rgba(34, 160, 107, 0.14);
    color: var(--gis-text);
    max-width: 1120px;
    margin: 0 auto;
}

#page:has(#gal-image-search-page) {
    width: 100%;
    max-width: 100%;
}

#content-inner:has(#gal-image-search-page) {
    width: min(1180px, calc(100vw - 40px));
    max-width: min(1180px, calc(100vw - 40px));
}

html[data-theme='dark'] #gal-image-search-page,
body[data-theme='dark'] #gal-image-search-page,
html.dark #gal-image-search-page,
body.dark #gal-image-search-page {
    --gis-surface: rgba(25, 20, 26, 0.96);
    --gis-surface-soft: rgba(33, 26, 34, 0.92);
    --gis-border: rgba(255, 255, 255, 0.10);
    --gis-text: #fff2f8;
    --gis-muted: #bca6b7;
    --gis-muted-soft: #8f7a8b;
    --gis-accent: #ff9fc4;
    --gis-accent-strong: #ff84b1;
    --gis-accent-soft: rgba(255, 159, 196, 0.14);
    --gis-shadow: none;
    --gis-success: #6dd3a5;
    --gis-success-soft: rgba(109, 211, 165, 0.14);
}

#gal-image-search-page .gis-shell {
    display: grid;
    gap: 24px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#gal-image-search-page[data-ready='true'] .gis-shell {
    opacity: 1;
    transform: translateY(0);
}

#gal-image-search-page .gis-upload,
#gal-image-search-page .gis-results-wrap,
#gal-image-search-page .gis-result-card,
#gal-image-search-page .gis-post,
#gal-image-search-page .gis-not-found {
    background: var(--gis-surface);
    border: 1px solid var(--gis-border);
    border-radius: 24px;
    box-shadow: var(--gis-shadow);
}

#gal-image-search-page .gis-hero-copy {
    padding: 8px 4px 0;
}

#gal-image-search-page .gis-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

#gal-image-search-page .gis-title {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1;
    font-weight: 900;
    letter-spacing: -0.05em;
    color: var(--gis-text);
}

#gal-image-search-page .gis-source-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    background: #2f3440;
    color: #ffffff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
}

#gal-image-search-page .gis-desc {
    margin: 10px 0 0;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--gis-muted);
}

#gal-image-search-page .gis-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

#gal-image-search-page .gis-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(31, 41, 55, 0.06);
    border: 0;
    color: #5f6775;
    font-size: 13px;
    font-weight: 700;
}

#gal-image-search-page .gis-upload,
#gal-image-search-page .gis-results-wrap {
    padding: 24px;
}

#gal-image-search-page .gis-upload-head,
#gal-image-search-page .gis-results-head {
    margin-bottom: 16px;
}

#gal-image-search-page .gis-section-title {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--gis-text);
}

#gal-image-search-page .gis-section-subtitle {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--gis-muted);
}

#gal-image-search-page .gis-dropzone {
    position: relative;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1.5px dashed rgba(229, 133, 173, 0.34);
    border-radius: 24px;
    background: #ffffff;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    cursor: pointer;
}

html[data-theme='dark'] #gal-image-search-page .gis-dropzone,
body[data-theme='dark'] #gal-image-search-page .gis-dropzone,
html.dark #gal-image-search-page .gis-dropzone,
body.dark #gal-image-search-page .gis-dropzone {
    background:
        linear-gradient(180deg, rgba(36, 28, 37, 0.94), rgba(30, 23, 31, 0.98)),
        repeating-linear-gradient(135deg, transparent, transparent 16px, rgba(255, 159, 196, 0.03) 16px, rgba(255, 159, 196, 0.03) 32px);
}

#gal-image-search-page .gis-dropzone:hover,
#gal-image-search-page .gis-dropzone.is-dragover {
    border-color: var(--gis-accent-strong);
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(31, 41, 55, 0.06);
}

#gal-image-search-page .gis-file {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

#gal-image-search-page .gis-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
    background: rgba(255, 255, 255, 0.82);
}

html[data-theme='dark'] #gal-image-search-page .gis-preview,
body[data-theme='dark'] #gal-image-search-page .gis-preview,
html.dark #gal-image-search-page .gis-preview,
body.dark #gal-image-search-page .gis-preview {
    background: rgba(22, 18, 23, 0.88);
}

#gal-image-search-page .gis-drop-inner {
    display: grid;
    gap: 14px;
    padding: 28px;
    text-align: center;
}

#gal-image-search-page .gis-drop-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #7a8190;
    font-size: 30px;
}

#gal-image-search-page .gis-drop-title {
    color: var(--gis-text);
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -0.04em;
}

#gal-image-search-page .gis-drop-subtitle {
    color: var(--gis-muted);
    font-size: 14px;
    line-height: 1.75;
}

#gal-image-search-page .gis-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
    align-items: center;
}

#gal-image-search-page .gis-button {
    min-height: 48px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

#gal-image-search-page .gis-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

#gal-image-search-page .gis-button:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

#gal-image-search-page .gis-button--primary {
    min-width: 148px;
    background: linear-gradient(135deg, var(--gis-accent), var(--gis-accent-strong));
    color: #fff;
    box-shadow: 0 12px 24px rgba(229, 109, 153, 0.18);
}

#gal-image-search-page .gis-button--ghost {
    min-height: 42px;
    padding: 0 14px;
    background: rgba(31, 41, 55, 0.04);
    color: #586171;
    border-color: rgba(31, 41, 55, 0.10);
    font-size: 13px;
}

#gal-image-search-page .gis-helper-line {
    margin-top: 12px;
    color: var(--gis-muted);
    font-size: 12px;
    line-height: 1.6;
}

#gal-image-search-page .gis-status {
    min-height: 24px;
    margin-top: 12px;
    color: var(--gis-muted);
    font-size: 14px;
}

#gal-image-search-page .gis-status.is-loading {
    color: var(--gis-text);
}

#gal-image-search-page .gis-status.is-loading::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--gis-accent-strong);
    box-shadow: 16px 0 0 rgba(239, 143, 177, 0.22);
    animation: gisPulse 1s ease-in-out infinite;
    vertical-align: middle;
}

#gal-image-search-page .gis-status.is-error {
    color: #d94f4f;
}

#gal-image-search-page .gis-status.is-success {
    color: var(--gis-success);
}

#gal-image-search-page .gis-results-wrap {
    display: grid;
    gap: 18px;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(8px);
    transition: max-height 0.28s ease, opacity 0.22s ease, transform 0.22s ease, padding 0.22s ease;
}

#gal-image-search-page[data-has-results='true'] .gis-results-wrap {
    max-height: 2400px;
    padding-top: 24px;
    padding-bottom: 24px;
    opacity: 1;
    transform: translateY(0);
}

#gal-image-search-page .gis-results,
#gal-image-search-page .gis-result-list,
#gal-image-search-page .gis-match-list {
    display: grid;
    gap: 14px;
}

#gal-image-search-page .gis-result-card {
    padding: 22px;
}

#gal-image-search-page .gis-result-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

#gal-image-search-page .gis-result-label,
#gal-image-search-page .gis-section-mini-title {
    color: var(--gis-muted-soft);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#gal-image-search-page .gis-result-title {
    margin: 8px 0 0;
    color: var(--gis-text);
    font-size: 1.5rem;
    line-height: 1.25;
    font-weight: 900;
    letter-spacing: -0.03em;
}

#gal-image-search-page .gis-score-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--gis-success-soft);
    color: var(--gis-success);
    font-size: 12px;
    font-weight: 800;
}

#gal-image-search-page .gis-result-section {
    margin-top: 18px;
}

#gal-image-search-page .gis-character-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

#gal-image-search-page .gis-character-tag {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--gis-accent-soft);
    color: var(--gis-accent-strong);
    font-size: 12px;
    font-weight: 700;
}

#gal-image-search-page .gis-muted-block {
    margin-top: 10px;
    color: var(--gis-muted);
    font-size: 14px;
}

#gal-image-search-page .gis-post {
    min-height: 72px;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: #222833;
    text-decoration: none;
    background: var(--gis-surface-soft);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

#gal-image-search-page .gis-post:hover {
    transform: translateY(-1px);
    border-color: rgba(229, 109, 153, 0.26);
}

#gal-image-search-page .gis-post-title {
    color: #222833;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.5;
    text-decoration: underline;
    text-underline-offset: 3px;
}

#gal-image-search-page .gis-post-subtitle,
#gal-image-search-page .gis-post-score,
#gal-image-search-page .gis-not-found-text {
    color: var(--gis-muted);
    font-size: 13px;
    line-height: 1.7;
}

#gal-image-search-page .gis-post-score {
    color: #5f6775;
    font-weight: 700;
    white-space: nowrap;
}

#gal-image-search-page .gis-not-found {
    padding: 16px;
    background: var(--gis-surface-soft);
}

#gal-image-search-page .gis-not-found-title {
    color: var(--gis-text);
    font-size: 15px;
    font-weight: 700;
}

@media (max-width: 768px) {
    #content-inner:has(#gal-image-search-page) {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
    }

    #gal-image-search-page .gis-upload,
    #gal-image-search-page .gis-results-wrap {
        padding: 18px;
        border-radius: 20px;
    }

    #gal-image-search-page .gis-dropzone {
        min-height: 230px;
    }

    #gal-image-search-page .gis-drop-title {
        font-size: 1.32rem;
    }

    #gal-image-search-page .gis-actions {
        align-items: stretch;
    }

    #gal-image-search-page .gis-button--primary {
        width: 100%;
    }

    #gal-image-search-page .gis-button--ghost {
        flex: 1 1 calc(50% - 5px);
        justify-content: center;
    }

    #gal-image-search-page .gis-result-head,
    #gal-image-search-page .gis-post {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    #gal-image-search-page .gis-shell,
    #gal-image-search-page .gis-dropzone,
    #gal-image-search-page .gis-button,
    #gal-image-search-page .gis-post,
    #gal-image-search-page .gis-results-wrap,
    #gal-image-search-page .gis-status.is-loading::before {
        transition: none;
        animation: none;
    }
}

@keyframes gisPulse {
    0%,
    100% {
        transform: scale(0.96);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.04);
        opacity: 1;
    }
}
