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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

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

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

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

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

.upload-area {
    border: 3px dashed #ddd;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #667eea;
    background-color: #f8f9ff;
}

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

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #333;
}

.upload-content p {
    color: #666;
    margin-bottom: 20px;
}

.upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

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

.settings-section h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #333;
}

.size-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.size-group {
    display: flex;
    flex-direction: column;
}

.size-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
}

.size-group input,
.size-group select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

.preset-sizes {
    margin-bottom: 30px;
}

.preset-sizes h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #333;
}

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

.preset-btn {
    background: #f8f9fa;
    border: 2px solid #ddd;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.preset-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.preset-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

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

.convert-btn,
.reset-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.convert-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.reset-btn {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #ddd;
}

.reset-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.preview-section {
    margin-top: 30px;
}

.preview-section h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #333;
}

.preview-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.original-image,
.converted-image {
    text-align: center;
}

.original-image h3,
.converted-image h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #333;
}

.original-image img,
.converted-image canvas {
    max-width: 100%;
    max-height: 300px;
    border: 2px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.image-info {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
}

.download-section {
    text-align: center;
}

.download-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(40, 167, 69, 0.3);
}

footer {
    text-align: center;
    color: white;
    opacity: 0.8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    main {
        padding: 20px;
    }
    
    .upload-area {
        padding: 30px 20px;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .size-controls {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .preset-buttons {
        justify-content: center;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .convert-btn,
    .reset-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .preview-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .original-image img,
    .converted-image canvas {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .upload-area {
        padding: 20px 15px;
    }
    
    .upload-icon {
        font-size: 2.5rem;
    }
    
    .upload-content h3 {
        font-size: 1.3rem;
    }
    
    .settings-section h2,
    .preview-section h2 {
        font-size: 1.5rem;
    }
    
    .preset-buttons {
        gap: 8px;
    }
    
    .preset-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* 加载动画 */
.loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    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); }
}

/* 成功提示 */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #c3e6cb;
    text-align: center;
}

/* 错误提示 */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #f5c6cb;
    text-align: center;
} 