body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #000000; /* Black background for the whole page */
    color: #ccc; /* Lighter text color for contrast on dark background */
    display: flex; /* Use flex for main to take full height */
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden; /* Prevent body scrollbars due to absolute elements */
}

main {
    flex-grow: 1; /* Main content takes all available vertical space */
    display: flex;
    justify-content: center; 
    align-items: center; /* Center canvas container */
    padding: 0;
    position: relative; /* For positioning settings button and menu */
    overflow: hidden; 
    background-color: #000000; /* Ensure main area is black */
}

#settings-toggle-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none; /* Remove background */
    border: none; /* Remove border */
    color: #e0e0e0; 
    cursor: pointer;
    padding: 5px; /* Adjust padding for click area */
    line-height: 0; 
    z-index: 1001; 
    box-shadow: none; /* Remove shadow */
    transition: color 0.2s ease; /* Only transition color now */
    display: flex; 
    align-items: center;
    justify-content: center;
}

#settings-toggle-button svg {
    width: 30px; /* Increased size */
    height: 30px; /* Increased size */
}

#settings-toggle-button:hover svg path {
    stroke: #ffffff; /* Make icon brighter white on hover */
}

/* Remove background transition on hover */
#settings-toggle-button:hover {
    color: #ffffff; /* Keep color change if needed, though SVG stroke handles hover now */
}

#canvas-container {
    display: flex;
    justify-content: center;
    align-items: center; 
    flex-grow: 1; 
    width: 100%; /* Take full width of main */
    height: 100%; /* Take full height of main */
    padding: 0; 
    transition: margin-right 0.3s ease-in-out;
    margin-right: 0;
    background-color: #000000; /* Explicitly black canvas container */
}

#plantCanvas {
    border: none; 
    background-color: #000000; /* Explicitly black canvas background */
    max-width: 100%;
    max-height: 100%;
}

/* New Settings Overlay Styling */
#settings-overlay {
    position: absolute;
    top: 60px; /* Below the settings icon */
    right: 15px;
    width: 320px; /* Adjust as needed */
    max-height: calc(100vh - 80px); /* Limit height and allow scroll */
    background-color: #2c2c2c; /* Dark background */
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    padding: 15px;
    z-index: 1000; /* Ensure it's above canvas but below settings icon if it overlaps */
    overflow-y: auto;
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
    transform-origin: top right;
}

#settings-overlay.collapsed {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
    pointer-events: none; /* Prevent interaction when hidden */
}

#settings-overlay.expanded {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.settings-section {
    margin-bottom: 15px; /* Slightly more space between control rows */
}

.settings-section label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.85em;
    color: #bbb;
}

.settings-section input[type="text"],
.settings-section input[type="number"],
.settings-section textarea,
.settings-section select {
    width: calc(100% - 16px); /* Adjust for padding/border */
    padding: 6px 8px;
    font-size: 0.9em;
    background-color: #383838;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
    box-sizing: border-box;
}

.settings-section textarea {
    min-height: 50px;
    resize: vertical;
}

.settings-section input[type="color"] {
    width: 100%; /* Let flexbox handle inline group */
    height: 28px;
    padding: 1px;
    border: 1px solid #555;
    border-radius: 4px;
    margin-right: 5px;
}

.settings-section small {
    font-size: 0.75em;
    color: #888;
    display: block;
    margin-top: 2px;
}

.settings-inline-group {
    display: flex;
    justify-content: space-between;
    gap: 15px; /* More gap for color pickers */
}

.settings-inline-group > div {
    flex: 1;
}

/* Color pickers take full width within their div */
.settings-inline-group input[type="color"] {
     width: 100%; 
}

.action-buttons-group {
    display: flex;
    flex-direction: column; /* Stack buttons vertically */
    gap: 8px; /* Space between stacked buttons */
}

.action-buttons-group button {
    padding: 8px 12px;
    font-size: 0.9em;
    background-color: #383838; /* Match other input backgrounds */
    color: #e0e0e0; /* Match other input text */
    border: 1px solid #555; /* Match other input borders */
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    width: 100%; /* Make buttons full width of their container */
    box-sizing: border-box;
    margin-right: 0; /* Remove right margin if previously set */
    margin-bottom: 0; /* Remove bottom margin if previously set, gap handles spacing */
    transition: background-color 0.2s ease;
}

.action-buttons-group button:hover {
    background-color: #4a4a4a;
}

#presets select {
    width: calc(70% - 5px); /* Adjust width */
    margin-right: 5px;
}

#presets button {
    width: 30%;
}

/* Dedicated Grow Button Styling */
#dedicated-grow-button {
    position: fixed; 
    right: 25px; 
    bottom: 30px; /* Position from bottom */
    background-color: transparent; 
    color: #e0e0e0; 
    border: 1px solid #e0e0e0; /* Thinner border */
    border-radius: 6px; 
    padding: 10px 20px; /* Adjust padding */
    font-size: 1em; /* Adjust size */
    font-weight: bold;
    cursor: pointer;
    box-shadow: none; /* Remove shadow */
    z-index: 999; 
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

#dedicated-grow-button:hover {
    background-color: rgba(224, 224, 224, 0.1); /* Subtle background on hover */
    border-color: #ffffff; /* Brighter border */
    color: #ffffff; /* Brighter text */
}

#dedicated-grow-button:active {
    transform: scale(0.95); /* Simpler scale transform */
    background-color: rgba(224, 224, 224, 0.2); 
}

#info p, #info ul {
    font-size: 0.9rem;
    color: #bbb; /* Lighter gray for info text */
}

