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

body {
    font-family: 'Arial', sans-serif;
    background-color: #0a0a0a;
    color: #ffffff;
    overflow: hidden;
}

/* Game Container - Full Screen */
#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

#game-canvas {
    width: 100%;
    height: 100%;
    background-color: #000;
}

/* Game HUD */
#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#hud div {
    background-color: rgba(0, 0, 0, 0.8);
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid #333;
}

.hud-button {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.hud-button:hover {
    background: linear-gradient(135deg, #45a049, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    margin: 2% auto;
    padding: 0;
    border: none;
    border-radius: 15px;
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

.modal-header {
    background: linear-gradient(135deg, #333, #444);
    padding: 20px 30px;
    border-bottom: 3px solid #4CAF50;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #4CAF50;
    margin: 0;
    font-size: 28px;
}

.close-button {
    background: none;
    border: none;
    color: #999;
    font-size: 32px;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-button:hover {
    color: #ff4444;
    transform: scale(1.1);
}

.modal-body {
    padding: 30px;
    height: calc(100% - 80px);
    overflow-y: auto;
}

/* Editor Layout */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.node-palette-section, .program-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #333;
}

.node-palette-section h3, .program-section h3 {
    color: #4CAF50;
    margin-bottom: 20px;
    font-size: 22px;
    text-align: center;
}

/* Node Categories */
.node-category {
    margin-bottom: 25px;
}

.node-category h4 {
    color: #FFC107;
    margin-bottom: 15px;
    font-size: 16px;
    padding: 8px 12px;
    background: rgba(255, 193, 7, 0.1);
    border-radius: 6px;
    border-left: 4px solid #FFC107;
}

.node-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

/* Nodes */
.node {
    background: linear-gradient(135deg, #3a3a3a, #4a4a4a);
    border: 2px solid #555;
    border-radius: 8px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    text-align: center;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.node::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.node:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    border-color: #777;
}

.node:hover::before {
    left: 100%;
}

.node[data-type="when"] {
    border-color: #2196F3;
    background: linear-gradient(135deg, #1976D2, #2196F3);
}

.node[data-type="if"] {
    border-color: #FF9800;
    background: linear-gradient(135deg, #F57C00, #FF9800);
}

.node[data-type="do"] {
    border-color: #4CAF50;
    background: linear-gradient(135deg, #388E3C, #4CAF50);
}

.node.dragging {
    opacity: 0.7;
    transform: rotate(5deg) scale(1.1);
    z-index: 1000;
}

/* Program Slots */
.slot-container {
    margin-bottom: 20px;
}

.slot-container h4 {
    color: #FFC107;
    margin-bottom: 10px;
    font-size: 16px;
}

.slot {
    background: rgba(255, 255, 255, 0.05);
    border: 3px dashed #666;
    border-radius: 12px;
    padding: 20px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.slot-placeholder {
    color: #999;
    font-style: italic;
}

.slot:hover {
    border-color: #888;
    background: rgba(255, 255, 255, 0.08);
}

.slot.drag-over {
    border-color: #4CAF50 !important;
    background: rgba(76, 175, 80, 0.1) !important;
    border-style: solid !important;
}

.slot.filled {
    background: rgba(76, 175, 80, 0.1);
    border-style: solid;
    border-color: #4CAF50;
}

.slot-content {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.slot-node {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    border: 1px solid #777;
    cursor: pointer;
    transition: all 0.2s ease;
}

.slot-node:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.slot-node[data-type="when"] {
    background: rgba(33, 150, 243, 0.3);
    border-color: #2196F3;
}

.slot-node[data-type="if"] {
    background: rgba(255, 152, 0, 0.3);
    border-color: #FF9800;
}

.slot-node[data-type="do"] {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4CAF50;
}

.arrow {
    color: #FFC107;
    font-weight: bold;
    font-size: 16px;
    margin: 0 5px;
}

/* Control Buttons */
.editor-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.control-button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 120px;
}

.control-button.primary {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

.control-button.success {
    background: linear-gradient(135deg, #4CAF50, #388E3C);
    color: white;
}

.control-button.danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.control-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Examples Section */
.examples-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #333;
}

.examples-section h3 {
    color: #4CAF50;
    margin-bottom: 20px;
    font-size: 22px;
    text-align: center;
}

.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.example-card {
    background: linear-gradient(135deg, #2a2a2a, #3a3a3a);
    border: 2px solid #444;
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.example-card:hover {
    border-color: #4CAF50;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.2);
}

.example-card h4 {
    color: #FFC107;
    margin-bottom: 10px;
    font-size: 16px;
}

.example-card p {
    color: #ccc;
    font-size: 14px;
    font-style: italic;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes nodePlace {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.node-placed {
    animation: nodePlace 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        width: 98%;
        height: 95vh;
        margin: 1% auto;
    }
    
    .editor-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .node-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .control-button {
        min-width: 100px;
        padding: 10px 16px;
        font-size: 12px;
    }
    
    .example-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* Hide scrollbar but keep functionality */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

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

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(76, 175, 80, 0.5);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 175, 80, 0.7);
}