body {
    margin: 0;
    overflow: hidden;
    background-color: #f5f5f5; /* Light grey */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    color: #333;
}

#toolbar {
    background: #ffffff;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-bottom: 1px solid #ddd;
    z-index: 10;
    flex-shrink: 0;
}

.tool-group {
    display: flex;
    gap: 10px;
}

.tool {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #f9f9f9;
    cursor: pointer;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
}

.tool:hover {
    background: #eee;
    transform: translateY(-1px);
}

.tool.selected {
    background: #333;
    color: #fff;
    border-color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Specific colors for buttons to match elements */
.tool[data-element="1"] { border-bottom: 4px solid #d9c074; } /* Sand */
.tool[data-element="2"] { border-bottom: 4px solid #4fa6ff; } /* Water */
.tool[data-element="3"] { border-bottom: 4px solid #555; }    /* Wall */
.tool[data-element="0"] { border-bottom: 4px solid #cc3333; } /* Eraser */

.info {
    font-size: 12px;
    color: #888;
    margin-right: 10px;
}

#canvas-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #e5e5e5; /* Frame color */
    overflow: hidden;
    background-image: 
        linear-gradient(45deg, #ddd 25%, transparent 25%), 
        linear-gradient(-45deg, #ddd 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #ddd 75%), 
        linear-gradient(-45deg, transparent 75%, #ddd 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

#sandbox {
    /* Maintain square aspect ratio to match 200x200 grid */
    width: 100vmin; 
    height: 100vmin;
    /* Limit width/height to not overflow the container if toolbar takes space */
    max-width: 100%;
    max-height: 100%;
    /* Pixel art rendering */
    image-rendering: pixelated; 
    image-rendering: crisp-edges;
    background-color: #ffffff; /* White canvas background */
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    cursor: crosshair;
}
