@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Inter:wght@300;400;500;600&display=swap');

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #ffffff;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 40% 80%, rgba(119, 255, 198, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 0;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.title {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(45deg, #00ffff, #ff00ff, #ffff00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.8;
    font-weight: 300;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 40% 60%;
    gap: 20px;
    margin-bottom: 20px;
    height: 500px;
}

/* Code Panel */
.code-panel {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.editor-header {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.run-btn, .clear-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.run-btn {
    background: linear-gradient(45deg, #00ffff, #ff00ff);
    color: #000;
    flex: 1;
}

.run-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.4);
}

.clear-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.code-editor {
    flex: 1;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    color: #00ffff;
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    margin-bottom: 15px;
}

.code-editor:focus {
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.templates h3 {
    margin-bottom: 10px;
    font-size: 0.9rem;
    opacity: 0.8;
}

.template-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.template-btn {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Canvas Panel */
.canvas-panel {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.save-btn, .fullscreen-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    color: #fff;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.4);
}

.fullscreen-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 40px;
}

.fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

#canvas {
    flex: 1;
    background: #000;
    border-radius: 8px;
    border: 2px solid rgba(0, 255, 255, 0.3);
    width: 100%;
    height: auto;
    max-height: 400px;
}

.canvas-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 0.9rem;
    opacity: 0.8;
}

.error-display {
    color: #ff4757;
    display: none;
}

/* Controls Bar */
.controls-bar {
    display: flex;
    align-items: center;
    gap: 30px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    flex-wrap: wrap;
}

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

.control-group label {
    font-weight: 500;
    opacity: 0.8;
    min-width: 50px;
}

input[type="range"] {
    width: 100px;
    accent-color: #00ffff;
}

select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 8px 12px;
    color: #fff;
    outline: none;
}

select:focus {
    border-color: #00ffff;
}

.random-btn {
    padding: 12px 24px;
    background: linear-gradient(45deg, #ff00ff, #8000ff);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: auto;
}

.random-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 0, 255, 0.4);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
        gap: 15px;
    }
    
    .code-panel, .canvas-panel {
        height: 400px;
    }
    
    .controls-bar {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .controls-bar {
        gap: 15px;
    }
    
    .control-group {
        flex-direction: column;
        text-align: center;
    }
    
    .random-btn {
        margin-left: 0;
        margin-top: 10px;
    }
    
    .template-buttons {
        justify-content: center;
    }
}

/* Fullscreen canvas styles */
canvas:fullscreen {
    background: #000 !important;
}

/* Scrollbar styling */
.code-editor::-webkit-scrollbar {
    width: 8px;
}

.code-editor::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.code-editor::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.5);
    border-radius: 4px;
}

.code-editor::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 255, 0.7);
}