:root {
    --bg-dark: #0a0a09;
    --panel-bg: #1a1a1a;
    --panel-border: #3b3b3b;
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --accent: #ff4a00;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Host Grotesk', -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Pulsing circles background */
.circle-container {
    position: fixed;
    bottom: 0;
    left: 50%;
    z-index: -1;
    width: 0;
    height: 0;
}

.circle {
    position: absolute;
    top: 0;
    left: 0;
    border: 2px solid #111111;
    border-radius: 50%;
    animation: pulse 3s ease-in-out infinite;
    transform: translate(-50%, -50%);
    scale: 1;
}

.circle-1 {
    width: 400px;
    height: 400px;
    animation-delay: 0s;
}

.circle-2 {
    width: 600px;
    height: 600px;
    animation-delay: 0.3s;
}

.circle-3 {
    width: 800px;
    height: 800px;
    animation-delay: 0.6s;
}

.circle-4 {
    width: 1000px;
    height: 1000px;
    animation-delay: 0.9s;
}

.circle-5 {
    width: 1200px;
    height: 1200px;
    animation-delay: 1.2s;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.2;
        border: 2px solid #111;
        scale: 1;
    }
    50% {
        opacity: 1;
        border: 4px solid #111;
        scale: 1.05;
    }
}

/* Background glow effect */
.glow-bg {
    position: fixed;
    bottom: -50vh;
    left: 50%;
    transform: translateX(-50%);
    width: 90vw;
    height: 100vh;
    background: radial-gradient(ellipse at bottom, rgb(255 235 226 / 100%) 30%, rgb(255 74 0 / 40%) 40%, rgb(33 18 12 / 8%) 60%, transparent 90%);
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
    animation: glowPulse 10s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
        opacity: 0.8;
    }
    50% {
        transform: translateX(-50%) scale(1.15, 0.9);
        opacity: 1;
    }
}

.app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 800px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
}

/* Drop Zone Styles */
.drop-zone {
    width: 100%;
    max-width: 440px;
    aspect-ratio: 1.2 / 1;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--panel-bg);
    
    /* Folder Masking logic */
    --folder-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cg fill='black'%3E%3Cpath fill-rule='evenodd' d='M12 17a4 4 0 0 1 4-4h11.326a4 4 0 0 1 2.95 1.3l3.107 3.396l.377.41l.376.412l.34.372c.216.236.522.37.843.37H64a4 4 0 0 1 4 4V33a4 4 0 0 0-4-4v-2a3 3 0 0 0-3-3H19a3 3 0 0 0-3 3v2a4 4 0 0 0-4 4z' clip-rule='evenodd'/%3E%3Cpath d='M12 33a4 4 0 0 1 4-4h48a4 4 0 0 1 4 4v28a4 4 0 0 1-4 4H16a4 4 0 0 1-4-4z'/%3E%3C/g%3E%3C/svg%3E");
    -webkit-mask-image: var(--folder-svg);
    mask-image: var(--folder-svg);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    
    /* Adjust content centering for the folder's body */
    padding-top: 2rem;
}

.drop-zone:hover {
    background-color: #2a2a2a;
    transform: translateY(-4px) scale(1.02);
}

.upload-icon-container {
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.subtext {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Preview Area */
.preview-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 45vh;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.8s ease;
}

.preview-wrapper {
    position: relative;
    display: flex;
    align-items: flex-start;
}

.preview-wrapper img {
    max-height: 45vh;
    max-width: 60vw;
    border-radius: 4px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    object-fit: contain;
    position: relative;
}

.preview-wrapper img.skeleton-loading {
    position: relative;
}

.preview-wrapper img.skeleton-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255,255,255,0.15) 50%, 
        transparent 100%);
    background-size: 200% 100%;
    animation: skeleton-sweep 2s linear infinite;
    pointer-events: none;
}

@keyframes skeleton-sweep {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Comparison View */
.comparison-view {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    animation: fadeIn 0.6s ease;
}

.comparison-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.comparison-image img {
    max-height: 40vh;
    max-width: 35vw;
    border-radius: 4px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.comparison-image img:hover {
    transform: scale(1.02);
}

.comparison-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.comparison-stats {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.compression-percentage {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4ade80;
    text-align: center;
    padding: 0.75rem 0 0.5rem;
}

.arrow-container {
    color: var(--text-secondary);
    opacity: 0.5;
}

.img-meta {
    position: absolute;
    left: calc(100% + 12px);
    top: 0;
    white-space: nowrap;
    transition: opacity 0.4s ease;
}

.meta-name {
    font-weight: 600;
    font-size: 0.8rem;
    color: white;
}

.meta-stats {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Control Panel */
.control-panel {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    background: var(--panel-bg);
    border-radius: 40px;
    padding: 1.25rem;
    border: 1px solid var(--panel-border);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0.5rem 1rem;
}

.filename {
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.compress-pill {
    background: #d4d4d4;
    color: #000000;
    border: none;
    padding: 12px 32px;
    border-radius: 28px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
}

.compress-pill:hover {
    background: #ffffff;
}

.compress-pill:active {
    transform: scale(0.95);
}

.panel-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 150px;
    padding-bottom: 2rem;
    overflow-y: auto;
    padding-right: 4px;
    mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}

.panel-rows::-webkit-scrollbar {
    width: 4px;
}

.panel-rows::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.row {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.25rem;
    height: 46px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

.slider-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
    transition: none;
}

.row-label {
    color: rgba(255, 255, 255, 0.4);
    font-size: 1rem;
    pointer-events: none;
    z-index: 2;
}

.row-value {
    color: rgba(255, 255, 255, 0.4);
    font-size: 1rem;
    pointer-events: none;
    z-index: 2;
}

.row-meta {
    color: rgba(255, 255, 255, 0.25);
    font-size: 0.95rem;
    flex: 1;
    text-align: center;
}

.res-pill {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.5);
    padding: 6px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    margin-left: -12px;
}

.stealth-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
    z-index: 3;
}

.stealth-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 6px;
    height: 32px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    margin-top: 0;
    cursor: ew-resize;
    box-shadow: 0 0 0 4px #1a1a1a;
}

.stealth-slider::-moz-range-thumb {
    width: 6px;
    height: 32px;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    border-radius: 3px;
    cursor: ew-resize;
    box-shadow: 0 0 0 4px #1a1a1a;
}

.select-box {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    position: relative;
}

.stealth-select {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.reset-area {
    display: flex;
    gap: 1.5rem;
    text-align: left;
    margin-top: 1rem;
    padding-left: 0.5rem;
}

.text-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-decoration: underline;
    cursor: pointer;
    opacity: 0.6;
}

/* Image Modal */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    animation: fadeIn 0.2s ease;
}

.image-modal img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.8);
}

.modal-label {
    position: absolute;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 20px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

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

.loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 20;
}

.loader p {
    font-size: 1.1rem;
    font-weight: 500;
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.3) 0%, 
        rgba(255,255,255,0.8) 50%, 
        rgba(255,255,255,0.3) 100%);
    background-size: 200% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { 
    from { opacity: 0; transform: translateY(20px) scale(0.98); } 
    to { opacity: 1; transform: translateY(0) scale(1); } 
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .preview-wrapper {
        flex-direction: column;
        align-items: center;
    }
    .img-meta {
        position: static;
        margin-top: 1rem;
        text-align: center;
    }
    .app-container {
        padding: 1rem;
    }
    .control-panel {
        width: 100%;
        max-width: 100%;
    }
}