* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f1419 0%, #1a252f 50%, #0f1419 100%);
    min-height: 100vh;
    padding: 20px;
    color: #ecf0f1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #34495e;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    overflow: hidden;
    border: 1px solid #5d6d7e;
}

.header {
    background: linear-gradient(135deg, #0d4f2a, #1e8449);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(46, 204, 113, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(39, 174, 96, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(52, 152, 219, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(155, 89, 182, 0.2) 0%, transparent 50%);
    animation: gentleGlow 6s ease-in-out infinite;
    z-index: 1;
}

.header h1,
.header p {
    position: relative;
    z-index: 2;
}

@keyframes gentleGlow {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.05);
    }
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.header-icon {
    width: 50px;
    height: 50px;
    object-fit: contain;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* Fancy divider between header and body */
.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(46, 204, 113, 0.8) 20%, 
        rgba(39, 174, 96, 1) 50%, 
        rgba(46, 204, 113, 0.8) 80%, 
        transparent 100%);
    box-shadow: 0 2px 10px rgba(46, 204, 113, 0.3);
    z-index: 3;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 40px;
}

.upload-section {
    background: #5d6d7e;
    padding: 30px;
    border-radius: 15px;
    border: 2px dashed #85929e;
}

.upload-section h2 {
    color: #ecf0f1;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #ecf0f1;
}

.form-group select,
.form-group input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #85929e;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    background: #34495e;
    color: #ecf0f1;
}

.form-group select:focus,
.form-group input[type="file"]:focus {
    outline: none;
    border-color: #27ae60;
}

/* Frame count control styles */
.frame-count-control {
    background: #34495e;
    border: 2px solid #5d6d7e;
    border-radius: 8px;
    padding: 15px;
    transition: border-color 0.3s ease;
}

.frame-count-control:focus-within {
    border-color: #27ae60;
}

.frame-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #5d6d7e;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 10px;
}

.frame-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #27ae60;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(39, 174, 96, 0.3);
}

.frame-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #27ae60;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(39, 174, 96, 0.3);
}

.frame-count-display {
    text-align: center;
    color: #ecf0f1;
}

.frame-count-display span {
    font-weight: bold;
    color: #27ae60;
    font-size: 18px;
}

.frame-count-display small {
    display: block;
    color: #bdc3c7;
    margin-top: 5px;
    font-size: 12px;
}

/* Quality dropdown styles */
.quality-info {
    display: block;
    color: #bdc3c7;
    margin-top: 5px;
    font-size: 12px;
    font-style: italic;
}

/* File Size Estimator styles */
.file-size-estimator {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.estimator-content h4 {
    color: #fff;
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.size-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    text-align: center;
    margin-bottom: 15px;
}

.size-kicker {
    display: block;
    margin-bottom: 4px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.size-display {
    text-align: center;
    margin-bottom: 15px;
}

.estimated-size {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

.size-details {
    display: block;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
}

.size-breakdown {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
}

.size-breakdown .breakdown-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.size-breakdown .breakdown-item:last-child {
    margin-bottom: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 8px;
    font-weight: bold;
}

.size-breakdown .breakdown-label {
    color: rgba(255, 255, 255, 0.7);
}

.size-breakdown .breakdown-value {
    color: #fff;
    font-weight: 500;
}

/* Source selection tabs */
.source-tabs {
    display: flex;
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #5d6d7e;
}

.source-tab {
    flex: 1;
    padding: 12px 20px;
    background: #5d6d7e;
    color: #bdc3c7;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    border-right: 1px solid #85929e;
}

.source-tab:last-child {
    border-right: none;
}

.source-tab:hover {
    background: #85929e;
    color: #ecf0f1;
}

.source-tab.active {
    background: #27ae60;
    color: white;
}

.source-content {
    display: none;
}

.source-content.active {
    display: block;
}

/* Tenor search styles */
.tenor-search-container {
    background: #34495e;
    border: 2px solid #5d6d7e;
    border-radius: 8px;
    padding: 15px;
    transition: border-color 0.3s ease;
}

.search-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.search-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #5d6d7e;
    border-radius: 6px;
    background: #2c3e50;
    color: #ecf0f1;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #27ae60;
}

.search-input::placeholder {
    color: #85929e;
}

.search-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.search-btn:hover {
    background: linear-gradient(135deg, #2980b9, #1f4e79);
    transform: translateY(-1px);
}

.search-btn:disabled {
    background: #5d6d7e;
    cursor: not-allowed;
    transform: none;
}

.search-results {
    margin-top: 15px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #5d6d7e;
}

.results-header h4 {
    color: #ecf0f1;
    margin: 0;
    font-size: 16px;
}

.clear-search-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.clear-search-btn:hover {
    background: #c0392b;
}

.gif-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
    padding: 5px;
}

.gif-item {
    position: relative;
    border: 2px solid #5d6d7e;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #2c3e50;
}

.gif-item:hover {
    border-color: #27ae60;
    transform: scale(1.05);
}

.gif-item.selected {
    border-color: #27ae60;
    box-shadow: 0 0 10px rgba(39, 174, 96, 0.5);
}

.gif-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}

.gif-item .gif-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 6px;
    font-size: 10px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-results {
    text-align: center;
    padding: 20px;
    color: #bdc3c7;
    font-style: italic;
}

.selected-gif-info {
    margin-top: 15px;
    padding: 15px;
    background: #2c3e50;
    border: 2px solid #27ae60;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.selected-gif-preview {
    flex-shrink: 0;
}

.selected-gif-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #27ae60;
}

