* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 20px;
    font-family: 'SimSun', '宋体', Arial, sans-serif;
    background-color: #f5f5f5;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    margin: 0;
    color: #333;
    font-size: 2.5em;
}

header p {
    color: #666;
    font-size: 1.1em;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.controls {
    margin-bottom: 30px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.controls input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
}

.controls button {
    padding: 10px 20px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
}

.controls button:hover {
    background-color: #0056b3;
}

.controls button:active {
    transform: scale(0.98);
}

.stroke-demo {
    margin: 30px 0;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.stroke-demo h3 {
    margin-top: 0;
    color: #333;
}

.stroke-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 15px;
}

.stroke-controls input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.stroke-controls button {
    padding: 8px 16px;
    cursor: pointer;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
}

.stroke-controls button:hover:not(:disabled) {
    background-color: #218838;
}

.stroke-controls button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.stroke-controls button:active:not(:disabled) {
    transform: scale(0.96);
}

#strokeCanvas {
    border: 2px solid #ddd;
    background-color: #fff;
    display: block;
    margin: 0 auto;
    cursor: crosshair;
}

.stroke-controls span {
    color: #666;
    font-size: 14px;
    font-weight: bold;
}

#container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    padding: 20px;
    background-color: #fafafa;
    border-radius: 4px;
}

.grid-cell-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    padding: 5px;
}

.grid-canvas {
    display: block;
    cursor: crosshair;
    border: none;
}

.grid-canvas:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

footer {
    text-align: center;
    margin-top: 30px;
    color: #666;
    font-size: 14px;
}