#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}




/* ---------- Hero ---------- */
.hero {
    text-align: center;
    margin-bottom: 28px;
    background: linear-gradient(219deg, #FB0E76 0%, #910694 100%);
    border-radius: 12px;
    padding: 20px !important;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: #ffffff;

}

.hero p {
    margin: 0 auto;
    max-width: 620px;
    color: whitesmoke;
    font-size: 15px;
}

/* ---------- Card ---------- */
.card {
    background: #ffffff;
    border: 1px solid #e5e7eb !important;
    border-radius: 16px !important;
    padding: 24px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

.card+.card {
    margin-top: 20px;
}

.card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.card-title h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title h3 .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.image-preview {
    display: flex;
    flex-direction: column;
}

.image-stage {
    display: flex;
    justify-content: center;
    align-items: center;

    min-height: 300px;
    padding: 20px;
}

.image-stage img {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
}




/* ---------- Dropzone ---------- */
.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px !important;
    border: 2px dashed #d1d5db;
    border-radius: 12px !important;
    background: #f9fafb !important;
    cursor: pointer;
    transition: border-color 180ms cubic-bezier(0.4, 0, 0.2, 1), background 180ms cubic-bezier(0.4, 0, 0.2, 1), transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.dropzone:hover {
    border-color: #FB0E76;
    background: rgba(251, 14, 118, 0.04);
}

.dropzone.dragover {
    border-color: #FB0E76;
    background: rgba(251, 14, 118, 0.06);
    transform: scale(1.01);
    box-shadow: 0 0 0 4px rgba(251, 14, 118, 0.15);
}

.dropzone-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px !important;
    background: rgba(251, 14, 118, 0.08);
    color: #FB0E76;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1), background 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.dropzone:hover .dropzone-icon {
    transform: translateY(-2px) scale(1.05);
}

.dropzone-icon svg {
    width: 28px;
    height: 28px;
}

.dropzone-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.dropzone-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
}

.dropzone-hint {
    font-size: 12px;
    color: #9ca3af;
}

.dropzone input[type='file'] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px !important;
    border-radius: 8px !important;
    border: 1px solid transparent !important;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 180ms cubic-bezier(0.4, 0, 0.2, 1), border-color 180ms cubic-bezier(0.4, 0, 0.2, 1), color 180ms cubic-bezier(0.4, 0, 0.2, 1), transform 180ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    user-select: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: #3b82f6 !important;
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: #2563eb;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: #f3f4f6 !important;
    color: #374151 !important;
    border-color: #e5e7eb;
}

.btn-secondary:hover:not(:disabled) {
    border-color: #d1d5db;
    background: #e5e7eb;
}

.btn-ghost {
    background: transparent !important;
    color: #6b7280 !important;
    border-color: #e5e7eb;
}

.btn-ghost:hover:not(:disabled) {
    color: #1a1a2e;
    border-color: #d1d5db;
    background: #f3f4f6;
}

.btn-danger {
    background: transparent !important;
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
}

.btn svg {
    width: 16px;
    height: 16px;
}

/* ---------- File info ---------- */
.file-info {
    display: none;
    align-items: center;
    gap: 14px;
    padding: 14px 16px !important;
    margin-top: 16px;
    background: #f9fafb !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px;
    animation: slideIn 220ms ease;
}

.file-info.active {
    display: flex;
}

.file-info-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(251, 14, 118, 0.08);
    color: #FB0E76;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.file-info-icon svg {
    width: 20px;
    height: 20px;
}

.file-info-text {
    flex: 1;
    min-width: 0;
}

.file-info-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-info-meta {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.file-info-remove {
    background: transparent !important;
    border: none !important;
    color: #9ca3af !important;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px!important;
    display: grid;
    place-items: center;
    transition: color 180ms cubic-bezier(0.4, 0, 0.2, 1), background 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.file-info-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}

/* ---------- Actions row ---------- */
.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.actions .spacer {
    flex: 1;
}

/* ---------- Output bar ---------- */
.output-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.output-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- Image Preview ---------- */
.image-preview {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    /* Checkered transparency grid */
    background-color: #f0f0f0;
    background-image:
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    padding: 15px;
}

.image-preview-empty {
    padding: 48px 24px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.85);
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.image-preview-empty svg {
    width: 36px;
    height: 36px;
    opacity: 0.4;
}

.image-preview img {
    max-width: 100%;
    max-height: 100vh;
    display: block;
    object-fit: contain;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    border-radius: 2px;
}

/* ---------- Image meta bar ---------- */
.image-meta-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.85);
    border-top: 1px solid #e5e7eb;
    font-size: 12px;
    color: #6b7280;

    bottom: 0;
    left: 0;
    right: 0;
}

.image-meta-bar span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ---------- Spinner ---------- */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- Loading overlay ---------- */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.80);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    z-index: 5;
    border-radius: 8px;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay .spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
    border-color: rgba(251, 14, 118, 0.25);
    border-top-color: #FB0E76;
}

.loading-overlay span {
    font-size: 13px;
    color: #374151;
}

/* ---------- Toast ---------- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    font-size: 14px;
    color: #1a1a2e;
    min-width: 260px;
    max-width: 360px;
    pointer-events: auto;
    animation: toastIn 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.success {
    border-color: rgba(34, 197, 94, 0.4);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.06), #ffffff);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.4);
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.06), #ffffff);
}

.toast.info {
    border-color: rgba(251, 14, 118, 0.3);
    background: linear-gradient(180deg, rgba(251, 14, 118, 0.05), #ffffff);
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: #22c55e;
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.info .toast-icon {
    color: #3b82f6;
}

.toast-msg {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
}

.toast.fade-out {
    animation: toastOut 200ms ease forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Footer ---------- */
.app-footer {
    text-align: center;
    margin-top: 32px;
    font-size: 12px;
    color: #9ca3af;
}

.app-footer a {
    color: #6b7280;
    text-decoration: none;
    border-bottom: 1px dotted #d1d5db;
}

.app-footer a:hover {
    color: #1a1a2e;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    #app {
        padding: 0px;
    }

    .card {
        padding: 18px;
    }

    .dropzone {
        padding: 36px 16px;
    }

    .output-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .output-actions {
        justify-content: stretch;
    }

    .output-actions .btn {
        flex: 1;
    }

    .actions .spacer {
        display: none;
    }

    .toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
    }

    .toast {
        max-width: none;
        min-width: 0;
    }
}

@media (max-width: 420px) {
    .actions .btn {
        flex: 1 1 100%;
    }
}