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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    border-bottom: 3px solid #4A90E2;
}

.header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.subtitle {
    font-size: 1.2rem;
    color: #666;
    font-weight: 300;
}

.main-content {
    display: flex;
    flex: 1;
    gap: 2rem;
    padding: 2rem;
}

.canvas-container {
    flex: 1;
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.canvas-container:hover {
    box-shadow: 0 12px 48px rgba(74, 144, 226, 0.2);
}

#canvas {
    width: 100%;
    height: 600px;
    display: block;
    cursor: crosshair;
    transition: transform 0.2s ease;
}

#canvas:active {
    transform: scale(0.99);
}

.performance-info {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 0.5rem;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.9rem;
}

.controls-panel {
    width: 350px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    padding: 1.5rem;
    max-height: 600px;
    overflow-y: auto;
}

.control-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

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

.control-section h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.control-group {
    margin-bottom: 1rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4A90E2;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #357abd;
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4A90E2;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.fine-tune-btn {
    width: 32px;
    height: 32px;
    border: 2px solid #4A90E2;
    background: white;
    color: #4A90E2;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

.fine-tune-btn:hover {
    background: #4A90E2;
    color: white;
    transform: scale(1.05);
}

.value-display {
    text-align: center;
    margin-top: 0.5rem;
}

.value-display span {
    background: #f8f9fa;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
    color: #4A90E2;
    border: 1px solid #e9ecef;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.preset-btn {
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.preset-btn:hover {
    border-color: #4A90E2;
    background: #f0f8ff;
    transform: translateY(-1px);
}

.illusion-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.illusion-btn {
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    font-weight: 500;
}

.illusion-btn:hover {
    border-color: #4A90E2;
    background: #f0f8ff;
}

.illusion-btn.active {
    border-color: #4A90E2;
    background: #4A90E2;
    color: white;
}

.animation-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.animation-btn {
    padding: 0.75rem 1.5rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.animation-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

.color-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.color-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.color-group label {
    margin-bottom: 0;
    min-width: 80px;
}

input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.preset-colors {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.color-preset {
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.color-preset:hover {
    border-color: #4A90E2;
    background: #f0f8ff;
}

.export-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.75rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.info-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 2rem;
    max-width: 500px;
    z-index: 1000;
    display: none;
}

.info-panel h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.info-panel p {
    line-height: 1.6;
    margin-bottom: 1rem;
    color: #555;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 30px;
    height: 30px;
    border: none;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .controls-panel {
        width: 100%;
        max-height: none;
    }
    
    .header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
        gap: 1rem;
    }
    
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .preset-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .preset-colors {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #canvas {
        height: 400px;
    }
}

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

.controls-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.controls-panel::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 3px;
}

.controls-panel::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.control-section {
    animation: fadeIn 0.3s ease;
}

/* Focus styles */
input:focus, button:focus {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

/* Loading animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    animation: spin 1s linear infinite;
}