* {
    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;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

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

.main-content {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 30px;
    padding: 30px;
}

/* 模式切换 */
.mode-selector {
    grid-column: 1 / -1;
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.mode-btn {
    flex: 1;
    max-width: 200px;
    padding: 12px 24px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-btn:hover {
    background: #f0f0f0;
}

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

/* 控制面板 */
.control-panel {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    height: fit-content;
}

.mode-controls {
    display: block;
}

.mode-controls.hidden {
    display: none;
}

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

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

.control-group input[type="text"],
.control-group input[type="file"],
.control-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.control-group input[type="text"]:focus,
.control-group select:focus {
    outline: none;
    border-color: #667eea;
}

.control-group input[type="color"] {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.control-group input[type="range"] {
    width: calc(100% - 60px);
    margin-right: 10px;
}

.control-group span {
    display: inline-block;
    min-width: 50px;
    font-weight: bold;
    color: #667eea;
}

/* 模板网格 */
.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 10px;
}

.template-item {
    cursor: pointer;
    text-align: center;
    transition: transform 0.3s;
}

.template-item:hover {
    transform: translateY(-5px);
}

.template-item.selected .template-preview {
    border: 3px solid #667eea;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #667eea;
}

.template-preview {
    height: 80px;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
}

.template-preview.gradient1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.template-preview.gradient2 {
    background: linear-gradient(135deg, #2193b0 0%, #6dd5ed 100%);
}

.template-preview.gradient3 {
    background: linear-gradient(135deg, #ee9ca7 0%, #ffdde1 100%);
}

.template-preview.tech {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.template-preview.minimal {
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
}

.template-preview.nature {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
}

.template-item span {
    font-size: 0.9rem;
    color: #666;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #666;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

/* 预览面板 */
.preview-panel {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
}

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

.canvas-container {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#coverCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.preview-info {
    margin-top: 15px;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

/* Footer */
footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
    border-top: 1px solid #e0e0e0;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 640px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 10px;
    }
    
    header {
        padding: 20px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .main-content {
        padding: 15px;
        gap: 15px;
    }
    
    .mode-selector {
        flex-direction: column;
    }
    
    .mode-btn {
        max-width: 100%;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}