.selected-gif-details {
    flex: 1;
}

.selected-gif-details h4 {
    color: #ecf0f1;
    margin: 0 0 5px 0;
    font-size: 14px;
}

.selected-gif-details p {
    color: #bdc3c7;
    margin: 0 0 10px 0;
    font-size: 12px;
}

.remove-gif-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.remove-gif-btn:hover {
    background: #c0392b;
}

/* Loading spinner for search */
.search-loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #bdc3c7;
}

.search-loading.active {
    display: block;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #5d6d7e;
    border-radius: 50%;
    border-top-color: #27ae60;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Crop control styles */
.crop-controls {
    background: #34495e;
    border: 2px solid #5d6d7e;
    border-radius: 8px;
    padding: 15px;
    transition: border-color 0.3s ease;
}

.crop-controls:focus-within {
    border-color: #27ae60;
}

.crop-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.crop-row label {
    min-width: 80px;
    font-size: 14px;
    color: #ecf0f1;
}

.crop-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #5d6d7e;
    outline: none;
    -webkit-appearance: none;
}

.crop-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #27ae60;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(39, 174, 96, 0.3);
}

.crop-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #27ae60;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(39, 174, 96, 0.3);
}

.crop-row span {
    min-width: 40px;
    text-align: right;
    color: #27ae60;
    font-weight: bold;
    font-size: 14px;
}

.crop-preview-container {
    margin-top: 15px;
    text-align: center;
}

.crop-preview {
    width: 250px;
    height: 250px;
    margin: 0 auto 10px;
    border: 2px solid #5d6d7e;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    background: #2c3e50;
}

.update-preview-btn {
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

.update-preview-btn:hover {
    background: linear-gradient(135deg, #2980b9, #1f4e79) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
}

.update-preview-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

.reset-crop-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

.reset-crop-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
}

.reset-crop-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

.crop-preview img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    /* Completely override any animation effects */
    animation: none !important;
    transform-origin: center center !important;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid #27ae60;
    background: rgba(39, 174, 96, 0.1);
    pointer-events: none;
    transition: all 0.2s ease;
    border-radius: 50%;
}

.crop-preview-container small {
    color: #bdc3c7;
    font-size: 12px;
}

/* Crop container styles */
.crop-container {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    transition: all 0.2s ease;
    /* Ensure proper clipping of scaled content */
    clip-path: circle(50% at 50% 50%);
}

.crop-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    transition: all 0.2s ease;
}

/* Ensure crop transforms take precedence */
.crop-container img[style*="transform"] {
    transition: none !important;
}

/* Force transform to work for crop preview */
.crop-container img {
    transform-origin: center center !important;
}

.upload-area {
    border: 2px dashed #27ae60;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    background: #34495e;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    background: #5d6d7e;
    border-color: #2ecc71;
}

.upload-area.dragover {
    background: #5d6d7e;
    border-color: #2ecc71;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3em;
    color: #27ae60;
    margin-bottom: 15px;
}

.upload-text {
    color: #bdc3c7;
    font-size: 1.1em;
}

