* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

h1 {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    margin-bottom: 0;
    color: #333;
}

h2 {
    color: #333;
    margin-bottom: 20px;
}

h3 {
    color: #555;
    margin-bottom: 15px;
}

.upload-section {
    padding: 30px;
    text-align: center;
}

.upload-options {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.upload-option {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    width: 150px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.upload-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    background: #e9ecef;
}

.upload-option .icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.upload-option p {
    font-size: 16px;
    color: #333;
}

.editor-section {
    padding: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.canvas-container {
    flex: 1;
    min-width: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

#memeCanvas {
    max-width: 100%;
    max-height: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background: #fff;
}

.controls {
    flex: 1;
    min-width: 300px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.control-group input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.control-group input[type="range"] {
    width: 70%;
    vertical-align: middle;
}

.control-group span {
    display: inline-block;
    width: 25%;
    text-align: right;
    color: #666;
}

.control-group input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    cursor: pointer;
}

.control-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    background: #667eea;
    color: white;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    flex: 1;
}

button:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

#resetImage {
    background: #6c757d;
}

#resetImage:hover {
    background: #5a6268;
}

.preview-section {
    padding: 30px;
    text-align: center;
}

.preview-container {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 20px;
}

#previewImage {
    max-width: 100%;
    max-height: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.preview-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* 拖拽手柄 */
.drag-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: #4CAF50;
    border-radius: 50%;
    cursor: move;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    .editor-section {
        flex-direction: column;
        padding: 15px;
    }
    
    .upload-options {
        flex-direction: column;
        align-items: center;
    }
    
    .upload-option {
        width: 80%;
    }
    
    .canvas-container {
        min-height: 300px;
    }
    
    .controls {
        min-width: 100%;
    }
    
    .control-group input[type="text"],
    .control-group select {
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .action-buttons,
    .preview-actions {
        flex-direction: column;
    }
    
    .preview-actions button {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* 移动端特定优化 */
@media (hover: none) and (pointer: coarse) {
    /* 移动端设备 */
    .upload-option:hover {
        transform: none;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    
    button:hover {
        transform: none;
    }
}