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

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

#canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    cursor: crosshair;
}

.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    text-align: center;
    font-size: 18px;
}

.controls {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(0, 0, 0, 0.95);
    padding: 25px;
    border-radius: 16px;
    color: white;
    width: 340px;
    max-height: 90vh;
    overflow-y: auto;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

.controls::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.controls::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

h1 {
    font-size: 22px;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #e0e0e0;
}

.version {
    font-size: 10px;
    color: #666;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
}

.tab {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 6px;
    color: #888;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab.active {
    background: rgba(255, 255, 255, 0.15);
    color: #ddd;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.section:last-child {
    border-bottom: none;
}

.section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    margin-bottom: 12px;
    font-weight: 600;
}

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

.control-group label {
    display: block;
    font-size: 12px;
    margin-bottom: 6px;
    color: #aaa;
    font-weight: 500;
}

.value-display {
    float: right;
    color: #999;
    font-weight: 500;
}

input[type="range"] {
    width: 100%;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: none;
}

input[type="color"] {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
}

.color-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.color-label {
    font-size: 10px;
    color: #666;
    margin-bottom: 4px;
    display: block;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.preset-btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.preset-sunset { background: rgba(255, 255, 255, 0.12); color: #ccc; }
.preset-ocean { background: rgba(255, 255, 255, 0.12); color: #ccc; }
.preset-purple { background: rgba(255, 255, 255, 0.12); color: #ccc; }
.preset-fire { background: rgba(255, 255, 255, 0.12); color: #ccc; }

.pattern-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.pattern-btn {
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    color: #ccc;
    font-size: 10px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4px;
}

.pattern-btn:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
    color: #ddd;
}

.pattern-btn.active {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.interaction-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.interaction-btn {
    padding: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #ccc;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s;
}

.interaction-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ddd;
}

.interaction-btn.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
    color: white;
}

.export-btn {
    width: 100%;
    padding: 14px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    color: #ddd;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    margin-top: 12px;
    transition: all 0.2s;
}

.export-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
    color: white;
}

/* Mobile Controls Toggle */
.controls-toggle {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: rgba(0, 217, 255, 0.15);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    color: #bbb;
    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: rgba(0, 217, 255, 0.25);
    border-color: rgba(0, 217, 255, 0.4);
    color: #fff;
}

.controls-toggle.active {
    background: rgba(0, 217, 255, 0.3);
    border-color: rgba(0, 217, 255, 0.5);
    color: #00D9FF;
}

@media (max-width: 768px) {
    .controls {
        position: fixed;
        right: -340px;
        top: 0;
        width: 340px;
        height: 100vh;
        transition: right 0.3s ease;
        z-index: 999;
        border-radius: 0;
        max-height: 100vh;
        padding-top: 60px;
        overflow-y: auto;
    }

    .controls.open {
        right: 0;
    }

    .controls-toggle {
        display: block;
    }

    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;
    }
}
