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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    background-color: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 35px;
}

.tool-section {
    flex: 1;
    min-width: 200px;
    margin-bottom: 15px; /* 增加底部间距 */
}

.tool-section h3 {
    margin-bottom: 10px;
    font-size: 16px;
    color: #2c3e50;
    font-weight: 600;
}

.drawing-tools {
    display: flex;
    gap: 15px; /* 增加间距 */
    margin-bottom: 15px;
}

.tool-btn {
    padding: 12px;
    background-color: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: #666;
    font-size: 1.2em;
}

.tool-btn:hover {
    background-color: #e0e0e0;
    transform: scale(1.05);
}

.tool-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #2980b9;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.brush-sizes {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.brush-size {
    padding: 8px 15px;
    background-color: #f1f1f1;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.brush-size:hover {
    background-color: #e0e0e0;
    transform: scale(1.05);
}

.brush-size.active {
    background-color: #3498db;
    color: white;
}

.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.color-btn {
    width: 30px;
    height: 30px;
    border: 2px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border: 2px solid #333;
}

.custom-color {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 12px;
}

#colorPicker {
    width: 45px;
    height: 45px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
}

.canvas-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 15px; /* 增加间距 */
}

.canvas-actions button {
    padding: 10px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-actions button:hover {
    background-color: #2980b9;
    transform: scale(1.05);
}

#clear {
    background-color: #e74c3c;
}

#clear:hover {
    background-color: #c0392b;
}

.canvas-container {
    width: 100%;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15); /* 增强阴影效果 */
    overflow: hidden;
    padding: 15px; /* 添加内边距 */
}

#drawingCanvas {
    display: block;
    background-color: #fff;
    cursor: crosshair;
    width: 100%;
    height: 500px;
    border: 2px solid #e0e0e0; /* 增加边框粗细 */
    border-radius: 4px; /* 添加圆角 */
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05); /* 添加内阴影 */
}

/* 历史记录面板样式 */
.history-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none; /* 默认隐藏 */
    overflow: hidden;
    flex-direction: column;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #3498db;
    color: white;
}

.history-header h3 {
    margin: 0;
    font-size: 18px;
}

#closeHistory {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
}

.history-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.history-item {
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.history-item:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.history-item img {
    width: 100%;
    height: auto;
    display: block;
}

.history-item .step-number {
    padding: 5px;
    background-color: #f1f1f1;
    text-align: center;
    font-size: 12px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
    }
    
    .tool-section {
        width: 100%;
    }
    
    #drawingCanvas {
        height: 400px;
    }
    
    .history-panel {
        width: 95%;
        max-height: 90vh;
    }
}

@media (max-width: 480px) {
    .brush-sizes, .canvas-actions {
        flex-wrap: wrap;
    }
    
    #drawingCanvas {
        height: 300px;
    }
}