.upload-text small {
    color: #27ae60;
    font-weight: 600;
}

.file-info {
    margin-top: 15px;
    padding: 10px;
    background: #34495e;
    border-radius: 5px;
    font-size: 0.9em;
    color: #ecf0f1;
    border: 1px solid #5d6d7e;
}

.btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 20px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(39, 174, 96, 0.3);
}

.btn:disabled {
    background: #5d6d7e;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.preview-section {
    background: #5d6d7e;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-section h2 {
    color: #ecf0f1;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.device-picker {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.device-option {
    border: 0;
    border-radius: 999px;
    padding: 8px 16px;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 650;
    cursor: pointer;
    color: #ecf0f1;
    background: #34495e;
}

.device-option:hover,
.device-option.active {
    background: #27ae60;
    color: #fff;
}

 .knomi-preview {
     display: flex;
     justify-content: center;
     align-items: center;
     position: relative;
 }

.device-frame {
    position: relative;
    width: 300px;
}

 .knomi-device {
     width: 100%;
     height: auto;
     display: block;
 }

.gif-overlay {
    position: absolute;
    top: 36.71%;
    left: 49.51%;
    transform: translate(-50%, -50%);
    width: 33.39%;
    aspect-ratio: 1;
    height: auto;
    z-index: 1;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #27ae60;
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
    background: #34495e;
    display: flex;
    align-items: center;
    justify-content: center;
    container-type: size;
    /* Ensure proper clipping of all content */
    clip-path: circle(50% at 50% 50%);
}

.knomi-preview[data-device="voron"] .gif-overlay {
    top: 20.69%;
    left: 50.86%;
    width: 49.24%;
}

.knomi-preview[data-device="pop"] .gif-overlay {
    top: 35.54%;
    left: 38.94%;
    width: 55.25%;
    /* Face is turned, so the round screen reads as a taller ellipse. Export stays a circle. */
    transform: translate(-50%, -50%) scaleX(0.904);
}

.gif-overlay .crop-container {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 50%;
    overflow: hidden;
    /* Ensure proper clipping of scaled content */
    clip-path: circle(50% at 50% 50%);
}

.gif-overlay img,
.gif-overlay video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

/* Animation preview styles */

.gif-overlay.preview-pulse img,
.crop-container.preview-pulse img {
    animation: pulsePreview 1.5s ease-in-out infinite;
}

.gif-overlay.preview-rotate img,
.crop-container.preview-rotate img {
    animation: rotatePreview 3s linear infinite;
}

.gif-overlay.preview-bounce img,
.crop-container.preview-bounce img {
    animation: bouncePreview 1s ease-in-out infinite;
}

.gif-overlay.preview-shake img,
.crop-container.preview-shake img {
    animation: shakePreview 0.5s ease-in-out infinite;
}

.gif-overlay.preview-glow img,
.crop-container.preview-glow img {
    animation: glowPreview 2s ease-in-out infinite;
}

.gif-overlay.preview-zoom img,
.crop-container.preview-zoom img {
    animation: zoomPreview 2s ease-in-out infinite;
}

.gif-overlay.preview-slide img,
.crop-container.preview-slide img {
    animation: slidePreview 2s ease-in-out infinite;
}

.gif-overlay.preview-wiggle img,
.crop-container.preview-wiggle img {
    animation: wigglePreview 0.8s ease-in-out infinite;
}

.gif-overlay.preview-fade img,
.crop-container.preview-fade img {
    animation: fadePreview 2s ease-in-out infinite;
}

.gif-overlay.preview-flip img,
.crop-container.preview-flip img {
    animation: flipPreview 2s ease-in-out infinite;
}

.gif-overlay.preview-float img,
.crop-container.preview-float img {
    animation: floatPreview 3s ease-in-out infinite;
}

.gif-overlay.preview-spin img,
.crop-container.preview-spin img {
    animation: spinPreview 2s ease-in-out infinite;
}

.gif-overlay.preview-rainbow img,
.crop-container.preview-rainbow img {
    animation: rainbowPreview 3s ease-in-out infinite;
}

.gif-overlay.preview-elastic img,
.crop-container.preview-elastic img {
    animation: elasticPreview 1.5s ease-in-out infinite;
}

.gif-overlay.preview-wave img,
.crop-container.preview-wave img {
    animation: wavePreview 2.5s ease-in-out infinite;
}

