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

:root {
    --primary-color: #4a90e2;
    --primary-hover: #357abd;
    --secondary-color: #52c41a;
    --danger-color: #ff4d4f;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 40px 0;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 20px;
}

.lang-switcher {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.lang-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lang-btn.active {
    background: white;
    color: var(--primary-color);
}

main {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-lg);
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(74, 144, 226, 0.05);
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    color: var(--primary-color);
}

.upload-area h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.select-btn {
    padding: 12px 32px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.select-btn:hover {
    background: var(--primary-hover);
}

.settings-panel {
    margin: 30px 0;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.settings-panel h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

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

.setting-group label {
    display: inline-block;
    width: 80px;
    color: var(--text-secondary);
    font-weight: 500;
}

#quality {
    width: 200px;
    vertical-align: middle;
}

#qualityValue {
    display: inline-block;
    width: 50px;
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
}

.preset-buttons {
    display: inline-flex;
    gap: 10px;
}

.preset-btn {
    padding: 8px 20px;
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.preset-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.preset-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.processing-area {
    padding: 40px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
    border-radius: 4px;
}

.processing-text {
    color: var(--text-secondary);
    font-size: 16px;
}

.results-area {
    margin-top: 30px;
}

.results-area h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-value.highlight {
    color: var(--secondary-color);
}

.converted-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.image-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.image-item:hover {
    box-shadow: var(--shadow-md);
}

.image-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: var(--bg-secondary);
}

.image-info {
    padding: 15px;
}

.image-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-size {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.image-reduction {
    font-size: 16px;
    font-weight: 600;
    color: var(--secondary-color);
}

.download-btn {
    width: 100%;
    padding: 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
    font-size: 14px;
}

.download-btn:hover {
    background: var(--primary-hover);
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.download-all-btn,
.reset-btn {
    padding: 12px 32px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-all-btn {
    background: var(--secondary-color);
    color: white;
}

.download-all-btn:hover {
    background: #46a614;
}

.reset-btn {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.reset-btn:hover {
    background: var(--primary-color);
    color: white;
}

.features {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.features h3 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-primary);
    font-size: 1.8rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.feature-item {
    text-align: center;
    padding: 20px;
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.feature-item h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.feature-item p {
    color: var(--text-secondary);
    font-size: 14px;
}

.faq {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.faq h3 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-primary);
    font-size: 1.8rem;
}

details {
    margin-bottom: 15px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 15px;
}

summary {
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

summary:hover {
    color: var(--primary-color);
}

details p {
    margin-top: 10px;
    color: var(--text-secondary);
    line-height: 1.8;
}

footer {
    text-align: center;
    padding: 30px 0;
    color: white;
    opacity: 0.9;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 10px;
    }
    
    main {
        padding: 20px;
    }
    
    .upload-area {
        padding: 40px 15px;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .download-all-btn,
    .reset-btn {
        width: 100%;
    }
}