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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    color: #2d3748;
    margin-bottom: 10px;
}

header p {
    color: #718096;
    font-size: 1.1rem;
}

.upload-section {
    margin-bottom: 40px;
}

.upload-box {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f7fafc;
}

.upload-box:hover {
    border-color: #667eea;
    background: #edf2f7;
}

.upload-box.dragover {
    border-color: #667eea;
    background: #e6fffa;
    transform: scale(1.02);
}

.upload-content svg {
    color: #667eea;
    margin-bottom: 20px;
}

.upload-content p {
    font-size: 1.2rem;
    color: #2d3748;
    margin-bottom: 10px;
}

.upload-content span {
    color: #718096;
    font-size: 0.9rem;
}

.image-preview {
    display: none;
    margin-top: 30px;
    text-align: center;
}

.image-preview.active {
    display: block;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
}

.image-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.image-info span {
    background: #edf2f7;
    padding: 8px 16px;
    border-radius: 6px;
    color: #4a5568;
    font-size: 0.9rem;
}

.controls-section {
    display: none;
    margin-bottom: 40px;
}

.controls-section.active {
    display: block;
}

.controls-section h2 {
    color: #2d3748;
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.format-control {
    background: #f7fafc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.2s ease;
}

.format-control:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.format-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.format-header h3 {
    color: #2d3748;
    font-size: 1.3rem;
}

.quality-value {
    background: #667eea;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1rem;
}

.quality-slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 15px;
}

.quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quality-slider::-webkit-slider-thumb:hover {
    background: #5568d3;
    transform: scale(1.2);
}

.quality-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.quality-slider::-moz-range-thumb:hover {
    background: #5568d3;
    transform: scale(1.2);
}

.format-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.estimated-size {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2d3748;
}

.compression-ratio {
    color: #718096;
    font-size: 0.95rem;
}

.comparison-section {
    display: none;
    margin-top: 40px;
}

.comparison-section.active {
    display: block;
}

.comparison-section h2 {
    color: #2d3748;
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.comparison-chart {
    margin-bottom: 20px;
}

.chart-bar {
    margin-bottom: 15px;
}

.chart-bar-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-weight: 500;
}

.chart-bar-visual {
    height: 30px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    padding-left: 10px;
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
}

.best-format {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
}

footer {
    max-width: 900px;
    margin: 20px auto 0;
    text-align: center;
    color: white;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    header h1 {
        font-size: 2rem;
    }

    .format-result {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