.gif-overlay.preview-morph img,
.crop-container.preview-morph img {
    animation: morphPreview 3s ease-in-out infinite;
}

.gif-overlay.preview-matrix img,
.crop-container.preview-matrix img {
    animation: matrixPreview 2s ease-in-out infinite;
}

.gif-overlay.preview-heartbeat img,
.crop-container.preview-heartbeat img {
    animation: heartbeatPreview 1.2s ease-in-out infinite;
}

.gif-overlay.preview-orbit img,
.crop-container.preview-orbit img {
    animation: orbitPreview 4s linear infinite;
}

.gif-overlay.preview-neon img,
.crop-container.preview-neon img {
    animation: neonPreview 2s ease-in-out infinite;
}

.gif-overlay.preview-kaleidoscope img,
.crop-container.preview-kaleidoscope img {
    animation: kaleidoscopePreview 3s ease-in-out infinite;
}

.gif-overlay.preview-earthquake img,
.crop-container.preview-earthquake img {
    animation: earthquakePreview 0.8s ease-in-out infinite;
}

.gif-overlay.preview-hologram img,
.crop-container.preview-hologram img {
    animation: hologramPreview 2.5s ease-in-out infinite;
}

.gif-overlay.preview-vortex img,
.crop-container.preview-vortex img {
    animation: vortexPreview 3s ease-in-out infinite;
}

.gif-overlay.preview-breathing img,
.crop-container.preview-breathing img {
    animation: breathingPreview 4s ease-in-out infinite;
}

.gif-overlay.preview-ripple img,
.crop-container.preview-ripple img {
    animation: ripplePreview 2.5s ease-in-out infinite;
}

.gif-overlay.preview-swirl img,
.crop-container.preview-swirl img {
    animation: swirlPreview 3.5s ease-in-out infinite;
}

.gif-overlay.preview-glitch img,
.crop-container.preview-glitch img {
    animation: glitchPreview 1.8s ease-in-out infinite;
}

.gif-overlay.preview-energy img,
.crop-container.preview-energy img {
    animation: energyPreview 2.2s ease-in-out infinite;
}

.gif-overlay.preview-water img,
.crop-container.preview-water img {
    animation: waterPreview 3.2s ease-in-out infinite;
}

.gif-overlay.preview-crystal img,
.crop-container.preview-crystal img {
    animation: crystalPreview 4.5s ease-in-out infinite;
}

.gif-overlay.preview-galaxy img,
.crop-container.preview-galaxy img {
    animation: galaxyPreview 5s ease-in-out infinite;
}

.gif-overlay.preview-lava img,
.crop-container.preview-lava img {
    animation: lavaPreview 2.8s ease-in-out infinite;
}

.gif-overlay.preview-ice img,
.crop-container.preview-ice img {
    animation: icePreview 3.8s ease-in-out infinite;
}


@keyframes pulsePreview {
    0%, 100% { transform: scale(0.9); }
    50% { transform: scale(1.1); }
}

@keyframes rotatePreview {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
}

@keyframes bouncePreview {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes shakePreview {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

@keyframes glowPreview {
    0%, 100% { 
        filter: brightness(1) drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
    }
    50% { 
        filter: brightness(1.3) drop-shadow(0 0 15px rgba(255, 255, 255, 0.8));
    }
}

@keyframes zoomPreview {
    0%, 100% { transform: scale(0.8); }
    50% { transform: scale(1.2); }
}

@keyframes slidePreview {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(10px); }
}

@keyframes wigglePreview {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(3deg); }
    75% { transform: rotate(-3deg); }
}

@keyframes fadePreview {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes flipPreview {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(180deg); }
    100% { transform: rotateY(360deg); }
}

@keyframes floatPreview {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}

@keyframes spinPreview {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(45deg) scale(1.1); }
    50% { transform: rotate(180deg) scale(0.9); }
    75% { transform: rotate(135deg) scale(1.1); }
}

@keyframes rainbowPreview {
    0%, 100% { filter: hue-rotate(0deg) brightness(1); }
    25% { filter: hue-rotate(45deg) brightness(1.2); }
    50% { filter: hue-rotate(180deg) brightness(0.8); }
    75% { filter: hue-rotate(135deg) brightness(1.2); }
}

