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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    overflow: hidden;
    touch-action: manipulation;
}

.game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.game-title {
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

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

.fps-counter {
    font-size: 14px;
    color: #4ecdc4;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.element-panel {
    width: 250px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.element-category {
    margin-bottom: 25px;
}

.element-category h3 {
    margin-bottom: 10px;
    color: #4ecdc4;
    font-size: 16px;
}

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

.element-btn {
    padding: 10px;
    border: 2px solid transparent;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.element-btn:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.5);
}

.element-btn.selected {
    border-color: #4ecdc4;
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.5);
}

.brush-controls {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.brush-controls label {
    display: block;
    margin-bottom: 8px;
    color: #4ecdc4;
    font-size: 14px;
}

#brushSize {
    width: 100%;
    margin-bottom: 5px;
}

#brushSizeValue {
    color: white;
    font-weight: bold;
}

.canvas-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1), transparent);
}

#gameCanvas {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    cursor: crosshair;
    max-width: calc(100vw - 270px);
    max-height: calc(100vh - 100px);
}

.canvas-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
}

.selected-element {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: bold;
    color: #4ecdc4;
    backdrop-filter: blur(10px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .element-panel {
        width: 100%;
        height: 200px;
        order: 2;
        padding: 15px;
    }
    
    .element-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 5px;
    }
    
    .element-btn {
        padding: 8px 4px;
        font-size: 10px;
    }
    
    .canvas-container {
        order: 1;
        flex: 1;
    }
    
    #gameCanvas {
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 280px);
    }
    
    .game-title {
        font-size: 18px;
    }
    
    .controls {
        gap: 10px;
    }
    
    .control-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 8px 15px;
    }
    
    .element-panel {
        height: 180px;
        padding: 10px;
    }
    
    .element-category h3 {
        font-size: 14px;
        margin-bottom: 5px;
    }
    
    .brush-controls {
        margin-top: 10px;
        padding-top: 10px;
    }
}

.custom-creator {
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-creator h3 {
    margin-bottom: 10px;
    color: #ff6b6b;
    font-size: 16px;
}

.custom-creator input, .custom-creator textarea {
    width: 100%;
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    color: white;
    font-size: 12px;
}

.custom-creator textarea {
    height: 60px;
    resize: vertical;
    font-family: inherit;
}

.custom-creator input::placeholder, .custom-creator textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.creation-status {
    font-size: 11px;
    color: #4ecdc4;
    min-height: 20px;
    margin-top: 5px;
}