/* Image Thumbnail Generator — itg- */
.itg-upload-zone {
    border: 2px dashed rgba(139, 92, 246, 0.35);
    border-radius: 16px;
    background: rgba(139, 92, 246, 0.04);
    padding: 56px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    outline: none;
}

.itg-upload-zone:hover,
.itg-upload-zone:focus,
.itg-upload-zone.itg-drag-over {
    border-color: #8B5CF6;
    background: rgba(139, 92, 246, 0.08);
}

.itg-upload-icon {
    font-size: 3rem;
    color: #8B5CF6;
    opacity: 0.7;
    margin-bottom: 14px;
    display: block;
}

.itg-upload-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px;
}

.itg-upload-sub {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

.itg-section {
    padding: 40px 0 60px;

}

.itg-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem
}

.itg-badge {
    width: 44px;
    height: 44px;
    background: rgba(139, 92, 246, .15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #8B5CF6;
    flex-shrink: 0
}

.itg-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0F172A;
    margin: 0 0 .2rem
}

.itg-subtitle {
    font-size: 0.9375rem;
    color: #64748B;
    margin: 0
}

.itg-controls {
    background: #F8FAFC;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    gap: .75rem
}

.itg-row {
    display: flex;
    flex-direction: column;
    gap: .75rem
}

.itg-group {
    display: flex;
    flex-direction: column;
    gap: .4rem
}

.itg-label {
    font-size: 0.9375rem;
    color: #64748B
}

.itg-presets {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem
}

.itg-preset-item {
    display: inline-flex;
    align-items: center;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748B;
    cursor: pointer;
    padding: .25rem .65rem;
    border: 1px solid #CBD5E1;
    border-radius: 99px;
    background: #F8FAFC;
    transition: background .15s, border-color .15s, color .15s;
    user-select: none;
}

.itg-preset-item:hover {
    border-color: #8B5CF6;
    color: #8B5CF6;
}

.itg-preset-item:has(:checked) {
    background: rgba(139, 92, 246, 0.1);
    border-color: #8B5CF6;
    color: #8B5CF6;
    font-weight: 600;
}

.itg-preset-item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.itg-custom-row {
    display: flex;
    gap: .5rem
}

.itg-num-input {
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: .4rem .6rem;
    color: #0F172A;
    font-size: 0.9375rem;
    outline: none;
    width: 100%;
    box-sizing: border-box
}

.itg-num-input:focus {
    border-color: #8B5CF6
}

.itg-select {
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: .45rem .7rem;
    color: #0F172A;
    font-size: 0.9375rem;
    outline: none;
    cursor: pointer
}

.itg-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem
}

.itg-btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity .2s, transform .1s
}

.itg-btn:active {
    transform: scale(.97)
}

.itg-btn--primary {
    background: #8B5CF6;
    color: #fff
}

.itg-btn--ghost {
    background: transparent;
    color: #64748B;
    border: 1px solid #CBD5E1
}

.itg-btn--ghost:hover {
    border-color: #8B5CF6;
    color: #8B5CF6
}

.itg-results-label {
    font-size: 0.9375rem;
    color: #64748B;
    margin-bottom: .75rem
}

.itg-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem
}

.itg-thumb-card {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: .75rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s;
    min-width: 80px
}

.itg-thumb-card:hover {
    border-color: #8B5CF6
}

.itg-thumb-card canvas {
    display: block;
    margin: 0 auto .4rem;
    image-rendering: pixelated;
    max-width: 80px;
    max-height: 80px;
    width: auto;
    height: auto
}

.itg-thumb-label {
    font-size: 0.9375rem;
    color: #64748B
}

@media(max-width:600px) {
    .itg-row {
        grid-template-columns: 1fr
    }
}

/* ── Loaded bar ─────────────────────────────────────────────────────────── */
.itg-loaded-bar {
    display: flex;
    align-items: center;
    gap: .85rem;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: .65rem .9rem;
    margin-bottom: 1.25rem;
}

.itg-loaded-thumb {
    border-radius: 6px;
    background: #E2E8F0;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: block;
}

.itg-loaded-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.itg-loaded-name {
    font-size: .9375rem;
    font-weight: 600;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.itg-loaded-dims {
    font-size: .8125rem;
    color: #64748B;
}

/* ── Fit mode tabs ───────────────────────────────────────────────────────── */
.itg-fit-tabs {
    display: flex;
    gap: .4rem;
}

.itg-fit-tab {
    padding: .3rem .85rem;
    border-radius: 99px;
    border: 1px solid #E2E8F0;
    background: #F1F5F9;
    font-size: .875rem;
    font-weight: 500;
    color: #64748B;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

.itg-fit-tab:hover {
    border-color: #8B5CF6;
    color: #8B5CF6;
}

.itg-fit-tab--active,
.itg-fit-tab--active:hover {
    background: #8B5CF6;
    border-color: #8B5CF6;
    color: #fff;
}

/* ── Quality slider ──────────────────────────────────────────────────────── */
.itg-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 99px;
    background: rgba(139, 92, 246, 0.2);
    outline: none;
    cursor: pointer;
}

.itg-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #8B5CF6;
    cursor: pointer;
}

.itg-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: #8B5CF6;
    cursor: pointer;
}

/* ── Background color picker ─────────────────────────────────────────────── */
.itg-color-input {
    width: 48px;
    height: 36px;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
    background: #F1F5F9;
}

/* ── Thumbnail card file size ─────────────────────────────────────────────── */
.itg-thumb-size {
    display: block;
    font-size: .75rem;
    color: #8B5CF6;
    margin-top: .15rem;
}

/* ── 2-col workspace layout ──────────────────────────────────────────── */
.itg-workspace {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.itg-left {
    min-width: 0;
}

/* ── Preview panel ──────────────────────────────────────────────── */
.itg-preview-panel {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    position: sticky;
    top: 80px;
}

.itg-preview-img-wrap {
    background: repeating-conic-gradient(#E2E8F0 0% 25%, #fff 0% 50%) 0 0 / 16px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 320px;
    overflow: hidden;
}

.itg-preview-img {
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
    display: block;
    border-radius: 4px;
}

.itg-preview-meta {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.itg-preview-name {
    font-size: .9375rem;
    font-weight: 600;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.itg-preview-dims {
    font-size: .8125rem;
    color: #64748B;
}

.itg-change-full-btn {
    width: 100%;
    justify-content: center;
}

@media (max-width: 768px) {
    .itg-workspace {
        grid-template-columns: 1fr;
    }

    .itg-preview-panel {
        position: static;
        order: -1;
    }
}