@keyframes elasticPreview {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(0.7); }
    75% { transform: scale(1.1); }
}

@keyframes wavePreview {
    0%, 100% { transform: rotate(0deg) translateY(0px); }
    25% { transform: rotate(2deg) translateY(-5px); }
    50% { transform: rotate(0deg) translateY(-10px); }
    75% { transform: rotate(-2deg) translateY(-5px); }
}

@keyframes morphPreview {
    0%, 100% { 
        transform: scale(1) rotate(0deg);
        border-radius: 50%;
    }
    25% { 
        transform: scale(1.1) rotate(45deg);
        border-radius: 30%;
    }
    50% { 
        transform: scale(0.9) rotate(180deg);
        border-radius: 20%;
    }
    75% { 
        transform: scale(1.05) rotate(135deg);
        border-radius: 40%;
    }
}

@keyframes matrixPreview {
    0%, 100% { 
        filter: hue-rotate(0deg) contrast(1) brightness(1);
        transform: scale(1);
    }
    25% { 
        filter: hue-rotate(45deg) contrast(1.5) brightness(1.2);
        transform: scale(1.05);
    }
    50% { 
        filter: hue-rotate(180deg) contrast(2) brightness(0.8);
        transform: scale(0.95);
    }
    75% { 
        filter: hue-rotate(135deg) contrast(1.3) brightness(1.1);
        transform: scale(1.02);
    }
}

@keyframes heartbeatPreview {
    0%, 100% { 
        transform: scale(1);
        filter: brightness(1);
    }
    10% { 
        transform: scale(1.1);
        filter: brightness(1.2);
    }
    20% { 
        transform: scale(1);
        filter: brightness(1);
    }
    30% { 
        transform: scale(1.15);
        filter: brightness(1.3);
    }
    40% { 
        transform: scale(1);
        filter: brightness(1);
    }
    50%, 100% { 
        transform: scale(1);
        filter: brightness(1);
    }
}

@keyframes orbitPreview {
    0%, 100% { 
        transform: rotate(0deg) translateX(0px) rotate(0deg);
    }
    25% { 
        transform: rotate(45deg) translateX(10px) rotate(-45deg);
    }
    50% { 
        transform: rotate(180deg) translateX(0px) rotate(-180deg);
    }
    75% { 
        transform: rotate(135deg) translateX(-10px) rotate(-135deg);
    }
}

