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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

.privacy-banner {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    text-align: center;
    padding: 14px 20px;
    font-weight: 700;
    font-size: 0.95em;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    letter-spacing: 0.3px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

.main-header {
    background: var(--bg-primary);
    padding: 40px 40px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.logo-section h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: var(--primary);
}

.logo-section p {
    color: var(--text-secondary);
    font-size: 1.05em;
}

.logo-section .brand {
    margin-top: 5px;
}

.logo-section .brand a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.logo-section .brand a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.workspace {
    padding: 60px 40px;
    background: var(--bg-secondary);
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 250px);
}

.content-wrapper {
    width: 100%;
    max-width: 1200px;
}

section {
    margin-bottom: 60px;
}

section h2 {
    font-size: 2em;
    margin-bottom: 30px;
    color: var(--text-primary);
    text-align: center;
}

section h3 {
    font-size: 1.3em;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.upload-zone {
    background: linear-gradient(135deg, #f8fafc, #ffffff);
    border: 4px dashed var(--border);
    border-radius: 16px;
    padding: 80px 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    max-width: 800px;
}

.upload-content {
    position: relative;
    z-index: 1;
}

.upload-zone::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.05) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 0;
}

.upload-zone:hover::before,
.upload-zone.drag-over::before {
    opacity: 1;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--primary);
    background: linear-gradient(135deg, #eff6ff, #ffffff);
    box-shadow: 0 8px 30px rgba(37, 99, 235, 0.15);
    transform: scale(1.01);
}

.upload-icon {
    font-size: 5em;
    margin-bottom: 25px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.upload-title {
    font-size: 1.6em;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.upload-subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.05em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #1e40af);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

.supported-formats {
    text-align: center;
    margin-top: 25px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.supported-formats p {
    margin: 5px 0;
}

/* Processing Section */
.progress-container {
    max-width: 600px;
    margin: 0 auto 30px;
}

.progress-bar {
    height: 12px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--success));
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.progress-text {
    text-align: center;
    margin-top: 15px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.05em;
}

.processing-info {
    text-align: center;
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #eff6ff, #f0f9ff);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.processing-info p {
    margin: 8px 0;
    font-size: 1em;
    color: var(--text-primary);
}

/* Result Section */
.comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.image-box {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border);
}

.image-box h3 {
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2em;
    color: var(--primary);
}

.image-wrapper {
    border-radius: 12px;
    overflow: hidden;
    background:
        linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
        linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.image-wrapper img,
.image-wrapper canvas {
    max-width: 100%;
    max-height: 500px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

/* Background Options */
.background-options {
    margin-bottom: 40px;
    padding: 30px;
    background: white;
    border-radius: 16px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow);
}

.bg-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.bg-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.bg-option span:first-child {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    border: 2px solid var(--border);
    display: block;
}

.bg-option.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.bg-option:hover:not(.active) {
    background: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.checkerboard {
    background:
        linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
        linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.custom-color-wrapper label {
    position: relative;
}

#custom-color {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    top: 0;
    left: 0;
}

.custom-color-wrapper label span:first-child {
    background: linear-gradient(135deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
}

.custom-image-wrapper label {
    position: relative;
}

#custom-bg-image {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    top: 0;
    left: 0;
}

.custom-image-wrapper label span:first-child {
    font-size: 2em;
    line-height: 1;
}

/* Options Container */
.options-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

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

/* Background Options */
.background-options {
    padding: 25px;
    background: white;
    border-radius: 16px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow);
}

.background-options h3 {
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.2em;
    color: var(--text-primary);
}

/* Download Options */
.download-options {
    padding: 25px;
    background: white;
    border-radius: 16px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow);
}

.download-options h3 {
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.2em;
    color: var(--text-primary);
}

.format-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.format-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.format-option:hover {
    border-color: var(--primary);
    transform: translateX(3px);
}

.format-option:has(input:checked) {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.format-option input[type="radio"] {
    cursor: pointer;
    width: 20px;
    height: 20px;
    margin: 0;
}

.format-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.format-name {
    font-weight: 700;
    font-size: 1.1em;
}

.format-desc {
    font-size: 0.9em;
    opacity: 0.85;
}

.quality-control {
    text-align: center;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 10px;
}

.quality-control label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
}

#quality-value {
    color: var(--primary);
    font-weight: 700;
}

#jpg-quality {
    width: 100%;
    max-width: 300px;
    cursor: pointer;
}

/* Image Info */
.image-info {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #f0f9ff, #eff6ff);
    border-radius: 10px;
    border-left: 4px solid var(--primary);
    margin-bottom: 30px;
    font-size: 0.95em;
}

.image-info p {
    margin: 5px 0;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-action {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border: none;
    padding: 18px 50px;
    border-radius: 12px;
    font-size: 1.15em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.btn-action:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border);
    padding: 18px 50px;
    border-radius: 12px;
    font-size: 1.15em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

/* Features Section */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.feature-card {
    background: white;
    padding: 30px;
    border-radius: 16px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow);
    text-align: center;
    transition: all 0.3s ease;
}

.feature-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 3em;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.feature-card h3 {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: var(--primary);
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Footer */
.main-footer {
    background: linear-gradient(135deg, var(--text-primary), #1e293b);
    color: white;
    padding: 60px 40px 30px;
    margin-top: 80px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: white;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.8;
    margin: 8px 0;
}

.social-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.social-link:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary);
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.social-link svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.social-link span {
    font-weight: 500;
    font-size: 1.05em;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 1200px;
    margin: 0 auto;
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95em;
}

/* Responsive */
@media (max-width: 768px) {
    .comparison-container {
        grid-template-columns: 1fr;
    }

    .workspace {
        padding: 40px 20px;
    }

    .main-header {
        padding: 30px 20px;
    }

    .logo-section h1 {
        font-size: 2em;
    }

    .upload-zone {
        padding: 60px 30px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-action,
    .btn-secondary {
        width: 100%;
    }

    .main-footer {
        padding: 40px 20px 20px;
    }

    .footer-content {
        gap: 30px;
    }

    .social-links {
        gap: 10px;
    }
}
