
    tryPlaceCard(card, targetExit) {
        const requiredDirection = this.opposite(targetExit.direction);
        const targetCell = this.neighbor(targetExit.x, targetExit.y, targetExit.direction);

        const rotations = [DIRECTIONS.NORTH, DIRECTIONS.EAST, DIRECTIONS.SOUTH, DIRECTIONS.WEST];
        // const shuffled = this.shuffle(rotations);
        
        // 🔧 DEBUG: Force SOUTH rotation only
        const forcedRotations = [DIRECTIONS.SOUTH];
        console.log('⚠️ FORCED ROTATION TO SOUTH ONLY FOR TESTING');

        let bestPlacement = null;
        let maxConnections = -1;

        for (const rotation of forcedRotations) { 
            const rotatedExits = this.rotateExits(card.exits, rotation);
            const candidates = rotatedExits.filter(e => e.direction === requiredDirection);

            for (const candidate of candidates) {
                const anchorX = targetCell.x - candidate.x;
                const anchorY = targetCell.y - candidate.y;

                if (this.grid.canPlace(card, anchorX, anchorY, rotation)) {
                    let score = 0;
                    for (const exit of rotatedExits) {
                        const globalX = anchorX + exit.x;
                        const globalY = anchorY + exit.y;
                        const neighbor = this.neighbor(globalX, globalY, exit.direction);
                        if (this.grid.occupiedCells.has(`${neighbor.x},${neighbor.y}`)) {
                            score++;
                        }
                    }

                    if (score > maxConnections) {
                        maxConnections = score;
                        bestPlacement = { card, anchorX, anchorY, rotation };
                    }
                }
            }
        }

        if (bestPlacement) {
            this.placeTileAt(bestPlacement.card, bestPlacement.anchorX, bestPlacement.anchorY, bestPlacement.rotation);
            console.log(`✅ Best Placement Selected: Score ${maxConnections}`);
            return true;
        }

        return false;
    }
