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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
}

#canvas {
    display: block;
    width: 100%;
    height: 100vh;
    background: #000;
}

.controls-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 320px;
    max-height: calc(100vh - 40px);
    background: rgba(20, 20, 40, 0.9);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
    overflow-y: auto;
    z-index: 1000;
}

.controls-panel.hidden {
    transform: translateX(calc(100% - 40px));
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px 12px 0 0;
}

.controls-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.toggle-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: transform 0.2s ease;
}

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

.controls-content {
    padding: 20px;
}

.control-section {
    margin-bottom: 25px;
}

.control-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #ccc;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.control-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.control-group label {
    flex: 1;
    font-size: 13px;
    color: #bbb;
}

.control-group input[type="range"] {
    flex: 2;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.value-display {
    min-width: 45px;
    font-size: 12px;
    color: #888;
    text-align: right;
    font-family: monospace;
}

.theme-buttons, .tool-buttons, .action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.theme-btn, .tool-btn, .action-btn {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ccc;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-btn:hover, .tool-btn:hover, .action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: translateY(-1px);
}

.theme-btn.active, .tool-btn.active {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: #fff;
    border-color: transparent;
}

.action-btn {
    flex: 1;
    min-width: 70px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: rgba(30, 30, 60, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    color: #fff;
    font-size: 18px;
}

.close-modal {
    background: none;
    border: none;
    color: #ccc;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.modal-body {
    padding: 20px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 20px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b35, #f7931e);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

#exportPreview {
    margin-top: 20px;
    border-radius: 8px;
    max-width: 100%;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .controls-panel {
        width: 280px;
        top: 10px;
        right: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .controls-content {
        padding: 15px;
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
    }
    
    .control-group label {
        font-size: 12px;
    }
    
    .theme-buttons, .tool-buttons {
        justify-content: center;
    }
    
    .theme-btn, .tool-btn, .action-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
}

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

.controls-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

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

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

/* Fullscreen adjustments */
body:fullscreen .controls-panel,
body:-webkit-full-screen .controls-panel,
body:-moz-full-screen .controls-panel {
    top: 10px;
    right: 10px;
}