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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000;
    overflow: hidden;
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

#canvas-container canvas {
    display: block;
}

/* Side Panel - Dark Glassmorphism */
#controls {
    position: fixed;
    right: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: rgba(30, 30, 30, 0.4);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#controls.collapsed {
    transform: translateX(280px);
}

#controls.fullscreen-hidden {
    display: none;
}

.panel-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 10px;
}

.panel-header h1 {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #fff;
    opacity: 0.9;
}

.panel-header .subtitle {
    display: none;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.section {
    margin-bottom: 32px;
}

.section h3 {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 12px;
}

.control-group label span {
    color: #fff;
    font-weight: 500;
}

.control-row {
    display: flex;
    gap: 16px;
}

.control-row .control-group {
    flex: 1;
}

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

input[type="range"]:hover {
    background: rgba(255, 255, 255, 0.15);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Textarea and Text Input */
.control-group textarea,
.control-group input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    resize: vertical;
    transition: border-color 0.2s;
}

.control-group textarea {
    min-height: 70px;
}

.control-group textarea:focus,
.control-group input[type="text"]:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Select */
.control-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
}

.control-group select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Color Input */
input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

/* Palette Swatches */
#palette-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

#palette-swatches .palette-color {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s, border-color 0.2s;
}

#palette-swatches .palette-color:hover {
    transform: scale(1.1);
}

#random-palette-btn {
    margin-top: 12px;
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
}

#random-palette-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Mode Toggle - Segment Control */
.mode-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 3px;
    gap: 2px;
}

.mode-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Courier New', monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.mode-btn:hover {
    color: rgba(255, 255, 255, 0.6);
}

.mode-btn.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Panel Footer */
.panel-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.button-group {
    display: flex;
    gap: 8px;
}

.button-group button {
    flex: 1;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.button-group button:hover {
    background: rgba(255, 255, 255, 0.15);
}

#pause-btn.paused {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
}

#export-btn {
    background: rgba(33, 150, 243, 0.2);
    border-color: rgba(33, 150, 243, 0.3);
}

#export-btn:hover {
    background: rgba(33, 150, 243, 0.3);
}

#fullscreen-btn {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
}

#fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Floating Toggle Button */
.floating-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 20px;
    cursor: pointer;
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.floating-toggle:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.25);
}

/* Scrollbar */
.panel-content::-webkit-scrollbar {
    width: 6px;
}

.panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.panel-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    #controls {
        width: 100%;
        height: auto;
        max-height: 70vh;
        top: auto;
        bottom: 0;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 20px 20px 0 0;
    }

    #controls.collapsed {
        transform: translateY(100%);
    }

    .floating-toggle {
        bottom: 80px;
    }

    .control-row {
        flex-direction: column;
        gap: 0;
    }
}
