:root {
    --accent: #00e5ff;
    --accent-glow: rgba(0, 229, 255, 0.25);
    --bg-panel: rgba(18, 18, 24, 0.7);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --font-stack: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --bg-control: rgba(0, 0, 0, 0.3);
    --bg-active: rgba(255, 255, 255, 0.1);
    --btn-primary-bg: #ffffff;
    --btn-primary-text: #000000;
    
    color-scheme: light dark;
}

/* Light mode overrides */
:root.theme-light {
    --accent: #0091ea; --accent-glow: rgba(0, 145, 234, 0.2);
    --bg-panel: rgba(255, 255, 255, 0.75); --border-glass: rgba(0, 0, 0, 0.1);
    --text-primary: #1c1c1e; --text-secondary: rgba(28, 28, 30, 0.6);
    --bg-control: rgba(0, 0, 0, 0.05); --bg-active: rgba(255, 255, 255, 0.8);
    --btn-primary-bg: #1c1c1e; --btn-primary-text: #ffffff;
}

@media (prefers-color-scheme: light) {
    :root:not(.theme-dark) {
        --accent: #0091ea; --accent-glow: rgba(0, 145, 234, 0.2);
        --bg-panel: rgba(255, 255, 255, 0.75); --border-glass: rgba(0, 0, 0, 0.1);
        --text-primary: #1c1c1e; --text-secondary: rgba(28, 28, 30, 0.6);
        --bg-control: rgba(0, 0, 0, 0.05); --bg-active: rgba(255, 255, 255, 0.8);
        --btn-primary-bg: #1c1c1e; --btn-primary-text: #ffffff;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000000;
    font-family: var(--font-stack);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    z-index: 1;
}

/* Glassmorphic Control Panel Overlay */
.control-panel {
    position: absolute;
    top: 30px;
    left: 30px;
    width: 340px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    background: var(--bg-panel);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
    padding: 24px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: opacity 0.5s ease, transform 0.5s ease;
    opacity: 1;
    transform: translateY(0);
}

.control-panel.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: -16px;
    font-weight: 300;
}

/* Control Groupings */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}

.slime-params {
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 500px;
    opacity: 1;
}

.slime-params.hidden {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin: 0;
}

/* Segmented Control Buttons */
.segmented-control {
    display: flex;
    background: var(--bg-control);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}

.segmented-control button {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-secondary);
    font-family: var(--font-stack);
    font-size: 13px;
    font-weight: 400;
    padding: 8px 0;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.segmented-control button:hover {
    color: var(--text-primary);
}

.segmented-control button.active {
    background: var(--bg-active);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-weight: 600;
}

/* Custom Select Menu */
.custom-select {
    position: relative;
    width: 100%;
}

.custom-select select {
    width: 100%;
    background: var(--bg-control);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-stack);
    font-size: 13px;
    padding: 10px 14px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.custom-select::after {
    content: "▼";
    font-size: 8px;
    color: var(--text-secondary);
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Slider Controls */
input[type="range"] {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-primary);
    transition: transform 0.1s ease, background 0.1s ease;
}

input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.2);
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.value-display {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    margin-top: -4px;
    font-weight: 300;
}

/* Custom Buttons */
.action-row {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.action-btn {
    flex: 1;
    font-family: var(--font-stack);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 0;
    border-radius: 12px;
    border: none;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:not(.secondary) {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}

.action-btn:not(.secondary):hover {
    background: var(--accent);
    box-shadow: 0 0 16px var(--accent-glow);
}

.action-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Footer info */
.footer {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
    margin-top: 10px;
    letter-spacing: 0.5px;
    font-weight: 300;
}
