:root {
    --bg-color: #0d0f14;
    --card-bg: rgba(22, 28, 38, 0.45);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent-color: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.35);
    --btn-hover: #4f46e5;
    --gradient-start: #4f46e5;
    --gradient-end: #06b6d4;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
}

html, body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    position: fixed; /* Prevents rubber-banding/scroll bouncing on iOS */
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Background Glowing Blurs */
.glass-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(6, 182, 212, 0.05) 50%, rgba(0,0,0,0) 100%);
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
}

.container {
    width: 100%;
    max-width: 800px;
    height: 100%;
    max-height: 100dvh;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 2;
    overflow: hidden;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 10px;
}

h1 {
    font-size: 3.2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #ffffff 40%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.glow-text {
    position: relative;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Card layout */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 25px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 600px;
    height: auto;
    max-height: 100%;
    overflow: hidden;
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 30px 60px rgba(99, 102, 241, 0.08);
}

/* Upload Area */
.drop-area {
    width: 100%;
    max-width: min(512px, 55vh);
    aspect-ratio: 1 / 1;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-area:hover, .drop-area.dragover {
    border-color: var(--accent-color);
    background: rgba(99, 102, 241, 0.03);
}

.icon-wrapper {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.drop-area:hover .icon-wrapper {
    transform: scale(1.08);
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--accent-color);
}

.upload-icon {
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.drop-area:hover .upload-icon {
    color: #a5b4fc;
}

.drop-area h2 {
    font-size: 1.4rem;
    font-weight: 600;
}

.drop-area p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Loading Card */
.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    position: relative;
    margin: 0 auto;
}

.double-bounce1, .double-bounce2 {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--accent-color);
    opacity: 0.6;
    position: absolute;
    top: 0;
    left: 0;
    animation: sk-bounce 2.0s infinite ease-in-out;
}

.double-bounce2 {
    background-color: var(--gradient-end);
    animation-delay: -1.0s;
}

@keyframes sk-bounce {
    0%, 100% { 
        transform: scale(0.0);
    } 50% { 
        transform: scale(1.0);
    }
}

.pulse-text {
    animation: text-pulse 1.5s infinite ease-in-out;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

@keyframes text-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1.0; }
}

/* Results Image Comparison Slider */
.result-container {
    width: 100%;
    max-width: min(512px, 55vh);
    aspect-ratio: 1 / 1;
    margin-bottom: 20px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.comparison-slider {
    position: relative;
    width: 100%;
    height: 100%;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    container-type: inline-size;
    container-name: slider;
}

.slider-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    overflow: hidden;
    border-right: 2px solid var(--text-primary);
}

.overlay-container .slider-image {
    width: 100cqw;
    height: 100%;
    max-width: none;
    object-fit: cover;
}

/* Slider Handle bar */
.slider-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 40px;
    height: 40px;
    margin-left: -20px;
    margin-top: calc(50% - 20px);
    background: var(--text-primary);
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    cursor: ew-resize;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    touch-action: none;
}

.handle-arrow-left, .handle-arrow-right {
    width: 0;
    height: 0;
    border: 5px solid transparent;
}

.handle-arrow-left {
    border-right-color: var(--bg-color);
    margin-right: 3px;
}

.handle-arrow-right {
    border-left-color: var(--bg-color);
    margin-left: 3px;
}

/* Buttons */
.btn-group {
    margin-top: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.primary-btn {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border: none;
}

.primary-btn:hover {
    background: linear-gradient(135deg, var(--btn-hover), var(--gradient-end));
    transform: translateY(-2px);
}

.btn-glow {
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-glow:hover {
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.actions-panel {
    display: flex;
    gap: 15px;
    width: 100%;
    justify-content: center;
}

.icon {
    width: 18px;
    height: 18px;
}

/* Footer */
footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.25);
    font-size: 0.8rem;
    font-weight: 300;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive / Mobile Design Queries */
@media (max-width: 600px) {
    h1 {
        font-size: 2.2rem;
    }
    
    .container {
        padding: 10px 8px;
        gap: 12px;
    }
    
    .card {
        padding: 15px 10px;
        width: 100%;
        border-radius: 16px;
    }
    
    .drop-area {
        padding: 20px 10px;
        max-width: min(100%, 50vh);
    }
    
    .result-container {
        max-width: min(100%, 50vh);
        margin-bottom: 15px;
    }
    
    .icon-wrapper {
        width: 55px;
        height: 55px;
    }
    
    .upload-icon {
        width: 26px;
        height: 26px;
    }
    
    .drop-area h2 {
        font-size: 1.15rem;
    }
}

@media (max-width: 480px) {
    .actions-panel {
        flex-direction: column-reverse;
        gap: 12px;
        width: 100%;
    }
    
    .btn {
        width: 100%;
        padding: 14px 20px;
    }
}
