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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 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 40px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.5em;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    color: #34495e;
    margin: 30px 0 20px;
    font-size: 1.5em;
}

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

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 200px;
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.upload-label:hover,
.upload-label.drag-over {
    border-color: #667eea;
    background-color: #f0f4ff;
}

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

.upload-label p {
    font-size: 18px;
    color: #666;
    margin-bottom: 10px;
}

.upload-label small {
    color: #999;
}

#file-upload {
    display: none;
}

.settings-section {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    align-items: flex-end;
}

.setting-group {
    flex: 1;
    min-width: 150px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.setting-group select,
.setting-group input[type="number"] {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.setting-group select:focus,
.setting-group input:focus {
    outline: none;
    border-color: #667eea;
}

.quality-group {
    flex: 2;
    display: flex;
    align-items: center;
    gap: 15px;
}

.quality-group label {
    margin-bottom: 0;
}

.quality-group input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
}

.quality-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.quality-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#quality-value {
    font-weight: 500;
    color: #667eea;
    min-width: 30px;
}

#convert-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
}

#convert-btn:hover:not(:disabled) {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

#convert-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.preview-container,
.result-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.preview-item,
.result-item {
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.preview-item:hover,
.result-item:hover {
    transform: translateY(-5px);
}

.preview-item img,
.result-item img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    background: white;
}

.item-info {
    padding: 15px;
    text-align: center;
}

.item-info .filename {
    font-weight: 500;
    margin-bottom: 5px;
    word-break: break-all;
    font-size: 14px;
}

.item-info .file-size {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.download-btn {
    display: inline-block;
    padding: 8px 16px;
    background: #48bb78;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.download-btn:hover {
    background: #38a169;
}

.svg-only {
    opacity: 0.5;
    pointer-events: none;
}

.svg-only.active {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .settings-section {
        flex-direction: column;
    }
    
    .setting-group {
        min-width: 100%;
    }
    
    .quality-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .quality-group label {
        margin-bottom: 8px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}