:root {
    --bg-color: #f4f4f9;
    --toolbar-bg: #ffffff;
    --text-color: #333333;
    --border-color: #dddddd;
}

body.dark-mode {
    --bg-color: #1a1a1a;
    --toolbar-bg: #2d2d2d;
    --text-color: #f4f4f9;
    --border-color: #444444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: sans-serif;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    display: flex;
    flex-direction: column;
}

#toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    background-color: var(--toolbar-bg);
    padding: 10px;
    gap: 12px;
    min-height: 80px;
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 20;
}

#tools,
#colors,
#actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    align-items: center;
}

button {
    cursor: pointer;
    /* Pointer (hand) cursor applied globally to all buttons */
}

button:hover {
    box-shadow: 0px 1px 3px gray;
}

.color-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    transition: transform 0.1s ease;
}

.tool-btn,
#actions button {
    padding: 8px 12px;
    font-size: 20px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-btn.active,
.tool-btn.active {
    transform: scale(1.1);
    border: 3px solid var(--text-color) !important;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

.color-btn:active,
.tool-btn:active {
    transform: scale(0.95);
}

#actions button:active {
    transform: scale(0.9);
}

#canvas-container {
    position: relative;
    width: 100%;
    flex-grow: 1;
    /* Automatically takes remaining space safely */
    touch-action: none;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

#previewBoard {
    z-index: 10;
}

/* Mobile Responsiveness for all the new buttons */
@media (max-width: 768px) {
    #toolbar {
        padding: 8px 5px;
        gap: 8px;
    }

    .color-btn {
        width: 32px;
        height: 32px;
    }

    .tool-btn,
    #actions button {
        padding: 6px 10px;
        font-size: 16px;
    }
}