:root {
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --accent-color: #4CAF50;
    --panel-bg: rgba(20, 20, 20, 0.85);
    --icon-color: #fff;
}

body.light-mode {
    --bg-color: #f0f0f0;
    --text-color: #1a1a1a;
    --accent-color: #2E7D32;
    /* Darker green */
    --panel-bg: rgba(255, 255, 255, 0.85);
    --icon-color: #1a1a1a;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

#canvas-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

#ui-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 280px;
    background-color: var(--panel-bg);
    padding: 20px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label:not(.toggle-switch) {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-color);
}

/* Range input styling */
input[type=range] {
    width: 100%;
    background: transparent;
    -webkit-appearance: none;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: #444;
    border-radius: 3px;
}

input[type=range]::-webkit-slider-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--text-color);
    margin-top: -5px;
    cursor: pointer;
    -webkit-appearance: none;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    justify-content: space-between;
}

.toggle-switch input {
    display: none;
}

.toggle-switch .slider {
    position: relative;
    width: 40px;
    height: 20px;
    background-color: #555;
    border-radius: 20px;
    transition: 0.3s;
}

.toggle-switch .slider:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked+.slider {
    background-color: var(--accent-color);
}

.toggle-switch input:checked+.slider:before {
    transform: translateX(20px);
}

.label-text {
    flex-grow: 1;
    margin-left: 10px;
    font-size: 0.9em;
    font-weight: 500;
}

.sub-panel {
    background: var(--panel-bg);
    padding: 10px;
    border-radius: 8px;
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-left: 3px solid var(--accent-color);
}

#loading-indicator {
    font-style: italic;
    color: var(--accent-color);
    font-size: 0.9em;
    text-align: center;
    margin-top: 10px;
}

.theme-toggle-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 20;
    background: var(--panel-bg);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s, background-color 0.3s;
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
}

.theme-toggle-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--icon-color);
    transition: fill 0.3s;
}

.control-group label:not(.toggle-switch) {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-color);
}