body {
    margin: 0;
    overflow: hidden; /* Prevent scrolling */
    background-color: #0a0a0a; /* Dark futuristic background */
    color: #00ffcc; /* Accent color */
    font-family: 'Space Mono', monospace; /* Futuristic font */
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw; /* Ensure body takes full viewport width */
}

#whiteboard-container {
    flex-grow: 1;
    position: relative;
    width: 100%;
    overflow: hidden; /* Hide anything outside the container */
    /* Allow text selection within textareas, but prevent elsewhere */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Disable user-select on canvas to prevent ghosting/selection issues while drawing */
canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #1a1a1a; /* Slightly lighter board color */
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#controls {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    background-color: #1a1a1a;
    box-shadow: 0 -2px 10px rgba(0, 255, 204, 0.2);
    display: flex;
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
    gap: 10px;
    justify-content: center;
    z-index: 10; /* Ensure controls are above canvas/text */
     /* Prevent text selection on controls */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#controls button,
#controls input[type="color"],
#controls input[type="range"] {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease;
    flex-shrink: 0; /* Prevent shrinking */
}

/* Add specific style for the fullscreen button if needed, e.g., narrower */
#fullscreenBtn {
    padding: 8px; /* Adjust padding for a square-ish button */
    font-size: 18px; /* Make the icon/text larger */
    line-height: 1; /* Improve vertical centering */
}

#controls button {
    background-color: #3a3a3a;
    color: #00ffcc;
}

#controls button.active {
    background-color: #00ffcc;
    color: #1a1a1a;
    font-weight: bold;
}

#controls button:hover:not(.active) {
    background-color: #4a4a4a;
}

#controls input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 40px;
    height: 40px;
    padding: 5px;
    background: #3a3a3a;
    border-radius: 5px;
    border: 1px solid #00ffcc;
    cursor: pointer;
}

#controls input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
#controls input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}
#controls input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 3px;
}

#controls input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 40px;
    background: transparent; /* Hide default slider track */
    cursor: pointer;
    width: 100px; /* Adjust width as needed */
}

#controls input[type="range"]::-webkit-slider-runnable-track {
    background: #3a3a3a;
    height: 5px;
    border-radius: 3px;
    border: 1px solid #00ffcc;
}

#controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    margin-top: -7px; /* Center thumb vertically */
    background-color: #00ffcc;
    border: 1px solid #0a0a0a;
    height: 20px;
    width: 20px;
    border-radius: 50%;
}

#controls input[type="range"]::-moz-range-track {
    background: #3a3a3a;
    height: 5px;
    border-radius: 3px;
    border: 1px solid #00ffcc;
}

#controls input[type="range"]::-moz-range-thumb {
    background-color: #00ffcc;
    border: 1px solid #0a0a0a;
    height: 20px;
    width: 20px;
    border-radius: 50%;
}


/* Style for dynamically added text areas */
.whiteboard-text {
    position: absolute;
    background-color: transparent; /* Default: no background */
    color: inherit; /* Inherit color from picker/settings */
    border: none; /* Default: no border */
    padding: 5px;
    resize: none; /* Allow resizing */
    overflow: hidden;
    font-family: 'Roboto', sans-serif; /* Default text font */
    font-size: 16px; /* Default text size */
    box-sizing: border-box;
    min-width: 50px;
    min-height: 25px; /* Give empty textarea a minimal height */
    z-index: 5; /* Below controls, above canvas */
    pointer-events: none; /* By default, clicks go through text */
    white-space: pre-wrap; /* Maintain line breaks */
    word-wrap: break-word; /* Break long words */
    outline: none; /* Remove default textarea outline */
}

/* Style for text areas when focused (editing) */
.whiteboard-text:focus {
    border: 1px dashed #00ffcc; /* Border when editing */
    background-color: rgba(255, 255, 255, 0.1); /* Background when editing */
    pointer-events: auto; /* Enable interaction when editing */
}

/* Style for text areas when in text tool mode */
/* This class on container is used to enable clicking on existing text */
#whiteboard-container.text-tool .whiteboard-text {
     /* Override pointer-events for *all* text areas when text tool is active,
        so user can click on existing text to focus it. */
    pointer-events: auto;
}

/* Fullscreen styles */
/* These ensure the container takes up the full screen space */
#whiteboard-container:-webkit-full-screen {
    width: 100%;
    height: 100%;
}
#whiteboard-container:-moz-full-screen {
    width: 100%;
    height: 100%;
}
#whiteboard-container:-ms-fullscreen {
    width: 100%;
    height: 100%;
}
#whiteboard-container:fullscreen {
    width: 100%;
    height: 100%;
}