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

body {
    font-family: 'Courier New', monospace;
    background: #000;
    color: #fff;
    overflow-x: hidden;
    min-height: 300vh;
}

#canvas {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    height: calc(100vh - 60px);
    z-index: 1;
}

.controls {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #333;
    padding: 15px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    width: 320px;
    font-size: 11px;
}

.controls::-webkit-scrollbar {
    width: 8px;
}

.controls::-webkit-scrollbar-track {
    background: #111;
}

.controls::-webkit-scrollbar-thumb {
    background: #333;
}

.section {
    margin-bottom: 20px;
    border-bottom: 1px solid #222;
    padding-bottom: 15px;
}

.section-title {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.section-title:hover {
    color: #aaa;
}

.toggle-icon {
    font-size: 10px;
}

.section-content {
    display: grid;
    gap: 8px;
}

.section-content.collapsed {
    display: none;
}

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

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-group label {
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
}

input[type="range"] {
    width: 100%;
    height: 3px;
    background: #222;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    background: #fff;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: #fff;
    cursor: pointer;
    border: none;
}

.value-display {
    font-size: 10px;
    color: #aaa;
    min-width: 35px;
    text-align: right;
}

input[type="text"], input[type="color"] {
    background: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 6px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    width: 100%;
}

input[type="color"] {
    height: 30px;
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
}

input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* Background mode switcher */
.bg-mode-switch {
    display: flex;
    border: 1px solid #333;
    margin-bottom: 10px;
    overflow: hidden;
}

.bg-mode-switch button {
    flex: 1;
    border: none;
    border-radius: 0;
    padding: 7px 6px;
    font-size: 10px;
    background: #111;
    color: #555;
    transition: all 0.2s;
}

.bg-mode-switch button.active {
    background: #2a2a2a;
    color: #fff;
    border-color: transparent;
}

.bg-mode-switch button:hover:not(.active) {
    color: #aaa;
    background: #1a1a1a;
}

/* Gradient-only sub-controls */
.bg-gradient-controls {
    display: none;
}

.bg-gradient-controls.visible {
    display: contents;
}

.preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

button {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    padding: 8px 12px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    transition: all 0.2s;
    text-transform: uppercase;
}

button:hover {
    background: #252525;
    border-color: #555;
}

button.active {
    background: #333;
    border-color: #666;
}

.header {
    position: fixed;
    top: 20px;
    left: 20px;
    font-size: 11px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.95);
    padding: 12px 15px;
    border: 1px solid #333;
}

.header h1 {
    font-size: 13px;
    font-weight: normal;
    margin-bottom: 5px;
}

.header p {
    font-size: 9px;
    color: #666;
}

.scroll-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #666;
    z-index: 100;
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 15px;
    border: 1px solid #333;
}

.effect-toggle {
    background: #0a0a0a;
    border: 1px solid #444;
    padding: 8px;
    margin-bottom: 8px;
}

.effect-toggle.enabled {
    border-color: #666;
    background: #1a1a1a;
}

/* Mobile Responsive Design */
.controls-toggle {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: #252525;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    color: #999;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    transition: all 0.3s ease;
    pointer-events: auto !important;
    display: none;
    outline: none;
}

.controls-toggle:hover {
    background: #2a2a2a;
    border-color: #444;
    color: #bbb;
}

.controls-toggle.active {
    background: #444;
    border-color: #555;
    color: #fff;
}

@media (max-width: 768px) {
    #canvas {
        width: 100%;
    }

    .controls {
        position: fixed;
        right: -320px;
        top: 0;
        width: 320px;
        height: 100vh;
        transition: right 0.3s ease;
        z-index: 999;
        top: 0;
        border-radius: 0;
        max-height: 100vh;
    }

    .controls.open {
        right: 0;
    }

    .controls-toggle {
        display: block;
    }

    /* Add overlay backdrop when controls are open */
    body.controls-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }
}

@media (max-width: 480px) {
    .controls {
        width: 280px;
        right: -280px;
    }

    .section-title {
        font-size: 11px;
    }

    .control-group label {
        font-size: 9px;
    }

    input[type="text"], input[type="color"], select {
        font-size: 10px;
        padding: 5px;
    }

    button {
        font-size: 9px;
        padding: 7px 10px;
    }

    .preset-grid {
        grid-template-columns: 1fr;
    }
}