@keyframes neonPreview {
    0%, 100% { 
        filter: drop-shadow(0 0 5px #00ffff) drop-shadow(0 0 10px #ff00ff) brightness(1);
    }
    25% { 
        filter: drop-shadow(0 0 10px #ff00ff) drop-shadow(0 0 20px #00ffff) brightness(1.2);
    }
    50% { 
        filter: drop-shadow(0 0 15px #ffff00) drop-shadow(0 0 30px #ff00ff) brightness(1.4);
    }
    75% { 
        filter: drop-shadow(0 0 10px #00ff00) drop-shadow(0 0 20px #ffff00) brightness(1.2);
    }
}

@keyframes kaleidoscopePreview {
    0%, 100% { 
        transform: rotate(0deg) scale(1);
        filter: hue-rotate(0deg) saturate(1);
    }
    16.66% { 
        transform: rotate(30deg) scale(1.1);
        filter: hue-rotate(30deg) saturate(1.5);
    }
    33.33% { 
        transform: rotate(60deg) scale(0.9);
        filter: hue-rotate(60deg) saturate(2);
    }
    50% { 
        transform: rotate(180deg) scale(1.05);
        filter: hue-rotate(180deg) saturate(1.8);
    }
    66.66% { 
        transform: rotate(60deg) scale(0.95);
        filter: hue-rotate(60deg) saturate(1.3);
    }
    83.33% { 
        transform: rotate(30deg) scale(1.08);
        filter: hue-rotate(30deg) saturate(1.6);
    }
}

@keyframes earthquakePreview {
    0%, 100% { 
        transform: translateX(0px) translateY(0px) rotate(0deg);
    }
    10% { 
        transform: translateX(-2px) translateY(-1px) rotate(-0.5deg);
    }
    20% { 
        transform: translateX(3px) translateY(2px) rotate(1deg);
    }
    30% { 
        transform: translateX(-1px) translateY(-2px) rotate(-0.8deg);
    }
    40% { 
        transform: translateX(2px) translateY(1px) rotate(0.6deg);
    }
    50% { 
        transform: translateX(-3px) translateY(-1px) rotate(-1.2deg);
    }
    60% { 
        transform: translateX(1px) translateY(2px) rotate(0.9deg);
    }
    70% { 
        transform: translateX(-2px) translateY(-1px) rotate(-0.7deg);
    }
    80% { 
        transform: translateX(2px) translateY(1px) rotate(0.8deg);
    }
    90% { 
        transform: translateX(-1px) translateY(-1px) rotate(-0.4deg);
    }
}

@keyframes hologramPreview {
    0%, 100% { 
        filter: brightness(1) contrast(1) hue-rotate(0deg);
        transform: scale(1);
        opacity: 1;
    }
    25% { 
        filter: brightness(1.3) contrast(1.2) hue-rotate(45deg);
        transform: scale(1.02);
        opacity: 0.8;
    }
    50% { 
        filter: brightness(0.7) contrast(1.5) hue-rotate(180deg);
        transform: scale(0.98);
        opacity: 0.6;
    }
    75% { 
        filter: brightness(1.1) contrast(1.1) hue-rotate(135deg);
        transform: scale(1.01);
        opacity: 0.9;
    }
}

@keyframes vortexPreview {
    0%, 100% { 
        transform: rotate(0deg) scale(1);
        filter: blur(0px) brightness(1);
    }
    25% { 
        transform: rotate(45deg) scale(1.1);
        filter: blur(1px) brightness(1.2);
    }
    50% { 
        transform: rotate(180deg) scale(0.8);
        filter: blur(2px) brightness(0.8);
    }
    75% { 
        transform: rotate(135deg) scale(1.05);
        filter: blur(1px) brightness(1.1);
    }
}

@keyframes breathingPreview {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }
    50% { 
        transform: scale(1.05);
        opacity: 0.8;
        filter: brightness(1.1);
    }
}

@keyframes ripplePreview {
    0% { 
        transform: scale(1);
        filter: drop-shadow(0 0 0px rgba(255, 255, 255, 0));
    }
    25% { 
        transform: scale(1.02);
        filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
    }
    50% { 
        transform: scale(1.05);
        filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.6));
    }
    75% { 
        transform: scale(1.02);
        filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
    }
    100% { 
        transform: scale(1);
        filter: drop-shadow(0 0 0px rgba(255, 255, 255, 0));
    }
}

@keyframes swirlPreview {
    0%, 100% { 
        transform: rotate(0deg) scale(1);
        filter: hue-rotate(0deg);
    }
    25% { 
        transform: rotate(45deg) scale(1.1);
        filter: hue-rotate(45deg);
    }
    50% { 
        transform: rotate(180deg) scale(0.9);
        filter: hue-rotate(180deg);
    }
    75% { 
        transform: rotate(135deg) scale(1.05);
        filter: hue-rotate(135deg);
    }
}

@keyframes glitchPreview {
    0%, 100% { 
        transform: translateX(0) scale(1);
        filter: hue-rotate(0deg) contrast(1) brightness(1);
    }
    10% { 
        transform: translateX(-2px) scale(1.01);
        filter: hue-rotate(90deg) contrast(1.2) brightness(1.1);
    }
    20% { 
        transform: translateX(2px) scale(0.99);
        filter: hue-rotate(180deg) contrast(0.8) brightness(0.9);
    }
    30% { 
        transform: translateX(-1px) scale(1.02);
        filter: hue-rotate(270deg) contrast(1.3) brightness(1.2);
    }
    40% { 
        transform: translateX(1px) scale(0.98);
        filter: hue-rotate(360deg) contrast(0.9) brightness(0.8);
    }
    50% { 
        transform: translateX(0) scale(1);
        filter: hue-rotate(0deg) contrast(1) brightness(1);
    }
}

@keyframes energyPreview {
    0%, 100% { 
        transform: scale(1);
        filter: brightness(1) contrast(1) drop-shadow(0 0 0px #00ffff);
    }
    25% { 
        transform: scale(1.08);
        filter: brightness(1.4) contrast(1.3) drop-shadow(0 0 8px #00ffff);
    }
    50% { 
        transform: scale(0.95);
        filter: brightness(0.7) contrast(1.5) drop-shadow(0 0 15px #ff00ff);
    }
    75% { 
        transform: scale(1.05);
        filter: brightness(1.2) contrast(1.2) drop-shadow(0 0 10px #ffff00);
    }
}

@keyframes waterPreview {
    0%, 100% { 
        transform: scale(1) rotate(0deg);
        filter: blur(0px) hue-rotate(0deg) saturate(1);
    }
    25% { 
        transform: scale(1.03) rotate(1deg);
        filter: blur(0.5px) hue-rotate(15deg) saturate(1.2);
    }
    50% { 
        transform: scale(0.97) rotate(-1deg);
        filter: blur(1px) hue-rotate(30deg) saturate(1.4);
    }
    75% { 
        transform: scale(1.01) rotate(0.5deg);
        filter: blur(0.3px) hue-rotate(45deg) saturate(1.1);
    }
}

@keyframes crystalPreview {
    0%, 100% { 
        transform: scale(1) rotate(0deg);
        filter: brightness(1) hue-rotate(0deg) saturate(1) contrast(1);
    }
    12.5% { 
        transform: scale(1.05) rotate(45deg);
        filter: brightness(1.3) hue-rotate(45deg) saturate(1.5) contrast(1.2);
    }
    25% { 
        transform: scale(0.95) rotate(90deg);
        filter: brightness(0.8) hue-rotate(90deg) saturate(2) contrast(1.4);
    }
    37.5% { 
        transform: scale(1.08) rotate(135deg);
        filter: brightness(1.5) hue-rotate(135deg) saturate(1.8) contrast(1.1);
    }
    50% { 
        transform: scale(1.1) rotate(180deg);
        filter: brightness(1.6) hue-rotate(180deg) saturate(2) contrast(1.2);
    }
    62.5% { 
        transform: scale(1.08) rotate(135deg);
        filter: brightness(1.5) hue-rotate(135deg) saturate(1.8) contrast(1.1);
    }
    75% { 
        transform: scale(0.95) rotate(90deg);
        filter: brightness(0.8) hue-rotate(90deg) saturate(2) contrast(1.4);
    }
    87.5% { 
        transform: scale(1.05) rotate(45deg);
        filter: brightness(1.3) hue-rotate(45deg) saturate(1.5) contrast(1.2);
    }
}

@keyframes galaxyPreview {
    0%, 100% { 
        transform: rotate(0deg) scale(1);
        filter: brightness(1) hue-rotate(0deg) saturate(1) drop-shadow(0 0 0px #ffffff);
    }
    20% { 
        transform: rotate(36deg) scale(1.05);
        filter: brightness(1.2) hue-rotate(36deg) saturate(1.3) drop-shadow(0 0 5px #ffffff);
    }
    40% { 
        transform: rotate(72deg) scale(0.95);
        filter: brightness(0.8) hue-rotate(72deg) saturate(1.5) drop-shadow(0 0 10px #ffffff);
    }
    50% { 
        transform: rotate(90deg) scale(1.08);
        filter: brightness(1.4) hue-rotate(90deg) saturate(1.2) drop-shadow(0 0 8px #ffffff);
    }
    60% { 
        transform: rotate(72deg) scale(0.95);
        filter: brightness(0.8) hue-rotate(72deg) saturate(1.5) drop-shadow(0 0 10px #ffffff);
    }
    80% { 
        transform: rotate(36deg) scale(1.05);
        filter: brightness(1.2) hue-rotate(36deg) saturate(1.3) drop-shadow(0 0 5px #ffffff);
    }
}

@keyframes lavaPreview {
    0%, 100% { 
        transform: scale(1);
        filter: hue-rotate(0deg) brightness(1) contrast(1) saturate(1);
    }
    25% { 
        transform: scale(1.06);
        filter: hue-rotate(15deg) brightness(1.3) contrast(1.2) saturate(1.4);
    }
    50% { 
        transform: scale(0.94);
        filter: hue-rotate(30deg) brightness(0.7) contrast(1.5) saturate(1.8);
    }
    75% { 
        transform: scale(1.04);
        filter: hue-rotate(45deg) brightness(1.1) contrast(1.3) saturate(1.2);
    }
}

@keyframes icePreview {
    0%, 100% { 
        transform: scale(1) rotate(0deg);
        filter: brightness(1) hue-rotate(0deg) saturate(1) contrast(1) blur(0px);
    }
    25% { 
        transform: scale(1.03) rotate(45deg);
        filter: brightness(1.4) hue-rotate(90deg) saturate(0.8) contrast(1.3) blur(0.3px);
    }
    50% { 
        transform: scale(0.97) rotate(180deg);
        filter: brightness(0.8) hue-rotate(180deg) saturate(1.2) contrast(1.5) blur(0.5px);
    }
    75% { 
        transform: scale(1.02) rotate(135deg);
        filter: brightness(1.2) hue-rotate(90deg) saturate(0.9) contrast(1.2) blur(0.2px);
    }
}

.preview-placeholder {
    width: 100%;
    height: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 18%;
    background: linear-gradient(45deg, #34495e, #5d6d7e);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #ecf0f1;
    font-size: 13cqw;
    line-height: 1.2;
    overflow: hidden;
    overflow-wrap: anywhere;
    border-radius: 50%;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #5d6d7e;
    border-radius: 3px;
    overflow: hidden;
    margin: 20px 0;
    display: none;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    width: 0%;
    transition: width 0.3s ease;
}

.status-message {
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    display: none;
}

.status-success {
    background: #2d5016;
    color: #9ae6b4;
    border: 1px solid #38a169;
}

.status-error {
    background: #742a2a;
    color: #feb2b2;
    border: 1px solid #e53e3e;
}

.status-warning {
    background: #744210;
    color: #f6e05e;
    border: 1px solid #d69e2e;
}

.status-info {
    background: #2a4365;
    color: #90cdf4;
    border: 1px solid #3182ce;
}

.download-section {
    margin-top: 20px;
    padding: 20px;
    background: #2d5016;
    border-radius: 10px;
    display: none;
    border: 1px solid #38a169;
}

/* Blur overlay for disabled upload section */
.upload-section {
    position: relative;
    transition: all 0.3s ease;
}

.form-container {
    position: relative;
    transition: all 0.3s ease;
}

.form-container.disabled {
    pointer-events: none;
}

.blur-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 10, 14, 0.72);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 40;
    padding: 24px;
    pointer-events: auto;
}

.blur-overlay.active {
    display: flex;
}

.create-another-container {
    width: min(420px, 100%);
    text-align: center;
    padding: 28px 24px;
    background: #121a22;
    border: 1px solid rgba(46, 204, 113, 0.45);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.create-another-container h3 {
    color: #fff;
    margin: 0 0 8px;
    font-size: 1.35rem;
}

.create-another-container p {
    color: #9aafbf;
    margin: 0 0 18px;
    font-size: 1rem;
    line-height: 1.45;
}

.create-another-btn {
    background: #1e8449;
    color: #fff;
    border: none;
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 650;
    cursor: pointer;
    pointer-events: auto;
}

.create-another-btn:hover {
    background: #27ae60;
    transform: none;
    box-shadow: none;
}

.processing-spinner {
    font-size: 2em;
    margin: 20px 0;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.download-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    text-decoration: none;
    padding: 12px 25px;
    border-radius: 6px;
    font-weight: 600;
    display: inline-block;
    transition: all 0.3s ease;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(40, 167, 69, 0.3);
}

.requirements {
    background: #34495e;
    border: 1px solid #5d6d7e;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    font-size: 0.9em;
    color: #bdc3c7;
    text-align: left;
}

.requirements h3 {
    margin-bottom: 10px;
    color: #ecf0f1;
}

.requirements ul {
    margin-left: 20px;
}

.compression-note {
    background: #2a4d3a;
    border: 1px solid #4ade80;
    border-radius: 6px;
    padding: 12px;
    margin-top: 15px;
    font-size: 0.85em;
}

.compression-note p {
    margin: 0;
    color: #86efac;
}

.tenor-note {
    background: #2a4d5a;
    border: 1px solid #4ade80;
    border-radius: 6px;
    padding: 12px;
    margin-top: 15px;
    font-size: 0.85em;
}

.tenor-note p {
    margin: 0;
    color: #86efac;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .header-icon {
        width: 40px;
        height: 40px;
    }
    
    .device-frame {
        width: 250px;
    }
}

@media (max-width: 480px) {
    .device-frame {
        width: 220px;
    }
}