#info strong {
    color: #4CAF50; /* Highlight L-System commands in green */
}

/* Remove controls-column as it's no longer used for layout */
.controls-column {
    display: none; 
}

/* Footer styles removed */

/* Responsive adjustments */
@media (max-width: 768px) {
    /* Header H1 styles removed */
    #settings-toggle-button {
        font-size: 1.5rem;
        top: 10px;
        right: 10px;
        padding: 7px;
    }
    #settings-overlay {
        width: 300px;
        right: -320px; 
        padding-top: 50px;
    }
    #settings-overlay.expanded {
        right: 0;
    }
    #settings-overlay.collapsed {
        right: -320px; 
    }
    #canvas-container {
        /* height: 100vh; // Already full height via main */
    }
}

@media (max-width: 480px) {
    #settings-overlay {
        width: 100%; 
        right: -100%;
        max-width: 100%;
        height: 100vh; 
        top: 0;
        padding-top: 60px; /* Space for close button or virtual button area */
    }
    #settings-overlay.expanded {
        right: 0;
    }
    #settings-overlay.collapsed {
        right: -100%;
    }
    /* #canvas-container.menu-visible { */
    /* margin-right: 0; */
    /* } */
    /* Header H1 styles removed */
    /* Footer styles removed */
}

/* Ensure canvas is not pushed by the menu if menu is full width overlay on mobile */
/* @media (max-width: 480px) { */
/* #settings-menu.expanded + #canvas-container { */
/* } */
/* } */

/* Style for rows containing sliders */
.slider-control label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #bbb;
}

.slider-control .value-display {
    font-weight: bold;
    color: #e0e0e0;
    margin-left: 5px;
    min-width: 30px; /* Ensure space for value */
    display: inline-block;
    text-align: right;
}

.slider-control .input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-control input[type="range"] {
    flex-grow: 1; /* Slider takes most space */
    height: 5px; /* Adjust height */
    cursor: pointer;
    appearance: none; /* Override default */
    background: #555; /* Track color */
    border-radius: 5px;
    outline: none;
}

/* Webkit (Chrome, Safari) thumb styling */
.slider-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4CAF50; /* Green thumb */
    border-radius: 50%;
    cursor: pointer;
}

/* Firefox thumb styling */
.slider-control input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.slider-control input[type="number"] {
    width: 65px; /* Fixed width for number input */
    flex-shrink: 0;
    padding: 5px;
    text-align: right;
    background-color: #383838;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
    -moz-appearance: textfield; /* Hide spinner in Firefox */
}
/* Hide spinner in Chrome, Safari, Edge */
.slider-control input[type="number"]::-webkit-outer-spin-button,
.slider-control input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Adjust non-slider sections slightly if needed */
.settings-section textarea {
    min-height: 50px;
    resize: vertical;
}

/* Adjust non-slider sections slightly if needed */
.settings-section input[type="color"] {
    width: 100%; /* Let flexbox handle inline group */
    height: 28px;
    padding: 1px;
    border: 1px solid #555;
    border-radius: 4px;
    margin-right: 5px;
}

/* Adjust non-slider sections slightly if needed */
.settings-inline-group {
    display: flex;
    justify-content: space-between;
    gap: 15px; /* More gap for color pickers */
}

/* Adjust non-slider sections slightly if needed */
.settings-inline-group > div {
    flex: 1;
}

/* Adjust non-slider sections slightly if needed */
.settings-inline-group input[type="color"] {
     width: 100%; 
}

/* Add styling for Color Preview */
.slider-control .color-preview {
    width: 30px;
    height: 20px;
    border: 1px solid #666;
    border-radius: 4px;
    margin-left: 10px;
    display: inline-block; /* Display next to the label/value */
    vertical-align: middle;
}

/* Adjust label width slightly to accommodate preview */
.slider-control label {
    /* display: block; // Already block */
    /* width: calc(100% - 50px); /* Example adjustment, might need tweaking */
    /* display: inline-block; */
}

/* New Layout Styles for Settings Controls */
.control-group-new {
    margin-bottom: 18px; /* Space between each control group */
}

.control-title {
    font-weight: bold;
    font-size: 0.9em;   /* Slightly smaller than section labels */
    color: #e0e0e0;     /* Match other text */
    margin-bottom: 6px;
}

.control-value-slider {
    display: flex;
    align-items: center; /* Vertically align value and slider */
    gap: 10px; /* Space between value and slider */
}

.control-value-slider .value-display {
    font-size: 0.9em;
    color: #d0d0d0;
    min-width: 35px; /* Ensure some space for the number, adjust as needed */
    text-align: right; /* Align numbers to the right for neatness if width varies */
}

.control-value-slider input[type="range"] {
    flex-grow: 1; /* Slider takes up remaining space */
    /* Inherits general range slider styling if already present, or add specific styling here */
}

.control-value-slider input[type="number"] {
    display: none; /* Hide the number input as requested */
}

/* Specific adjustments for Hue control previews if needed, 
   but the current structure seems to place it inside control-value-slider already */
.control-value-slider .color-preview {
    flex-shrink: 0; /* Prevent color preview from shrinking */
    /* margin-left: 10px; /* This was in the HTML, ensure it's styled correctly */
}

/* Remove old settings-inline-group styling if it's no longer desired 
   or if it conflicts, but let's see how it looks first. 
   The new structure is more explicit per control. */

/* Ensure general .settings-section provides enough padding if not overridden */
#settings-overlay .settings-section {
    padding-bottom: 0; /* Remove bottom padding if .control-group-new provides margin */
} 